Pro Layout export to TIFF - how to set the georef_frame?

1759
3
Jump to solution
06-15-2021 11:20 PM
MicZatorsky_AEC
Occasional Contributor III

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)

MicZatorsky_AEC_1-1623823588882.png


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

 

1 Solution

Accepted Solutions
Tim_McGinnes
Occasional Contributor III

The next row in the table has the answer (even though the description of the parameter is obviously incorrect):

Tim_McGinnes_0-1623838671534.png

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)

 

View solution in original post

3 Replies
Tim_McGinnes
Occasional Contributor III

The next row in the table has the answer (even though the description of the parameter is obviously incorrect):

Tim_McGinnes_0-1623838671534.png

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)

 

JeffBarrette
Esri Regular Contributor

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

MicZatorsky_AEC
Occasional Contributor III

That worked!  Many thanks to both of you 

0 Kudos