Start the Local Server and Local Map Service, create an ArcGIS Map Image Layer from the Local Map Service, and add it to a map.
Use case
For executing offline geoprocessing tasks in your ArcGIS Runtime apps via an offline (local) server.
How to use the sample
The Local Server and local map service will automatically be started and, once running, a map image layer will be created and added to the map.
How it works
- Create and run a local server with
LocalServer.Instance
. - Start the server asynchronously with
server.StartAsync()
. - Create and run a local service, example of running a
LocalMapService
.- Instantiate
LocalMapService(Url)
to create a local map service with the given URL path to the map package (mpkx
file). - Start the service asynchronously with
LocalMapService.StartAsync()
. The service is added to the Local Server automatically.
- Instantiate
- Create an ArcGIS map image layer from local map service.
- Create a
ArcGISMapImageLayer(Url)
from local map service url provided by theLocalMapService.Url
property. - Add the layer to the map's operational layers.
- Wait for the layer to load with
await myImageLayer.LoadAsync()
- Set the map view's extent to the layer's full extent.
- Create a
Relevant API
- ArcGISMapImageLayer
- LocalMapService
- LocalServer
- LocalServerStatus
Offline data
This sample downloads the following items from ArcGIS Online automatically:
- RelationshipID.mpkx - This map package is included in the ArcGIS Runtime sample data.
Additional information
Local Server can be downloaded for Windows and Linux platforms from the developers website. Local Server is not supported on macOS.
Tags
image, layer, local, offline, server
Sample Code
<UserControl x:Class="ArcGISRuntime.WPF.Samples.LocalServerMapImageLayer.LocalServerMapImageLayer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" />
</Grid>
</UserControl>