I'm trying to write a script that uses a search cursor to loop through a field in a .shp file (Incident_Z) find every value that meets a specific condition (zip code=10004) and then at a scale of 1000, the layout at that scale to a pdf.
With advice from various folks I've tried two approaches:
Using a search cursor. However I've run into problems with it: The problem is that there is no output, and interestingly, no errors. The script runs, and when I include a print "Done" statement at the end, prints correctly.
mxd = arcpy.mapping.MapDocument("C:\temp\Graffiti_DM1.mxd") df = arcpy.mapping.ListDataFrames(mxd, "*") expdir= "C:\temp"
cursor=arcpy.SearchCursor("C:\temp\itscomplicated.shp",'"Incident_Z" = ' + "'10004'", "", "", "")
for cur in cursor: cur.rotation = 0 cur.scale = 1000 outFile = expdir + "\" + cur.name + ".tif" cur.panToExtent(lyr.getSelectedExtent()) arcpy.mapping.ExportToTIFF(mxd, outFile, df)
Additionally, I've tried as per @PolyGeo's suggestion, the definition query method, below, which runs and produces an output, but not exactly what.I'm looking for.. The problem is that the output is a pdf (I'm actually preferential to pdf than tiff) of the current extent of the layout, and only the current layout. What I'm looking to do is to have a page for each instance of the where_clause, i.e. each record where '"Incident_Z" = ' + "'10033'", at a specified scale of 1000. Is it possible to modify the existing definition_query script to achieve that? As always, any advice is greatly apprecaited.