Local server feature layer

View on GitHub
Sample viewer app

Start a local feature service and display its features in a map.

Image of local server feature layer

Use case

For executing offline geoprocessing tasks in your applicationss via an offline (local) server.

How to use the sample

A Local Server and Local Feature Service will automatically be started. Once started then a FeatureLayer 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 feature service.
    1. Instantiate LocalFeatureService(Url) to create a local feature service with the given url path to mpk file.
    2. Start the service asynchronously with LocalFeatureService.StartAsync(). The service will be added to the local server automatically.
  4. Create an event handler for the LocalFeatureService.StatusChanged event. This will run whenever the status of the local service has changed.
  5. When the service's status has changed to Started, create a feature layer from local feature service.
    1. Create a ServiceFeatureTable(Url) using the URL for the feature layer.
    2. Create feature layer from service feature table using new FeatureLayer(ServiceFeatureTable).
    3. Load the layer asynchronously using FeatureLayer.LoadAsync().
  6. Add feature layer to map using Map.OperationalLayers.Add(FeatureLayer).

Relevant API

  • FeatureLayer
  • LocalFeatureService
  • LocalServer
  • LocalServerStatus
  • StatusChangedEvent

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.


feature service, local, offline, server, service

Sample Code

Use dark colors for code blocksCopy
<UserControl x:Class="ArcGIS.WPF.Samples.LocalServerFeatureLayer.LocalServerFeatureLayer"
        <esri: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.