The Pro 2.7 docs imply that it is possible to export a Layout to a TIFF that is georeferenced, either by both embedded geoTIFF tags and/or by a world file using the exportToTIFF method:
(See https://pro.arcgis.com/en/pro-app/2.7/arcpy/mapping/layout-class.htm)
I have a simple map series already configured in Pro, and I'm calling exportToTIFF in this code :
import arcpy, os, sys
import arcpy, os, sys
p = arcpy.mp.ArcGISProject(r"C:\Temp\Scratch.aprx")
l = p.listLayouts()[0]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
for pageNum in range(1, ms.pageCount + 1):
ms.currentPageNumber = pageNum
print("Exporting {0}".format(ms.pageRow.msi))
pageName = ms.pageRow.msi
filename = os.path.join(r"C:\Temp", f"image_{ms.pageRow.msi}.tif")
l.exportToTIFF(out_tif=filename,world_file=True,geoTIFF_tags=True)
(Adapted from MapSeries example 2 in https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapseries-class.htm)
As is, this is exporting TIFs 🙂 but without world files or geoTIFF tags ☹️.
How do I set a valid georef_mapframe in this code such that I would get geoTIFFs or a world file?
Thanks
Solved! Go to Solution.
The next row in the table has the answer (even though the description of the parameter is obviously incorrect):
You need to pass the MapFrame that will be used to setup the georeferencing. Here's a basic example. This does export with both the tags and tfw file:
p=arcpy.mp.ArcGISProject("CURRENT")
l=p.listLayouts()[0]
mf=l.listElements('MAPFRAME_ELEMENT')[0]
l.exportToTIFF("out.tif",world_file=True,geoTIFF_tags=True,georef_mapframe=mf)
The next row in the table has the answer (even though the description of the parameter is obviously incorrect):
You need to pass the MapFrame that will be used to setup the georeferencing. Here's a basic example. This does export with both the tags and tfw file:
p=arcpy.mp.ArcGISProject("CURRENT")
l=p.listLayouts()[0]
mf=l.listElements('MAPFRAME_ELEMENT')[0]
l.exportToTIFF("out.tif",world_file=True,geoTIFF_tags=True,georef_mapframe=mf)
Thank you for bringing this to our attention. This was obviously a copy/paste error that describes clip to graphics. As Tim suggests, the georef_mapframe parameter is what allows this to happen. We will fix the help topic.
Thanks,
Jeff - Layout and arcpy.mp teams
That worked! Many thanks to both of you