Select Page
NOTE: This is a static archive of an old blog, no interactions like search or categories are current.

GMapEZ has supported drawing lines using the Google Maps API for a while now, but I’ve always put off implimenting this since I thought it would be quite a bit of work and involve lots of changes in my XML format. I finally decided to impliment it today and I found a very easy way to assign points to lines.
First an example map so you can see what you can achieve:


The line thickness, color and opacity is configurable on a per-line basis and you can assign any point in your existing data file to a line on the map, to achieve this I extended the XML data using a <linemember> element, here is an example point:
<point>
<lat>51.393522</lat>
<long>0.527054</long>
<type>visit</type>
<title>Chatham Historic Dockyard</title>
<country>England</country>
<href>http://www.chdt.org.uk/</href>
<linktext>Home Page</linktext>
<linemember>1</linemember>
</point>

The points on the line get connected in order that they appear in your data file.
To configure the line created above you can add a [line1] section to your configuration file, simply match up the linemember numbers with the lineX section in your config, a sample:

[line1]
color = #00ff00
width = 2
opacity = 0.6

This will draw the line in the image above, I think it’s very simple and it should be 100% backward compatible with your exiting data should you choose not to use this feature.
As always you can get the code at http://www.devco.net/code/gmapsphp-current.tgz the documentation at http://www.devco.net/pubwiki/GMapsPHP has also been updated to reflect these changes.