# vertex_angle.py # find change in angle along a polyline at each vertex # assume : # in a projected coordinate system, not dd # don't know what to do with output, maybe add value to a point # Kim Ollivier # 29 October 2010 # import arcgisscripting import math import sys gp = arcgisscripting.create(9.3) try: inlay = sys.argv[1] except : inlay = "d:/work/test.gdb/wiggle" desc = gp.Describe(inlay) shapefield = desc.ShapeFieldName cur = gp.SearchCursor(inlay) row = cur.next() n = 0 m = 0 p = 0 while row: feat = row.getValue(shapefield) print "Feature",n for partNum in range(feat.partCount) : part = feat.getPart(partNum) ptLast = None bearingLast = None print "Part",m for ptNum in range(part.count): pt = part.next() if ptLast: bearing = math.atan2((pt.Y - ptLast.Y),(pt.X - ptLast.X)) if bearingLast: delta = bearing - bearingLast print p,delta/math.pi*180.0 bearingLast = bearing ptLast = pt p+=1 m+=1 n+=1 row = cur.next() del cur,row
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.