0
votes

I am using Google Maps Geocoding API to get geometry location (lat, lng values) of the address in store locator address filter.

Example:

When I used to search an address (Postal code, Street name, Landmark) of Singapore and It gives location lat & lng values in geometry results as follows,

JavaScript method:

geocoder.geocode({'address': "New Bridge Road"}, function(results, status) {});

The above JavaScript method and the Geocoder Request URL API will return as

"location" : {
   "lat" : 1.283266,
   "lng" : 103.8426887
},

But when I used to search the same address in Google map (https://www.google.co.in/maps), it shows different lat & lng values in the address bar as

enter image description here

So here I wanted to have the same zoom level, center position and lat & lng values as google map for my store locator also.

1
Did you try another address, just for testing purpose?fubbe
@fubbe I tried with multiple addressesSoliyappan
Why do you think the values in the Google Maps URL are more accurate? Last I checked, that was the center of the map, not the location that resulted from the query.geocodezip
@geocodezip I did not think URL values are accurate. Rather than mentioned that I need to achieve the same behaviour of Google maps (same lat & lng, Zoom level and centre position) by using Geocoder API for my store locator.Soliyappan
@Soliyappan have you tried giving New Bridge Rd, Singapore in the java script method you have?Coder

1 Answers