Mashed Up Maps
As part of my project to create a mobile polling station locator site, I've been playing with various mapping APIs.
As a base experiment, I passed the postcode of a polling station (GU22 7DT) to both Google Maps and Yahoo Maps. Here are the results.
-
Two things of interest to note.
Firstly, Google has a specific "Mobile" call in the API, it reformats the map image to be more readable on the mobile - I think you'll agree that Google edges out Yahoo here.
Secondly, Google maps is less accurate than Yahoo! Maps. Severely so. While maps.google.com is highly accurate when passed a postcode, the API seems only to look at the first part and discard the rest. Yahoo on the other hand is unnervingly precise.
What to do? Well, as all the cool kids are doing, let's have ourselves a mashup!
We can call Yahoo Maps to get the Latitude and Longitude of a postcode thusly http://local.yahooapis.com/MapsService/V1/geocode?appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--&zip=gu227dt&state=uk
This will return <Latitude>51.318691</Latitude>
<Longitude>-0.543540</Longitude>
<Address/>
<City>Woking, GU22 7DT</City>
<State>United Kingdom</State>
<Country>GB</Country>
We take the Latitude and Longitude and pass it to Google Maps like so http://maps.google.com/staticmap?center=$lat,$long&markers=$lat,$long,tiny&zoom=14&size=240x240&maptype=mobile&key=&sensor=false
Which nets us this map.

Google Map from Yahoo Geo Location
Hey presto! Better looking than the Yahoo Map and better accuracy than the Google Map.
The geocoding prescision of the Google Maps API is very poor for UK postcodes. There really shouldn't need to be this need sort of work around.
This is the sort of data that the UK government should be providing. The Ordnance Survey have an API but it seems restricted to JavaScript which isn't very useful for most mobile phones. Nevertheless I'll have a play with it and see if it's more useful.
Edit
I am now using Ernest Marples' Postcode Latitude/Longitude Lookup API which has much greater accuracy than either Google or Yahoo.
knersis says: