TransWikia.com

Exporting to GeoTIFF from data view with Data Driven Pages and ArcPy

Geographic Information Systems Asked by SZYM on March 6, 2021

I’m trying to work with ArcGIS Desktop with this problem. I need to export a data to geotiff with specific boundaries which are polygons, so i decided to use Data Driven Pages (DDP). Because there is hundreds of them I found a script (batch export to GeoTIFF in dataview) which should make this what i want much quicker:

mxd = arcpy.mapping.MapDocument("CURRENT")
res = arcpy.GetParameterAsText(0)
export = arcpy.GetParameterAsText(1)
preFix = arcpy.GetParameterAsText(2)
df = arcpy.mapping.ListDataFrames(mxd)[0]

for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
      mxd.dataDrivenPages.currentPageID = pageNum
      arcpy.AddMessage("Exporting Map " + str(pageNum) + " of " + str(mxd.dataDrivenPages.pageCount))
      pageName = mxd.dataDrivenPages.pageRow.godlo
      arcpy.mapping.ExportToTIFF(mxd, r"C:xxxark_" + preFix + pageName + ".tif",df,
                     df_export_width=10369,
                     df_export_height=6375,
                     resolution = res,
                     world_file=True,
                     geoTIFF_tags=True)
del mxd

But at the end there is a problem with viewing them in arcMap, because some of rasters cover each other. When code is executing the scale in map window is jumping between two values, so I got like on the picture small rasters inside bigger ones.

Maybe someone has the same problem, with getting raster (geotiff) for each polygon?

Example output

One Answer

I don't know why you are getting small rasters, may be a topological issue with your data (e.g. it is multi-part)? But the scale jumping around as the code execute sounds correct as you are zooming to the extent of each polygon which will have a unique extent, may be you have accepted the default best fit option in the DDP dialogue?

DDP

Answered by Hornbydd on March 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP