Hmm, seems there's some things I need to know about this Google Maps malarkey before I embrace it as a full feature of my website. Please, if you happen to know anything about the minutiae of this, pipe up!

To add a point to a google map you need to feed it latitude and longitude coordinates, and in order to get those you need to geocode the location you're looking for. The trouble, as I saw it, was that all of the examples I looked at were for UK or US street addresses, and my map covers Australia, Europe, and everywhere else I go as well.

I figured that if I manually searched for each city name on the google maps website, then copied the linking URL of each that the lat & long must be stored somewhere in there. My guess ended up being the “ll” part of the querystring (“ll” being a fairly obvious abbreviation for “Latitude/Longitude”, right?).

As it turns out, near enough was good enough and looking at the map from a long zoom everything's approximate enough and fine. However if you zoom in to any useful level of detail, it becomes quite apparent that the markers aren't where they should be. For example, if you click on Leeds and then click the + zoom button 4 times, you'll see that the pint icon appears about 5 miles north of Leeds city centre. Eastbourne is about 3 miles out, Birmingham's about 5 or 6 miles out, and poor old Great Yarmouth is apparently floating in the ocean!

It's not a massive problem, except that I was thinking of putting together a map showing all the pubs I've been to in London, and it's not exactly practical to have the markers all 5 or 6 miles north.

So… anyone got any clues as to how I do this better?

print