[postgis-users] ST_Value from Polygon

Andreas Forø Tollefsen andreasft at gmail.com
Tue Feb 22 01:27:51 PST 2011


Hi all,

I am working with a large raster dataset that i want to aggregate into
vector grids.
The raster dataset is a landcover dataset, and i want to find which of the
raster values are the most dominant within each of the vector grid cells.

I have been looking at the ST_Value function, but this is not usable
together with the cell polygon.

I have written a script that gives me the raster value of the centroid of
each cell, but i want to find which raster class is the largest.
Hence i need to calculate the area of each raster class within each cell and
select the largest class.

Any idea? So far i have only come this far:

DROP TABLE IF EXISTS globshortpoly;
SELECT priogrid_land.cell, ST_Value(rast, ST_Centroid(cell))
INTO globshortpoly
FROM priogrid_land, globshort
WHERE rast && priogrid_land.cell
LIMIT 1000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110222/7800776f/attachment.html>


More information about the postgis-users mailing list