Question

I am looking for examlpes of how to use polylines in V3 of Google maps, I have read the help at Google but must admit I don't fully understand. I feel if I could see a good example I might understand it better. What I have is a site that I track my vehicle I have it plotting the points on the map what I want is to draw the line between the points. I am using a mysql database and a XML file with PHP to display the point on the map.

Any help would make my day. I have found this site very helpful and I wish to thank all.

Take care, all the best

Was it helpful?

Solution

It's a matter of creating a KML xml file, using data from your database, and feed google api with that. You can use this tool to interactively see how the kml file changes while adding points to the polyline.

EDIT:

  1. Create a script in your preferred scripting language which retrieves the points from database, and generates a kml file format as in the third link above.

  2. In your javascript script, you need to add a kml layer to the map, loading the kml you generate on the fly in your script at point 1. :

    [...] var map = new google.maps.Map(document.getElementById('map'), options); [...] kmlFiles = new google.maps.KmlLayer("http://yourdomain.com/generatekml.php"); kmlFiles.setMap(map);

and that's it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top