[postgis-users] Queries and (helper) functions for viewing and analysing PostGIS Raster data?

Stefan Keller sfkeller at gmail.com
Thu Nov 25 09:25:27 PST 2010

I'm still trying to understand PostGIS Raster especially regarding
analysis and viewing PostGIS raster data. Let's begin with the latter.

=> What are the pros & cons to do this (and which is preferred?):
ST_DumpAsPolygons or ST_PixelAsPolygons?

Here is an example for viewing PostGIS Raster e.g. in OpenJUMP I found
in the Tutorial
(http://trac.osgeo.org/postgis/wiki/WKTRasterTutorial01 )

FROM srtm_tiled
WHERE rid=3278;

This seems to polygonize raster to vector. Unfortunately it's not
explained in the tutorial what the constraint clause "rid=3278" means:
it's obviously a single, distinct tile(?). From the book "PostGIS in
Action": "ST_DumpAsPolygons returns a set of single polygon, pixvalue
pairs for a given raster band and relies on the GDAL library. In many
cases this function will be easier and faster to use than going down
to the level of the pixel using ST_Value.". A solution for doing this
I found here as a pl/pgsql function called ST_PixelAsPolygons

Analysis: Regarding analysis I'd like to begin with the observation,
that all examples I've found so far are polygonizing rasters to
vector. From the tutorial doing overlay:

CREATE TABLE caribou_srtm_inter AS
  (ST_Intersection(rast, the_geom)).geom AS the_geom,
  (ST_Intersection(rast, the_geom)).val
FROM cariboupoint_buffers_wgs,
WHERE ST_Intersects(rast, the_geom);

=> What is the intended exact result type of this overlay operation
query (ST_Intersects)? POINT?
=> Which query would generate another raster layer (instead of a point
vector like in the above example)?

Yours, S.

More information about the postgis-users mailing list