Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how can I create a polygon, containing the actual outlines (aka footprint) of a raster file with postgis?

I just need the outlines of the data containing parts of the raster.

ST_PixelAsPolygon creates a complex polygons - but I just need the footprint.

There is a similar question here How do I create a shapefile showing footprints of Rasters?, but the answers do not cover postgis.


share|improve this question

Use the ST_Envelope function:

SELECT ST_Envelope(rast)
  FROM raster_table;

This will return a rectangular bounding box for your raster(s). PostGIS describes what this function returns as:

Returns the polygon representation of the extent of the raster.

share|improve this answer
This gives me just a rectangular envelope (bounding box). I'm looking for a polygon which describes the data area of the raster. With satellite pictures the resulting polygon will be a trapezoidal shape in most cases. – I. Gona Sep 11 '13 at 7:52
The shape can be projection-dependent. Why don't you try ST_PixelAsPolygon followed by ST_ConvexHull? – Arthur Sep 11 '13 at 17:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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