Local Server map image layer

View inWPFWinUIView on GitHubSample viewer app

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.

Image of local server map image layer

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

  1. Create and run a local server with LocalServer.Instance.
  2. Start the server asynchronously with server.StartAsync().
  3. Create and run a local service, example of running a LocalMapService.
    1. Instantiate LocalMapService(Url) to create a local map service with the given URL path to the map package (mpkx file).
    2. Start the service asynchronously with LocalMapService.StartAsync(). The service is added to the Local Server automatically.
  4. Create an ArcGIS map image layer from local map service.
    1. Create a ArcGISMapImageLayer(Url) from local map service url provided by the LocalMapService.Url property.
    2. Add the layer to the map's operational layers.
    3. Wait for the layer to load with await myImageLayer.LoadAsync()
    4. Set the map view's extent to the layer's full extent.

Relevant API

  • ArcGISMapImageLayer
  • LocalMapService
  • LocalServer
  • LocalServerStatus

Offline data

This sample downloads the following items from ArcGIS Online automatically:

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

LocalServerMapImageLayer.xamlLocalServerMapImageLayer.xamlLocalServerMapImageLayer.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
<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>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.