Guest User

Untitled

a guest
Jan 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. # Import system modules
  2. import arcpy
  3. import os
  4.  
  5.  
  6. # Set local variables
  7. datasource = r"C:/Alexsomeplace"
  8. inTable = os.path.join(datasource, "Murray Sp2.shp")
  9. fieldName = "DipDir"
  10. fidField = arcpy.AddFieldDelimiters(datasource, "FID")
  11.  
  12. def Strike(shape, fid):
  13.  
  14. degreeBearing = 55
  15.  
  16. arcpy.MakeFeatureLayer_management(inTable, 'shapelyr', "{0} = {1}".format(fidField, fid))
  17.  
  18. arcpy.Delete_management('shapelyr')
  19. #returns the degreebearing value as the dip direction
  20. return degreeBearing
  21.  
  22. with arcpy.da.UpdateCursor(inTable, ['SHAPE@', 'FID', fieldName]) as cursor:
  23. for row in cursor:
  24. row[2] = Strike( row[0], row[1])
  25. cursor.updateRow(row)
  26. del cursor
  27.  
  28. arcpy.MakeFeatureLayer_management(inTable, 'shapelyr')
  29.  
  30. def Strike(shape, fid):
  31.  
  32. degreeBearing = 55
  33.  
  34. arcpy.SelectLayerByAttribute_management('shapelyr', 'NEW_SELECTION', "{0} = {1}".format("FID", fid))
  35.  
  36. arcpy.Delete_management('shapelyr')
  37.  
  38. #returns the degreebearing value as the dip direction
  39. return degreeBearing
  40.  
  41.  
  42. with arcpy.da.UpdateCursor(inTable, ['SHAPE@', 'FID', fieldName]) as cursor:
  43. for row in cursor:
  44. row[2] = Strike( row[0], row[1])
  45. cursor.updateRow(row)
Add Comment
Please, Sign In to add comment