【问题标题】:How to get Latitude and Longitude of highways and roads in Google maps API如何在谷歌地图API中获取高速公路和道路的纬度和经度
【发布时间】:2016-04-04 21:27:14
【问题描述】:

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

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

【问题讨论】:

    标签: google-maps google-maps-api-3 latitude-longitude google-latitude


    【解决方案1】:

    以下示例显示了 Google 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>

    【讨论】:

      猜你喜欢
      • 2014-06-06
      • 2013-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多