Hi All,
Please help me. Google map is not working.
Following is my code. I am very new to google maps. The issue I have is:
google map is not moving to specified Lat and Lng. When I Zoom in I can see
my markers. But the map is not taking me to the specific location.Map is not
moving. Any help is really appreciated.
<script type="text/javascript">
var map;
var geocoder;
var req = new XMLHttpRequest();
function address() {
req.open("GET", "file.json", true);
req.onreadystatechange = Getaddress;
req.send(null);
}
function initialize() {
if (GBrowserIsCompatible()) {
geocoder = new GClientGeocoder();
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 11);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
}
function createMarker(point, number, address) {
var marker = new GMarker(point);
marker.value = number;
GEvent.addListener(marker, "click", function() {
var myHtml = "<b>#" + number + "</b><br/>" + address;
map.openInfoWindowHtml(point, myHtml);
});
return marker;
}
function Getaddress() {
if (req.readyState == 4) {
if (map == null)
initialize();
var obj = eval('(' + req.responseText + ')');
for (var i = 0; obj.Locations[i] != null; i++) {
var point = new
GLatLng(parseFloat(obj.Locations[i].Address.Coordinates.Latitude),
parseFloat(obj.Locations[i].Address.Coordinates.Longitude));
var marker = createMarker(point,i + 1,
obj.Locations[i].Address.Line1)
map.addOverlay(marker);
}
}
}
</script>
--
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.