ArcGIS-Location "Location 1" in "Stops" is unlocated in Online Routing
I was trying to run a sample project "Routing" provided by ArcGis Runtime SDK. I tried the code but when the method solve() of RouteTask class is executed, it throws the following exception without returning any routes:
map.setOnLongPressListener(new OnLongPressListener() { private static final long serialVersionUID = 1L; public boolean onLongPress(final float x, final float y) { // Clear the graphics and empty the directions list routeLayer.removeAll(); hiddenSegmentsLayer.removeAll(); curDirections = new ArrayList(); mResults = null; // retrieve the user clicked location final Point loc = map.toMapPoint(x, y); // Show that the route is calculating dialog = ProgressDialog.show(RoutingSample.this, "", "Calculating route...", true); // Spawn the request off in a new thread to keep UI responsive Thread t = new Thread() { @Override public void run() { try { // Start building up routing parameters RouteParameters rp = mRouteTask .retrieveDefaultRouteTaskParameters(); NAFeaturesAsFeature rfaf = new NAFeaturesAsFeature(); // Convert point to EGS (decimal degrees) Point p = (Point) GeometryEngine.project(loc, wm, egs); // Create the stop points (start at our location, go // to pressed location) StopGraphic point1 = new StopGraphic(mLocation); StopGraphic point2 = new StopGraphic(p); rfaf.setFeatures(new Graphic[] { point1, point2 }); rfaf.setCompressedRequest(true); rp.setStops(rfaf); // Set the routing service output SR to our map // service's SR rp.setOutSpatialReference(wm); // Solve the route and use the results to update UI // when received mResults = mRouteTask.solve(rp); mHandler.post(mUpdateResults); } catch (Exception e) { Log.w(ESRI_EXCEPTION_TAG, e); mException = e; mHandler.post(mUpdateResults); } } }; // Start the operation t.start(); return true; } I get exception on the following line: mResults = mRouteTask.solve(rp);
أكثر...
I was trying to run a sample project "Routing" provided by ArcGis Runtime SDK. I tried the code but when the method solve() of RouteTask class is executed, it throws the following exception without returning any routes:
com.esri.core.io.EsriServiceException: Unable to complete operation. Location "Location 1" in "Stops" is unlocated. Location "Location 2" in "Stops" is unlocated. Need at least 2 valid stops. "Stops" does not contain valid input for any route.
I am not able to figure out what the actual problem is. Here is the link for the sample code and the code looks like this:
map.setOnLongPressListener(new OnLongPressListener() { private static final long serialVersionUID = 1L; public boolean onLongPress(final float x, final float y) { // Clear the graphics and empty the directions list routeLayer.removeAll(); hiddenSegmentsLayer.removeAll(); curDirections = new ArrayList(); mResults = null; // retrieve the user clicked location final Point loc = map.toMapPoint(x, y); // Show that the route is calculating dialog = ProgressDialog.show(RoutingSample.this, "", "Calculating route...", true); // Spawn the request off in a new thread to keep UI responsive Thread t = new Thread() { @Override public void run() { try { // Start building up routing parameters RouteParameters rp = mRouteTask .retrieveDefaultRouteTaskParameters(); NAFeaturesAsFeature rfaf = new NAFeaturesAsFeature(); // Convert point to EGS (decimal degrees) Point p = (Point) GeometryEngine.project(loc, wm, egs); // Create the stop points (start at our location, go // to pressed location) StopGraphic point1 = new StopGraphic(mLocation); StopGraphic point2 = new StopGraphic(p); rfaf.setFeatures(new Graphic[] { point1, point2 }); rfaf.setCompressedRequest(true); rp.setStops(rfaf); // Set the routing service output SR to our map // service's SR rp.setOutSpatialReference(wm); // Solve the route and use the results to update UI // when received mResults = mRouteTask.solve(rp); mHandler.post(mUpdateResults); } catch (Exception e) { Log.w(ESRI_EXCEPTION_TAG, e); mException = e; mHandler.post(mUpdateResults); } } }; // Start the operation t.start(); return true; } I get exception on the following line: mResults = mRouteTask.solve(rp);
أكثر...