For update_row in update_cursor: geo_update_row=create a geometry object for this row's label point for search_row in search_cursor: geo_search_row=create a geometry object for this row if geo_update_row.crosses(geo_search_row) == True: update_row.something = search_row.something update_cursor.updaterow(update_row) del geo_search_row del geo_update_row
parceldesc=arcpy.Describe('parcels') parcelShapeField=parceldesc.ShapeFieldName parcel_cursor=arcpy.UpdateCursor('parcels') for parcel_row in parcel_cursor: parcel_row_shape=parcel_row.getValue(parcelShapeField) # centroid=parcel_row_shape.centroid
centroid.crosses(other geometry object)
parcel_desc=arcpy.Describe("parcels") #describe the parcels and get the shape field name parcel_shapefield=parcel_desc.ShapeFieldName flu_desc=arcpy.Describe("flu")#describe the flu and get the shape field name flu_shapefield=flu_desc.ShapeFieldName parcel_cursor=arcpy.UpdateCursor("parcels") for row in parcel_cursor: #iterate over the parcels parcel_row_shape=row.getValue(parcel_shapefield) #get the geometry object centroid=parcel_row_shape.centroid #get the centroid from the geometry object flu_cursor=arcpy.SearchCursor("flu") for flu_row in flu_cursor: #iterate over the flu flu_row_shape=flu_row.getValue(flu_shapefield) #get the geometry object if centroid.within(flu_row_shape)==True: #compare the two geometries print "RENUM: %s FLU: %s" % (parcel_row.A1RENUM, flu_row.FLU_CODE) #do some junk with the two rows del flu_cursor del parcel_cursor