GMaps PHP version 1.6

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.

Leave a comment

Recent Entries

  • flashpolicyd 2.0

    I wrote a multi threaded server for Adobe Flash Policy requests, some background from Adobe:Since policy files were first introduced, Flash Player has recognized /crossdomain.xml...

  • Adventures with Ruby

    Some more about my continuing experiences with ruby, in my last post I saidthe language does what you'd expect and as you'll see in my...

  • New programming language of choice - Ruby

    I have fallen out of love with Perl some time ago, I cannot point to one specific thing about it that put me off, I...

  • On working from home

    I've not been posting much here, work has been incredibly manic the last while, especially I need to still finish off my SSO posts with...

  • Rework of puppet facts for /etc/facts.txt

    Previously I blogged a custom fact that reads /etc/facts.txt to build up some custom facts for use in Puppet manifests, well I've since learned a...

Close