Update features for a ServiceFeatureTable

776
2
12-05-2017 07:19 PM
lin2Zhang
New Contributor

Env:
arcgis runtime SDK 10.2.7 .Net and arcgis server 10.3.

I have a feature service with point geometry. I want to update the attributes of the features based on object id of feature only, because the amount of records in the feature service is quite big, I pre-store all the the object id in local memory.

but it is not working until I must do the retrieval of the feature by ArcGISFeatureTable.QueryAsync the object id or zoom the map to the location of feature to make the map load the feature , the property RowCount of FeatureTable class will be updated when trace it, I look through the document, RowCount represents "the number of rows in the table".

e.g. example in https://developers.arcgis.com/net/10-2/sample-code/DynamicLayerEditAttribute/


var table = await ServiceFeatureTable.OpenAsync(new Uri(url), null, MyMapView.SpatialReference);
table.OutFields = new OutFields(new string[] { "has_pool" });


// Retrieves feature identified by ID and updates its attributes.
* var feature = await table.QueryAsync(featureID);
feature.Attributes["has_pool"] = selected.Key;
await table.UpdateAsync(feature);
if (table.HasEdits)
{

}

Q1: the features loaded in mapview by pan/zoom (e.g. with max count 1000/per time),the RowCount of feature table will be changed and increased(so that the features appeared on map can be updated directly with Objectid/featureid), so the feature data loaded are stored in local cache? can access directly? what is the format in it(data or image) if it is in local cache/memory. it will be very appreciated to provide info about it.

Q2:Why I must do "var feature = await table.QueryAsync(featureID)" to update the feature?

0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor

In the sample you referenced, the features were displayed initially as an image from server through dynamic layer and retrieved/downloaded to the table only once you identify/select it for editing. It is the query call that downloads a local copy of the feature and allows you to edit its attributes, geometry, and/or attachments. This workflow sounds like it should also work for your use case.

The local cache is a geodatabase with service metadata and requested features. It's content depends on the selected query mode, query and other filters like Where, OutFields, etc. You can access this using the table instance through query, create, add, update, delete methods. Is there a specific database operation or metadata you're not finding available in the API? The local geodatabase is just a temporary file that allows clients to choose which features to download from or edits to upload to server.

`QueryAsync(featureID)` is necessary because `UpdateFeature` requires a feature parameter and query will find the feature by id and load it for editing so you can do operations like update its geometry and attributes. It is not the only query available though, you may query by where clause or geometry.

0 Kudos
lin2Zhang
New Contributor

Thanks, Jennifer.

0 Kudos