I am processing polygons > 60,000. using zonal stats - All.
I use a loop to select a subset for processing in batches. Then run the zonal stat to table.
Create a dictionary of the stats and I want to populate back to the original feature class.
the update cursor does not give an error but the attributes of the feature class are not updated.
I wondered if the selection is interfering with the update.
I select by attribute = Lyr1
I select by location = lyr2
Then process zonal stats but maintain a PlygnID which would link the table back to the original feature path.
Inside the loop selecting by layer:
[ CODE]
#Loop through table and update feature values
updtCur = arcpy.UpdateCursor(wtlndPath)
for row in updtCur:
wtlndKey = row.getValue('WVID')
if wtlndKey in statDict:
wtlndMean = statDict[(row.getValue('WVID'), 'MEAN')]
row.setValue("MeanSlp", wtlndMean)
row.setValue("MaxSlp", statDict[(row.getValue('WVID'), 'MAX')])
row.setValue("MinSlp", statDict[(row.getValue('WVID'), 'MIN')])
row.setValue("VarietySlp",statDict[(row.getValue('WVID'), 'VARIETY')])
row.setValue("MajorSlp", statDict[(row.getValue('WVID'), 'MAJORITY')])
row.setValue("MinorSlp", statDict[(row.getValue('WVID'), 'MINORITY')])
row.setValue("StdDevSlp", statDict[(row.getValue('WVID'), 'STD')])
updtCur.updateRow(row)
del row, updtCur
[/CODE]
Thanks for any help.
Alicia
I use a loop to select a subset for processing in batches. Then run the zonal stat to table.
Create a dictionary of the stats and I want to populate back to the original feature class.
the update cursor does not give an error but the attributes of the feature class are not updated.
I wondered if the selection is interfering with the update.
I select by attribute = Lyr1
I select by location = lyr2
Then process zonal stats but maintain a PlygnID which would link the table back to the original feature path.
Inside the loop selecting by layer:
[ CODE]
#Loop through table and update feature values
updtCur = arcpy.UpdateCursor(wtlndPath)
for row in updtCur:
wtlndKey = row.getValue('WVID')
if wtlndKey in statDict:
wtlndMean = statDict[(row.getValue('WVID'), 'MEAN')]
row.setValue("MeanSlp", wtlndMean)
row.setValue("MaxSlp", statDict[(row.getValue('WVID'), 'MAX')])
row.setValue("MinSlp", statDict[(row.getValue('WVID'), 'MIN')])
row.setValue("VarietySlp",statDict[(row.getValue('WVID'), 'VARIETY')])
row.setValue("MajorSlp", statDict[(row.getValue('WVID'), 'MAJORITY')])
row.setValue("MinorSlp", statDict[(row.getValue('WVID'), 'MINORITY')])
row.setValue("StdDevSlp", statDict[(row.getValue('WVID'), 'STD')])
updtCur.updateRow(row)
del row, updtCur
[/CODE]
Thanks for any help.
Alicia