Is this possible to generate polygons from points (which are centroids of future polygon)? I got shapefile with ~250 points + they have got two attributes: length and width.
I don't need complete workaround I need tip on how this can be achieved.
Is this possible to generate polygons from points (which are centroids of future polygon)? I got shapefile with ~250 points + they have got two attributes: length and width.
I don't need complete workaround I need tip on how this can be achieved.
import arcpy
fc = r'X:\centroids.shp'
heightfield = 'height'
widthfield = 'width'
outfile = r'X:\rectangles2.shp'
points = [i for i in arcpy.da.SearchCursor(fc,['SHAPE@XY',heightfield,widthfield])]
features = []
for point in points:
lowerleft = arcpy.Point(point[0][0]-point[2]/2, point[0][1]-point[1]/2)
lowerright = arcpy.Point(point[0][0]+point[2]/2, point[0][1]-point[1]/2)
topleft = arcpy.Point(point[0][0]-point[2]/2, point[0][1]+point[1]/2)
topright = arcpy.Point(point[0][0]+point[2]/2, point[0][1]+point[1]/2)
features.append(arcpy.Polygon(arcpy.Array([lowerleft,lowerright,topright,topleft])))
arcpy.CopyFeatures_management(features,outfile)