# Getting boundary of raster image as polygon in ArcMap

I have a rectangular raster image in ArcMap.

How can I produce a polygon which is just the extent of the raster image?

That is, I want to have a polygon layer with a single quadrilateral which is the edge of the image.

I've tried simply doing a Raster->Polygon conversion, but this tries to use the data in the image to generate the outline - all I want is the outline of the edge of the image.

I'm using ArcGIS Desktop 10.

If you have the "Spatial Analyst" then you can:

1. Multiply the raster by 0 to create a constant value raster using Raster Calculator. (be sure to convert it to integer type or step 2 will not work)
2. Convert the result of step 1 to polygon using the Raster to Polygon tool.

Another solution:

If your have 3D Analyst license then you can use the Raster Domain tool under 3D Analyst>Conversion>from raster (however it does not have the smooth function)

You can use the Raster Domain tool from 3D Analyst to create a polygon with the same extent as your raster data

– R.K.
Nov 22, 2012 at 14:22
• Raster Domain tool did the job, perfectly! Creates an outline or boundary of the raster data.
– user27891
Mar 10, 2014 at 17:28
• A word of warning about this tool - the bounding polygon that's created is the extent of your raster data starting & ending at the pixel CENTER, not the outside edge of the pixels. I just tried it and thought it returned the outside bounding box of the raster, but when you zoom in you'll see that the bounding box starts at the pixel center. Aug 4, 2016 at 3:29
• There is actually a parameter for the IRasterDomainExtractor.ExtractDomain method that controls whether it uses the center or the outer edge of the pixels/cells. May 19, 2017 at 22:36
• This is perfect! One tool and I have a polygon outline of my raster. Thanks! Aug 3, 2017 at 20:10

I use this simple python script, it create a polygon featureclass with the extent of all the raster present in a folder. To use it, you can create a tool in ArcToolbox or you simply change the InFolder and Dest (Destination) variables.

``````import arcpy,os

InFolder = arcpy.GetParameterAsText(0)
Dest=arcpy.GetParameterAsText(1)

arcpy.env.workspace=InFolder
#The raster datasets in the input workspace
in_raster_datasets = arcpy.ListRasters()

arcpy.CreateFeatureclass_management(os.path.dirname(Dest),
os.path.basename(Dest),
"POLYGON")

cursor = arcpy.InsertCursor(Dest)
point = arcpy.Point()
array = arcpy.Array()
corners = ["lowerLeft", "lowerRight", "upperRight", "upperLeft"]
for Ras in in_raster_datasets:
feat = cursor.newRow()
r = arcpy.Raster(Ras)
for corner in corners:
point.X = getattr(r.extent, "%s" % corner).X
point.Y = getattr(r.extent, "%s" % corner).Y
polygon = arcpy.Polygon(array)
feat.shape = polygon
feat.setValue("RasterName", Ras)
feat.setValue("RasterPath", InFolder + "\\" + Ras)
cursor.insertRow(feat)
array.removeAll()
del feat
del cursor
``````
• can tell us in details how to use this code. I wanna use it on .asc raster file. My images are different different sub folder.? Mar 23, 2015 at 12:14
• Answer from jeb has worked for me, don't have sufficient rep to up vote him. @GIS Data Butcher Save the complete source into a script.py file and execute it from Python Window within ArcMap. You can use following command on Python Window to execute script from file. > execfile(r'd:\temp\script.py')
Mar 13, 2016 at 10:13
• perfect!! i wonder, is there a way to the tool read subfolders as well? Feb 18, 2019 at 18:14
• @raphael, for sure, you just have to implement the standard python os.listdir or os.walk in script.
– jeb
Feb 27, 2019 at 15:08
• @jeb yes, i get the concept... bot i'm very new at this, and could not make it work... can you give some help? Feb 27, 2019 at 19:05

You can use the Build Footprint tool in the Data management Toolbox. You have to create a Mosaic Dataset out of your raster.

Create a new Mosaic in a File Geodatabase , add your raster.

Open your Mosaic in ArcMap and Extract the Footprint.

That's what I would do.

What about simply digitizing it? Click-click-click-click done.

• Not really sure why this option has been down voted. You can find the coordinates of the extent corners and create vertices at those coordinates. It can even be used for analysis. If it's only for display, click-click-click-click works great. Mar 20, 2012 at 19:26
• I'd say because the raster could be an irregular shape and, depending on the complexity, could result in a pretty tiresome digitising job Mar 20, 2012 at 21:57
• But the OP said it was rectangular. Seems like a pretty simple job to me. By zooming in and being accurate, the difference between the actual raster outline and the digitized outline would be negligible for any real world application.
– Matt
Mar 21, 2012 at 13:09

Also, an easy way is to use Reclassify tool where you should click the button Classify and change the number of classes to 1. Click Ok. Now, the output raster can be easily converted using Raster to Polygon conversion Tool. ;)

I think that reclassifying and converting the raster to polygon can be way too time consuming. In my opinion, the easiest way to do it is:

• Get maxX, maxY, minX, minY (this can be done in Python with the describe command)
• Run Create Fishnet with the extent as above and number of rows/columns as 1

If you have lots of rasters, this should be done in Python and can create hundreds of footprints in a matter of seconds.

In ArcCatalog you can create a raster catalog in a .gdb (Data Management Tools->Raster). Unmanaged is fine. Then right click and load (if the rasters are just sitting in a folder then "load from workspace". If you load the raster catalog into ArcMap you can right click-> data-> export footprint, as a shape file or feature class. The shape file will have a 'name' field populated with the name of the raster.

The Raster Catalog will automatically display the extents but I needed to send the extents to someone who wasn't using ArcGIS.

Use the "Raster to Polygon" tool in the conversion tools toolbox. Make sure to uncheck the simplify polygons box. This will create exactly what you want.

• Are you sure this doesn't just create a huge mess of polygons, one for each contiguous set of equal-value pixels in the original image? Mar 21, 2012 at 16:33
• You could always add a dissolve after this to get the extent poly. However, I bet the python solution listed by @jeb is faster. Jun 4, 2015 at 15:45

"Raster Domain" tool will create a polygon around an irregularly shaped raster. I believe it requires a license for the 3d analyst extension.

Using ArcCatalog is the best option. Create a Mosaic Dataset from available rasters. Define "NO VALUE" in the mosaic to avoid the background of raster from being included in the polygon. Build footprints using Radiometric method. Open the Mosaic dataset in ArcGIS and export Footprints to shp file. Great way to get the mosaic boundaries...

If you are trying to get the outline of a DEM raster then you will need to do the following

If you have Spatial Analyst and 3d Analyst then you can:

1. multiply the raster by 0 to create a constant value raster using Raster Calculator.
2. Convert results of step 1 to a raster integer by using the "INT (Tool)". This is necessary for the next step.
3. convert result of step 2 to polygon using the Raster to Polygon tool (only works with raster integers).
• Hi Seamster02, welcome to GIS Stack Exchange :) As written this is not appreciably different from the accepted answer, gis.stackexchange.com/a/22016/108. Jun 12, 2015 at 16:04

I read this post for advice on a similar need. I wanted to outline a raster that is very irregularly shaped, with a stair-step pattern around all the curves, which would have taken hours to digitize. All the other recommendations, mosaic, reclassify, raster calculator, raster domain, etc., all require higher level licenses that I don't have. I solved this problem by using the free program QGIS for parts of it. I loaded my raster into Q. I ran it through the tool Raster>Conversion>polygonize, which converted it into a polygon layer with many thousands of tiny polygons. I exported that layer as an ESRI shapefile, and brought that into Arcmap. Once in arcmap, I began an editing session, opened the attribute table, and selected all of the many thousands of polygons. The selection could have been more easily accomplished with the selector tool, but either way... From the Editor toolbar's main dropdown menu, I selected Union (different from the Union tool from the toolbox). It created the outline I wanted, already highlighted. From the attribute table, I clicked on switch selection, and then right clicked the selected polygons and deleted the selection, so all I had left in the layer was the outline. Then saved edits and stopped editing.

You can do it easily with "arcpy" module in Python: The important thing is that you have to read the spatial georeference system of the input raster, and create a polygon feature with the same spatial georeference system. You read the corners of the raster and add points to a polygon shape. Then you add the shape to your feature class. This is the code for doing it.

``````import arcpy
import sys
import os

fp_inp = "C:\\raster\\raster.tif"
fp_out_dir, fp_out_name = "C:\\raster", "polygon.shp"
fp_out = os.path.join(fp_out_dir, fp_out_name)
if arcpy.Exists(fp_inp):
desc = arcpy.Describe(fp_inp)
spatialName, spatRef = "Unkown", None
if hasattr(desc, 'spatialReference'):
spatRef = desc.spatialReference
spatialName = desc.spatialReference.name
if spatialName != "" and spatialName != "Unkown":
arcpy.env.workspace = fp_out_dir
try:
arcpy.CreateFeatureclass_management(fp_out_dir, fp_out_name, 'POLYGON', spatial_reference=spatRef)
polygonSuc = True
except:
print("ERROR (126401236004)")
print(arcpy.GetMessages())
fieldsOk = False
if polygonSuc:
try:
arcpy.AddField_management(fp_out, "src", "TEXT", "", "", 254, "src",
"NULLABLE")
fieldsOk = True
except:
msg01 = "\n" + arcpy.GetMessages()
print(msg01)
corners = ["lowerLeft", "lowerRight", "upperRight", "upperLeft"]
ras = arcpy.Raster(fp_inp)
points_array = arcpy.Array()
for corner in corners:
pt = arcpy.Point(getattr(ras.extent, "%s" % corner).X, getattr(ras.extent, "%s" % corner).Y)