[postgis-users] ST_SetValue problem

Hugues François hugues.francois at irstea.fr
Tue Nov 19 07:04:23 PST 2013


Hello,

Did you try with a new raster

CREATE TABLE schema.data_raster_newval AS

SELECT rid,  ST_SetValue(rast,1, geom, 100) AS RAST
FROM schema.data_raster, schema.data_vector

What is the result ?

Since you have only one tile, I don't think the intersect statement will really improve performances.

Hugues.

-----Message d'origine-----
De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] De la part de Sebastian Schutte
Envoyé : mardi 19 novembre 2013 14:42
À : postgis-users at lists.osgeo.org
Objet : [postgis-users] ST_SetValue problem

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
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list