5

I am required to open a bunch (50 per week) of mxd's and 'Clear' the Coordinate system from the data-frame to make sure my students have all of their data projected in the same (correct) Coordinate System, to see if their data 'lines up'.

I do this by hand, over and over and over, by using the steps below:

-Right Clicking the Data Frame

-Go to the Coordinate System Tab of 'Data Frame Properties'

-Click on the Globe dropdown arrow

-Scroll to 'Clear'

-Click 'OK' or 'Apply' as I watch to see if any of the data disappears.

There has GOT to be a way I can copy/paste a short line of Python into the Python Window to automate this. I know I could write a complete script that would check the coordinate system of each layer in the map without actually opening the map, but I'm just looking for a quick fix that I can do while I also evaluate their cartography.

I am using ArcGIS 10.2.1 for Desktop with an Advanced level license.

1

1 Answer 1

4

This is pieced together from the link @PolyGeo commented.

Copy/paste this into the Python window:

sr = arcpy.SpatialReference()
sr.loadFromString('{B286C06B-0879-11D2-AACA-00C04FA33C20}')
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.spatialReference = sr
arcpy.RefreshActiveView()

I tested it in ArcMap and it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.