2

Environment:

  • ArcGIS Runtime for .NET 10.2.7
  • ArcGIS Server 10.3.1
  • Map Service with Feature Access enabled (Create, Read, Update)
  • Postgres database underneath

    ServiceFeatureTable reportLayer = await ServiceFeatureTable.OpenAsync(new Uri("http://localhost/arcgis/rest/services/MyMapService/FeatureServer/4"));
    var testFeature = reportLayer.CreateNew(); //new GeodatabaseFeature(reportLayer.Schema);
    testFeature.Attributes["a_commodity_group"] = "fake";
    
    var addedReportOIDs = await reportLayer.AddAsync(testFeature);
    var editResult = await reportLayer.ApplyEditsAsync();
    

I've done the CreateNew() as well as creating a new GeodatabaseFeature as described in the documents here:

https://developers.arcgis.com/net/desktop/guide/edit-features.htm#ESRI_SECTION1_2A4C0222216A448C9CBAFCD0F75A21F6

I've tried Adding and Updating features. The "a_commodity_group" attribute is exactly how I see it spelled in the rest endpoint and is a Text/varchar field in the database underneath

I'm seeing none of my attributes come through. (example, the "fake" value that I've put in here)

ArcGIS Server Log (at "Info" level)

FINE Mar 28, 2016, 8:59:46 PM GraphicFeatureServer::HandleRESTRequest

inputJSON = {"rollbackOnFailure":true,"adds":[{"attributes":{"objectid":-10}}]}

Inspecting client traffic from Telerik's Fiddler:

As you can see, the request is totally wrong in that it doesn't have any other attributes going in. enter image description here

Manually adding features through "ApplyEdits" in the REST endpoint worked. enter image description here

Info from ArcGIS Server logs (the attributes come in correctly here):

GraphicFeatureServer::HandleRESTRequest ## inputJSON = {"adds":[{"attributes":{"objectid":405,"a_commodity_group":"fake"}}],"rollbackOnFailure":true}

I don't see any known issues with this in the ArcGIS Runtime. I'm considering writing my own REST api as the workaround right now since I can't get this to work.

It's quite possible that I'm making a totally wrong assumption in how I'm using the API, but I haven't seen many examples for adding features to a connected service. I'll double check the full .net runtime sdk pdf document and see if I'm doing anything wrong, too.

Update: I also noticed that DeleteAsync doesn't work unless I layer.QueryAsync the features first. Probably has something to do with some local cache in the ServiceFeatureTable layer object. Before I was querying objectids using the ExecuteObjectIdsQueryAsync() method on a QueryTask object.

  • I'll probably open a dev support ticket in the next few days and have something useful to share in the next week or so. – C. Tewalt Mar 29 '16 at 14:54
2

I had this same problem adding features, the geometry went in but no attributes. I fixed it for my code by adding the OutFields to the ServiceFeatureTable in the xaml file:

        <esri:ServiceFeatureTable 
                 ServiceUri="http://..."  OutFields="USER_NAME,EXTRACTION_ID"/>
        </esri:FeatureLayer.FeatureTable>

Works fine now. I guess the example at https://developers.arcgis.com/net/desktop/guide/edit-features.htm#ESRI_SECTION1_2A4C0222216A448C9CBAFCD0F75A21F6 doesn't show the xaml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.