Apologies this follows on from a previous topic, but I couldnt see how to remove the previous one, and I have a more specific error now.
Map: www.my-walk.com/index.php Heres the code in question: function loadRoutes() { <?php $r = mysql_query ("SELECT * FROM routes"); while($row = mysql_fetch_assoc($r)) { ?> var coordinates = '.$row["coordinates"].' coordinates = coordinates.replace(/[(]/g, ""); coordinates = coordinates.replace(/[)],/g, "&"); var temp = []; var temp2 = []; temp = coordinates.split("&"); temp2 = temp[0].split(","); var latlng = new google.maps.LatLng(parseFloat(temp2[0]), parseFloat(temp2[1])); path.push(latlng); // -1 gets rid of the last string which is empty space for (var i = 1; i < temp.length-1; i++) { temp2 = temp[i].split(","); var latlng = new google.maps.LatLng(parseFloat(temp2[0]), parseFloat(temp2[1])); path.push(latlng); } // Ideally want the path added at the location of it's id, instead of using push //pathArray['.$row["id"].'] = path; pathArray.push(path); <?php }; ?> } function addRoutes() { for (i=0; i<pathArray.length; i++) { poly = new google.maps.Polyline({ path: pathArray[i], strokeColor: "#FF0000", strokeOpacity: 0.5, strokeWeight: 5 }); poly.setMap(map); } } loadRoutes() is ran inside initialize(), and takes all the routes in the database, and creates a path for them. addRoutes is called by a listener for the event 'idle', and uses these paths to display a poly line on the map for each one. Ideally I want to add the paths to pathArray[] at a specific palce, determined by the paths 'id', but to be safe ive started by using push and looping through the array, but it dosen;t draw the poly line. Inside the addRoute method I would like some code that says if the path is within the bounds of the map, draw its polyline and add it to the map. Hence, with the 'idle' event listener, the map will only display routes which are within the window fo the map that the user is scrolling. Thanks for your help, Rick -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.