Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a tiled raster in a PostGIS table and I would like to change the value of all pixels which have values less than 0 to -9999. How should I do this?

I suspect it involves ST_SetValue and possibly a SQL sub-statement, but I'm not sure how to put these together.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Comprehensive raster functionality is apparently rather new to PostGIS, but the official reference should be helpful:

http://postgis.net/docs/manual-2.0/RT_reference.html

I think this is the desired function, with examples:

http://postgis.net/docs/manual-2.0/RT_ST_Reclass.html

And for constructing the reclassarg, the docs are a little hazier:

http://postgis.net/docs/manual-2.0/reclassarg.html

I think it should be something along the lines of:

'(-999999-0):-9999,[0-999999]:0-999999'

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.