Hi,
I must center the map with multiple markers but this code don't run,
any idea?
(I've read the previously post)
thanks
var bounds = new GLatLngBounds();
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
// Creo GeoCoder Max 1.6 query/sec
geocoder = new GClientGeocoder();
function showAddress(address)
{
geocoder.getLatLng(address,
function(point)
{
if (!point)
{
// Indirizzo non trovato!
alert(address + " non trovato!");
}
else
{
// Indirizzo trovato, centra la mappa sul punto
//map.setCenter(point, 14);
// Crea il marker
map.addOverlay(createMarker(point, address));
bounds.extend(marker.getPoint());
}
});
}
showAddress('milano');
showAddress('venezia');
showAddress('genova');
var center = bounds.getCenter();
map.setCenter(center, map.getBoundsZoomLevel(bounds));
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---