Hi guys, Site: www.my-walk.com/addwalk.php
I have a method which takes a string of saved markers, then I want to break it down so I can add them to a Marker array and display them on a map. At the moment Im using a defined marker string becuase I was having issues carrying the marker String as a session variable into the mySQL and back, but that doesn't relate to this group.... function addMap(coordinates) { var coordinateString = "(18.66774725247165, -3.3367449040771535), (54.6671516, -3.3574301),(54.6750929147338, -3.3477312322021535), (54.6750929147338, -3.377256989038091),(54. 667052323738794, -3.393908142602544),(54.6671516, -3.3574301),(54.6671516, -3.3574301),"; coordinateString = coordinateString.replace(/[(]/g, ""); coordinateString = coordinateString.replace(/[)],/g, "&"); var i = 0; var temp = []; var temp2 = []; //split marker string into individual markers temp = coordinateString.split("&"); //split first marker into lat and lng values temp2 = temp[0].split(","); var lat = temp2[0].parseFloat(); alert(lat); var lng = temp2[1].parseFloat(); alert(lng); map.setCenter(lat, lng); marker = new google.maps.Marker({ position: new google.maps.LatLng(lat, lng), map: map }); marker.setMap(map); // -1 gets rid of the last string which is empty space // splits rest of markers into lat lng for (i = 1; i < temp.length-1; i++) { temp2 = temp[i].split(","); var lat = temp2[0].parseFloat(); var lng = temp2[1].parseFloat(); marker = new google.maps.Marker({ position: new google.maps.LatLng(lat, lng), map: map }); marker.setMap(map); } } The issue is alert(lat) and alert(lng) doesn't work, so there is issuesw around the parseFloat() area. Why is this? Also can you see any other problems further down the line?? Thankyou very much, 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.