【问题标题】:Get the Latitude,Longitude Points Every 10 meters ,between the Two different Locations in android获取纬度,每10米的经度点,在android中的两个不同位置之间
【发布时间】:2016-06-20 12:24:02
【问题描述】:
  1. A(Home)---->B(Office)之间的点。

  2. 我已经知道家和办公室的经纬度,我在地图上画了两个位置之间的路径

  3. 我的需要

    使用任何方式获取 My Home 到 Office 之间每 10 米的经纬度

注意:但我们不是在旅行。

请帮助我实现这一目标的可能方法。

【问题讨论】:

    标签: android google-maps google-play-services latitude-longitude


    【解决方案1】:

    您可以使用Google Maps API utility Library 中的SphericalUtil.computeHeadingSphericalUtil.computeOffset 方法。

    首先,您需要计算从 A(家)到 B(办公室)的航向。你可以这样做:

    double heading = SphericalUtil.computeHeading(home, office);
    

    homeoffice 定义如下:

    LatLng home;
    LatLng office;
    

    获得航向后,您可以计算偏移量,迭代得到一个点,该点位于从您家到办公室 10、20、30... 米处。

    例如,要获得从您家到办公室 10 米的点:

    LatLng point10meters = SphericalUtil.computeOffset(home, 10, heading);
    

    【讨论】:

    • 谢谢你的朋友 :),这里,LatLng 家和 Latlng 办公室的位置合适吗?
    • 是的,WGS84 中的位置(纬度/经度)
    • 好的,例如从我家到办公室 100 米,Point10meters 变量将获得 10 个不同的位置?
    • 不,point10meters 将是从您的家指向您的办公室 10 米的一点。您将需要计算距离并迭代以获得更多点(20、30、...米)
    • 您需要为您的项目配置 Google Maps API 实用程序库:googlemaps.github.io/android-maps-utils
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多