Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #need to update FERRY column with yes or no values if ferry crossing is available in feature field
  2. delimfield = arcpy.AddFieldDelimiters(fc, "FERRY")
  3. cursor = arcpy.da.UpdateCursor(fc, ["FERRY"])
  4. for row in cursor:
  5. if row[0] == "ferry crossing":
  6. cursor.updateRow("FERRY")
  7. print "YES"
  8. if row[0] is not "ferry crossing":
  9. cursor.updateRow("FERRY")
  10. print "NO"
  11.  
  12. del row
  13. del cursor
  14.  
  15. #if feature is ferry crossing == YES in FERRY field
  16. #if feature is not ferry crossing == NO in FERRY field
  17.  
  18. with arcpy.da.UpdateCursor(fc, ["FEATURE", "FERRY"]) as cursor:
  19. for row in cursor:
  20. if row[0] == "ferry crossing": # test the FEATURE field
  21. row[1] = "FERRY" # set the FERRY field
  22. print "YES"
  23. else:
  24. print "NO"
  25. cursor.updateRow(row) # commit the changes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement