AnsweredAssumed Answered

How to give routes using LatLng points?

Question asked by Zulcan on Feb 10, 2017
Latest reply on Feb 10, 2017 by ANohe-esristaff

I am new to ArcGIS but have followed the guide at Find a route—ArcGIS Runtime SDK for Android | ArcGIS for Developers  to route from one location to another but the guide uses a projected coordinate system in California. I want to, ideally, be able to give route parameters using LatLng or at least be able to convert from LatLng to something else? Will the API not accept LatLng points? I want to route in the United Kingdom so, accordiing to Coordinate systems and projections for beginners — Esri UK  this would mean I need to convert WKID 4326 into WKID 102100 or 3857?

 

In the example I can give 2 stops as follows:

Stop stop1 = new Stop(new Point(-13046294.924, 4036100.529, SpatialReferences.getWebMercator()));
Stop stop2 = new Stop(new Point(-13046094.899, 4036273.038, SpatialReferences.getWebMercator()));

 

But if I give these stops, also in California, using LatLng:

Stop stop1 = new Stop(new Point(32.863797, -117.205879, SpatialReferences.getWgs84() ));
Stop stop2 = new Stop(new Point(32.902620, -117.150526, SpatialReferences.getWgs84() ));

 

.... no matter what spatial reference or lack of I use, it returns java.util.concurrent.ExecutionException: com.esri.arcgisruntime.io.JsonEmbeddedException: Unable to complete operation when I call RouteResult routeResult = routeResultFuture.get();

 

So I guess something it wrong with my query to the API? What am I supposed to do to query using LatLng? I am using the following route service proxy (minus my personal key):

http://utility.arcgis.com/usrsvcs/appservices/XXXXXXXXXXXXXXXX/rest/services/World/Route/NAServer/Route_World 

 

Please can someone help? It is important I use LatLng as I need the routing to be compatible with GoolgeMap and the rest of my application that is all coded to use LatLng. I don't mind converting it if I have to but I need a way to do this programatically in my app.

Outcomes