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

  • 4
    @ziggy not if you treat them as an extent. – mkennedy Feb 7 '17 at 18:56
  • 1
    Not sure why this is on hold. Seems clear to me. Follow these steps: 1) add XY data from File menu. Then export data. (2) use the XY To Line geoprocessing tool to convert the XY Coordinates to a Line (3) Use the Line as input into the Minimum Bounding Geometry geoprocessing tool. All of the geoprocessing tools are under Data Management Tools\Features – Brad Feb 7 '17 at 19:03
  • 2
    What license level is available? You can use @Brad 's solution with Advanced, but won't have access to the 'ENVELOPE' option with Basic/Standard. – phloem Feb 7 '17 at 19:08
  • 1
    @Brad further up in that link you'll see (under Syntax > geometry_type) that ENVELOPE is only available under Advanced license – Midavalo Feb 7 '17 at 19:18
  • 1
    The tool is available, but the output geometry type is limited by license level. – phloem Feb 7 '17 at 19:18

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):
 return polygon
toExtent( !EXT_MIN_X!, !EXT_MIN_Y!, !EXT_MAX_X!, !EXT_MAX_Y! ) 

OUTPUT: enter image description here


I know you prefer not to use arcpy, but I'm not sure how you can get around it with Basic/Standard license. After you've got your Excel spreadsheet into an ArcMap table view:

fc = 'my_table' # the table
fields = ['N_Lat','W_Lon','S_Lat','E_Lon'] # coordinate fields. Order is important.
sr = arcpy.SpatialReference(4326) # spatial reference. Assume WGS_1984.
out_recs = [] # placeholder
with arcpy.da.SearchCursor(fc,fields) as cursor: # loop through table
    for row in cursor:
        extent = arcpy.Extent(row[1],row[2],row[3],row[0]) # create extent object
        extent_poly = arcpy.Polygon(arcpy.Array([extent.upperLeft,extent.upperRight,extent.lowerRight,extent.lowerLeft]),sr) # create polygon from extent. Define spatial reference.
        out_recs.append(extent_poly) # add to polygon list
arcpy.CopyFeatures_management(out_recs,r'in_memory\out_recs') # write to disk

Follow these steps (Advanced license only):

(1) From the File Menu\Add Data\Add XY Data - Add your XY Data and export as feature class.

(2) Use this as input for the "XY To Line" geoprocessing tool

(3) Use the line as input into the Minimum Bounding Geometry geoprocessing tool.

All of the geoprocessing tools are under Data Management Tools\Features

  • (1) to be done twice – FelixIP Feb 7 '17 at 19:56
  • XY to Line will take a table/text/csv/etc. directly so you don't need to feature a feature class first. – mkennedy Jun 5 '18 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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