How to refresh a layer after adding a new feature on ArcGIS Pro add-in

352
5
Jump to solution
4 weeks ago
Labels (3)
DENGD
by
New Contributor II

I have an ArcGIS pro (3.2.2) add in. I need to refresh the layer or the map after added a new feature. I know that I can set to refresh it by intervals on the layer property.  But that will keeping refresh all layers on the map by the interval. The reason that I need to refresh the layer is because the layer has a field with a trigger to populate the data. The data source is 19c SDE database. I have to save the edit and refresh the layer to get the trigger on. I need that data from that field for some following process. I searched the ArcGIS Pro APIs but did not find a refresh working to set off the trigger (i.e. LayoutView.Active.Layout.RefreshMapSeries(); but LayoutView was null) Any suggestions? Thank you!!

0 Kudos
1 Solution

Accepted Solutions
RobertCao
Esri Contributor

Thanks for the clarification. You might want take take a look of Redraw Method. Not sure if this is exactly what you are looking for (refresh one particular layer) in this case, but hopefully this will help. 

 

Thanks,

Rob

View solution in original post

5 Replies
RobertCao
Esri Contributor

Hi @DENGD ,

 

There are a few ways of refreshing contents/data/connection in ArcGIS Pro. I think this document might cover what you are looking for. 

 

Thanks,

Rob

0 Kudos
DENGD
by
New Contributor II

Thank you for the document. I meant that how to do in C# code to refresh the layer after added a new feature.

0 Kudos
RobertCao
Esri Contributor

Thanks for the clarification. You might want take take a look of Redraw Method. Not sure if this is exactly what you are looking for (refresh one particular layer) in this case, but hopefully this will help. 

 

Thanks,

Rob

DENGD
by
New Contributor II

Thank you so much for the Redraw Method that works perfectly for me. @RobertCao 

anonymous_geographer
Occasional Contributor

Thanks, @RobertCao. This is an okay band-aid option for now, but I'd prefer to refresh a feature layer and its attributes individually instead of bogging down the map session while all feature layers get refreshed unnecessarily. Would you or anyone else on your side happen to know of a way to refresh individual feature layers?

I got some odd suggestions from ChatGPT on this. Most of the options are invalid (e.g. featureLayer.Refresh() is not possible, even if ChatGPT thinks so...what a tease...). I thought maybe featureLayer.ClearDisplayCache() might work since it discusses the refreshing of the display, but it did not work as I needed. I'll put a pin in this and see if you have any other suggestions.

0 Kudos