Select to view content in your preferred language

Opening Mobile Map Package Fails

1493
3
03-24-2017 03:09 PM
JoeHershman
MVP Regular Contributor

I am trying to open a Mobile Map Package.  When I do I get an error that the file does not exist even though it does.

if ( File.Exists(item.MapPackagePath) )
{
     Console.WriteLine(item.MapPackagePath);
     MobileMapPackage mapPackage = await MobileMapPackage.OpenAsync(item.MapPackagePath);

     RuntimeControls.Map = mapPackage.Maps[0];
}‍‍‍‍‍‍‍

The output from the Console.Writeline followed by the error:

D:\Mobile\Packages\Gas_Network.mpkx
System.IO.FileNotFoundException: File not found: D:\Mobile\Packages\Gas_Network.mpkx ---> Esri.ArcGISRuntime.ArcGISRuntimeException: File not found: D:\Mobile\Packages\Gas_Network.mpkx
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Esri.ArcGISRuntime.Mapping.MobileMapPackage.<OpenAsync>d__4.MoveNext()‍‍‍‍‍‍‍‍‍‍

Anyone know why it does not find a file that obviously exists?

Thanks,
-Joe
Tags (1)
0 Kudos
3 Replies
MaraStoica4
Regular Contributor

Looks like you're trying to open an mpkx, which is a map package. A mobile map package has an mmpk extension. You can create one by using the Create Mobile Map Package tool in Arcgis Pro. 

JoeHershman
MVP Regular Contributor

Thank you this was the issue.  I do wonder, is there some restriction on the size of a mobile package?  When i try to generate from a full service area the geoprocessing task has crashed, but doing a small area does succeed.  Also it is my understanding that if multiple maps reference the same feature class that only one copy of the data is added to the mobile map package, would you know if this correct?

Thanks,
-Joe
0 Kudos
MichaelBranscomb
Esri Frequent Contributor

...and we've entered an issue to try to provide a more helpful error message in this and similar scenarios (it's not that the file wasn't found, but rather it was the incorrect file type/extension).

Cheers

Mike

0 Kudos