Tuesday, 6 February 2007

Gez's 30th Birthday

It was Gez's birthday on Sunday so lot's of us went out into town to celebrate.

Liza brought her new camera along so here are some photo's of the evening...

When we were in Orvitto, Italy for new years eve we bought a little 3x3x3 wooden cube. Each piece of the cube is attached to one of it's adjacent pieces by a piece of string... the idea, simple, put the cube back together!

Anyhow - here's a pic of Manu giving up trying! ... and a few more of us lot out for Gez's 30 birthday.
Posted by Picasa

cheddarvision.tv » Live Westcountry Cheddar

.. so this has got to be one of the stranges projects I've ever been involved in.. but one of the most amazing nonetheless!

On January 1st 2007 we ( on behalf of a client ) put a webcam live, trained on a real, fresh block of Westcountry Farmhouse Cheddar.

The idea? To allow people to see how much time and effort goes into a properly matured lump of cheese.

Boring? Apparantly, according to some of the blogs and forums I've seen, but not quite as boring as watching paint dry.

Anyway today, around 4pm GMT, the story hit Reuters!

The Reuters text reads:
Already nearly 49,000 people have clicked on to www.cheddarvision.tv to enjoy
the thrill.

... thing is, it's now about 7pm and over 63'000 people have been to have a look. That's 14'000 folk in three hours..

Just goes to show there's nothing more important going on in the world!! ;-)

I have to say we're lucky enough that the guys from this very dairy have a stall at the farmers market outside our office every Saturday morning so I can tell you first hand it's pretty delicious cheese :-)

Anyhoo... why not take a look - it is remarkably addictive.


PS. Anyone who wants a desktop-widget version - yelp... I'm trying to encourage myself to find the time!

Update : 10th February 2006

- Strangest thing happened... it hasn't let up... in fact we've had so much interest we had to distribute some of the load out the docklands to a dc in Frankfurt.. ( Pipex's switches are 10Mbps and couldn't cope! )

... anyhow at the time of writing - Saturday lunchtime - we're nudging ¼Millon!? :-/

Thursday, 1 February 2007

Prototype Update Stack

I've been playing about for a while with prototype.js which is a phenominal javascript framework for all things cross-browser compatible and "wizzy". <-- technical terminology

Anyhow... in conjunction with a discussion here about a new little feature we've been toying with I though I should stick a patch here for anyone to get hold of since it may be easier to run the patch than to follow my post to the discussion!

So here it is: experimental prototype.js patch to allow update stacking

... that's all for now!... this will continue back here ;-)

Sunday, 28 January 2007

Converting OS Coodinates
into Longitude and Latitude

So, I've been doing some digging to try and work around the legal restrictions which mean that Google can't provide Longitude & Latitude for British Postcodes.

Preface: Geolocating Postcode Solution

I've found, so far, two legal sources of data which describes the geographical relationship of every postcode in the UK.

  • The Post Office: "PostZon" [ accuracy ~100m, cost ~£250 ]
    The British Post office does provide a list of every postcode ( >1.5Million ) with the geographical relationship of every code. However, these locations are rounded to the nearest 100 metres which, for the exacting user is simply not good enough.

    The reseller who seems to dominate associated adwords sells the data for £250 - not bad if you consider that's 60 postcodes for every penny!

    - The Post Office PostZon File

  • The Ordinance Survey: "Code-Point" [1m, £750+]
    The Ordinance Survey ( in association with a number of other UK Gov. Depts. it seems ) provides an alternate database of 1.7Million postcodes with a 'resolution' of 1metre.

    My understanding is that the figure given is the location of the property closest to the centre of the scatter of all the properties in the code, which seems about as good as it's going to get, short of giving you the locations of every one of the 26M properties. This also ensures that the code-point will be within the boundries of the scatter, whatever it's shape.

    This is a little more pricey, but worth it for the extra resolution. There are also some interesting extras; as well as things like NHS wards and such you get a number of business versus residential versus PO-Box delivery points within the code. Licenses start at £750 and range to ~£5.5k for 101+ users.

    - The Ordinance Survey Code-Point

The Catch! : Both provide "Northing" and "Easting"

The only catch is that both the OS and the PO provide their locations in what is known as Eastings and Northings. I shalln't go into a great deal of detail about these here as a number of sites/articles cited here explain it better than I can but in short this co-ordinating system stems from the UK Ordinance Survey maps of the country.

Use of Easting & Northing does not in of itself bring inaccuracy to mapping postcodes on something like Google Maps - these coordinates are exceedinly accurate - but translating between the two systems is not increadably simple.

There are two things you need to do here:

  1. Convert Easting & Northing to Longitude & Latitude

    This is the process of translating OS Coordinates like "264046", "192487", which as a GridRef looks like SN26401924 to their Lat/Long equivalents : 051°50′40″N, 004°31′13″W or, in decimal 51.61430, -3.96382

    There are a number of great online tools for demonstrating this; Chris Veness has published some javaScript here which shows how intricate just this little bit of maths is!
  2. Converting between Airy1830/OSGB36 and WGS84/GRS80

    What? Ok, so you have your latitude & longitude but when you compare these to Google's estimation of where a postcode lies you'll realise that you're a few blocks out!

    As I understand it it goes like this: The OS coordinates are based on a model of the shape of the Earth called the "Airy 1830 ellipsoid".

    Google Maps ( and GPS systems etc ) are based on a different model of the curvature of the Earth, developed - to be fair to George Airy - some 150 years later. This model - or "Datum" is called called WGS84

    It is this difference between the Datum used within the OS Coordinates and the Datum used by Google that causes the lats and longs to be out.

    According to Wikipedia longitude lines are our byt around 70 metres in Cornwall, rising to ~120metres on the east coast of East Anglia.

Fitting the square peg through the round hole.

I have therefore been trawling around looking for a solution for the next problem: how do we convert our Eastings and Northings into Longitude and Latitude that work with Google Maps?

First we need to convert East/North to Lat/Long.

Solution 1: Geo::Coordinates::OSGB ( Perl )

This is a perl module written by a chap called Toby Thurston. I've just found a png on his site which describes the problem very well: here

Result for SA1 4LS : 51.6143013958951, -3.96382366182886 ( Marker A )

Solution 2: Geography::NationalGrid::GB ( Perl )

Another perl module, this time written by a P Kent.

Now, solutions 1 & 2 both claim inaccuracies for mathematical and theoretical reasons. Interestingly though they do show exceedinly similar results ( a difference of around 1.5e-10 degrees ) which suggest to me that while written separately they have been written pretty exactingly to the same mathematical rules.

Result for SA1 4LS : 51.614301395634, -3.9638236618435 ( Marker A )

Solution 3: PHPcoord, JScoord, Jcoord ( php, javaScript & java )

This is a PHP library written by a chap called Jonathan Stott.

This solution has a couple of distinct advantages over the first two: that for many people doing this in PHP or javaScript would make more sense.. and because it both converts to Lat/Long and converts into the WGS84 Datum.

It also calculates distances which could be very handy.

Result for SA1 4LS (Airy1830) : 51.6143013965, -3.96382366167 ( Marker A )

Then we convert OSGB/Airy1830 to WGS84

Solution 1 : Geo::HelmertTransform ( perl )

A datum transformation module written by Chris Lightfoot.

This will take our Airy1830 Lat/Longs derived from our OS data and translate them to the WGS84 datum used by Google Maps

Result for SA1 4LS : 51.614743995912299, -3.964993028066230 ( Marker B )

Solution 2 : PHPcoord, JScoord, Jcoord ( php, javaScript & java )

Yup.. same libraries as above..

Result for SA1 4LS (Airy1830) : 51.6147522043, -3.96497954404 ( Marker C )

Putting all this together

I think this is probably far more easily explained on a map! .. so here it is:

  • A = Before transformation;
  • B = After transformation;
  • C = phpcoord, jcoord, jscoord's transformed answer ( which is so similar it's obscured by B );
  • X = Google's opinion of "SA1 4LS"

So.. is that it?

Well... yes... that's it: some solutions for turning Easting/Northing into Lat/Longs that can be used with Google Maps.

.. I just spent a long time banging my head against this so I thought it might help someone else if it were all in one place... or in yet another place!

( Incidentally, if anyone can explain why all the methods above agree on the position but Google's own estimate is different I'd be interested to hear. It seems ( having looked up the postcode in question ) that Marker "C" is in exactly the right spot so I'd be interested in understanding the discrepancy. )

Saturday, 27 January 2007

Geocoding within the UK

So it seems you can no longer use Google's fantastic Maps API Geocoder for retreiving Longitude and Lattitude for UK PostCodes.

.. pitty. We we're playing with it for deployment on our soon-to-be-launched revamp of Gate54 and it was working last time I looked.

I picked up the thread again the other day, working on our Estate Agent Software product and 'bang!' no more.

The problem

As mapperz explains on this thread there are now legal restrictions in place that do not allow Google to provide their geocoding data for UK Postcodes; something to do with the PO or Crown Copyright.

Speaking to collegues this is not a new problem and has been hounding companies like Multimap and UpMyStreet for some time.

The result

Well... while a request such as this :


.. will provide a plethora of data, a similar request such as this :


... will simply get you a G_UNAVAILABLE_ADDRESS noted as :

The geocode for the given address cannot be returned due to legal or contractual reasons.

The solution:

Well, I haven't got that far! .. the Google Maps AJAX system still geocodes UK Postcodes so I would recommend having a play with that. In 'theory' as Mapperz puts it you could use the two together.

IMHO ( and I get the impression Mapperz things the same? ) doing this would violate the terms of use of both APIs and is therefore not a viable long term solution.

Also cited have been the Yahoo! Maps API which I've found to be pretty inaccurate and the Microsoft offering with which I've yet to play.

... watch this space!

Friday, 8 December 2006

Australia 2006

So... I'm just back from a trip to Austraila ( sniff ) to see my brother Andy and his wife, my sis-in-law Mai.. and thought I should keep some notes about our antics... Thus far I'm just playing with blogger so don't expect anything excting!

Anyhow, here's a pic of me to get things started - standing just back from Circular Quay in Sydney in 30C heat wondering why on God's earth there's a Christmas Tree up!

Back soon! Posted by Picasa