I'm digging through examples on how to load a local mpk into my .net map and I don't see how to do this. There are old references to ArcGISLocalDynamicMapServiceLayer but that isn't available now. The mpk was constructed in ArcMap 10.2 and the layers exist within a GeoDatabase. I am using 10.2.5 build of .Net as well.
If someone can point me in the right direction I would appreciate it.
Thanks,
Jim
Solved! Go to Solution.
Hi Jim,
Here is the way to add mpk layer to the map, you just need to use ArcGISDynamicMapServiceLayer and the ServiceUri will be a LocalMapService.UrlMapService
LocalMapService localMapService = new LocalMapService("mpk file path");
await localMapService.StartAsync();
ArcGISDynamicMapServiceLayer arcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer()
{
ID = "arcGISDynamicMapServiceLayer",
ServiceUri = localMapService.UrlMapService,
};
MyMapView.Map.Layers.Add(arcGISDynamicMapServiceLayer);
And there is a sample for that on GitHub. ArcGIS .NET Samples, in Desktop Samples > Layers > Dynamic Service Layer > ArcGIS Local Dynamic Service Layer Sample
Thanks,
Asser
Hi Jim,
Here is the way to add mpk layer to the map, you just need to use ArcGISDynamicMapServiceLayer and the ServiceUri will be a LocalMapService.UrlMapService
LocalMapService localMapService = new LocalMapService("mpk file path");
await localMapService.StartAsync();
ArcGISDynamicMapServiceLayer arcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer()
{
ID = "arcGISDynamicMapServiceLayer",
ServiceUri = localMapService.UrlMapService,
};
MyMapView.Map.Layers.Add(arcGISDynamicMapServiceLayer);
And there is a sample for that on GitHub. ArcGIS .NET Samples, in Desktop Samples > Layers > Dynamic Service Layer > ArcGIS Local Dynamic Service Layer Sample
Thanks,
Asser
When I run that code example I get this error:
It fails on the StartAsync call. Thoughts?
Hi,
That is not an error - it is just the license protection warning. When the time comes to deploy your app, you will need to licensed your application at the Standard level (either by having an Organizational user sign in or by setting a Standard license code) and that message will no longer be displayed.
For more information see License your app—ArcGIS Runtime SDK for .NET | ArcGIS for Developers
Cheers
Mike
I think Jim was talking about the "StartAsync" call (not the pop-up window). I think you need to start a local server to run this correct? And you need the standard level license to run a local server.
Joe