2

I want apply a colormap to a monoband grey scale tiff from postgis calling ST_ColorMap.

My query is something like

"SELECT oid, lowrite(lo_open(oid, 131072), tiff) As num_bytes " +
    "FROM ( VALUES (lo_create(0), ST_AsTIFF( ( " +
    "SELECT ST_ColorMap(rast, (select colormap from styles,products where products.original_filename = $1 and products.style_id=styles.id) ) " +
    "FROM raster_query " +
    "WHERE id=$2" +
    ") ) ) ) As v(oid,tiff);",

but when tiff present 0.0 values and colormap maps this value to a RGBA the resulting png doesn't present this map and 0.0 values are lost.

colormap is:

 nodata 0 0 0 0
 100.0 217 0 0 255
 97.1429 235 0 0 255
 94.2857 255 0 0 255
 91.4286 255 65 0 255
 88.5714 255 100 0 255
 85.7143 255 125 0 255
 82.8571 255 150 0 255
 80.0 255 170 0 255
 77.1429 255 190 0 255
 74.2857 255 220 0 255
 71.4286 255 255 0 255
 68.5714 235 255 0 255
 65.7143 200 255 0 255
 62.8571 150 255 0 255
 60.0 100 255 0 255
 57.1429 0 255 0 255
 54.2857 0 255 100 255
 51.4286 0 255 150 255
 48.5714 0 255 200 255
 45.7143 0 255 255 255
 42.8571 0 227 255 255
 40.0 0 200 255 255
 37.1429 0 175 255 255
 34.2857 0 150 255 255
 31.4286 0 100 255 255
 28.5714 0 50 255 255
 25.7143 0 0 255 255
 22.8571 70 0 255 255
 20.0 110 0 255 255
 17.1429 150 0 255 255
 14.2857 190 0 255 255
 11.4286 225 0 255 255
 8.57143 255 0 255 255
 5.71429 255 100 255 255
 2.85714 255 150 255 255
 0.0 255 200 255 255
 nodata 0 0 0 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.