Note that there are some explanatory texts on larger screens.

plurals
  1. POPolyline Error Line
    primarykey
    data
    text
    <p>Hi guys I have a Google Maps and the coordinates are pulled via parse XML data. This script was based on econym's site I am using V3 of Google Maps. Now the thing is I was able to display the markers right but the polyline isn't a single line instead it lines from one marker to another so it looks like a polygon which isn't supposed to happen. </p> <pre><code>&lt;script type="text/javascript"&gt; var select_html = ""; var gmarkers = []; var map = null; function createMarker(latlng, name, html) { var contentString = html; var marker = new google.maps.Marker({ position: latlng, map: map, zIndex: Math.round(latlng.lat()*-100000)&lt;&lt;5 }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString); infowindow.open(map,marker); }); gmarkers.push(marker); return marker; } //function createPolyline function initialize() { var myOptions = { zoom: 16, center: new google.maps.LatLng(&lt;?php echo $row['latitude']?&gt;, &lt;?php echo $row['longitude']?&gt;), mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addListener(map, 'click', function() { infowindow.close(); }); // Read the data from 100.xml downloadUrl("phpsqlajax_genxml.php?id=&lt;?= $_GET['lgid']?&gt;", function(doc) { var xmlDoc = xmlParse(doc); var markers = xmlDoc.documentElement.getElementsByTagName("marker"); var path = []; for (var i = 0; i &lt; markers.length; ++i) { var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new google.maps.LatLng(lat,lng); var html = markers[i].getAttribute("html"); var label = markers[i].getAttribute("label"); var marker = createMarker(point,label,html); path.push(marker.position); } var polyline = new google.maps.Polyline({ path: path, strokeColor: "#FF0000" }); polyline.setMap(map); }); } var infowindow = new google.maps.InfoWindow( { size: new google.maps.Size(150,50) }); </code></pre> <p></p> <p>Would you mind taking a look? Thanks! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload