Hi,I would like to zoom to features and export the map data frame into JPEGs with world files. I have created an Index Grid shapefile that covers my area of interest. All I need to to is go through each row/record in the shapefile, zoom to extent and export the data frame as JPEG with worldfile.I am new to python programming. I have composed a python script (thanks to fellow members), but it is not working.import arcpy from arcpy import env from arcpy import mapping env.workspace = r"C:\temp\python" mxd = mapping.MapDocument(r"C:\Temp\Sample.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] for lyr in arcpy.mapping.ListLayers(mxd): lyr.visible = True fc = r"C:\Temp\Grid.shp" count = str(arcpy.GetCount_management(fc)) x = 0 while x < int(count) + 1: rows = arcpy.SearchCursor(fc, "FID = " + str(x)) for row in rows: df.zoomToSelectedFeatures() df.extent = lyr.getSelectedExtent() arcpy.RefreshActiveView() mapping.ExportToJPEG(mxd, r"C:\Temp\Map_" + str(x) + ".jpg", df, df_export_width=3004, df_export_height=2125, world_file=True) print('Exported image',x, 'of', count) x += 1 print("MXD to JPEGs Export successful") print("Thank you!")
I would really appreciate your help in correcting this.