# Formula for rotating half degree square map/data frames in projected coordinate system so that they look straight?

I am currently developing a map series using ArcPy with ArcGIS Pro. I am not using the Map Series functionality for this because I need to have lots of control over what is on each map sheet, and there are many exceptions to its many rules. Instead of using Map Series functionality I am simply using a search cursor to iterate through the map series index and setting the camera extent of the map frame to each map sheet.

For each map frame only one of three map frames is visible, because there is a map frame for each of the UTM/MGA zones in my "third" of Australia. I use the mean of xMin and xMax of each sheet extent to decide which zone I am in and choose the appropriate map frame to use.

I am using 30 minute (half degree) square map sheets in GDA94, and drawing them in a projected MGA Zone which means they are no longer quite square and depending on where each sheet is in the zone that almost square may be "rotated" slightly. My understanding is that cartographers will usually "straighten" up the map by rotating it slightly. Often this is done by eye but my understanding is that there is a formula that can be used to calculate the amount of rotation that is needed to make each sheet look straight. An example rotation value is `-0.0782913899729035.

Is anyone familiar with the formula that I am trying to describe and able to point me at where I may be able to find details of it for Australia (MGA zones) or globally (UTM zones)?

• I have seen the formula back when I was doing 1:250k mapping (12 years ago), if I still have it it would be in AML. It was basically the average of X top to bottom in projected coordinates to get a trend line for the centre of the map then calculating the angle that line is apparently rotated from normal using Pythagorean calculus. How would you set the rotation of the map frame in python? – Michael Stimson Apr 12 '17 at 5:33
• @MichaelMiles-Stimson `Data Frame` object has `rotation` property desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/… – Alex Tereshenkov Apr 12 '17 at 5:36
• Yes @AlexTereshenkov but does that rotate the frame on the sheet or the contents of the frame inside the square? – Michael Stimson Apr 12 '17 at 5:36
• @MichaelMiles-Stimson I'm thinking that I will use the `heading` property of the `camera` object for the map frame so that it is the contents of the frame that rotates, and then I'll mask the data that falls outside the projected half degree square. Having the formula in AML will be perfect because that and ArcPy/Python are the only programming languages that I am fluent in. – PolyGeo Apr 12 '17 at 5:40
• @MichaelMiles-Stimson Do you have any idea what that formula might be named or described as? – PolyGeo Apr 12 '17 at 5:41