【问题标题】:Calculation for latitude and longitude from start to destination point从起点到终点的经纬度计算
【发布时间】:2016-12-02 10:35:55
【问题描述】:

您好,我是 android 开发新手。

我在大学项目中,它基于位置,需要找到两点之间的纬度和经度列表。 假设起始位置为 12.990143,80.215784,目标位置为 12.992595,80.217618。

 Over the past days i search the google, i found so many links to find distance between locations and mid point. I cant able to find solution for my problem.

Please suggest some solution for this problem. I am struggling over days to find solution for this.


 Thanks in advance

【问题讨论】:

标签: android google-maps android-location android-maps


【解决方案1】:

您可以使用Google Maps API Utility Library 中的SphericalUtil.interpolate 方法。

例如,您可以通过以下方式找到一个LatLng,它位于您的起始位置和目的地之间距离的 1/5 处

LatLng origin = new LatLng(12.990143,80.215784);
LatLng destination = new LatLng(12.992595,80.217618);
LatLng result = SphericalUtil.interpolate(origin, destination, 0.2);

【讨论】:

    【解决方案2】:

    您可以使用 google Directions api 获取路径的完整折线。您可以获取 JSON 对象并对其进行解析以获取路径中的位置。

    http://maps.googleapis.com/maps/api/directions/json?origin=12.990143,80.215784&destination=12.992595,80.217618&mode=driving

    这将返回一个完整的 JSON 结果,其中包含您找到到达其上所有点的整个路线所需的一切。

    您可以在以下位置查看更多信息:

    https://developers.google.com/maps/documentation/directions/intro#Introduction

    【讨论】:

    • 是的,我尝试了这个方向 api,它返回道路中的经纬度路径。但我需要直线的经纬度列表和导出列表位置。
    猜你喜欢
    • 2016-02-03
    • 2015-05-25
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-20
    • 2012-10-13
    相关资源
    最近更新 更多