Tag Archives: gmaps
GMaps PHP version 1.7

GMaps PHP version 1.7

After my recent release of version 1.6 I realized you wouldn’t always want to have a clickable point at every line point so version 1.7 introduces a fix for this.
First a sample:


You can see there are few points and the line just gets drawn through points that aren’t clickable. This is a much more practical approach to it since with version 1.6 you’d have had 2000 clickable markers on that map, not good.
To activate this feature there is now a special type called none, if you specify this as the type for a point it won’t get a marker, no comments, not clickable etc. You can also therefore not define your own types using the word none since they just won’t work.
As a side note, the image you see above is from a map with very close to 2000 points on it, the map works on my iMac with 1GB RAM but I’ve seen it fail on other smaller machines, it seems the problem is related to the time the javascript takes to run so the browsers kill the javascript. This is the first time I came across limitation in this so all I can say is if you intend to make huge maps, test it on smaller machines as well.
This version also fixes a small error in the HTML that my code produce, this didn’t break anything but it’s best to stick to what GMap EZ expect.
Version 1.7 is available at http://www.devco.net/code/gmapsphp-current.tgz as always and the docs at http://www.devco.net/pubwiki/GMapsPHP have been updated.

Read full storyComments { 2 }
GMaps PHP version 1.6

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.

Read full storyComments { 0 }
GMaps PHP version 1.5

GMaps PHP version 1.5

There is a new version of GMapEZ that brings with it some new features, I’ve implimented some of these into GMaps PHP.


As you can see from the screenshot above the map now supports varying sizes of markers, the small ones are good for maps with lots of points but obviously they do not support any kind of text on the marker.
To activate mini icons for a specific type of point you need to edit your config file:

[types]
visit = orange mini
transit = blue
lived = green

The above configuration snipped will make any points of type visit to be small markers.
The other change in this version is simply a little mouse-over window that will show the title of any point when you hover over it, activating this feature does not require any config changes.
These features will only be available to you if your config file points to the latest version 2 of GMapEZ:

[misc]
gmapez=http://bluweb.com/chouser/gmapez/gmapez-2.js

There is one more feature in GMapEZ 2.2 that I did not include in this release, it supports tabbed popup windows, if anyone need these please drop me a line and I’ll look at including them.
GMapEZ also supports drawing lines, I may include support for these if there are demand for it, personally I don’t need them but if someone does, leave a comment here and I’ll keep it in mind for the next release.
Upgrading from 1.4 to 1.5 is really simple, simply replace the gmap.inc.php from your site with the one in the tarball below. Then make the optional config change above if you’d like mini icons.
As always you can get the latest version at http://www.devco.net/code/gmapsphp-current.tgz and full documentation can be found on my Wiki

Read full storyComments { 0 }

GMaps PHP version 1.4

The author of GMapEZ released a new version of his javascript that supports the new version of Google Maps.
I’ve had some mails asking me to support the new version but as it was in Beta till this morning I delayed doing a full release of the new code till now.
Upgrading from 1.3 to 1.4 is really simple, simply replace the gmap.inc.php from your site with the one in the tarball below. You also need a small change in your config file for your map, the url to the GMapEZ has changed:

[misc]
gmapez=http://bluweb.com/chouser/gmapez/gmapez-2.js

With this in place, if you open a map it should still look roughly the same, but if you scroll over France – or in fact all of Europe – you’ll see street level maps now, in future some of the newer Google features are likely to be supported.
Get the code at http://www.devco.net/code/gmapsphp-current.tgz, full documentation can be found here

Read full storyComments { 0 }

GMaps PHP version 1.3

After returning from a few days away to Cornwall I got a bit fed up with the formatting issues that exist with Google Maps and Firefox, I discovered a post on the Google Maps EZ forum about fixing it.
In order to fix this I added a new configuration option in the map section of the configuration file called divwidth. You will need to add your own option to your config file to upgrade to the latest version, simply replace the gmap.inc.php file with the new one found in the tarball.
The latest version can be found here: http://www.devco.net/code/gmapsphp-current.tgz. Full updated documentation can be found here.

Read full storyComments { 0 }

Gmaps PHP Documentation

I’ve realized for a while now that simply announcing new versions of code that I put out listing what’s changed does not really work, as a new user it would be nearly impossible to find all the posts I’ve made related to a specific bit of code.
I’ve therefore installed a copy of MoinMoin Wiki that I will use to write documentation for projects with.
The first project to get the Wiki treatment is my PHP Library for Google Maps EZ, you can find the full documentation here.

Read full storyComments { 7 }

GMaps PHP version 1.2

The author of GMapEZ broke backwards compatibility with a recent change, this release will work around that. If you’re maps just wouldn’t display give this one a try.
There is also a new feature that lets you provide multiple extends, if you are upgrading from a previous version your config file needs to change, a new section [extends] has been added, you should also look at the sample index.php to see how to pass multiple extends to the backend.
Using this new ceature you can create one set of map data and one config file but provide different views, see my visited map showing default view and the same map with a view of just South England.
Some changes made to GMapEZ has some positive effects on my library, for one load time on maps with many points are much much faster now and there are also lots more colours to pick from.
I will be helping the GMapEZ author to produce a downloadable package containing all that is needed to self host the GMapEZ library rather than rely on his hosted version, that way I can also certify my code to work with a given version of GMapEZ.
The new version can be found here: http://www.devco.net/code/gmapsphp-current.tgz full documentation for this application can be found here

Read full storyComments { 0 }

GMaps PHP version 1.1

The sample data provided with my 1.0 release of GMaps PHP had a mistake in the config file which rendered the sample useless.
I’ve fixed this and also added a <comment> tag to the XML data file that will be shown at the locations. A full valid point in the XML file now looks like this:

<point>
<lat>-34.01715</lat>
<long>23.07238</long>
<type>visit</type>
<title>Knysna</title>
<country>South Africa</country>
<comment>Holiday during school years</comment>
</point>

The new version can be found here, full documentation including these changes can be found here.
Thanks to BJE for pointing this out.

Read full storyComments { 0 }
Google Maps and PHP

Google Maps and PHP

I’ve kept a map of my travels since around 1999, I used to use the now defunct PARC Xerox Map Viewer, when that went away I started just projecting dots onto XPlanet maps to produce a static map.

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.

Gary got hold of some code which got me going but it was a bit of a PITA so some searching brought me to Google Maps EZ which is basically a javascript library that takes standard HTML HREF’s and turns them into points etc, very easy to use.

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.

Read full storyComments { 7 }