We're migrating automated mapping scripts from ArcGIS Desktop to ArcGIS Pro — Python 2.7 to 3,
arcpy.mapping module to
arcpy.mp module. All these scripts iterate through a loop to select various features of interest, and then focus the dataframe extent on that selection. For example:
gas_main_layer = arcpy.mapping.ListLayers(mxd, "GasMain", data_frame) data_frame.extent = gas_main_layer.getSelectedExtent() # adjust scale slightly so view is larger than polygon extent data_frame.scale *= 1.2
I easily figured out how to transition
ListLayers to the new mapping module's workflow, but I can't find a comparable method on the Layer class to get the selected extent and then reset the zoom/extent of its Map. What is the way to get the same functionality out of the new module?