arcpy.mapping.ExportToTIFF full georeferenced export problem

3340
5
11-11-2011 06:02 AM
JelmerOosthoek
New Contributor III
Hello,

I have two raster layers in my TOC of which the top one is semitransparent. They have the same size and extent. I would like to export this combined 'map' in it's full resolution.

My first attempt uses File > Export Map. First I set the Dataframe width to be the rasters width. Next in Export Map I increase the DPI until the exported image width is around the width of the rasters. When I export ArcGIS 10 SP3 crashes. This has worked for me with ArcGIS 9.3.

The second attempt is using python:
import arcpy
mxd = arcpy.mapping.MapDocument("mymxd.mxd")
outTIFFpath = "out.tif"
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
arcpy.mapping.ExportToTIFF(mxd, outTIFFpath, df, df_export_width=46070, df_export_height=28126, resolution=2642, world_file=True, geoTIFF_tags=True)

(the width of the rasters is 46080 and 46070 here is the best approximation I can get)

The problem here is that the exported TIFF isn't correctly georeferenced. The resulting map is mostly white 'nodata' around the raster. How can I make sure the MapDocument goes to full extent before I export?

Kind regards,

Jelmer Oosthoek
Tags (2)
0 Kudos
5 Replies
AndrewChapkowski
Esri Regular Contributor
Jelmer,

The reason you are seeing all the white space in your tiff is because you are exporting the page layout, not the actual tiff.  Try specifying your data frame and try it again.

Help document: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000009000000

Example:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
arcpy.mapping.ExportToTIFF(mxd, r"C:\Project\Output\ProjectDataFrame.tif", df,
                           df_export_width=1600,
                           df_export_height=1200,
                           geoTIFF_tags=True)
del mxd
0 Kudos
JeffBarrette
Esri Regular Contributor
How can I make sure the MapDocument goes to full extent before I export?

Have you tried something like:

mxd = arcpy.mapping.MapDocument(PathToMXD)
df = arcpy.mapping.ListDataFrames(mxd, "myDataFrame")[0]
lyr = arcpy.mapping.ListLayers(mxd, "myRasterLayer")[0]
df.extent = lyr.getExtent()

Jeff
0 Kudos
JelmerOosthoek
New Contributor III
Hi Jeff,

I added the code you suggested but then ArcMap 10 crashes...

Jelmer
0 Kudos
JeffBarrette
Esri Regular Contributor
There is obviously something wrong.  It must have something to do with your MXD and/or data.  I recommend that you submit this to support services so we can evaluate the problem.

Jeff
0 Kudos
DavidRahe
New Contributor
I have a similar Problem,
I tried exporting a geoTIFF series via Data driven pages, but the TIFFs are noch georeferenced correctly.
If I Mosaic them together I get doubles.

I exported it vial Python using this script:

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
   mxd.dataDrivenPages.currentPageID = pageNum
   arcpy.mapping.ExportToTIFF(mxd, r"C:\Projects\Test\page" + str(pageNum) + ".tif", data_frame=df, geoTIFF_tags=True)
del mxd
del df


maybe someone has a good idea.
greetings

David
0 Kudos