goption

Working with Google Maps

During the Iron Butt Rally, I developed some static Google Maps showing the various bonus locations and checkpoints. I started with the Leg 1 bonus locations, once they were published on the IBR web site. I scraped the necessary data from the PDF file, wrote a Perl script to reformat it, and the map was born. Click here for the IBR maps.

The powers-that-be didn't publish the bonus locations for legs 2 and 3 until after the rally was over, but when they did I created maps for those legs as well, along with a single map showing all the bonus locations, using different color push-pins for the different legs.

A couple of weeks ago the SPOT people began publishing the tracking data in an XML format, which made it a lot easier to download the data. I've been using the Spot Trip Manager website to display maps with the tracks for my trips, but I had a few issues with some of the formatting, and wanted to store the data on my own site for future use. With the new XML format, I saw that I could set it up to work just the way I wanted it.

For the last couple of weeks I've been building a trip viewer to manage and display my SPOT tracks, and yesterday I converted all of the SPOT maps on the tcfjr site over to my new viewer.

I use a Perl script running in a cron job every 15 minutes to download the XML data from the SPOT site. The script parses the data, and inserts any new spots into a MySQL database.

The trip viewer is a PHP script that builds a Google Maps API v3 page to display the spots. For multi-day trips I can set it to display markers X number of times per day, which makes the overview map a lot cleaner. Polyline support was just added to V3 earlier this week, so lines are now drawn between every spot, even if the spot's marker is suppressed, so the overall track can be viewed.

I have a basic trip creator CGI script in place, but mostly I dive into the phpMyadmin page in my hosting account's cPanel to create and edit trip definitions.

It's been a lot of fun learning about the Google Maps API, and there's always more stuff to add to it. Yesterday I added a trip listing page, and added support for embedding maps in other pages using iframes.

For now it's only for my own use, but the infrastructure is set up to support multiple accounts. The current Spot Trip Manager is great for most people, so unless something changes with STM I will use my setup just for me.

posted 25 Sep 2009 in Doing