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?

Thanks!

  • 1
    ArcGIS Runtime? – KHibma Nov 6 '14 at 16:56
  • Yes, I'm using ArcGIS Runtime. – Renee Cammarere Nov 6 '14 at 18:16
0

Have you checked 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.

  • Thanks for the comment. I have used the Editor Widget in the past successfully. – Renee Cammarere Nov 21 '14 at 14:59
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.

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.