<?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 Re: Deleting the same Map Points in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234372#M9108</link>
    <description>&lt;P&gt;You have to describe your workflow in a bit more detail.&amp;nbsp; For example, where are your MapPoints?&amp;nbsp; In a graphic layer, in a feature layer, in memory?&amp;nbsp; You are talking about 'uploading coordinates', I am not clear what that means.&amp;nbsp; Do you have to check the 'dataset' to where you 'upload' your MapPoints for duplicates before you upload?&amp;nbsp; &amp;nbsp;If you have a feature class with MapPoints you suspect having duplicates you can use the 'Delete Identical (Data Management)' geoprocessing tool:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/delete-identical.htm" target="_blank"&gt;Delete Identical (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 00:21:14 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2022-11-23T00:21:14Z</dc:date>
    <item>
      <title>Deleting the same Map Points</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234071#M9104</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;how to remove duplicate MapPoints?Is there an easy way? or should I upload the coordinates of each MapPoint, then save and delete the same?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;BR /&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 13:28:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234071#M9104</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-11-22T13:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the same Map Points</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234372#M9108</link>
      <description>&lt;P&gt;You have to describe your workflow in a bit more detail.&amp;nbsp; For example, where are your MapPoints?&amp;nbsp; In a graphic layer, in a feature layer, in memory?&amp;nbsp; You are talking about 'uploading coordinates', I am not clear what that means.&amp;nbsp; Do you have to check the 'dataset' to where you 'upload' your MapPoints for duplicates before you upload?&amp;nbsp; &amp;nbsp;If you have a feature class with MapPoints you suspect having duplicates you can use the 'Delete Identical (Data Management)' geoprocessing tool:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/delete-identical.htm" target="_blank"&gt;Delete Identical (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 00:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234372#M9108</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-11-23T00:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the same Map Points</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234417#M9109</link>
      <description>&lt;P&gt;I had a Polyline layer which I converted to a PointCollection from which I created a Point layer.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 06:53:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1234417#M9109</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-11-23T06:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting the same Map Points</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1235587#M9114</link>
      <description>&lt;P&gt;I created sample code that copies all vertices from a line layer (TestLines) into a point layer (PointsNoDuplicates) and then deletes all duplicates (with the same shape) using the "management.DeleteIdentical" GP tool.&amp;nbsp; I used an addin with a button to test this code and a map&amp;nbsp; that contained the required layers.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async void OnClick()
{
  try
  {
    var lineLayerName = "TestLines";
    var noDupPointLayerName = "PointsNoDuplicates";

    FeatureLayer polyLine = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(layer =&amp;gt; layer.Name.Equals(lineLayerName)) as FeatureLayer;
    FeatureLayer pointsNoDuplicates = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault(layer =&amp;gt; layer.Name.Equals(noDupPointLayerName)) as FeatureLayer;

    var ok = await QueuedTask.Run&amp;lt;bool&amp;gt;(() =&amp;gt;
    {
      var createFeatures = new EditOperation();
      createFeatures.Name = "Add Points with duplicates";
      //Create a feature for each point        
      using (var fc = polyLine.Search())
      {
        while (fc.MoveNext())
        {
          using (var feature = fc.Current as Feature)
          {
            var multiPart = feature.GetShape() as Multipart;
            foreach (var point in multiPart.Points)
            {
              createFeatures.Create(pointsNoDuplicates, point);
            }
          }
        }
      }
      //Execute to execute the operation
      //Must be called within QueuedTask.Run
      var result = createFeatures.Execute();
      if (!result)
      {
        MessageBox.Show($@"Error creating points with duplicated: {createFeatures.ErrorMessage}");
      }
      return result;
    });
    if (!ok) return;

    await Project.Current.SaveEditsAsync();
    // Clear selection
    await QueuedTask.Run (() =&amp;gt; pointsNoDuplicates.ClearSelection());
    // arcpy.management.DeleteIdentical(noDupPointLayerName, "Shape", "0.1 Meters", 0.1)

    var paramsArray = Geoprocessing.MakeValueArray(noDupPointLayerName,
        "Shape", "0.1 Meters", 0.1);
    var delDupsDlg = new ProgressDialog("Delete Duplicates", "Cancel", 100, false);
    var progsrc=new CancelableProgressorSource(delDupsDlg);

    await Geoprocessing.ExecuteToolAsync("management.DeleteIdentical", paramsArray, null, progsrc.Progressor);
  }
  catch (Exception ex)
  {
    MessageBox.Show($@"{ex.Message}");
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that when i click my button repeatedly it will add the same points again (hence creating duplicates) which are then removed by the GP tool.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 20:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deleting-the-same-map-points/m-p/1235587#M9114</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-11-28T20:15:52Z</dc:date>
    </item>
  </channel>
</rss>

