View in MAUI WPF WinUI View on GitHub Sample viewer app
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

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

will be created and added to the map.

How it works

  1. Create and run a local server with
    .
  2. Start the server asynchronously with
    .
  3. Create and run a local feature service.
    1. Instantiate
      to create a local feature service with the given url path to mpk file.
    2. Start the service asynchronously with
      . The service will be added to the local server automatically.
  4. Create an event handler for the
    event. This will run whenever the status of the local service has changed.
  5. When the service’s status has changed to
    , create a feature layer from local feature service.
    1. Create a
      using the URL for the feature layer.
    2. Create feature layer from service feature table using
      .
    3. Load the layer asynchronously using
      .
  6. Add feature layer to map using
    .

Relevant API

  • FeatureLayer
  • LocalFeatureService
  • LocalServer
  • LocalServerStatus
  • StatusChangedEvent

Offline data

This sample downloads the following items from ArcGIS Online automatically:

Additional information

ArcGIS Maps SDK for Local Server (Local Server) is deprecated and will be retired in 2030. For more information, see the deprecation announcement.

Tags

feature service, local, offline, server, service

Sample Code

LocalServerFeatureLayer.xaml LocalServerFeatureLayer.xaml LocalServerFeatureLayer.xaml.cs
<UserControl x:Class="ArcGIS.WPF.Samples.LocalServerFeatureLayer.LocalServerFeatureLayer"
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>