Ok heres where Ive reached...
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();
map.setCenter(lat, lng);
marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lng),
map: map
});
marker.setMap(map);
}
}
The issue is alert(lat) works, alert(lng) doesn't.
Why is this?
Also can you see any other problems??
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 [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-js-api-v3?hl=en.