0

在我的公司中,我们使用Google地图API对地址进行地理编码以获取经度和纬度。 Fpor城市,它工作正常。但是,当我们必须找到公路/公路的经纬度时,并没有数字。我们只有地址的名称/代码和公里/英里的位置(即:50公里处的BR-060或150公里处的Bandeirantes公路)。如何在Google地图中获取公路和道路的经纬度API

我住在巴西,所以也许我们使用的表达式不匹配,但我想知道是否有办法找到这些地址的纬度/经度,导致我们找不到它们。我们试图在Google的文档中看到没有成功。

回答

0

这里的,显示了谷歌Autoocomplete API如何返回的纬度和经度

var autocomplete = new google.maps.places.Autocomplete(street); 
 

 
google.maps.event.addListener(autocomplete, 'place_changed', function() { 
 
    var place = autocomplete.getPlace().geometry.location; 
 
    document.getElementById("lat").value = place.lat(); 
 
    document.getElementById("lon").value = place.lng(); 
 
});
input { 
 
    width: 400px; 
 
}
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places&dummy=.js"></script> 
 
<form> 
 
    <input type="text" id="street" name="street" placeholder="street"> 
 
    <br> 
 
    <input type="text" id="lat" placeholder="lat"> 
 
    <br> 
 
    <input type="text" id="lon" placeholder="lon"> 
 
    <br> 
 
</form>

为例
相关问题