arcpy.mapping: ExportToTIFF() creates invalid output

2641
5
07-01-2010 06:38 AM
KellyCrowell
New Contributor
Hello,

I did indeed search for any other posts on this and saw none, apologies if this is incorrect.  I have installed ArcGIS10 on my secondary machine to test functions which should help with a milestone deliverable in the next week, particularly batching the exports (I'm much better at python than C#).  While ExportToPDF() appears to work fine, the preferred TIFF export function produces a small file which is not recognized by Windows XP or by IDL 7.1.  I'm running a python distribution by ActiveState (2.6.5) with the latest numpy installed prior to receiving ArcGIS 10. Syntax was:

arcpy.mapping.ExportToTIFF(kmxd, kpath+"\\test1.tif", resolution=300)

where kmxd is a valid MapDocument object and kpath is a valid path to a directory.  The output file for a tabloid mxd is only around 122000 bytes rather than the ~50MB expected for an uncompressed file at this resolution. The same arguments passed to ExportToJPEG() appears to work fine; however for vector graphics we do not like JPG. 

Has anyone else seen this problem?

Thanks,
Kelly Crowell
0 Kudos
5 Replies
MichaelGrossman
Esri Contributor
Kelly,

Often TIFF files fail to open in certain veiwers when specific compression types are used.  To test all of the common compression types, try again with these three calls:
[INDENT]
arcpy.mapping.ExportToTIFF(kmxd, kpath+"\\test1_CmprsNone.tif", resolution=300, tiff_compression="NONE") 

arcpy.mapping.ExportToTIFF(kmxd, kpath+"\\test1_CmprsLZW.tif", resolution=300, tiff_compression="LZW") 

arcpy.mapping.ExportToTIFF(kmxd, kpath+"\\test1_CmprsDeflate.tif", resolution=300, tiff_compression="DEFLATE") 
[/INDENT]

Sincerely,
Michael G.
0 Kudos
KellyCrowell
New Contributor
Thanks for your reply Michael,

I went through each compression type using that basic syntax, changing only the output file name and the string passed through the tiff_compression keyword; FYI when specifying JPEG compression I received the error: PageLayoutObject: Error in executing ExportToTiff.

All other compression types (including 'none') resulted in a small, corrupted file ( 'NONE','LZW','DEFLATE' : 4K, 6K, 120K vs. 50 MB for successful 'NONE').  I then remembered that maybe I should try exporting directly from ArcMap, which also failed.  This reminded me of a problem I've been having on my main workstation with 9.3. On both that and this secondary laptop I'm running windows on a Parallels VM under OS X. The laptop is running XP under OS 10.6.4 while the workstation is running Windows 7 32-bit under 10.6.3, parallels version is the same at build 5.0.9344. At some point in the last few months the workstation suddenly stopped behaving well when trying to create featureclasses on a network shared based on an OS X-based folder.

As it stands, if I try to write to the c: drive ExportToTiff() works for both ArcMap and Arcpy.  Oddly, though, ExportToPDF(), ExportToJPEG(), and ExportToAI() all work even when writing to an OS X folder.  I'll have to investigate this further given time, but for now at least I know I can batch our exports through Python.

Cheers,
Kelly Crowell
0 Kudos
SabitaTripathi
New Contributor
Can someone tell me why am I getting an error? error is marked in red.


import arcpy
... mxd = arcpy.mapping.MapDocument(r"C:\Project\G_1.mxd")
... arcpy.mapping.ExportToTIFF(mxd, r"C:\Project\Output\Project.tif", resolution=300, tiff_compression="NONE")
... del mxd
...


Runtime error <type 'exceptions.AttributeError'>: PageLayoutObject: Error in executing ExportToTIFF
0 Kudos
DanielSattler
New Contributor III
Can someone tell me why am I getting an error? error is marked in red. 


import arcpy 
... mxd = arcpy.mapping.MapDocument(r"C:\Project\G_1.mxd") 
... arcpy.mapping.ExportToTIFF(mxd, r"C:\Project\Output\Project.tif", resolution=300, tiff_compression="NONE") 
... del mxd 
...  


Runtime error <type 'exceptions.AttributeError'>: PageLayoutObject: Error in executing ExportToTIFF



Did you find an answer to this? I have the same message when Exporting to PDF.


Also, you know if there is a way to do a batch export of MXDs to PDFs?
0 Kudos
JeffBarrette
Esri Regular Contributor
The original issue with exporting to TIFF creating the same output regardless of compression type will be fixed for service pack 3.
0 Kudos