我想绘制纬度和经度之间的路径每次我将位置发送到此函数并获取URL然后我调用异步任务并逐个路径绘制时,我有很多位置。
有什么方法可以同时发送我所有的纬度和经度,并绘制与此图相同的路径。
我使用这种方法绘制路径: -
String GetUrl = makeURL(StartLatitude, StartLongitude, Latitude, Longitude);
public String makeURL(double sourcelat, double sourcelog, double destlat, double destlog) {
StringBuilder urlString = new StringBuilder();
urlString.append("https://maps.googleapis.com/maps/api/directions/json");
urlString.append("?origin=");// from
urlString.append(Double.toString(sourcelat));
urlString.append(",");
urlString
.append(Double.toString(sourcelog));
urlString.append("&destination=");// to
urlString
.append(Double.toString(destlat));
urlString.append(",");
urlString.append(Double.toString(destlog));
urlString.append("&sensor=false&mode=driving&alternatives=true");
urlString.append("&key=MyApiKey");
return urlString.toString();
}