Select to view content in your preferred language

RouteTracker not receiving status changes with offline map.

342
7
Jump to solution
07-23-2024 01:22 PM
JacobCurrier
Emerging Contributor

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. 

0 Kudos
1 Solution

Accepted Solutions
Ting
by Esri Contributor
Esri Contributor

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.

View solution in original post

0 Kudos
7 Replies
Ting
by Esri Contributor
Esri Contributor
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 documentationThe 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:

  • Did you use the RouteTrackerLocationDataSource API?
  • Did you start the location data source? Can you ensure your simulated data source is emitting locations correctly?
  • Did you access the updates of routeTracker.$trackingStatus using a for-await-in syntax as it is an asynchronous stream?
  • Did you set the stops for the navigation correctly?

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.

0 Kudos
JacobCurrier
Emerging Contributor

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.

0 Kudos
Ting
by Esri Contributor
Esri Contributor

Curious to see the repro case. Just want to double check a few things:

  • Did you use Lite license for the local network dataset?
  • Was there any error being thrown during the route tracker construction and starting process?
0 Kudos
JacobCurrier
Emerging Contributor
  • Did you use Lite license for the local network dataset?

Yes, I believe so

  • Was there any error being thrown during the route tracker construction and starting process?

No errors through the construction process, and the datasource status is showing it's been started. 

0 Kudos
Ting
by Esri Contributor
Esri Contributor

Lite license might be a problem… Can you check if this line in your code throw any error?

 

try await locationDisplay.dataSource.start()

 

 

0 Kudos
JacobCurrier
Emerging Contributor

I'm not getting any errors. 

0 Kudos
Ting
by Esri Contributor
Esri Contributor

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.

0 Kudos