Add features

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Add features to a feature layer.

Image of adding features

Use case

An end-user performing a survey may want to add features to the map during the course of their work.

How to use the sample

Click on a location on the map to add a feature at that location.

How it works

A Feature instance is added to a ServiceFeatureTable which then pushes that new feature to the server.

  1. Create a ServiceFeatureTable from a URL.
  2. Create a FeatureLayer derived from the ServiceFeatureTable instance.
  3. Create a Feature with attributes and a location using the ServiceFeatureTable.
  4. Add the Feature to the ServiceFeatureTable.
  5. Apply edits to the ServiceFeatureTable which will upload the new feature to the online service.

Relevant API

  • Feature
  • FeatureEditResult
  • FeatureLayer
  • ServiceFeatureTable

Tags

edit, feature, online service

Sample Code

AddFeatures.xamlAddFeatures.xamlAddFeatures.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.AddFeatures.AddFeatures"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <TextBlock Text="Tap to add features."
                       TextAlignment="Center"
                       FontWeight="SemiBold" />
        </Border>
    </Grid>
</UserControl>

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