说明:我有一些要求两个获得原点和目的地之间的所有纬度和经度。我已经得到了它。问题是它没有进入序列。
例如:如果我设置的原点是“德里”而我的目的地是“孟买”。所以我需要一个lat&在这两点之间长。首先必须靠近德里,因为我的起源是“德里”。 Google Direction API为我提供了任意方式。有时它需要靠近“孟买”,然后又回到德里附近。
请帮助我解决这个问题,或者如果你知道如何获得所有的lat&请按顺序排好。
答案 0 :(得分:0)
您可以使用方向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;
从上面的url下载lat long列表并使用该列表获取特定的lat long。