Batch export to GeoTIFFs for set polygon features in data frame?

5555
16
10-10-2011 02:21 PM
EdGage
by
New Contributor
I'm not a particularly savvy user, as my question will make clear, so any help is greatly appreciated!
What I'd like to do is use some sort of batch map export, whereby I could export a series of GeoTIFFs driven by a list of polygon features in a data frame. I tried playing with the functionality in data driven pages, but the only export options are from the layout view, and what I need are georeferenced images (to be batch segmented for further analysis). Any ideas how to proceed?
Thanks!
0 Kudos
16 Replies
JosephArmbruster
New Contributor III
John Sobetzer, Did you figure out how to calculate the width and height exactly as ESRI does in their "Export Map" dialog?  If so, can you post a snippet of your calculation?

I just opened up a related-thread.  Feel free to chime in.
http://forums.arcgis.com/threads/93836-ExportToTif-width-height-calculation
0 Kudos
JohnSobetzer
Frequent Contributor
I'm not knowledgeable enough about arcpy to do that, and fortunately didn't need to be either.  Here's a clumsy way you might get what you are looking for.

The key additions that Drewsky made in the code involved the "ar".  In his code these two lines were the key to producing a properly geoereferenced tif that wasn't skewed since it got the actual pixels being used:

ar = df.extent.height / df.extent.width
arcpy.mapping.ExportToTIFF(mxd,r"C:\ImageTemp\" + str(pageNum) + ".tif",df,1024,1024*ar,48,True)

I typically use 9036,9036*ar in my code and this produces pdfs that are 9036 x a number that depends on my window size.  (Right click on the tif in Windows Explorer - Properties - Details.)  If you run your code and look at a resulting tif you will see this second number.  In a batch I'm currently running it is 10339 in all the tifs.  If I didn't change the window size I could depend on that.
0 Kudos
JeffBarrette
Esri Regular Contributor
The easiest solution is to create a page layout the size of the desired data frame and export the layout, not the data frame.  See response to related post.

http://forums.arcgis.com/threads/93836-ExportToTif-width-height-calculation

Jeff
0 Kudos
JosephArmbruster
New Contributor III
I'm not knowledgeable enough about arcpy to do that, and fortunately didn't need to be either.  Here's a clumsy way you might get what you are looking for.

The key additions that Drewsky made in the code involved the "ar".  In his code these two lines were the key to producing a properly geoereferenced tif that wasn't skewed since it got the actual pixels being used:

ar = df.extent.height / df.extent.width
arcpy.mapping.ExportToTIFF(mxd,r"C:\ImageTemp\" + str(pageNum) + ".tif",df,1024,1024*ar,48,True)

I typically use 9036,9036*ar in my code and this produces pdfs that are 9036 x a number that depends on my window size.  (Right click on the tif in Windows Explorer - Properties - Details.)  If you run your code and look at a resulting tif you will see this second number.  In a batch I'm currently running it is 10339 in all the tifs.  If I didn't change the window size I could depend on that.


This does not address my problem really (see the other post), since you are assuming that your data frame can always safely/clearly export into a 1024*Y image (which may not always be the case).
0 Kudos
JosephArmbruster
New Contributor III
The easiest solution is to create a page layout the size of the desired data frame and export the layout, not the data frame.  See response to related post.

http://forums.arcgis.com/threads/93836-ExportToTif-width-height-calculation

Jeff


It seems silly to me that I would have to create an entirely new page layout, just to do an export of a data frame.  When i'm in ArcMap and select "Export Map", I do not have to create a new layout before that operation.  My only issue is that of calculating the dimensions, precisely as the Export Map UI does.
0 Kudos
JeffBarrette
Esri Regular Contributor
That is because when the application is actually open the data frame window has a defined size.  But when you run a stand-alone script, the application isn't actually open, there is not a real point of reference and depending on your system settings, you may get different results on diferent machines.  Using a page layout that has a defined page space whether open or not, you will get consistent results.

Also - defining a page layout size and fixed dataframe size on the layout you will get consistent results.  Otherwise when you resize the TOC, the application, etc, the data frame size will be different. etc, etc,

Jeff
0 Kudos
JosephArmbruster
New Contributor III
Jeff,

When I load my mxd and switch to data frame mode, the export-map dimensions are not altered by zooming in and out.  The dimensions of export-map remain the same and are being calculated to accomodate the extents of the data I have loaded.

Joe
0 Kudos