Ever since Google introduced their Google Maps system a number of mapping tools became available, dedicated blogs have been written like the very good Google Maps Mania and I’ve been thinking of trying to do my map using that instead.
My problem was still that maintaining data in a html file of HREF’s isn’t exactly what I had in mind, I was more partial to a XML file like the sample below:
<points> <point> <lat>-33.9333</lat> <long>18.4667</long> <type>lived</type> <title>Cape Town</title> <country>South Africa</country> <href>http://flickr.com/photos/ripienaar/tags/capetown/</href> <linkimg>images/19591136_35a14f6d58_s.jpg</linkimg> </point> </points>
This contains a lot of information, the type of visit I made to the location, links to my images taken there, a thumbnail to show for the links etc it wouldn’t be great to automate the parsing of that to output the HTML for GMapsEZ?
So that is exactly what I wrote. My script takes a simple configuration file like the one below:
[map] data = visited.xml type = map extend = "http://maps.google.com/maps?ll=51.964577,-1.241455&spn=3.460112,7.639893&hl=en" width = 350 height = 200 showcountry = 1 showtype = 0 [controls] mapctrl = 1 typectrl = 1 scalectrl = 0 size = small [types] visit = orange transit = blue lived = green [misc] gmapez=http://www.devco.net/visited/gmapez.js apikey="mykey"
By calling the script I wrote and passing the config file as argument it will produce all the HTML GMapsEZ needs to do its magic.
<? require_once("gmap.inc.php"); print(getGMapEZ("smalldemo.cfg")); ?>
And this is the map it will produce, this is just a screenshot of the final result, see below the image for a link to the full working page.
My full working version of the map can be seen here, it’s the same data as above just a much bigger map, bigger controls and a different extend. The only actual difference are some changes to the config file, same data and same PHP code was used.
I’ve set up a Wiki to maintain documentation for this as it matures over time, I will make announcements of new features on this blog, but the Wiki will be the resource that contains a always up to date reference to features and installation. You can read about obtaining, configuring and using this script there.