import arcpy infc = arcpy.GetParameterAsText(0) outfc= arcpy.GetParameterAsText(1) h=arcpy.GetParameter(2) arcpy.analysis.Select(infc, outfc, '') cursor=arcpy.da.UpdateCursor(outfc, ["OID@", "SHAPE@"]) for row in cursor: partnum = 0 row1_new= arcpy.Array() for part in row[1]: part_new=arcpy.Array() for pnt in part: if pnt: point_new =arcpy.Point(pnt.X,pnt.Y,pnt.Z+h) part_new.append(point_new) print("{}, {}".format(pnt.X, pnt.Y)) else: print("Interior Ring:") row1_new.append(part_new) rowl_new_polyline = arcpy.Polyline(row1_new,has_z= True) row[1] =rowl_new_polyline cursor.updateRow(row) partnum += 1 del cursor
import arcpy infc = arcpy.GetParameterAsText(0) outfc= arcpy.GetParameterAsText(1) h=arcpy.GetParameter(2) arcpy.AddMessage("=={}, {},{}".format(infc, outfc,h)) arcpy.analysis.Select(infc, outfc, '1=2') cursor = arcpy.da.InsertCursor(outfc, ["SHAPE@"]) with arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]) as qcursor: for row in qcursor: partnum = 0 row1_line= arcpy.Array() for part in row[1]: linearr=arcpy.Array() for pnt in part: if pnt: arcpy.AddMessage("{}, {},{}".format(pnt.X, pnt.Y,pnt.Z)) point_new =arcpy.Point(pnt.X,pnt.Y,pnt.Z+h) linearr.append(point_new) n=linearr.count p1=linearr[n-1] arcpy.AddMessage("kkk={}, {},{}".format(p1.X, p1.Y,p1.Z)) else: print("Interior Ring:") arcpy.AddMessage("Interior Ring:") row1_line.append(linearr) new_polyine = arcpy.Polyline(row1_line,has_z= True) cursor.insertRow([new_polyine]) partnum += 1
标签:高程,arcpy,三维,pnt,outfc,part,new,Arcpy,row From: https://www.cnblogs.com/gisoracle/p/17201354.html