Hey all,
I've been searching everywhere to find an example of clicking on a feature and getting a route from current location. Any help would be greatly appreciated. I am using QML and Runtime 100.8. I do know the nearby sample does have that capability but having trouble finding the source code due to all the other capabilities.
Thanks in advance,
Eric
Solved! Go to Solution.
HI Eric,
I give the user the choice of starting navigation from any point or current location. The user selects from the buttons.
Here is the code that sets the current location as the starting point and places a graphic.
stop1Geometry=RT.ArcGISRuntimeEnvironment.createObject("Point", {x: mapView.locationDisplay.location.position.x, y: mapView.locationDisplay.location.position.y, spatialReference: RT.SpatialReference.createWgs84()});
var simpleMarker1 = RT.ArcGISRuntimeEnvironment.createObject("SimpleMarkerSymbol", {style: RT.Enums.SimpleMarkerSymbolStyleCross, size: 15, color: "green"});
var graphic1 = RT.ArcGISRuntimeEnvironment.createObject("Graphic", {symbol: simpleMarker1, geometry: stop1Geometry});
graphicsOverlay.graphics.append(graphic1)
Hope this helps.
Joe
HI Eric,
I give the user the choice of starting navigation from any point or current location. The user selects from the buttons.
Here is the code that sets the current location as the starting point and places a graphic.
stop1Geometry=RT.ArcGISRuntimeEnvironment.createObject("Point", {x: mapView.locationDisplay.location.position.x, y: mapView.locationDisplay.location.position.y, spatialReference: RT.SpatialReference.createWgs84()});
var simpleMarker1 = RT.ArcGISRuntimeEnvironment.createObject("SimpleMarkerSymbol", {style: RT.Enums.SimpleMarkerSymbolStyleCross, size: 15, color: "green"});
var graphic1 = RT.ArcGISRuntimeEnvironment.createObject("Graphic", {symbol: simpleMarker1, geometry: stop1Geometry});
graphicsOverlay.graphics.append(graphic1)
Hope this helps.
Joe
Thanks Joe that helped alot. I have only had experience with WAB and Dashboards so this is all pretty new to me. I am trying to use this route URL https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World but it does not seem to be working and am wondering if I need to put in a API key?
cheers,
I have never used that service and I couldn't access it. We have our own network dataset that we use.
Cheers Joe, I’ll hunt down if we have our own service.
Eric