Issue with using custom Network Dataset on ArcGIS Runtime SDK for Android

1569
8
Jump to solution
05-15-2020 02:23 PM
MiguelLourenço
New Contributor II

Hello everyone,

I'm having a problem regarding the use of a custom Network Dataset.
So I built a Network Dataset using ArcCatalog and ArcMap 10.7.1 and exported as ArcGIS Runtime Content on ArcMap as a .geodatabase file. The settings chose for the exported file were: "Do not include feature and tabular data"; "Do not include a basemap"; "Include network data from the current map"; and "Do not include a locator".

I then put this file on an Android emulator device and tested the find-closest-facility-to-multiple-incidents-service sample from ESRI's Github loading my geodatabase file through its path and using some custom example layers as Facilities and Incidents. The code I used is in the attachment.

I tried to run the app and whenever I pressed the button to solve the ClosestFacilityTask I had an error with code 18. After checking the Platform Codes of the ArcGIS Runtime for Android this code was described as an 'Internal Error Exception' under the 'ArcGIS Runtime errors' category.

Thinking that this error might be due to a misconfiguration of my Network Dataset or possibly it wasn't really prepared to be used on the ArcGIS Runtime, I proceeded to search for an alternative Network Dataset geodatabase that could be used for testing. I found this one from ESRI (only the file with .geodatabase extension) and tried to test on my app. Unfortunately, I got exactly the same error with code 18.

I tried to figure out the reason for this error and for the failure of the ClosestFacilityTask but couldn't find one.

I will provide the code from the MainActivity Java class, as well as my geodatabase in hopes that someone could provide some valuable insight as to why I get this error.

Thank you very much for the support, It is strongly appreciated.

0 Kudos
1 Solution

Accepted Solutions
FrankKish
Esri Contributor

When creating a mobile geodatabase that has a network (from a FGDB) a "tn" folder which contains the transportation network data should be created also.

For example the one you mentioned from esri (san diego) you need to copy both the san-diego-network.geodatabase and the san-diego-network.tn folder to the device location.

So I suspect the same is true your data (forester.geodatabase) since the zip attached also did not have the "tn" folder.

Note, if you have ArcGIS Pro, and are working with 100.x of the ArcGIS Runtime you can also use the create-mobile-map-package to create an mmpk.

View solution in original post

8 Replies
Nicholas-Furness
Esri Regular Contributor

Hi,

Sorry - too late on a Friday and I plain missed your whole first paragraph. Frank's answer is correct.

Can you try to export the network dataset using the ArcGIS Runtime Content sharing tool in ArcMap? See Creating ArcGIS Runtime content—Help | Documentation for more details. You will need to enable the tool in ArcMap's options.

This session from a few years ago covers the ArcMap workflow (including a demo).

Another approach is to author an mobile map package in ArcGIS Pro and export the network dataset with a map in that package. Not sure if that's an option for you. This technical session covers more info about Pro.

Hope that helps.

Nick

FrankKish
Esri Contributor

When creating a mobile geodatabase that has a network (from a FGDB) a "tn" folder which contains the transportation network data should be created also.

For example the one you mentioned from esri (san diego) you need to copy both the san-diego-network.geodatabase and the san-diego-network.tn folder to the device location.

So I suspect the same is true your data (forester.geodatabase) since the zip attached also did not have the "tn" folder.

Note, if you have ArcGIS Pro, and are working with 100.x of the ArcGIS Runtime you can also use the create-mobile-map-package to create an mmpk.

MiguelLourenço
New Contributor II

Thank you very much, the issue was exactly that, I completely ignored that 'tn' folder.

The ClosestFacilityTask worked now despite some problems that I will try to figure out (reds are incidents, blues are facilities)

I will also try the mobile map package approach on ArcMap (I don't have ArcGIS Pro).

Once again thank you very much for your feedback!

0 Kudos
FrankKish
Esri Contributor

Just to note the mobile map package tool is only in Pro (not ArcMap).

MiguelLourenço
New Contributor II

Thank you!

0 Kudos
MiguelLourenço
New Contributor II

Hello everyone, I would like to revive this topic because of the problem I had following the execution of the ClosestFacilityTask.

The result I get on the mobile app is different from the ArcMap one, it seems like on the mobile app, not all possible routes are displayed for some reason. Does anyone have any idea why this may happen? I assume the problem in on the Network Dataset itself because I tried using the San Diego one and everything was working fine.

The code I used is presented above on the first message, as well as the settings chose on the ArcMap exporting screen for ArcGIS Runtime Content.

I will attach the Transportation Network that was generated.

Thank you in advance for all the help provided.

Android result:

ArcMap result:

0 Kudos
FrankKish
Esri Contributor

Hi,

I think perhaps the network data in the mobile geodatabase data got cutoff when it was created.  Below is what I see (with inc and fac from service on top) when I use the forester data that was attached (and drawing the roads)... some of the inc and facs are in areas with out a network features

Since it is a straight line at the bottom ... I suspect that in ArcMap when running the Create Runtime Content tool when it did the "Analyze" another window is result opened but that changed (reduced) the visible map extent, there by cutting off the bottom portion.  If that is the case just re-create the data but make sure when tool, after the analysis window open,you see all the data you want to include in the map view.

MiguelLourenço
New Contributor II

Thank you very much, sir! It was exactly the issue you mentioned.

I didn't know the map extent present when the Analyze window appeared would influence the exported files but it turned out it did. Everything on the app is working fine now, just like it's working on ArcMap.

Second time you were really accurate and straight to the point and provided valuable support, can't thank you enough!

Cheers!

0 Kudos