I am currently trying to use modelbuilder to go through each row in an attribute table, select the streets that intersect the polygon (which is the row in the attribute table), zoom to the selected features, apply a definition-query to show only the currently selected polygon and the roads, then export the current layout as a pdf.
For example, say you have a 4x4 group of polygons labeled like so
A B C D E F G H I J K L M N O P
What I am trying to do is:
- select the row that correlates to F
- select the streets that intersect it,
- zoom to the polygon with the streets selected,
- apply a definition query so that I can only see F and the streets that intersect it, and then
- export the map layout as a pdf and then
- go on to do the exact same thing for G, then H, and so on.
Is this feasible to do with modelbuilder/python, or would it just be easier to use other methods like data driven pages and manually apply the definition-query?
I have included the portion of the code that I have managed to get working in model builder below.
import arcpy arcpy.ImportToolbox("Model Functions") cotgis11_COTGIS_Block_Watch__2_ = "cotgis11.COTGIS.Block_Watch" Streets_59_999_to_10_000 = "Streets 59,999 to 10,000" I_cotgis11_COTGIS_Block_Watc = "I_cotgis11.COTGIS_Block_Watc" arcpy.IterateRowSelection_mb(cotgis11_COTGIS_Block_Watch__2_, "Block_Watc #", "false") arcpy.SelectLayerByLocation_management(Streets_59_999_to_10_000, "INTERSECT", I_cotgis11_COTGIS_Block_Watc, "50 Feet", "NEW_SELECTION") arcpy.CalculateValue_management("zoomToSelectedFeatures()", "import arcpy\\ndef zoomToSelectedFeatures():\\n mxd = arcpy.mapping.MapDocument('CURRENT')\\n df = arcpy.mapping.ListDataFrames(mxd,\"Layers\")\\n df.zoomToSelectedFeatures()\\n arcpy.RefreshActiveView() ", "Feature Layer")