【发布时间】:2017-08-25 06:05:31
【问题描述】:
如何在 3 个点之间获取方向,例如从 A 到 B 到 C。我当前的代码是从 2 个点获取方向。
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";
// 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 + "&key=" + getResources().getString(R.string.googleApiKey);
return url;
}
【问题讨论】:
标签: java android google-maps google-api routes