首页 文章

具有自动填充功能的Google Maps JavaScript API

提问于
浏览
-2

我们正在使用Google API从自动填充输入中获取地址 .

<script src="https://maps.googleapis.com/maps/api/js?key=XXXXX&signed_in=true&libraries=places&callback=initAutocomplete" async defer></script>

源代码可以在这里找到:https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform?hl=de

现在我想知道我是否可以从该请求中获得经度和纬度 . 因此,我们可以访问Google Map 并计算距起点的距离 .

1 回答

  • 0

    所以解决方案正在使用

    place.geometry.location.lat() 为纬度

    place.geometry.location.lng() for longtidue

    在声明var位置后的fillInAddress()函数中 .

    谢谢@JaromandaX

相关问题