Select to view content in your preferred language

arcpy: changing a grid spatial projection in a layout

351
1
11-12-2024 03:18 PM
Labels (1)
PeterKT
Frequent Contributor

I have a UTM grid within my map frame, and I would like to use arcpy to change its projection.

As far as I can see that can only be done with a CIM definition.

I'm getting an error. Any ideas? Or am I on the wrong path?

....
cim_mapframe = first_mapframe.getDefinition('V3')
cim_mapframe.grids[0].projectedCoordinateSystem = arcpy.SpatialReference(7854)
first_mapframe.setDefinition(cim_mapframe)
 
I get an error when on the setDefinition line. 
 
AttributeError: SpatialReference: Get attribute X does not exist
Peter T, Brisbane
0 Kudos
1 Reply
DanielGarcia
Regular Contributor

Hi Peter,

Please try using this...

cim.grids[0].projectedCoordinateSystem = {'wkid': 7854, 'latestWkid': 7854}
 
This work for me.
0 Kudos