AnsweredAssumed Answered

Is there a way to allow a FeatureCollectionTable to update the geometry of existing features?

Question asked by danielcharles on Jan 29, 2018
Latest reply on Feb 1, 2018 by MBranscomb-esristaff

I am using the ArcGIS Runtime SDK for .NET version 100.2. I am new to the SDK in particular and GIS in general. My goal is to take data from a locally available database with associated lat/long and show it on a map. When the database is updated with a new location, I get a push notification and I would like to update that feature on the map.

 

This is a (contrived) example of what I would like to do.

 

private async Task<Map> BuildAnUpdateableMap()
{
    var map = new Map(Basemap.CreateTopographic());
    var fields = new[] { new Field(FieldType.Text, "foo", "bar", 10) };
    var table = new FeatureCollectionTable(fields, GeometryType.Point, SpatialReferences.Wgs84);
    var collection = new FeatureCollection(new[] { table });
    var layer = new FeatureCollectionLayer(collection);
    var feature = table.CreateFeature();
    feature.SetAttributeValue(fields[0], "baz");
    feature.Geometry = new MapPoint(-119, 36);

    // Add the feature to the table. This works fine.
    await table.AddFeatureAsync(feature);
    map.OperationalLayers.Add(layer);

    // Update feature geometry.
    feature.Geometry = new MapPoint(-119, 30);
    // Push the updated feature. This throws an exception.
    await table.UpdateFeatureAsync(feature);

    return map;
}

 

The initial feature and geometry shows up just fine but when trying to update the geometry, an exception is thrown:

 

Esri.ArcGISRuntime.ArcGISRuntimeException: 'Ownership-based access control does not permit this operation on this feature.: allowGeometryUpdates=false'

 

I can accomplish the update by first removing the feature from the table and then adding it again after updating the geometry but that results in an unsightly flicker (in the WPF control at least) and I expect that wouldn't scale well either.

Is there a way to update feature geometry with `FeatureCollectionTable`? Or do I need to use something different?

Outcomes