Select to view content in your preferred language

Online routing sample basemap problem

3056
6
05-22-2016 11:39 PM
albavoli
Deactivated User

Why the sample of the online routing works only with

http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer basemap?

0 Kudos
6 Replies
LucasDanzinger
Esri Frequent Contributor

You can use any basemap you want while doing routing. My guess for why this one in particular is working and others are not is because this one is in WKID 4326, and most others are in WKID 102100 (web mercator). The routing service is probably in 4326, so there may need to be some work done to project any input coordinates to the right spatial reference. If so, you can do this with project() on the GeometryEngine - ArcGIS Runtime SDK for Qt QML API: GeometryEngine Class Reference

0 Kudos
albavoli
Deactivated User

Thank Lucas for your reply i am doing as u advised me trying to re project the point from 4326 to 102100

but i am not sure if i am doing it right:

i have a variable that is created on mouse clicked to get the geometry:

mPoint=mouse.mapPoint;

and then i am trying to re project that like this

GeometryEngine.project(mPoint,map.spatialReference);

but its not working can u help what i am doing wrong

0 Kudos
LucasDanzinger
Esri Frequent Contributor

That looks right. I am not positive that is the problem- it was just a guess. You should be able to use any basemap you want when you're using the RouteTask, and the only obvious difference between the service you posted and most others is the spatial reference. Are you getting some errors? What is happening when you try to route?

0 Kudos
albavoli
Deactivated User

I think its the spatial reference coz the map and the feature layer have the spatial reference at 4326 and route service is projecting on that spatial so when i change the basemap to theone with reference 102100 i get route error:unable to complete operation.

And when i re project mouse.mapPoint to mPoint=GeometryEngine.project(mouse.mapPoint,map.spatialReference);

and give the stop graphic the value like:

var graphic1 = stopGraphic.clone();

graphic1.geometry = mPoint;
than doesnt route at all.
This re projection generate in this case a point or a geometry?
I think this is the error that the reprojected geometry is not a valid geometry for the graphic?
0 Kudos
LucasDanzinger
Esri Frequent Contributor

That should be fine, as a Point is a Geometry.

0 Kudos
albavoli
Deactivated User

I think the problem is that the feature layer is sourced by a GeodatabaseFeatureServiceTable

and i dont know if its suported the reprojection of point

maybe its better to change the web service what can i do?

0 Kudos