Select to view content in your preferred language

arcpy search/update cursor not working

6987
11
Jump to solution
04-28-2015 03:56 AM
MarkWisniewski
Deactivated User

Im running my script in ArcGIS 10.2 and the dialog window says completed, but the empty fields in the 'SoilsType' row of the 'mSoils' Feature Class aren't getting populated with the values from the 'SoilsType' field from the 'mLanduse' Feature Class.

cur = arcpy.da.SearchCursor(mLanduse, lField)
for row in cur:
 cur2 = arcpy.da.UpdateCursor(mSoils, sField)
 for row2 in cur2:
   if row2[0] == '' or row2[0] is None:
  row2[0] = lField
  cur2.updateRow(row2)
Tags (1)
0 Kudos
11 Replies
MarkWisniewski
Deactivated User

Oh, I see what you are saying Curtis, but I thought that was all achieved with the SelectLayerByLocation.

0 Kudos
SepheFox
Deactivated User

Ernst, select layer by location will simply select all the soil layer polygons that are within all your land use polygons. You could use this in your for loop, so that you select each feature, and then select by location the feature in the other class that is within your selected feature.