[GIS] Creating Polygons based on 2 XY points

arcgis-desktopcoordinatespolygon

I have an excel file with 2 x,y coordinates as columns. One set of coordinates is the top left vertex of a rectangle, the other set is the bottom right vertex of the rectangle.

Is there anyway to plot these coordinates and have Arcmap automatically draw rectangles connecting these vertexes? I've searched on here for the answer but kept getting hung up on some of the options. Preferably a solution without using arcpy.

enter image description here

Best Answer

As suggested by @Brad convert pairs of points to lines.

arcpy.AddGeometryAttributes_management("LINES", "EXTENT")
arcpy.Buffer_analysis("LINES", "D:/Scratch/buffers.shp", "1 Meters")

Apply this field calculator expression on field Shape of buffers:

def toExtent(xmin,ymin,xmax,ymax):
 LL=arcpy.Point(xmin,ymin)
 UL=arcpy.Point(xmin,ymax)
 UR=arcpy.Point(xmax,ymax)
 LR=arcpy.Point(xmax,ymin)
 array=arcpy.Array([LL,UL,UR,LR])
 polygon=arcpy.Polygon(array)
 return polygon
#------------------------
toExtent( !EXT_MIN_X!, !EXT_MIN_Y!, !EXT_MAX_X!, !EXT_MAX_Y! ) 

OUTPUT: enter image description here

Related Question