Google Maps API

I’ve been wanting to get to grips with the Google Maps application for sometime because the geographer in me recognises it not only as a useful tool, but a spatial data godsend. I’ve been using Google Earth for sometime, but Google Maps lets you do some cool stuff. After trying a few different plugins that utilise the Google Maps API, I’ve decided to use Avi Alkalays version to develop the Singletrack Magarchive website.

I’ve long recognised that my previous method of illustrating the various locations of Singletrack’s route guides had limitations. The largest being the poor spatial resolution a fairly big marker on a smallish map had. Google Maps gets around that with its use of scalable vector data and geocoded tags. Better still each of the marker point tags can be customised to include images and hyper links.

This means that every time you click on one of the markers in the new route guide section you get the details of the route and a link to the magazine page in the archive. I’ve added in the Singletrack Office location too. I’m hoping that this new approach will also solve the second concern I had – In places like Calderdale and the Peak and Lake Districts, some of the points were so close together that they were quite off the mark. I’m pleased with the end result and will be applying this to some websites at work.

There’s a few things I’d like to be able to tweak, least not being able to number each of the marker points rather than just have a black dot in them. I’ll have to get to grips with the Mapplets documentation first, but I think it’s do-able. Here’s a quick demo:

Author: Cris Bloomfield

Usually mountain biking in the North.

10 thoughts on “Google Maps API”

  1. Google Maps API is ace. Different markers? Look at this script to see how I did it. The point data is generated by running a CSV file of points through an awk* script to generate javascript.

    Thing is that at the moment it can be easier instead of writing javascript to write a KML file (or generate one from common source data) and let Google do all the hard work of displaying that instead.

    For instance I’ve been playing with Google Maps for the local hunt – The thing is that Google have developed their own site so much that it’ easier for me to let them do all the hard work for me, and just pass them a KML file –

    This also gives the end-user more choice in what they do with the map – they can’t get directions on my version for instance unless I find the time to learn how to code it – and the KML file is compatible with Google Earth, allowing users even more choice in what to do with it.

    I parse the same spreadsheet to keep the javascript or KML for both map versions in sync but that relies on me then updating the files manually – clever people would use a database and PHP to keep everything in sync.

    * sometimes perl is too blunt.


  2. You got mail – I’ve looked at Avi’s script since I write, and I can modify that to do what you want so you don’t have to change plugin.

    In fact I’ll probably amend the VLH site to use this plugin once I’ve modded it.


  3. Actually I’ve modified the VLH site now so the vlhunt.js contains my modified version of Avis plugin to allow markers to be identified by letter.


  4. Quiet day at work then 😉
    That looks like a nice solution. I’ll have a look at my email when I get home. You may want to look at this for the VLH site:
    In the dl style add in ”visibility: hidden;” title=”googlemap”…etc
    Using style=”visibility: hidden” will make the browser hide the map definititon text while loading the page. Seconds later, when the plugin renders the maps on your page, the hidden blocks will finally appear as maps.
    Not quite as nice as you previous one that used to display ‘loading google map”, but I’m sure it wouldn’t be too difficult to do that either.


  5. I forgot to add – in the end I just changed my awk script to write HTML code for Avis plugin instead of javascript. I still find it easier to co-ordinate my KML and HTML by parsing a common spreadsheet than by doing anything clever with PHP.


  6. Nick,

    You basically create style sheet type items in the KML header and relate them down to the individual placemarks. Take a look at the KML file for an example:

    It’s not however exactly what I want it to do. Ideally for the Singletrack Mag Archive Routes Page I want it to dynamically number the placemarks rather than have to create png thumbnails. I need to do a bit more work on that to find a way forward.

    I’ve also been playing with the vector functionalities for producing polygons as I’d been using the route plotting function to scope out the potential for recording and sharing rides. It might be a cool thing to setup on Cheekytrails…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: