2

I'm converting to SQL (PostGIS) some raster files (TIFF). Then I'm using those SQL files for queries with MapServer, and displaying it in my app with OpenLayers with no problems. Everything goes well. The TIFF files are like 600KB weight (by the way, the SQL files are like 22MB approx), and I can see with the QGIS explorer that they are Float64 as "Data Type" and -1.7e+308 as "No Data Values" (excuse me if the translations isn't OK, I'm using QGIS in Spanish). As I said, everything is OK.

In MapServer, I have a map file like this:

LAYER
    NAME zonificacion_cabernet_sauvignon_actual_rango5

    TYPE raster
    STATUS ON
    DATA "PG:host=192.168.1.133 port=5432 dbname='XXXXXX' user='postgres' password='XXXXXX' schema='raster' table='XXXXXX' mode='2' where='ano=2014 AND rango_5' "

    PROJECTION
        "init=epsg:32719"
    END
    PROCESSING "SCALE=AUTO"
    OPACITY 80
    CLASS
        NAME ""
        EXPRESSION ([pixel] = 1)
        COLOR "#3399cc"
    END
    CLASS
        NAME ""
        EXPRESSION ([pixel] = 2)
        COLOR "#99cc33"
    END
    CLASS
        NAME ""
        EXPRESSION ([pixel] = 3)
        COLOR "#cc3399"
    END
END

Everything goes well, I can see 3 colors (each for those cases) in the map of my app.

But now, my client, who provides this TIFF files, made a change, and he told me "I will use Integer instead Float". So, I started to replace the SQL files, doing all the previous actions. The TIFF files now are much lighter, they are around 60-70KB and the SQL files like 2MB, but the script on the map file is not working, but if I use this:

EXPRESSION it does:

CLASS
    NAME ""
    EXPRESSION ([pixel] = 85)
    COLOR "#3399cc"
END
CLASS
    NAME ""
    EXPRESSION ([pixel] = 170)
    COLOR "#99cc33"
END
CLASS
    NAME ""
    EXPRESSION ([pixel] = 255 )
    COLOR "#cc3399"

I checked with QGIS Explorer the new TIFFs, and I can see that "Data Type" is now "Byte - Natural Integer of 8 bits" and "No Data Values" are 255

What should I do to my client in order to have TIFF files with correct data? because I need to match the EXPRESSIONwith 1, 2 and 3 (the amount of pixels for each color) but not 85, 170 and 255.

  • As per the Tour there should be only one question asked per question? – PolyGeo Mar 19 '17 at 11:40
  • Finally, the tif files were in Byte, Mapserver couldn't handle it. My client now save them as 32 Integer, and now it's recognizing my EXPRESSION – pmiranda Mar 20 '17 at 13:57

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.