[postgis-users] ST_SetValue problem

Sebastian Schutte sebastian.schutte at icr.gess.ethz.ch
Tue Nov 19 05:41:52 PST 2013


Dear Postgis list,

I have been struggling for a while with a seemingly simple raster
operation in postgis. I have a small number of quadratic polygons
arranged like a chessboard. The cells of this chessboard contain values
like elevation that I would like to write into a much larger raster
layer with one band. To check whether I was on the right track with
ST_SetValue, I tried to set the raster values of the cells that
intersect with any of my polygons to some value (100 in this example):

UPDATE     schema.data_raster SET rast = ST_SetValue(rast,1, geom, 100)
FROM     schema.data_vector

I also tried a variant with "WHERE   ST_Intersects(rast,geom)"

The raster dataset has only one tile, but I assumed this would not be
important for the task at hand (expect maybe for longer runtimes of the
query).

ST_SetValue is supposed to work with arbitrary geometries:
http://postgis.net/docs/RT_ST_SetValue.html . The result is that I
change raster values in only 1 of the 81 polygon cells that I have in
schema.data_vector. What am I missing here? Thanks for your help! Keep
up the great work!

All the best,
Sebastian


More information about the postgis-users mailing list