import arcpy # input point file fc = r'C:\Project\_Forums\pointInterpol\fgdb\test.gdb\points' # edit this fields = ("SHAPE@XY") # size of rectangle h = 1000 # height, edit this w = 1500 # width, edit this # output feature class fcout = r'C:\Project\_Forums\pointInterpol\fgdb\test.gdb\diamonds01' # edit this features = [] with arcpy.da.SearchCursor(fc, fields) as cursor: for row in cursor: arrPnts = arcpy.Array() X = row[0][0] Y = row[0][1] # point 1 pnt = arcpy.Point(X-w/2,Y-h/2) arrPnts.add(pnt) # point 2 pnt = arcpy.Point(X-w/2,Y+h/2) arrPnts.add(pnt) # point 3 pnt = arcpy.Point(X+w/2,Y+h/2) arrPnts.add(pnt) # point 4 pnt = arcpy.Point(X+w/2,Y-h/2) arrPnts.add(pnt) # point 5 (close diamond) pnt = arcpy.Point(X-w/2,Y-h/2) arrPnts.add(pnt) pol = arcpy.Polygon(arrPnts) features.append(pol) # write to output arcpy.CopyFeatures_management(features, fcout)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.