GISGURU_001

Im Trying to use a loop to create Geoprocessing operations for each of the rows

Discussion created by GISGURU_001 on Sep 14, 2012
I want a code that can be used to create a list of geoprocessing operations on each of the rows in a feature. I would start with the first row and generate a final pdf output, then move to the next row till the searchcursor is through with all the rows; im thinking along the line of the code you suggested but im not sure if it would take each of the rows one at a time, below is an example of what i want

fc = "Parcels"
field = "Plot_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
    feat = row.getValue(shapefieldname) # this gives you the geometry
    val = row.getValue(field) 
    outFC = str(val) + "_Buffer" + ".shp" # there should be no Null-values in "Plot_No", the values have to be unique
    arcpy.Buffer_analysis(feat , outFC, "15 meters", "FULL", "ROUND", "NONE")
    dfAsFeature = arcpy.Polygon(arcpy.Array([df.extent.lowerLeft, df.extent.lowerRight, df.extent.upperRight,     df.extent.upperLeft]),df.spatialReference)
    arcpy.Clip_analysis(lyr,dfAsFeature,outFC) 
    arcpy.mapping.ExportToPDF(mxd,r"C:\KWARA_STATE\\" + outName + "\\" + outName1 + "\\" + "TDP_For_" + outName2) 


fc = "Parcels"
field = "Plot_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
    feat = row.getValue(shapefieldname) # this gives you the geometry
    val = row.getValue(field) 
    outFC = str(val) + "_Buffer" + ".shp" # there should be no Null-values in "Plot_No", the values have to be unique
    arcpy.Buffer_analysis(feat , outFC, "15 meters", "FULL", "ROUND", "NONE")dfAsFeature = arcpy.Polygon(arcpy.Array([df.extent.lowerLeft, df.extent.lowerRight, df.extent.upperRight,df.extent.upperLeft]),df.spatialReference)
    arcpy.Clip_analysis(lyr,dfAsFeature,outFC) 
    arcpy.mapping.ExportToPDF(mxd,r"C:\KWARA_STATE\\" + outName + "\\" + outName1 + "\\" + "TDP_For_" + outName2)


Im not particularly sure if i have to repeat each of the geoprocessing operations for each row, the problem is how do i determine the no of rows? the no of rows would not be fix it can change.

Your suggestions would be highly appreciated.

Outcomes