Hi to all,
I'm using arcpy to export map in JPEG format. I am not able to get the TextElement in the output file. The label "Confini comunali" doesn't appear in the JPEG file. Even if I don't change TextElement.text, it doesn't work.
Can anyone help me?
PS Using ArcMap 10.1 on Windows 10, Python 32-bit.
The portion of my script is:
mxd = arcpy.mapping.MapDocument(r"C:\StampeGriglie\Comuni.mxd") df = arcpy.mapping.ListDataFrames(mxd) # Change text element TextElement = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "MioTesto") TextElement.text = "Confini comunali" path_output = "C:/StampeGriglie/Output/1234.jpg" arcpy.mapping.ExportToJPEG(mxd, path_output, df, df_export_width=9360, df_export_height=6623, resolution=200, world_file=False) del mxd
Although I am not running 10.1, I did some experimenting and have the following suggestion:
arcpy.mapping.ExportToJPEG(mxd, path_output, "PAGE_LAYOUT", df_export_width=9360, df_export_height=6623, resolution=200, world_file=False)
I am assuming the text element was created in layout view. Referencing "df" in the export would point to the first data frame and not the layout view.
excuse me for the delay. You are right. I had to change dinamically the
TextElement, then I had to save mxd and now ExportToJPEG using
"PAGE_LAYOUT". It works.
Il 8 gennaio 2019 alle 4.47 Randy Burton <firstname.lastname@example.org> ha scritto:
Re: TextElement with arcpy.mapping.ExportToJPEG
reply from Randy Burton
Python - View the full discussion