Hi there,
Can anyone help me with this issue. How would I go about changing
map.setCenter in such a way as to display all the clustermarkers that
I have created from my MSSQL? I have tried to look at how other
examples have done it (e.g.
http://groups.google.com/group/google-maps-api/browse_thread/thread/28b13f0a09c48716),
but I can't seem to figure out how I can apply this to my Google Map.
Any example code and advice is greatly appreciated!
Cheers,
Neil
My function to initialise the map is posted below:
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(
document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addMapType(G_SATELLITE_3D_MAP);
map.setCenter(
new GLatLng(34.94148,-114.139431), 11);
var icon = new GIcon(G_DEFAULT_ICON);
icon.image = "http://chart.apis.google.com/chart?
cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png";
var markers = []
<!-- This function creates a marker for every lat/long in the query --
>
function createMarker(point, text, title) {
var marker =
new GMarker(point,{title:title});
return marker;
}
<?php
/* This is where all the data is collected into an array */
$lat=array();
$long=array();
while($points = sqlsrv_fetch_array($result)) {
$lat[] = $points['gps_lat'];
$long[] = $points['gps_long'];
}
$latLongSize = sizeof($lat)-1;
for($i=0; $i<=$latLongSize; $i++){ ?>
markers.push(createMarker(new GLatLng(<?php echo $lat[$i];?>, <?php
echo $long[$i]; ?>)));
<?php } ?>
var markerCluster = new MarkerClusterer(map, markers);
}
}
//]]>
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.