Monday, 25 January 2010

Google maps embedding - who moved the marker?

All I wanted to do was have a little map next to each address for outlets on a web site. I figured this would be a nice quick job - especially as Google nicely provide an embed link when you use their Mapping site.

I knew I would have to modify the links at runtime to accept the postcode from the database I was using to list the outlets but I figured I could do this quite easily.

So let's get a single outlet done and working before I start trying to be clever.

Postcode = WA15 8ES

Go to Google maps, enter it and get the following.....



Perfect so far!

so now I get the embed link kindly provided by Google for this particular location

http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Altrincham,+Cheshire+WA15+8ES,+UK&sll=53.800651,-4.064941&sspn=15.686479,36.254883&ie=UTF8&hq=&hnear=Altrincham,+Cheshire+WA15+8ES,+United+Kingdom&z=16&ll=53.388896,-2.34556&output=embed

Place this on my site and voila......



Easy! Erm.... actually...... who moved the marker! I've changed nothing, just done as Google suggested and embedding has moved the location of the outlet to a main road that is actually a bit of a drive away - not very useful for customers really!

Incidentally, the link they provide for this

http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Altrincham,+Cheshire+WA15+8ES,+UK&sll=53.800651,-4.064941&sspn=15.686479,36.254883&ie=UTF8&hq=&hnear=Altrincham,+Cheshire+WA15+8ES,+United+Kingdom&ll=53.389471,-2.344573&spn=0.007716,0.017703&z=16

is fine so why the embedding is so far out is something only the Google developers could perhaps answer.

I did mess about with trying to change the values in the embed link's querystring - including the latitude and longitude values but got nowhere. In the end, I resorted to use the Google Maps API and all seems well (although I did have to use the longitude and latitude locations for this to work, rather than the postcode).

A colleague suggested that the embed link only takes into consideration the first part of the postcode. If this is true then I'm not sure why Google would have made it like this unless they are trying to force developers down the API route.

No comments:

Post a Comment