Hi Guys - I'm working on doing something similar to the person in this post:
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/872736831afeae40/058d237461390f86?lnk=gst&q=gdirections#058d237461390f86 My data is dynamically gathered, however, and I need to plot multiple polylines between pairs of coordinates on one map. They need to directly overlay on top of streets, and I also need to be able to control their color. Therefore, I need to export GPolyLines from GDirections. Can anyone help me with a code segment that reads in coordinate pairs and draws lines in between them in this manner? I can't seem to figure out how to draw more than one at a time on a map. <script type="text/javascript"> function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas" )); map.addControl(new GLargeMapControl()); map.setCenter(new GLatLng(43.070946, -89.400737), 15); var request = GXmlHttp.create(); request.open("GET", "coordinates.xml", true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = GXml.parse(request.responseText); // obtain the array of markers and loop through it var markers = xmlDoc.documentElement.getElementsByTagName ("street"); for ( var i = 0; i < markers.length; i++) { // obtain the attribues of each marker var lat1 = parseFloat(markers[i].getAttribute("lat1")); var lon1 = parseFloat(markers[i].getAttribute("lon1")); var point1 = new GLatLng(lat1, lon1); var lat2 = parseFloat(markers[i].getAttribute("lat2")); var lon2 = parseFloat(markers[i].getAttribute("lon2")); var point2 = new GLatLng(lat2, lon2); if ((lat1 != lat2)&&(lon1 != lon2)) { map.addOverlay(new GMarker(point1)); map.addOverlay(new GMarker(point2)); } } } } request.send(null); } } </script> This is what I have so far - it just parses an xml file and plots the pairs of coordinates that I need a polyline laid over. Thanks for any help! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
