Local Server map image layer

View inWPFWinUIView on GitHub

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 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.


image, layer, local, offline, server

Sample Code

Use dark colors for code blocksCopy
<UserControl x:Class="ArcGIS.WinUI.Samples.LocalServerMapImageLayer.LocalServerMapImageLayer"
        <esriUI:MapView x:Name="MyMapView" />

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