I am using Google map api v3 and My Reverse Geocoding Fuction is nOt Working.HEre is my Curretn code.Through This code my is load but no marker is shown
here is code
var map;
var geocoder = new Array();
var markers = new Array();
var latlng = new Array();
function initialize() {
var GPS = <%=GPS %>
var map_center = new google.maps.LatLng(31.2330555556,72.3330555556);
var myOptions = {
zoom: 6,
scaleControl:true,
pancontrol: true,
streetViewControl: true,
center: map_center,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
mapTypeId: google.maps.MapTypeId.HYBRID
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var infowindow = new google.maps.InfoWindow();
for(i=0; i<GPS.length; i++)
{
latlng[i] = new google.maps.LatLng(GPS[i].GPS);
geocoder[i] = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng[i]}, function(results, status) {
markers[i] = new google.maps.Marker(
{
position: latlng,
map: map,
draggable:true,
info:'Adeel',
title:GPS[i].TITLE
});
google.maps.event.addListener(markers[i], 'click', function() {
infowindow.setContent(results[1].formatted_address);
infowindow.open(map,this);
});
});
}
}
Please Anyone Help me to Trace the Exact error in my code.
I have Already used this code .But this code works for Only one marker .Here in My question i am trying to do reverse geocoding with a loop of markers i-e multiple markers. And there is problem in my array and passing arguments to geocoder function please
help me to get out of this problem.thanks
theadeelasla...
Member
32 Points
16 Posts
Javascript Reverse Geocoding Function is Not Working
Feb 23, 2012 06:26 AM|LINK
I am using Google map api v3 and My Reverse Geocoding Fuction is nOt Working.HEre is my Curretn code.Through This code my is load but no marker is shown
here is code
var map; var geocoder = new Array(); var markers = new Array(); var latlng = new Array(); function initialize() { var GPS = <%=GPS %> var map_center = new google.maps.LatLng(31.2330555556,72.3330555556); var myOptions = { zoom: 6, scaleControl:true, pancontrol: true, streetViewControl: true, center: map_center, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }, mapTypeId: google.maps.MapTypeId.HYBRID } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var infowindow = new google.maps.InfoWindow(); for(i=0; i<GPS.length; i++) { latlng[i] = new google.maps.LatLng(GPS[i].GPS); geocoder[i] = new google.maps.Geocoder(); geocoder.geocode({'latLng': latlng[i]}, function(results, status) { markers[i] = new google.maps.Marker( { position: latlng, map: map, draggable:true, info:'Adeel', title:GPS[i].TITLE }); google.maps.event.addListener(markers[i], 'click', function() { infowindow.setContent(results[1].formatted_address); infowindow.open(map,this); }); }); } }Please Anyone Help me to Trace the Exact error in my code.javascript
vinay13mar
Star
7756 Points
1626 Posts
Re: Javascript Reverse Geocoding Function is Not Working
Feb 23, 2012 06:33 AM|LINK
Hi,
check the link
http://code.google.com/apis/maps/documentation/javascript/geocoding.html
V.K.Singh
theadeelasla...
Member
32 Points
16 Posts
Re: Javascript Reverse Geocoding Function is Not Working
Feb 23, 2012 06:42 AM|LINK
I have Already used this code .But this code works for Only one marker .Here in My question i am trying to do reverse geocoding with a loop of markers i-e multiple markers. And there is problem in my array and passing arguments to geocoder function please help me to get out of this problem.thanks
Richey
Contributor
3816 Points
431 Posts
Re: Javascript Reverse Geocoding Function is Not Working
Feb 29, 2012 12:44 PM|LINK
Hi,
You can refer to the below links.
http://you.arenot.me/2010/06/29/google-maps-api-v3-0-multiple-markers-multiple-infowindows/
http://stackoverflow.com/questions/6478914/reverse-geocoding-code
http://code.google.com/intl/zh-CN/apis/maps/documentation/geocoding/v2/
You can put the post in the Goog Map API as it it third party tool.