import arcpyfrom arcpy import envfrom arcpy import mapping#I'm in ArcMap 10.1 Desktop with the map openmxd = arcpy.mapping.MapDocument("CURRENT")#I have two data frames that this will need to work on but the first one is more important to work and I can work on the next data frame latermydf = arcpy.mapping.ListDataFrames(mxd)[0]#Point feature that I want to iterate through so I can export one PDF map with this featured at 1:5000 scale.facilities = arcpy.mapping.ListLayers(mxd, "Permian_facilities", mydf) [0]#buffer layer that I've already processed. Currently, all buffers appear but I only want the associated buffer with the point feature above to appear. I don't understand the [0] in this below because the unique attribute column in the buffer layer starts at 1, not 0.buffer = arcpy.mapping.ListLayers(mxd,"Permian_facilities_Buffer1",mydf)[0]#I understand this and "FID" is the unique attribute column I am stepping/iterating throughwith arcpy.da.SearchCursor(facilities, ("SHAPE@", "FID")) as cursor: for row in cursor: mydf.extent = row[0].extent mydf.scale = 5000 #So up until now it works. I'm not sure that new SearchCursor below is indented correctly nor is it in the right sequential order with arcpy.da.SearchCursor(buffer, ["OID@"]) as rows: for row in rows: #What do the {} mean in this? Also, does the .format(row[0]) mean the line below will align with the active "FID" above in the stepping through process? buffer.definitionQuery = "OBJECTID = {}".format(row[0]) #Should this be indented here or afterward in case I have a different amount of rows in the first iterated SearchCursor arcpy.RefreshActiveView() #using to see if they match up print cursor print rows arcpy.mapping.ExportToPDF(mxd, r"C:\Users\cdhabro\Desktop\PythonScript\Map_" + str(row[1]) + ".pdf", resolution=100, image_quality="BEST") del mxddel mydfprint "done"
أكثر...
أكثر...