2

I have more than >100 shp files (each one contain points). I would like to make polygon around particular shp (scale is not necessary, should be zoomed). I have already printed them but it would be great to make one illustrative map where they are located. So as a result one map allow to recognize where thea are located (if proper labelled of course). Is there any tool (arcgis) which will automate generate polygons around each one?

  • So for each file you'd like to create a polygon that is the bounding box of all points in the file, and then display all those "envelope" polygons on one map? – til_b Jan 28 '16 at 14:37
  • Possibly related, but uses ogr bindings and python: gis.stackexchange.com/questions/14874/… – til_b Jan 28 '16 at 14:38
  • Just a thought, but have you tried using the buffer tool in ArcMap? you can quickly change a point layer into a polygon layer by creating a buffer polygon around each point. I don't know if this is the route you were looking for. Let me know and I can post something with regard to the Buffer tool. – Joshua A Jan 28 '16 at 15:27
1

An out-of-the-box ArcMap tool that can do this is Data Management Tools > Features > Minimum Bounding Geometry. This will create a polygon feature class containing one polygon that depicts the extent of your features.

You can do different things with this tool. To create a polygon feature class containing a single feature depicting the extent of all features of the input shapefile, tell it you want to create Geometry Type = Envelope and Group Option = All. This is telling the tool you want to create a rectangular polygon from the extent of all features.

See the image below for an example. enter image description here

Then you can merge all the output extent feature classes.

Note that if you check to add geometry characteristics and your data is in projected space, you can get the area of your polygons, etc.

Since you don't want to use a script, you could use the batch grid, in the following fashion.

  1. Make a new geodatabase.
  2. Set this new geodatabase to be your default geodatabase in the Catalog Window.
  3. Open the Minimum Bounding Geometry tool to the batch grid. (Right-click and select Batch.)
  4. Select all the input shapefiles and drag them to the input features parameter, so they will create a batch.
  5. If you have a common name column you can use for labeling, you can group by that, instead of saying ALL.
  6. Let ArcMap pick the output names and paths.
  7. Click OK.
0

7 yo script to do the job:

# Import arcpy module
import arcpy, traceback, os, sys
from arcpy import env
env.overwriteOutput = True

try:
    # input folder with shapefiles or rasters
    inputFolder = arcpy.GetParameterAsText(0)
    env.workspace = inputFolder
    # output folder for tiles shapefile
    outputFolder = arcpy.GetParameterAsText(1)
    # table name
    outputFile = "tiles.shp"
    inRasters = arcpy.ListFeatureClasses()
    arcpy.CreateFeatureclass_management(outputFolder, outputFile, "POLYGON", "", "DISABLED", "DISABLED", "", "", "0", "0", "0")
    outputFile=outputFolder+ os.sep +outputFile
    arcpy.AddField_management(outputFile, "FILE_NAME", "TEXT", "", "", 250, "", "NON_NULLABLE", "NON_REQUIRED", "")
    inRows = arcpy.InsertCursor(outputFile)
    arcpy.SetProgressor("step", "", 0, len(inRasters))
    for inRaster in inRasters:
        desc = arcpy.Describe(inRaster)
        ext=desc.extent
        thePoints=[ext.lowerLeft, ext.upperLeft,ext.upperRight,ext.lowerRight, ext.lowerLeft]
        pntarray = arcpy.Array(thePoints)
        polygon = arcpy.Polygon(pntarray)
        row = inRows.newRow()
        row.Shape=polygon
        row.FILE_NAME=inputFolder+os.sep+inRaster
        inRows.insertRow(row)
        arcpy.SetProgressorPosition()
        arcpy.AddMessage (inRaster + "...processed")

    del inRows
except:
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n    " + \
            str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"
    msgs = "GEOPROCESSOR ERRORS:\n" + arcpy.GetMessages(2) + "\n"
    arcpy.AddError(msgs)
    arcpy.AddError(pymsg)

enter image description hereenter image description here

Script assumes that all shapefiles are stored in single input folder (with little efforts this can be changed). It will create output_folder\tiles.shp containing extents of input shapefiles. The output table will have a field with shapefile name stored in it for individual rectangle.

  • Thank you @FelixIP unfortunatelly I do not know how to make a script so i will get back to post when I will familarize more with python :D – Falcon Jan 28 '16 at 21:53

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.