AnsweredAssumed Answered

export each polygone shape to jpeg on a loop with each worldfile using python or arcpy

Question asked by mdunn on Jul 31, 2014
Latest reply on Aug 2, 2014 by xander_bakker

I'm new to Python and Arcpy mapping.  Has anyone built any code for exporting a layer of polygons one record at a time,  I want to select each record,  Zoom to selected and then export each view from the dataframe to jpeg with the worldfile.  I want to name the files with the name of the polygone that is stored in the field name.

 

This is the start of my code.  I'm stuck on selecting each record in a loop and then exporting to jpeg from the datafram not the layout view.  I need to store the worrld file with each export.

 

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")

df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

for row in arcpy.SearchCursor (r"C:\GIS\Grid.shp"):

    df.extent = row.Shape.extent

    df.scale = df.scale *1.07

    arcpy.mapping.ExportToJPEG(mxd, r"C:\GIS\OutputPages\Grid_name.jpg", df,

                           df_export_width=1600,

                           df_export_height=1200,

                           world_file=True)

Outcomes