In several MXDs, I have symbology displayed based on a rotation field. In each MXD, I rotate the data frame based on the site plan. When I export to a PDF within ArcMap, the symbols stay rotated as they should.
I have already gone into ArcMap Advanced Settings Utility and checked off Rotate marker symbols with dataframe.
Sample when exporting to PDF from ArcMap:
When I use arcpy.mapping.ExportToPDF, the PDF exports correctly, but it will not honor the rotation. I would like to use Python because I have several dozen MXDs that will be updated on a monthly basis.
Sample when using arcpy.mapping.ExportToPDF
Sample Code:
import arcpy, os
folderPath = r"J:\GIS\PrePlans"
for filename in os.listdir(folderPath):
fullpath = os.path.join(folderPath, filename)
if os.path.isfile(fullpath):
basename, extension = os.path.splitext(fullpath)
if extension.lower() == ".mxd":
mxd = arcpy.mapping.MapDocument(fullpath)
mapPath = mxd.filePath
fileName = os.path.basename(mapPath)
print "Exporting " + fileName
txtFile.write("Exported " + fileName +'\n')
arcpy.mapping.ExportToPDF(mxd, basename + '.pdf')
Solved! Go to Solution.
You have to use 32-bit python when you execute the script. If you have installed 64-bit background geoprocessing then 64-bit python is used and rotation i not honored.
Hello Brian,
I'm with the arcpy.mapping team. I was not able to reproduce your scenario.
What version of ArcMap are you using?
It would be best to open an incident with support services for tracking purposes but you are also welcome to send me data / exact steps to jbarrette@esri.com.
Thanks,
Jeff
Was this resolved?
I am having the same issue when exporting to .AI using arcpy on 10.4.1
I don't rotate the data frame but I have a few layers displayed using rotation field. When exporting through standard way (File>Export>...) everything works fine. But when I export using arcpy the symbols end up un-rotated.
MXD:
:
AI file:
The code I am using:
import arcpy, os
MapMainFolder = r"Z:\Workspace" # topmost folder
AIoutLoc = r"J:\CURRENT PROJECTS"
for (root, dirs, files) in os.walk (MapMainFolder):
for fileName in files:
if os.path.splitext (fileName)[1] == ".mxd":
arcpy.AddMessage (fileName)
fullPath = os.path.join (root, fileName)
mxd = arcpy.mapping.MapDocument (fullPath)
print fileName
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
#ungoup layers
for lyr in arcpy.mapping.ListLayers(mxd, "*", df):
depth = len(lyr.longName.split("\\"))
if depth == 1:
refLayer = lyr
elif depth == 2:
moveLayer = lyr
arcpy.mapping.MoveLayer(df, refLayer, moveLayer, "BEFORE")
arcpy.RefreshTOC()
#export AI
ai = fileName.replace (".mxd",".ai")
AIpath = os.path.join (AIoutLoc,ai)
arcpy.AddMessage ("Exporting " + ai)
arcpy.mapping.ExportToAI(mxd,AIpath,"PAGE_LAYOUT",0,0, resolution=300, image_quality="BEST", convert_markers="true")
This was not resolved as our project decided to export PDFs manually instead of via Python. This is because the number of pages per each location relates to the number of stories at a building, which involves exporting PDF for floor 1, checking off floor 1 and checking on floor 2, exporting, so on.
You have to use 32-bit python when you execute the script. If you have installed 64-bit background geoprocessing then 64-bit python is used and rotation i not honored.
Thank you,
This seems to happen in other areas as well such as exporting TPKs via ArcPy and using Data Reviewer ArcPy functions.