我正在尝试开发一个调用Web服务并接收geojson数据的Android应用程序。我可以在地图框地图上绘制折线(在此示例后为“ https://www.programcreek.com/java-api-examples/?code=mapbox/mapbox-android-demo/mapbox-android-demo-master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/extrusions/MarathonExtrusionActivity.java”),但无法将此路线设置为导航。问题是限制为20个航点, mapboxservice.getRoute()返回的路线与我的路线不同。
private void getRoute(Point origin, Point destination{
NavigationRoute.builder(getContext()).accessToken(Mapbox.getAccessToken()) .origin(origin).profile(DirectionsCriteria.PROFILE_WALKING)
.destination(destination).build() .getRoute(
new Callback() { @Override public void onResponse(Call call,Response response) {currentRoute = response.body().routes().get(0); if (navigationMapRoute != null) navigationMapRoute.removeRoute(); else navigationMapRoute = new NavigationMapRoute(null, mapView, map, R.style.NavigationMapRoute); navigationMapRoute.addRoute(currentRoute); startButton.setVisibility(View.VISIBLE); } @Override public void onFailure(Call call, Throwable throwable) { Log.e("debug", call.toString()); } });AV private void getRoute(Point origin, Point destination) {
NavigationRoute.builder(
getContext()).accessToken(Mapbox.getAccessToken())
.origin(origin)
.profile(DirectionsCriteria.PROFILE_CYCLING)
.destination(destination).build()
.getRoute(new Callback() {
@Override
public void onResponse(Call call, Response response) {
currentRoute = response.body().routes().get(0);
if (navigationMapRoute != null)
navigationMapRoute.removeRoute();
else
navigationMapRoute = new NavigationMapRoute(null, mapView, map, R.style.NavigationMapRoute);
navigationMapRoute.addRoute(currentRoute);
startButton.setVisibility(View.VISIBLE);
}
@Override
public void onFailure(Call call, Throwable throwable) {
Log.e("debug", "AZZO NON RISPOSTO!");
Log.e("debug", call.toString());
}
});
我想知道这段代码的任何想法
navigationMapRoute.addRoute(myJSON);
任何形式的帮助都是有意义的