Hello,
I'm working on upgrading our existing application from esri 100.15 to 200.4. Currently I'm working on implementing a MapView that can solve a simple route, display it graphically, track the users progress, give directions, and reroute them if needed. The map and route task will be either from esri online services or from an mmpk depending on the users settings. I'm simulating my location / movement using a gpx file.
When using the online map / routing service everything is working as desired. (except the ability to reroute which seems to be unsupported by the service. Is this an esri online account setting that can be configured?)
When using a map / transportation network dataset from an mmpk pretty much everything is done the same way besides loading the offline map and creating the route task using a TransportationNetworkDataSet.
In this case however I can only solve the route and display the initial route from the RouteResult.
After the initial solve I create the RouteTracker, use it to create a RouteTrackerLocationDataSource, set the maps locationDisplay.datasource equal to it, and start the datasource.
I've verified that it's status is started however with the offline map the location is always nil and the RouteTracker trackingStatus is not getting any updates.
I've tried a few different mmpks and got the same result in both.
Are there any settings that I need to change specifically for offline maps to work with the route tracker?
Any guidance would be appreciated.
Solved! Go to Solution.
A quick update: I have asked our network analysis team about why there isn't an error - it should be an error thrown somewhere, but I can't manage to find it.
Per my test, using local network dataset for route tracking requires higher than Lite license - Basic, Standard, Advanced.
If you want to see it work, you can also comment out the line that set the license in the main function's initializer, and the app falls back to developer mode, which allows you to use all the functionalities while showing a watermark.
When using the online map / routing service everything is working as desired. (except the ability to reroute which seems to be unsupported by the service. Is this an esri online account setting that can be configured?)
To publish a routing service, most likely it is done through the ArcGIS Server Manager. There is a section that discusses the auto-rerouting configuration on the server in this documentation. The availability of the rerouting option is determined by the service or local network dataset. If the service does not support rerouting or does not advertise the parameter, the property value will be false. For local datasets, it is always true.
Update: another thing pointed out by our routing team - the world routing service doesn't allow rerouting, because otherwise our data providers will charge us for the extra service. So the most widely used world routing service is kept to the basics.
After the initial solve I create the RouteTracker, use it to create a RouteTrackerLocationDataSource, set the maps locationDisplay.datasource equal to it, and start the datasource.
I've verified that it's status is started however with the offline map the location is always nil and the RouteTracker trackingStatus is not getting any updates.
I know you might have already checked but just in case… there is a sample for rerouting. A few things that come to my mind are:
There are many pieces for the navigation workflow so it is hard to tell which part went wrong. If possible, you can dm me a zip archive of a demo project with the offline network data you used for routing.
Thank you for the response.
Everything is working when I create a route task with the esri online routing service like this:
let routeTask = RouteTask(url: URL(string: "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")!)
I'm getting the $trackingStatus updates and the route is being calculated from the start and end stops.
My issue is when I create a routeTask with a transportationNetworkDataset such as:
if let transportationNetwork = map.transportationNetworks.first {
routeTask = RouteTask(dataset: transportationNetwork)
}
In this scenario the RouteResult is correct and returns the correct route start to finish. However the locationDisplay using the RouteTrackerLocationDataSource isn't getting location updates and the $trackingStatus isn't getting status updates.
I'll try to put together a small demo today and send it over.
Curious to see the repro case. Just want to double check a few things:
Yes, I believe so
No errors through the construction process, and the datasource status is showing it's been started.
Lite license might be a problem… Can you check if this line in your code throw any error?
try await locationDisplay.dataSource.start()
I'm not getting any errors.
A quick update: I have asked our network analysis team about why there isn't an error - it should be an error thrown somewhere, but I can't manage to find it.
Per my test, using local network dataset for route tracking requires higher than Lite license - Basic, Standard, Advanced.
If you want to see it work, you can also comment out the line that set the license in the main function's initializer, and the app falls back to developer mode, which allows you to use all the functionalities while showing a watermark.