如何在谷歌地圖API中獲取高速公路和道路的緯度和經度 (How to get Latitude and Longitude of highways and roads in Google maps API)


問題描述

如何在谷歌地圖API中獲取高速公路和道路的緯度和經度 (How to get Latitude and Longitude of highways and roads in Google maps API)

在我的公司,我們使用 Google 地圖 API 對地址進行地理編碼以獲取緯度和經度。Fpor城市,它工作正常。但是當我們必須找到高速公路/道路的緯度/經度時,它沒有數字。我們只有地址的名稱/代碼及其公里/英里位置(即:50 公里處的 BR‑060,或:150 英里處的班德蘭特斯高速公路)。

我住在巴西,所以也許我們使用的表達式不匹配,但我想知道是否有辦法找到這些地址的緯度/經度,因為我們找不到它們。我們試圖查看 Google 的文檔,但沒有成功。


參考解法

方法 1:

Here's an example that shows how the Google Autoocomplete API returns back the latitude and longitude

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>

(by Eduardo Samoggincamiblanch)

參考文件

  1. How to get Latitude and Longitude of highways and roads in Google maps API (CC BY‑SA 2.5/3.0/4.0)

#google-latitude #google-maps-api-3 #latitude-longitude #google-maps






相關問題

Otentikasi permanen Google Latitude API untuk akun tertentu (Google Latitude API permanent auth for specific account)

無法從 Google Apps 腳本連接到 Google Latitude API (Can't connect to Google Latitude API from Google Apps Script)

如何在谷歌地圖API中獲取高速公路和道路的緯度和經度 (How to get Latitude and Longitude of highways and roads in Google maps API)

如何修復谷歌地圖上的標記並移動地圖? (How to fix marker on google map and move map?)

使用 Google Latitude API 獲取朋友的位置 (Using Google Latitude API to get friends' locations)

尋找我和朋友之間最近的距離 (Finding nearest distance between me and friends)







留言討論