Skip to Content
0
May 16, 2018 at 07:24 AM

issue in geocoder.geocode() to get a latitude and longitude.

919 Views Last edit May 25, 2020 at 12:51 PM 2 rev

Hello Experts,

I have a requirement to display location as a marker on the google map and the address are coming from the backed.

Now i have used for loop to take address one by one and pass to the method geocoder.geocode().

Now i can see that when the control come to this method, instead of going to the inner side of method it is going back to loop.

following is the code:--

for (var i = 0; i <= oData.results.length; i++)

{ var address = oData.results[i].ZADDRESS;

that.geocoder = new google.maps.Geocoder();

that.geocoder.geocode({ 'address': address },

function(results, status)

{ if (status == google.maps.GeocoderStatus.OK)

{ results[0].geometry.location.lat();

results[0].geometry.location.lng();

}});

Can you please tell me why control is not going into geocoder.geocode() ?