I have around 1,000 satellite images in tiff format, and I want to create a shapefile which will serve as an index to the rasters. This is something similar to a raster catalog, but I do not want to build a raster catalog.

Some obstacles I can forsee, is that the image are georefrenced, so they are not rectangular in shape (I am talking about the data area).

To clarify, I require the polygon to cover only the non-zero (or non nodata) pixels of the raster, and not the entire rectangular raster. Most of the answers so far, give a rectangular polygon, which covers the data, as well as the non-data pixels.

My Image A sample Satellite Image

Result given by tools I have examined (like raster catlog, various Arcscripts, custom Python script given in one of the answers): Result

Result that I want: enter image description here

  • 4
    It seems like creating a raster catalog, even temporarily would be a good solution to create footprints. You can create a catalog that is unmanaged, which creates a table of references, but leaves the images in their location on the server. It is easy, and relatively quick to do a batch import of rasters to a catalog. Once created, you can export the footprints to a new featureclass and delete the raster catalog. This might be as quick as other options. – Get Spatial Jun 6 '12 at 7:33
  • 2
    Mosaic dataset also produces the imagery footprint. – Roy Jun 6 '12 at 11:12
  • mosaic dataset is the way to go. Very easy to accomplish – Brad Nesom Jun 6 '12 at 12:30
  • So in the last image, are the pixels outside the red box NoData or 0? If they are 0, are there pixels in the area you want that are also of 0 value? – Chad Cooper Jun 7 '12 at 13:55
  • 1
    The pixels outside the red border are nodata; However my multi-spectral data has 0,0,0 as the RGB values for the nodata areas. In both cases, there are no pixels with value 0 inside the required area. – Devdatta Tengshe Jun 7 '12 at 14:42

There is a plugin in QGIS called Image Boundary. It is a great tool. Within this tool there is an option for "Valid Pixels" which will omit the black edges of a satellite image, for example.

|improve this answer|||||
  • This plugin claims to do what I wanted, but it is failing on an image that I experimented with. I'll try with my real data tomorrow. – Devdatta Tengshe Jun 6 '12 at 13:56
  • I found that this plugin works very well with multi-spectral data, but sometimes gives weird results with single-band pancromatic images. – Devdatta Tengshe Jun 8 '12 at 14:25
  • 2
    I agree that the QGIS Image Boundary works the best but is there a tool to do this for vector files where we don't need the "bounding box" or "footprint" but a polygon outlining where data exists. – GeorgeC Aug 7 '12 at 6:07
  • The image boundary tools is great, however, the link you provide is 404. I believe the tools is still available if you allow experimental plugins in the plugin settings. Perhaps use this link?: github.com/lmotta/imagefootprint_plugin – Aaron Feb 27 '18 at 3:54
  • Is there any documentation for using Image Boundary? – Loonuh Jan 15 '19 at 17:08

The following code will take an input raster, get it's extent, and insert that extent into a polygon featureclass:

import arcpy

r = arcpy.Raster(in_raster)
point = arcpy.Point()
array = arcpy.Array()

corners = ["lowerLeft", "lowerRight", "upperRight", "upperLeft"]

cursor = arcpy.InsertCursor(fc)
feat = cursor.newRow()
for corner in corners:    
    point.X = getattr(r.extent, "%s" % corner).X
    point.Y = getattr(r.extent, "%s" % corner).Y
print len(array)
polygon = arcpy.Polygon(array)
feat.shape = polygon
del feat
del cursor

You can run it in the ArcMap Python window by setting up in_raster and fc like so:

>>> fc = 'r_extent'
>>> in_raster = 'CaliCoast10mNED_HavCurvedPCS'

where r_extent is a existing polygon featureclass. Then just copy the code and run it. I get this:

enter image description here

|improve this answer|||||

You can use gdaltindex for this: http://www.gdal.org/gdaltindex.html

It will however still create rectangles (eg 4+1 points) in the same reference system as the images. But I wonder whether that really is a problem: how large are your images?

|improve this answer|||||
  • The problem with gdaltindex, is that it creates a rectangular polygon for each image. I am only interested in the nonzero value pixels – Devdatta Tengshe Jun 6 '12 at 13:57

I tried "Image Boundary" tool in QGIS but it fails with some rasters.

Another option that worked for me is:- 1. Convert input raster to a single digital number by using gdal_translate command-line utility.

gdal_translate -co compress=lzw -b 1 -ot byte -scale 1 1 inp.tif out.tif

This will create raster with values of 1 everywhere inp.tif had non-zero values.

  1. Then in ArcMap you can use "raster to polygon" tool to get polygon(shapefile).

Output shapefile will have non-quadrilateral boundaries, with multiple polygon vertices, following image's actual boundary.

|improve this answer|||||

If you are interested in a scripted solution, try the gdal command nearblack. You can use the flag -white to retrieve data bounded by white space as well. You can polygonize the output to generate a non-rectangular footprint of the raster data.

##run nearblack
shellcmds = "nearblack -white -o " + outpath + " " + inpath

##run polygonize
shellcmds = "gdal_polygonize.py " + outpath + " -f" + """ "ESRI Shapefile"  """ + outpath2 + " nearblack"
|improve this answer|||||

I believe that, in ArcGIS world you can achive it with 3D Analyst\Conversion\From Raster\Raster Domain tool.

|improve this answer|||||
  • It works only on 3D data, and even then does not give expected results. Doesn't work with Satellite Imagery at all. – Devdatta Tengshe Feb 15 '13 at 9:11
  • Yeah, thats true. I'll leave the answer for others, to be aware of that. – Tomek Feb 15 '13 at 13:54

There is a tool in ArcGIS 3D Analyst called Raster Domain which creates a polygon or polyline footprint of the data portions of a raster dataset - and ignores NoData cells. Worked great for me.

|improve this answer|||||
  • 1
    Welcome to our site! Could you explain how your answer differs from Tomek's? – whuber Apr 12 '13 at 22:04
  • Raster domain worked for me - thanks for your help! – meryloo Oct 29 '14 at 8:44

You could create a raster catalog with a spatial reference assigned, add the raster catalog to ArcMap, and then "Export Footprint". Remember there's the option to create an "UNMANAGED" raster catalog so that you're not making a duplicate of each raster dataset.

|improve this answer|||||

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.