Access and set the pitch, roll, and heading using arcpy

325
1
07-27-2023 07:46 AM
saldanax
New Contributor II

Hello! I am creating a script using arcpy that will automatically output 3D maps. Currently, a good portion of the maps are being output straight down. I would like to adjust the angle but I am having trouble accessing the properties. Here is a link that I tried using: https://pro.arcgis.com/en/pro-app/latest/help/mapping/navigation/camera-properties.htm

Thank you!

0 Kudos
1 Reply
by Anonymous User
Not applicable

You were in  the Help\Interact with maps and scenes section of the docs. For arcpy, use this one.

https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/camera-class.htm

import arcpy
aprx = arcpy.mp.ArcGISProject(r"CURRENT")

m = aprx.listMaps("Yose*")[0] # use the map name you want
lyt = aprx.listLayouts("Main Attr*")[0] list the layout name
mf = lyt.listElements("mapframe_element", "Yosemite National Park")[0] # get the frame to set the heading ptich and roll

mf.camera.roll = 4.0
mf.camera.pitch = -30.0
mf.camera.heading = 36.0

maybe need an aprx.save in there depending on your workflow.

0 Kudos