<?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: Refresh Map after modifying features with addin? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549622#M12191</link>
    <description>&lt;P&gt;You could check if exists unsaved manual edit and ask user to save them and try to start your tool/button again. We use that workflow in our applications.&lt;/P&gt;
&lt;P&gt;Call &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14518.html" target="_self"&gt;HasEdits&lt;/A&gt; method from Datastore.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2024 17:55:51 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2024-10-17T17:55:51Z</dc:date>
    <item>
      <title>Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1548787#M12173</link>
      <description>&lt;P&gt;I see that I'm not the first person who can't get map layers to refresh/redraw after feature geometries have been modified. I have an addin that updates the geometry and attributes of selected features. The attribute updates are immediately visible in the attribute table, but geometry updates are not, unless I save edits, and then close and re-open Pro.&lt;/P&gt;&lt;P&gt;I've tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapView.Active.Redraw(true)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;myFeatureLayer.SetDataConnection((CIMFeatureDatasetDataConnection)myFeatureLayer.GetDataConnection())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm using Pro 3.3, and myFeatureClass's data connection (Json) is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;{
  "type": "CIMFeatureDatasetDataConnection",
  "featureDataset": "GDB_HMSDev.HMSADMIN.KerrySandbox",
  "workspaceConnectionString": "ENCRYPTED_PASSWORD_UTF8=00022e684a474377616152656c6f7a763650316344487555664e68764d523255577766652b50366a714e7457374c343d2a00;ENCRYPTED_PASSWORD=00022e68385049416956586c766d4f566e64316f46466a4367764b4e443157626e374a494d4c624641786b466543343d2a00;SERVER=aotgis;INSTANCE=sde:sqlserver:aotgis;DBCLIENT=sqlserver;DB_CONNECTION_PROPERTIES=aotgis;DATABASE=GDB_HMSDev;USER=HMSADMIN;VERSION=sde.DEFAULT;AUTHENTICATION_MODE=DBMS",
  "workspaceFactory": "SDE",
  "dataset": "GDB_HMSDev.HMSADMIN.Nodes_1",
  "datasetType": "esriDTFeatureClass"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the Edit Operation code, and I can provide the rest of the addin code if necessary.&amp;nbsp; Any Suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Edit Operation
var updateDangleNodeAndLegShapes = new EditOperation() { Name = "Add Node and Legs" };

// Modify Node
nodeInspector["SHAPE"] = newNode;
nodeInspector["NodeClass"] = "testing_addin";

// Modify NodeLeg
var newLeg = SharedMethods.makeLeg(singlePolyline, startEnd);
var legInspector = new Inspector();
legInspector.Load(legsMapMember, selectedFeatures[legsMapMember].First()); // This works because only one nodeLeg is selected
legInspector["SHAPE"] = newLeg;

updateDangleNodeAndLegShapes.Modify(nodeInspector);
updateDangleNodeAndLegShapes.Modify(legInspector);

if (!updateDangleNodeAndLegShapes.IsEmpty)
{
    var result = updateDangleNodeAndLegShapes.Execute(); //Execute will return true if the operation was successful and false if not.
    if (result)
    {
        MapView.Active.Redraw(true); // doesn't refresh
        nodesMapMember.SetDataConnection((CIMFeatureDatasetDataConnection)nodesMapMember.GetDataConnection());  // doesn't refresh
        legsMapMember.SetDataConnection((CIMFeatureDatasetDataConnection)legsMapMember.GetDataConnection());  // doesn't refresh
        MessageBox.Show(string.Format("Features modified"));
    }
    else
    {
        MessageBox.Show("Feature not created. Error: {0}", updateDangleNodeAndLegShapes.ErrorMessage);
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In case this makes a difference: My workflow for using the addin is to edit a feature in one feature layer manually using the EditVertices tool, and then I select features from two other feature layers, and execute my addin button to edit those selected features.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for any insight! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 18:35:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1548787#M12173</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-10-15T18:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1548901#M12178</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Working with Inspector and EditOperation has some limitations.&lt;/P&gt;
&lt;P&gt;All features loaded into the inspector must be from the same feature layer. Only feature values that are modified in the inspector are applied to the loaded feature(s). If tables are joined to the feature layer then the joined attributes are loaded also.&lt;/P&gt;
&lt;P&gt;You can't use Modify and Inspector in cycle. Only last Modify will be executed. Your workflow must be like this: Load, Modify, Execute, Load, Modify, Execute... If you want to have possibility undo in one operation, you need to use CreateChainedOperation. I would recommend do not use inspector in your case. There are plenty of overloads of &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9529.html" target="_self"&gt;Modify&lt;/A&gt; methods which you could use for your workflow without inspector and execute all modifications at once.&lt;/P&gt;
&lt;P&gt;More info about Editing &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 06:11:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1548901#M12178</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-10-16T06:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549284#M12182</link>
      <description>&lt;P&gt;Thanks for your quick response!&lt;/P&gt;&lt;P&gt;I have different inspectors (nodeInspector and legInspector) for the two features from different feature layers that I'm modifying. Is that possible as long as I'm not re-using the inspectors and if the changes in the two inspectors are independent of each other?&lt;/P&gt;&lt;P&gt;Regarding your inspector comments, I can switch to using attribute dictionaries instead of inspectors, i.e. use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;updateDangleNodeAndLeg.Modify(nodesMapMember, nodeoid, nodeDict); //or use row instead of nodesMapMember&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;updateDangleNodeAndLeg.Modify(nodeInspector);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But is there an easy way to&amp;nbsp;create an attribute dictionary from a row or a feature instead of from an inspector? I'm currently using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var nodeDict = nodeInspector.ToDictionary(a =&amp;gt; a.FieldName, a =&amp;gt; a.CurrentValue);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(and I'm too embarrassed to say how long it took me to find *that* solution!)&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Oh, and how do I get rid of all the blank lines from these posts? If I delete the following lines from the html manually, it adds even more!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help!!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 21:50:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549284#M12182</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-10-16T21:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549360#M12184</link>
      <description>&lt;P&gt;You don't need to copy all feature/row values to dictionary. You need fill dictionary with field values, you want to change, only. All other original field values will not be modified.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;            // Modify Node
            updateDangleNodeAndLegShapes.Modify(nodesMapMember, selectedFeatures[nodesMapMember].First(),
                new Dictionary&amp;lt;string, object&amp;gt;() { { "SHAPE", newNode }, { "NodeClass", "testing_addin" } });

            // Modify NodeLeg
            updateDangleNodeAndLegShapes.Modify(legsMapMember as Layer, selectedFeatures[legsMapMember].First(), newLeg);
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 05:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549360#M12184</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-10-17T05:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549511#M12186</link>
      <description>&lt;P&gt;&lt;SPAN&gt;(Edit note: This question is now moot... see the following post)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I updated my addin so that it no longer modifies features using inspectors, but I still have the issue of the map not refreshing (otherwise the edits still seem to complete successfully).&lt;/P&gt;&lt;P&gt;Does this mean that my assumption that I don't need to chain edits is incorrect? My assumption is based on the following (from my previous post above):&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;I have different inspectors (nodeInspector and legInspector) for the two features from different feature layers that I'm modifying. Is that possible as long as I'm not re-using the inspectors and if the changes in the two inspectors are independent of each other?&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 16:23:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549511#M12186</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-10-17T16:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549596#M12188</link>
      <description>&lt;P&gt;I thought I had already tested this, but...&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original code actually seems to work fine with or without inspectors. As far as I can tell, the problem was that I was executing the addin while there were unsaved manual edits (in the same SDE workspace). The unsaved feature was referenced in (but not modified by) the addin. Is there any way around having to save manual edits before executing an editing addin? Would I have to switch to using classic edit sessions in Pro?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 16:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549596#M12188</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-10-17T16:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549622#M12191</link>
      <description>&lt;P&gt;You could check if exists unsaved manual edit and ask user to save them and try to start your tool/button again. We use that workflow in our applications.&lt;/P&gt;
&lt;P&gt;Call &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14518.html" target="_self"&gt;HasEdits&lt;/A&gt; method from Datastore.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 17:55:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1549622#M12191</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-10-17T17:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Map after modifying features with addin?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1556283#M12264</link>
      <description>&lt;P&gt;Pro patch 3.3.2 fixed a lot of the weird map rendering issues mentioned above... I no longer have to save edits both before and after running one of my add-ins to avoid these issues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 14:40:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/refresh-map-after-modifying-features-with-addin/m-p/1556283#M12264</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-11-07T14:40:23Z</dc:date>
    </item>
  </channel>
</rss>

