In my company, we use the Google maps API to geocode addresses to get the Latitude and Longitude. Fpor cities, it works fine. But when we have to find the Lat/Long of Highways/Roads, that doesn't have numbers. We have just the name/code of the address and the Kilometer/Mile location of it (I.e: BR-060 at 50 KM, or: Bandeirantes Highway at Mile 150).
在我的公司,我们使用Google maps API对地址进行地理编码以获取纬度和经度。 Fpor城市,它运作良好。但是,当我们必须找到Lat / Long of Highway / Roads时,那里没有数字。我们只有地址的名称/代码和它的公里/英里位置(即:50公里处的BR-060,或英里150公里处的Bandeirantes高速公路)。
I live in Brazil, so maybe the expressions we use didn't match, but I want to know if there's a way to find the lat/long of these addresses, cause we can't find them. We tried to look in Google's documentation with no success.
我住在巴西,所以也许我们使用的表达式不匹配,但我想知道是否有办法找到这些地址的纬度/长度,因为我们找不到它们。我们试图查看Google的文档但没有成功。
1 个解决方案
#1
0
Here's an example that shows how the Google Autoocomplete API returns back the latitude and longitude
这是一个示例,显示了Google自动填充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>
#1
0
Here's an example that shows how the Google Autoocomplete API returns back the latitude and longitude
这是一个示例,显示了Google自动填充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>