我使用谷歌的方向API来绘制源和目的地之间的驱动路径。我想要显示多个可选路由,所以我在URL字符串中传递参数alternatives=true。但它没有显示任何额外的路径,只有一条。我的URL代码:
Private String getDirectionsUrl(LatLng origin,LatLng dest)
{
// 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";
//Adding Alternative parameter
String alternative = "alternatives=true";
// Building the parameters to the web service
String parameters = str_origin+"&"+str_dest+"&"+sensor+"&"+alternative;
// Output format
String output = "json";
// Building the url to the web service
String url = "https://maps.googleapis.com/maps/api/directions/"+output+"?"+parameters;
return url;
}发布于 2017-02-21 17:30:25
https://stackoverflow.com/questions/42373965
复制相似问题