Update geometries (feature service)

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Update a feature's location in an online feature service.

Image of update geometries feature service

Use case

Sometimes users may want to edit features in an online feature service by moving them.

How to use the sample

Tap a feature to select it. Tap again to set the updated location for that feature. An alert will be shown confirming success or failure.

How it works

  1. Create a ServiceFeatureTable object from a URL.
  2. Create a FeatureLayer object from the ServiceFeatureTable.
  3. Select a feature from the feature layer, using FeatureLayer.SelectFeatures.
  4. Load the selected feature.
  5. Change the selected feature's location using Feature.Geometry = geometry.
  6. After the change, update the table on the server using ApplyEditsAsync.

Relevant API

  • Feature
  • FeatureLayer
  • ServiceFeatureTable

Tags

editing, feature layer, feature table, moving, service, updating

Sample Code

UpdateGeometries.xamlUpdateGeometries.xamlUpdateGeometries.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.UpdateGeometries.UpdateGeometries"
    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 a feature to select. Tap again to update its location."
                       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.