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.

Below is sketch picture of what I want to achieve.

  • You have an answer for QGIS here: gis.stackexchange.com/questions/217218/…. You can try to adapt this code for arcpy.
    – xunilk
    Jan 12, 2019 at 15:41
  • Im gonna check this. Thank you! But if anyone has something more arcpy related please post your ideas. Jan 12, 2019 at 15:49
  • Add geometry attributes and Create 2 copies of your points. Calculate Shape using arcpy.Point(pointx-w/2,pointy-L/2). This will create lower left points. Similarly calculate upper right points. Merge, dissolve to create multipoint, minimum bounding geometry envelope.
    – FelixIP
    Jan 12, 2019 at 19:00

1 Answer 1

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)


enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.