<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic add a feature to my feature class in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523230#M6412</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello every one ,&lt;/P&gt;&lt;P&gt;I'm trying to add a 2D feature (polygon) to my feature layer using ServiceFeatureTable &amp;nbsp;so i tried to &amp;nbsp;let the user to click the map&amp;nbsp;&lt;SPAN style="color: #4c4c4c;"&gt;&amp;nbsp; to specify a new feature's location by listening to a click event on your map view, which in turn will call a function for adding a new feature. but my method doesn't seems good enough to work here's my code&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;&amp;nbsp; public MainWindow()&lt;BR /&gt; {&lt;BR /&gt; InitializeComponent();&lt;BR /&gt; MyMapView.Map = new Map(Basemap.CreateTopographic());&lt;BR /&gt; MyMapView.GeoViewTapped += MymapView_GeoViewTapped;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;private async void MymapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.UI.Controls.GeoViewInputEventArgs e)&lt;BR /&gt; {&lt;BR /&gt; //get the click point in geographic coordinates&lt;BR /&gt; var mapClickPoint = e.Location;&lt;BR /&gt; var pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84);&lt;BR /&gt; pointCollection.Add(-109.048, 40.998);&lt;BR /&gt; pointCollection.Add(-102.047, 40.998);&lt;BR /&gt; pointCollection.Add(-102.037, 36.989);&lt;BR /&gt; pointCollection.Add(-109.048, 36.998);&lt;/P&gt;&lt;P&gt;//create a new polygon from the point collection&lt;/P&gt;&lt;P&gt;var polygon = new Esri.ArcGISRuntime.Geometry.Polygon(pointCollection);&lt;/P&gt;&lt;P&gt;var mapService = new LocalFeatureService(@"C:\Users\lolo\Documents\ArcGIS\3Dservitude.mpk");&lt;BR /&gt; await mapService.StartAsync();&lt;BR /&gt; var featureTable2DUri = new System.Uri($"{mapService.Url}/1");&lt;BR /&gt; var featureTable = new ServiceFeatureTable(featureTable2DUri);&lt;BR /&gt; await featureTable.LoadAsync();&lt;BR /&gt; //call the function that will add the new feature at this location &lt;BR /&gt; AddNewFeature(featureTable, mapClickPoint, 2018, polygon, 7000, 70000);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; private async void AddNewFeature( ServiceFeatureTable featureTable,MapPoint location ,int servitude , Esri.ArcGISRuntime.Geometry.Polygon poly,int area , int lenght)&lt;BR /&gt; {&lt;BR /&gt; &lt;BR /&gt; var attributes = new Dictionary&amp;lt;string, object&amp;gt;();&lt;BR /&gt; attributes.Add("servitude", servitude);&lt;BR /&gt; attributes.Add("polygone", poly);&lt;BR /&gt; attributes.Add("area", area);&lt;BR /&gt; attributes.Add("lenght", lenght);&lt;BR /&gt; &lt;BR /&gt; //create a new feature in the GEOM2DServitudeGabarit table , pass in the attributes and geometry&lt;/P&gt;&lt;P&gt;var template = featureTable.FeatureTemplates.FirstOrDefault() ?? featureTable.FeatureTypes.FirstOrDefault(t =&amp;gt; t.Templates.Any())?.Templates?.FirstOrDefault();&lt;BR /&gt; var newFeature = featureTable.CreateFeature(attributes, location);&lt;BR /&gt; await featureTable.AddFeatureAsync(newFeature);&lt;BR /&gt; var layer = new FeatureLayer(featureTable);&lt;BR /&gt; &lt;BR /&gt; //push this update (apply edit) to the feature service&lt;BR /&gt; IReadOnlyList&amp;lt;EditResult&amp;gt; editResults = await featureTable.ApplyEditsAsync();&lt;BR /&gt; // check the results for errors&lt;BR /&gt; foreach (var r in editResults)&lt;BR /&gt; {&lt;BR /&gt; if (r.CompletedWithErrors)&lt;BR /&gt; {&lt;BR /&gt; Console.WriteLine("Edit to Object '" + r.ObjectId + "' failed: " + r.Error.Message);&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;i have a problem with (var newFeature = featureTable.CreateFeature(attributes, location);) looks doesn't support it although i have the right type parameters .and my code doesn't do any thing i join my mpk file .Any one can help please&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;thanks in advanced&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Jul 2017 15:01:22 GMT</pubDate>
    <dc:creator>ManelKEDDAR</dc:creator>
    <dc:date>2017-07-20T15:01:22Z</dc:date>
    <item>
      <title>add a feature to my feature class</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523230#M6412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello every one ,&lt;/P&gt;&lt;P&gt;I'm trying to add a 2D feature (polygon) to my feature layer using ServiceFeatureTable &amp;nbsp;so i tried to &amp;nbsp;let the user to click the map&amp;nbsp;&lt;SPAN style="color: #4c4c4c;"&gt;&amp;nbsp; to specify a new feature's location by listening to a click event on your map view, which in turn will call a function for adding a new feature. but my method doesn't seems good enough to work here's my code&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;&amp;nbsp; public MainWindow()&lt;BR /&gt; {&lt;BR /&gt; InitializeComponent();&lt;BR /&gt; MyMapView.Map = new Map(Basemap.CreateTopographic());&lt;BR /&gt; MyMapView.GeoViewTapped += MymapView_GeoViewTapped;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;private async void MymapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.UI.Controls.GeoViewInputEventArgs e)&lt;BR /&gt; {&lt;BR /&gt; //get the click point in geographic coordinates&lt;BR /&gt; var mapClickPoint = e.Location;&lt;BR /&gt; var pointCollection = new Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84);&lt;BR /&gt; pointCollection.Add(-109.048, 40.998);&lt;BR /&gt; pointCollection.Add(-102.047, 40.998);&lt;BR /&gt; pointCollection.Add(-102.037, 36.989);&lt;BR /&gt; pointCollection.Add(-109.048, 36.998);&lt;/P&gt;&lt;P&gt;//create a new polygon from the point collection&lt;/P&gt;&lt;P&gt;var polygon = new Esri.ArcGISRuntime.Geometry.Polygon(pointCollection);&lt;/P&gt;&lt;P&gt;var mapService = new LocalFeatureService(@"C:\Users\lolo\Documents\ArcGIS\3Dservitude.mpk");&lt;BR /&gt; await mapService.StartAsync();&lt;BR /&gt; var featureTable2DUri = new System.Uri($"{mapService.Url}/1");&lt;BR /&gt; var featureTable = new ServiceFeatureTable(featureTable2DUri);&lt;BR /&gt; await featureTable.LoadAsync();&lt;BR /&gt; //call the function that will add the new feature at this location &lt;BR /&gt; AddNewFeature(featureTable, mapClickPoint, 2018, polygon, 7000, 70000);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; private async void AddNewFeature( ServiceFeatureTable featureTable,MapPoint location ,int servitude , Esri.ArcGISRuntime.Geometry.Polygon poly,int area , int lenght)&lt;BR /&gt; {&lt;BR /&gt; &lt;BR /&gt; var attributes = new Dictionary&amp;lt;string, object&amp;gt;();&lt;BR /&gt; attributes.Add("servitude", servitude);&lt;BR /&gt; attributes.Add("polygone", poly);&lt;BR /&gt; attributes.Add("area", area);&lt;BR /&gt; attributes.Add("lenght", lenght);&lt;BR /&gt; &lt;BR /&gt; //create a new feature in the GEOM2DServitudeGabarit table , pass in the attributes and geometry&lt;/P&gt;&lt;P&gt;var template = featureTable.FeatureTemplates.FirstOrDefault() ?? featureTable.FeatureTypes.FirstOrDefault(t =&amp;gt; t.Templates.Any())?.Templates?.FirstOrDefault();&lt;BR /&gt; var newFeature = featureTable.CreateFeature(attributes, location);&lt;BR /&gt; await featureTable.AddFeatureAsync(newFeature);&lt;BR /&gt; var layer = new FeatureLayer(featureTable);&lt;BR /&gt; &lt;BR /&gt; //push this update (apply edit) to the feature service&lt;BR /&gt; IReadOnlyList&amp;lt;EditResult&amp;gt; editResults = await featureTable.ApplyEditsAsync();&lt;BR /&gt; // check the results for errors&lt;BR /&gt; foreach (var r in editResults)&lt;BR /&gt; {&lt;BR /&gt; if (r.CompletedWithErrors)&lt;BR /&gt; {&lt;BR /&gt; Console.WriteLine("Edit to Object '" + r.ObjectId + "' failed: " + r.Error.Message);&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;i have a problem with (var newFeature = featureTable.CreateFeature(attributes, location);) looks doesn't support it although i have the right type parameters .and my code doesn't do any thing i join my mpk file .Any one can help please&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;thanks in advanced&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jul 2017 15:01:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523230#M6412</guid>
      <dc:creator>ManelKEDDAR</dc:creator>
      <dc:date>2017-07-20T15:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: add a feature to my feature class</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523231#M6413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think &lt;STRONG&gt;LocalFeatureService&lt;/STRONG&gt; yet has the capability of&amp;nbsp;editing the feature from mpk. If you capture the url of the local feature service, only supported operation is the "&lt;STRONG&gt;Query&lt;/STRONG&gt;". So it doesn't have the editing capabilities.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nagma&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;IMG __jive_id="363742" alt="LocalFeatureService" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/363742_SupportedOperation_LocalFeatureService.PNG" style="width: 620px; height: 336px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jul 2017 05:34:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523231#M6413</guid>
      <dc:creator>NagmaYasmin</dc:creator>
      <dc:date>2017-07-21T05:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: add a feature to my feature class</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523232#M6414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Yasmin;&lt;/P&gt;&lt;P&gt;Thanks for your answer , i realy need to add feature to my featureLayers using serviceFeatureTables (from .mpk file)&amp;nbsp;, and i don't know why ArcMap guives me only the query support when i generate .MPK ?help please&lt;/P&gt;&lt;P&gt;Thanks in advanced&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jul 2017 09:10:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523232#M6414</guid>
      <dc:creator>ManelKEDDAR</dc:creator>
      <dc:date>2017-07-21T09:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: add a feature to my feature class</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523233#M6415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Yasmin ,&lt;/P&gt;&lt;P&gt;Okay now i understand , it's because of my basic licence of ArcMap &amp;nbsp;that i use to generate my .mpk &amp;nbsp;do you think that if i change the licence to standard will give me the ability to edit the features ? thanks in advance&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jul 2017 13:09:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523233#M6415</guid>
      <dc:creator>ManelKEDDAR</dc:creator>
      <dc:date>2017-07-26T13:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: add a feature to my feature class</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523234#M6416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;i want to know with what i can replace &amp;nbsp;(.mpk) to access to my geodatabase and edit features , knowing that i don't have arcGis pro so i can't use (.mmpk)&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jul 2017 13:59:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/add-a-feature-to-my-feature-class/m-p/523234#M6416</guid>
      <dc:creator>ManelKEDDAR</dc:creator>
      <dc:date>2017-07-27T13:59:49Z</dc:date>
    </item>
  </channel>
</rss>

