简体   繁体   中英

How to get the Google Geocoder API geometry values (latitude and longitude) same as Google maps URL latitude and longitude values

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

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM