When I woke up this morning, I decided that I wanted to see how hard it was to implement a map using the Google Map API (god only knows why I think of things like this when I wake up.) I’m no longer much of a programmer, but I can hack around with the best of them, especially if someone else does all the hard work and all I need to do is play trial and error with some HTML, CSS, and Javascript.
I got my Google Maps API Key and tossed up the “Hello, World” of Google Maps on my web site. Pretty easy. I then started trying to get the size, zoom, and center point set the way I wanted it. Suddenly, I had to find the longitude / latitude points and – to make sure I was putting them in the right place – began digging through the Class Reference which is well documented, but doesn’t give me much of a clue about the actual boundary parameters (e.g. I figured out that map.centerAndZoom (latLng, zoomLevel) was what I wanted and I could figure out the latLng, but I didn’t know how to determine zoomLevel without trial and error.)
I found an easy latitude / longitude geocoder site and started monkeying around with the addresses of the five marathons that I have run. I kept thinking there should be something that would generate the code for me as it was starting to get a little messy and it seemed like I was trying to create a pretty simply map – centered on Colorado, with five locations with some text associated with them.
As I was looking for other geocoder options, I stumbled upon Map Builder which did everything I wanted (including embedding the geocoder in its UI.) Ten minutes later, I had the source code for the map. I had to muck around with it some to integrate it properly into my Marathon page on my web site, but it’s up, functional in Firefox, IE, and Safari, and in pretty good shape.
After I run my next marathon, I’ll work on creating an XML file with the data and actually feeding both the map and the table with the data (e.g. I’ll clean up the code from Map Builder and put an abstraction layer in place.) In the mean time, I’ve satiated my need to play around with the Google Map API for now.