Hi everyone,
I've a problem using multi-markers.
I've a PHP array which contains coordinates of many points and I would
like to add a marker for all of those points so i tried this:
PHP:
//to add my coordinates in arrays
$arrayLat = array();
$arrayLon = array();
$count=0;
while($row = mysql_fetch_array($result)){
$arrayLat[] = $row['latitude'];
$arrayLon[] = $row['longitude'];
$count++;
}
//javascript (this part works)
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var adresse = "<?php echo $city; echo $address;?>" ;
var geocoder = new google.maps.ClientGeocoder();
geocoder.getLatLng(adresse, function (coord) {
// Et centrage de la map sur les coordonnées renvoyées par
Google :
map.setCenter(coord, 15);
});
//and the problem is here (because without the following part, the map
works):
function creerMarker(point) {
var marker = new GMarker(point);
});
return marker;
}
for (i=0; i<=<?php echo $count; ?>; i++){
var point = new GLatLng(<?php echo $arrayLat[$i]; ?> , <?php
echo
$arrayLon[$i]; ?>);
var marker = creerMarker(point );
map.addOverlay(marker);
}
I've tried many solutions but i can't manage to do it.
Sorry i'm beginner in Javascript especially with Google API !
(i've no link to share sorry).
Could you help me please? Thanks!
PS: sorry for my bad English but I'm French :)
--
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.