How to find the lat lng from a geocoded address?

前端 未结 2 1561
时光取名叫无心
时光取名叫无心 2021-01-24 15:21

I\'m trying to create a Gmap to allow people to geocode an address and find the respective lat lng. I would like to see this in the forms I\'ve already created. Also, I would li

2条回答
  •  春和景丽
    2021-01-24 16:02

    Inside the geocoder call back do this:

    document.getElementById('lat').value = results[0].geometry.location.lat();
    document.getElementById('lng').value = results[0].geometry.location.lng();
    

    Working example

提交回复
热议问题