【问题标题】:Determine the position between the two positions on the map in android studio在android studio中确定地图上两个位置之间的位置
【发布时间】:2018-03-19 05:40:44
【问题描述】:

我们在地图上有两个具有指定特征的位置 A 和 B。 我们希望在这两个点之间 50 米的距离处进行定位。 enter image description here

【问题讨论】:

标签: google-maps android-studio position


【解决方案1】:

您可以为此使用几何库: https://developers.google.com/maps/documentation/javascript/geometry https://developers.google.com/maps/documentation/javascript/reference/3/#spherical

来自文档:

导航功能

在球体上导航时,航向是相对于固定参考点的方向角度,通常为正北。在 Google Maps API 中,航向以相对于真北的度数定义,其中航向是从真北(0 度)顺时针测量的。您可以使用 computeHeading() 方法计算两个位置之间的这个航向,将它从 LatLng 对象传递给和传递给两个对象。

给定特定的航向、起点位置和行驶距离(以米为单位),您可以使用 computeOffset() 计算目的地坐标。

在您的情况下,您可能希望先获取标题

var heading = google.maps.geometry.spherical.computeHeading(latLngFrom, latLngTo)

那么就可以得到偏移位置:

google.maps.geometry.spherical.computeOffset(latlngFrom, distance, heading) 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-25
    • 1970-01-01
    相关资源
    最近更新 更多