0

How to retrieve or get the lat/lon by providing the address?, I'm using Google places auto-complete API and you typed the address in the auto-complete text-box and you select the address and the marker pops-up in the google map.

I'm after how to get the lat/lon once the address is pops-up in the map?

I could have done using the server side apex but it has limitation which is Google limit number of API calls etc...

But how I can do that using Google Maps Javascript API

2

Google map Autocomplete itself returns the geolocation of the selected place. You can get the latitude and longitude with the following lines of code. Hope this helps.

var place = autocomplete.getPlace();
var lat = place.geometry.location.lat();
var long = place.geometry.location.lng();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.