Select to view content in your preferred language

Using the network dataset from mmpk, ArcGISRuntimeException: Unlocated stop "unnamed (index = 1)" is shown.

192
0
06-04-2024 05:38 AM
守俨李
New Contributor


The start and end points are set as follows:

//添加起点和终点
List<Stop> stops = new ArrayList<>();
Stop startPoint = new Stop(new Point(84.2885638,46.8646832, SpatialReferences.getWgs84()));
Stop endPoint = new Stop(new Point(84.7241962, 46.8695688, SpatialReferences.getWgs84()));
//添加停靠点到列表
stops.add(startPoint);
stops.add(endPoint);

I am using another mmpk to verify the same location, the code is working.

//计算路线
ListenableFuture<RouteResult> routeResultFuture = routeTask.solveRouteAsync(routeParameters);
routeResultFuture.addDoneListener(() -> {
try {
RouteResult routeResult = routeResultFuture.get();
System.out.println("路径结果:"+routeResult);
if (!routeResult.getRoutes().isEmpty()) {
Route route = routeResult.getRoutes().get(0);
// 在地图上显示路线
System.out.println(route.getRouteGeometry());
// 例如,添加一个 Graphic 表示这条路线
// 创建一个图形对象来展示路线
SimpleLineSymbol routeSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 5);
Graphic routeGraphic = new Graphic(route.getRouteGeometry(), routeSymbol);

// 将图形添加到图形覆盖层中
graphicsOverlay.getGraphics().add(routeGraphic);
}else {
System.out.println("路线为空");
}
} catch (Exception e) {
// 处理路线计算错误
Log.e("RoutingError", "Error solving route: " + e.getMessage());
}
});

Is the problem in the network?, I used the same method to export two MMPKS from arcgis pro, which aspects should I troubleshoot?



0 Kudos
0 Replies