2

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 Creating shapefile showing footprints of Rasters?, but the answers do not cover postgis.

D3

1

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.

  • 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. – ABX Sep 11 '13 at 7:52
  • 1
    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 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.