Select to view content in your preferred language

Ability to access the Popup Object in ArcPy (ArcGIS Pro)

2276
3
03-28-2021 07:36 PM
Status: Already Offered
LeandraGordon
Frequent Contributor

There is a need to be able to access and edit the Popup Object in ArcPy to:

1. Toggle the Popup on and off

2. Set expressions for the text

Some of this can be achieved via ApplySymbobologyFromLayer but the "showPopups" : false, setting does not seem to be honoured at the moment.

See also: https://community.esri.com/t5/python-questions/arcypy-custom-pop-ups/m-p/538954

Tags (2)
3 Comments
JeffBarrette

Leandra,

This can be done using Python CIM Access.  Here is the help topic that describes what that means:

https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm

This sample below assumes popups are already configured and it only toggles the visibility.  If they are not already configured and customized they can be with Python CIM Access as well but it takes more CIM work.  See Creating CIM objects in the document above.

If you can give me an example of "Set expressions for the text" I can try to provide a sample snippet.

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
l = m.listLayers('GreatLakes')[0]
l_cim = l.getDefinition('V2')
l_cim.showPopups = True
l.setDefinition(l_cim)

 

Jeff - Layout and arcpy.mp teams

KoryKramer
Status changed to: Already Offered
 
LeandraGordon

Works a Treat Jeff!!! Thankyou!!! 😀