【问题标题】:How to get the latitude and longitude between two points in sequence?如何依次得到两点之间的经纬度?
【发布时间】:2017-12-05 10:36:46
【问题描述】:

说明:我有一些要求,我得到了起点和终点之间的所有纬度和经度。我得到了。问题是它没有进入序列。

例如:如果我设置的起点是“德里”,而我的目的地是“孟买”。所以我需要这两点之间的纬度和经度。首先必须靠近德里,因为我的出身是“德里”。 Google Direction API 为我提供了任意方式。有时它会靠近“孟买”,然后返回德里附近。

请帮我解决这个问题,或者如果您知道如何按顺序获取所有经纬度,请发表您的评论。

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    你可以使用方向api

    // Origin of route
    String str_origin = "origin=" + origin.latitude + "," + origin.longitude;
    
    // Destination of route
    String str_dest = "destination=" + dest.latitude + "," + dest.longitude;
    
    // Sensor enabled
    String sensor = "sensor=false";
    
    // Building the parameters to the web service
    String parameters = str_origin + "&" + str_dest + "&" + sensor;
    
    // Output format
    String output = "json";
    // Building the url to the web service
    String url = "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters;
    

    从上述网址下载经纬度列表并使用该列表获取特定经度。

    【讨论】:

      猜你喜欢
      • 2020-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-13
      • 1970-01-01
      • 1970-01-01
      • 2012-03-29
      • 1970-01-01
      相关资源
      最近更新 更多