Why the sample of the online routing works only with
http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer basemap?
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
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
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?
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?
That should be fine, as a Point is a Geometry.
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?