Select to view content in your preferred language

Why i can't edit my featureClass using (.geodatabase) file

496
0
07-27-2017 08:59 AM
ManelKEDDAR
New Contributor III

hello i've generated (.geodatabase) and i ried to edit my featureClass by adding a new feature (polygon) using the following code : 

private async void startLocalDB()
{


var gdb = await Esri.ArcGISRuntime.Data.Geodatabase.OpenAsync(@"C:\Users\mkeddar\Documents\ArcGIS\geodblocal\poly\data\pocdb.geodatabase");
var table = gdb.GeodatabaseFeatureTables.ElementAt(0);
await table.LoadAsync();
MapPoint locationPoint = new MapPoint(-2.708471, 56.096575, 5000, SpatialReferences.Wgs84);
var pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84);
pointCollection.Add(-109.048, 40.998);
pointCollection.Add(-102.047, 40.998);
pointCollection.Add(-102.037, 36.989);
pointCollection.Add(-109.048, 36.998);

var poly = new Esri.ArcGISRuntime.Geometry.Polygon(pointCollection);
var attributes = new Dictionary<string, object>();
attributes.Add("polygon", poly);
if (table.LoadStatus == Esri.ArcGISRuntime.LoadStatus.Loaded)
{
// var lyr = new FeatureLayer(table);
MyMapView.Map = new Map();
// MyMapView.Map.OperationalLayers.Add(lyr);
var template = table.FeatureTemplates.FirstOrDefault() ?? table.FeatureTypes.FirstOrDefault(t => t.Templates.Any())?.Templates?.FirstOrDefault();
var feature = table.CreateFeature(attributes,locationPoint);

//var feature = table.CreateFeature(template);
await table.AddFeatureAsync(feature);

}

}

i don't know why this doesn't work and i have an exception telling me that the table doesn't support Create option , although i have a standard licence ArcMap 10.4  that i used to generate the mobile geodatabase i have the same problem when i work with (.mpk) file is it the problem with ArcGis runtime or with my ArcMap configuration ? i shared my .geodatabse file .thanks to help

cheers

0 Kudos
0 Replies