ArcGIS Pro 1.2
2D Map
If tried this code:
print(mf.camera.scale)
>> 125000.0
mf = myMapframe
mf.camera.type = "MAP"
mf.camera.setExtent(extent)
mf.camera.scale = 500000.0
print(mf.camera.scale)
>> 125000.0
so, nothing happend
Any ideas?
Thanks Tom
Solved! Go to Solution.
Problem is solved. Setting the viewing options in the mapframe properties to "none" enables the python code to run properly.
ArcMap? Pro? CityEngine? something else?
Looking at the Camera documentation for scale:
scale (Read and Write) | Provides the ability to either get or set the scale of the data in a map frame. A numerical (double) value must be used. Scales really only apply only to 2D map types because of their planimetric view of the data. Scales can be returned from 3D maps types but are only an estimation. | Double |
Are you working with a 3D map or 2D map?
Problem is solved. Setting the viewing options in the mapframe properties to "none" enables the python code to run properly.
I am building a Python Toolbox out of ArcPro 2.5 and setting a MapFrame_Element Camera scale as well, and originally had the Layout Map Frame element with a Display Options Constraint of Fixed Scale. If this was set to Fixed, the python code could not change the scale, but if it was set to None, and I saved the Project (important if you're doing arcpy.mp.ArcGISProject('CURRENT'), it would change the map frame scale from the map frame.
The problem is that there is no indication of this fact. It is very implicit (maybe it should seem obvious) Thank you @ThomasKölbel for making this point evident.