0

I have C# and XAML code that I would like to use to add features to a feature layer that is in a file geodatabase. This is how the feature layer is defined in the XAML code:

<esriLocal:ArcGISLocalFeatureLayer ID="myLayerName" x:Name="myLayerName" Path="C:/Projects/MyMapPackage.mpk" LayerName="myLayerName" OutFields="*" 
DisableClientCaching="True" Editable="True" Visible="True"
AutoSave="False"  ValidateEdits="True" Opacity="0.50" />

This is how I am attempting to add the data to the feature layer in the C# code:

     var aLayer = _map.Layers["myLayerName"] as ArcGISLocalFeatureLayer;
 if (aLayer != null)
     aLayer.Graphics.AddRange(myGraphicCollection);
 aLayer.SaveEdits();

When I checked the unpacked location of the feature class, there are no features added, although the attributes and graphics are added to MyGraphicCollection, and show up there when I'm tracing through.

Am I doing something wrong in my code?

I am using ArcGIS Runtime.

0

2 Answers 2

0

I was proceeding from a wrong assumption. The edits do not get written to the file geodatabase or even to an unpacked location.
I was able to add a graphic collection to the ArcGISLocalFeatureLayer aLayer using: if (aLayer != null) aLayer.Graphics.AddRange(aGraphicCollection); Then when you execute aLayer.SaveEdits(); . . . you can access and use the new data from the object aLayer.

0

Try checking if the layer contains edits after the addition, using the result from aLayer.HasEdits().

You could also try to assign the map/layer to an EditorWidget and test if you can add features and save them manually.

1
  • Thanks for the comment. I have used the Editor Widget in the past successfully. Nov 21, 2014 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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