Using Google maps API v3 how do I get LatLng with a given address?

前端 未结 3 1424
遥遥无期
遥遥无期 2020-12-07 13:42

If a user inputs an address, I want to convert to the equivalent LatLng.

I\'ve read the documentation, and I think I can use the Geocoder class to do this, but can\'

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 14:07

    I don't think location.LatLng is working, however this works:

    results[0].geometry.location.lat(), results[0].geometry.location.lng()
    

    Found it while exploring Get Lat Lon source code.

提交回复
热议问题