I had such case:
function load()
{
// Create new map object
map = new GMap2(document.getElementById("map"));
// Set map center location
map.setCenter(new GLatLng(63.13450320833446,16.69921875), 3);
// Add Map Controls
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
// Create new geocoding object
geocoder = new GClientGeocoder();
var bounds = new google.maps.LatLngBounds();
// Download the data in data.xml and load it on the map.
// GDownloadUrl("http://esmd.info/index.php?file=map&MAP", function(data) {
GDownloadUrl( "data.php", function(data) {
xml = GXml.parse(data);
markers = xml.documentElement.getElementsByTagName("marker");
name = [];
for (var i = 0; i < markers.length; i++) {
address = markers[i].getAttribute("address");
name[address] = markers[i].getAttribute("name");
var uid = markers[i].getAttribute("uid");
markerId = "id_"+i;
// vardas = "<div id="+markerId+">"+name+"</div>";
geocoder.getLocations(address, addToMap);
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
}
});
}
function addToMap(response )
{
// Retrieve the object
place = response.Placemark[0];
// Retrieve the latitude and longitude
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker( point );
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml( name[response.name] +' ' + response.name );
});
map.addOverlay(marker);
}
Web url: http://esmd.info/index.php?file=MAP
--
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.