Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Time.Sleep between arcpy.mapping.ExportToTIFF in Data Driven Pages

$
0
0

I’m building a code in Python to export in geotiff my imagery.

I need specific spots so I created a Data Driven Pages with polygons.

Everything works fine, except that my imagery layer takes a long time to be completely draw, and the output of my script shows just small parts of what I want. Please, see image below:

Time to load

So, what I need is a way to insert time.sleep in my python script to wait until imagery layer is completely loaded.

This is my script:

    mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
ar = df.extent.height / df.extent.width
for page_number in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = page_number
    print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
    arcpy.mapping.ExportToTIFF(mxd, r"C:UsersIstusDocumentsXXXXXXXXImagerymapasGEOTIFFmap_" + str(page_number) + ".tiff", df, 9306,9306*ar, resolution=300, geoTIFF_tags=True)
del mxd

I’m using ArcMap 10.1 and Python 2.7.2.


Viewing all articles
Browse latest Browse all 767

Trending Articles