Hi all,<div><br></div><div>I am working with a large raster dataset that i want to aggregate into vector grids.</div><div>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.</div>
<div><br></div><div>I have been looking at the ST_Value function, but this is not usable together with the cell polygon.</div><div><br></div><div>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.</div>
<div>Hence i need to calculate the area of each raster class within each cell and select the largest class.</div><div><br></div><div>Any idea? So far i have only come this far:</div><div><br></div><div><div>DROP TABLE IF EXISTS globshortpoly;</div>
<div>SELECT priogrid_land.cell, ST_Value(rast, ST_Centroid(cell))</div><div>INTO globshortpoly</div><div>FROM priogrid_land, globshort</div><div>WHERE rast && priogrid_land.cell </div><div>LIMIT 1000</div></div>