When updating the coordinate system of a map (i.e. moving to a different UTM zone) using Python in ArcGIS PRO, the coordinate system of the associated layout grid(s) is not updated. Choosing the Coordinate System of the grid to match the coordinate system of the map within the UI only reads that coordinate system one time (it then sets it to that coordinate system)- It isn't "tied" to the map and so is not updated when the map is updated which is a useful option when writing tools to work in multiple utm zones.
There doesnt appear to be away within python to update the coordinate system of grids directly.
Thank you for submitting this Timothy Barnes.
This is not a bug. If you believe you are experiencing something in the software that may be a bug, the best avenue is to contact technical support. The ArcGIS Ideas site is designed to request new features/functionality. Could you please edit the idea's title to remove the word bug? Thank you!
For a measured grid, the grid can have a different coordinate system than the map and therefore it should not automatically update.
There is no way within python to update the coordinate system of grids directly.
The grid's coordinate system can be changed using Python CIM access. Here is some example code:
p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts()[0]
cim_lyt = lyt.getDefinition('V2')
mf = cim_lyt.elements[0]
mf.grids[0].projectedCoordinateSystem.get("wkid")
3446 #RI SPF
mf.grids[0].projectedCoordinateSystem['wkid'] = 26919 #UTM Zone19
mf.grids[0].projectedCoordinateSystem['latestWkid'] = 26919
lyt.setDefinition(cim_lyt)
Note: set both wkid AND latestWkid.
Given that, the idea becomes something more like "Provide a way to automatically update Coordinate System of grats/grids when changing map coordinate system"
Thanks Kory- have amended title. It appeared as a bug as setting the coordinare system to the maps coordinate system seemed like it should 'stick' to that map sr rather than just read it and then list it as an actual coordinate system...if that makes sense. While there are definitely times when having different grid coordinate system than the map is useful, having the ability/tick box to tie that to the map would also be useful.
However, the CIM access is definitely something I can use to achieve this.
Cheers
Hi,
I am seconding Timothy's comment here, and I would consider this a bug because:
I am glad that a solution exists, and have successfully implemented it on my own system, but it took a few hours of Googling to locate this post. I hope that others have more success than me.
Here is a link to the CIM docs: https://github.com/Esri/cim-spec/blob/master/docs/v2/CIMLayout.md
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.