ArcPy RefreshCatalog() function for ArcGIS Pro

720
4
08-21-2023 01:49 AM
Status: Needs Clarification
Labels (1)
Clubdebambos
Occasional Contributor III

ArcPy for ArcMap has a RefreshCatalog() function as per Esri documentation.

Can this function be made available for ArcGIS Pro?

4 Comments
Michele_Hosking

Yes please. It's so dumb that we can't do this anymore.  I have a python script.  It grabs attributes from one layer and updates the attribute tables of a bunch of other layers.  I have this script in a geoprocessing tool and it runs as a task.  It all works but requires the user to go to List by Data Source, find the right data connection (we have data from an enterprise geodatabase version, a different enterprise geodatabase, portal services and image services - so heaps of data source connections) and then right click and choose Refresh.

We are using tasks because most of these people aren't GIS people.  GIS is a small part of their job and this palaver is confusing - even though we have attempted to explain how as part of the task.

The major problem with this when the next task is run it's looking for attributes that were updated in the previous task but since ArcPro refuses to acknowledge that these actually have been changed this next task doesn't work unless above palaver is executed. So frustrating.

With all I've read Pro is supposed to update itself when things change if the script is run from inside ArcPro. I'm not referencing the data directly in our enterprise geodatabase from the script, I'm finding and using the layers from the pro project itself and I thought that would allow pro to know something had changed and refresh itself but it doesn't.

I can't even put it in as a hidden task as I found suggested.... somewhere on the interweb.... this simply doesn't work. 

This is a major annoyance.  Please can we get this sorted soon?

HannesZiegler
Status changed to: Needs Clarification

Thank you for sharing your idea with us. At the ArcGIS Pro 3.3 release, we have added RefreshLayer—ArcGIS Pro | Documentation and PauseDrawing—ArcGIS Pro | Documentation. To be clear, these two methods do not refresh the contents of the Catalog Pane. 

@Clubdebambos @Michele_Hosking I want to clarify that you are asking specifically for a method to refresh the contents of the Catalog Pane rather than the Contents Pane/Map View/Layer.

Some background:

The Catalog Pane is not the same as the Contents Pane.

To clarify, arcpy.RefreshLayer will cause a layer in the map view (present in the Contents Pane) and its table to update if you have made changes to it. For example, you have a layer symbolized a certain way based on the values in a particular field, and you change some of those values with an arcpy.da.UpdateCursor. Calling arcpy.RefreshLayer(<layer name>) will update the layer displayed in the map view and table to reflect the new values.

arcpy.PauseDrawing will pause updating the map view. For example, you are repeatedly running a tool in Python Window or a Notebook in Pro that repeatedly produces an output and adds it to the Map View, causing a lot of rapidly succeeding refreshes of the map and slowing down the overall operation. Using arcpy.PauseDrawing will defer the refresh until after all the outputs have been produced.

Neither of these functions affect the contents of Catalog Pane. Is your request specifically regarding the Catalog Pane, or do the above methods provide what you are looking for?

Thank you!

Michele_Hosking

HI there Hannes,

I'll try arcpy.RefreshLayer in my script - maybe that will work.  And no - I'm not talking about the Catalog pane.

Maybe you have solved my issue! 

I'll let you know.

HannesZiegler

@Michele_Hosking Excellent! Yes please let us know what you find