1

I Have a problem with novalue datas in my DEM… This is the workflow I did:

  1. my DEM datas are in multiple Arcgis ASCII grids… Each .asc files have a header containing "NODATA_value -99999.00". I opened the in QGIS 3.0.3 and merged them in QGIS
  2. I save my new layer in GeoTiff format, close QGIS and reopen my new GeoTIFF. All the "nodata" values have a value of -99999.
  3. I process my nodata values with gdal_translate -co TILED=YES -of GTiff -a_nodata "-99999" input.tif outputNaN.tif
  4. On QGIS the outputNaN.tif has a correct behaviour, nodata are "no data"
  5. I created a Mapserver 7.0.7 map file:
MAP
  OUTPUTFORMAT
      NAME "GTiff"
      DRIVER GDAL/GTiff
      MIMETYPE "image/tiff"
      IMAGEMODE INT16
      EXTENSION "tif"
  END

  NAME "Modèle numérique de terrain"
    EXTENT  -6.0001389 39.9998611 10.0001389 52.0001389
    MAXSIZE 4096
    PROJECTION
        "init=epsg:2154"
  END

  WEB
    METADATA
        "wcs_label"           "WCS Server"
        "wcs_onlineresource"  "http://localhost/cgi-bin/mapserv?map=/tmp/testNaN.map&"
        "wcs_enable_request" "*"
            "wcs_fees"            "none"
            "wcs_accessconstraints"    "none"
            "wcs_keywordlist"          "wcs,dem"
            "wcs_metadatalink_type"    "TC211"
            "wcs_metadatalink_format"  "text/plain"
            "wcs_metadatalink_href"    "http://localhost"
            "wcs_address"              ""
            "wcs_city"                 "Paris"
            "wcs_stateorprovince"      "IDF"
            "wcs_postcode"             "75000"
            "wcs_country"              "France"
            "wcs_contactelectronicmailaddress" "[email protected]"
            "wcs_contactperson"            "me"
            "wcs_contactorganization"      "unemployed"
            "wcs_contactposition"          "manager"
            "wcs_contactvoicetelephone"    ""
            "wcs_contactfacimiletelephone" ""
            "wms_title"           "WMS Server"
            "wms_onlineresource"  "http://localhost/cgi-bin/mapserv?map=/tmp/testNaN.map&"
            "wms_srs"             "EPSG:2154"
            "wms_enable_request"  "*"
            "wfs_title"          "WFS Server" 
            "wfs_onlineresource" "http://localhost/cgi-bin/mapserv?map=/tmp/testNaN.map&" ## Recommended
            "wfs_srs"            "EPSG:2154 EPSG:4326 EPSG:5698" ## Recommended
            "wfs_abstract"       "WFS Server" 
            "wfs_enable_request" "*"  
      END
    END

  LAYER
        NAME TESTNAN
          DATA "/tmp/outputNaN.tif"
        STATUS ON
        TYPE RASTER
        PROCESSING "SCALE=AUTO"
        PROJECTION
           "init=epsg:2154"
        END
    METADATA
      "wms_title"         "DEM 75m"
      "wcs_description" "Modèle numérique de terrain"
      "wcs_name" "DEM 75m"
      "wcs_label" "DEM (rés: 75m)"
      "wcs_srs" "EPSG:2154"
      "wcs_enable_request" "*"
      "wcs_bandcount" "1"
      "wcs_band_names" "Altitude"
      "Altitude_band_description" "Altitude en mètres"
    END
  END
END
  1. But this layer has now -32768 value where a "nodata" must be found. I tried to play with PROCESSING "NODATA=OFF" or PROCESSING "NODATA=-32768"but without success.

I know how to set in the layer properties in QGIS a transparency of 100% where pixel=-32768 . But I'd prefer to find a better solution. How can achieve this?

9
  • What do you mean with "this layer has now -32768 value where a "nodata" must be found"? You seem to have configurered the tif as a WCS coverage, do you mean that the output of WCS GetCoverage in image/tiff format has that other nodata value?
    – user30184
    Commented Jun 5, 2018 at 7:37
  • Thanks for your comment: by -32768 I mean: When I select my merged tif file and I click with the "info" icon on a zone where I know there is no data I get a "Sans données" in my result window I translated as "No data" When I do the same thing on my layer from my mapserver map I get -32768, when I click in a zone with values I get a correct value. And yes I defined a WCS coverage corresponding to the maximum extent (rectangle) of my DEM datas
    – Ronan L.
    Commented Jun 5, 2018 at 7:52
  • And do you read the image into QGIS through WCS?
    – user30184
    Commented Jun 5, 2018 at 8:09
  • Yes, because in fact I need to share my DEM on a mapserver. It seems that my tif file appears correct when directly opened in QGIS3 but not while served via MasServer 7.
    – Ronan L.
    Commented Jun 5, 2018 at 8:15
  • If you want to know what really happens read your WCS service with direct GetCoverage requests with curl, save the result on disk and check with gdalinfo. But I believe that your issue is real. Perhaps you must write your own GDAL outputformat for image/tiff mapserver.org/mapfile/outputformat.html
    – user30184
    Commented Jun 5, 2018 at 8:19

1 Answer 1

2

I found a solution with help from @user30184.

In the layer METADATA I added two metadatas: "wcs_rangeset_nullvalue" "-99999"wich alone does no do anything but -99999 is my geoTiff "nodata" real value (in the tiff metadata there is a tag nodata=-99999). For working it needs also "wcs_rangeset_name" "DEM 75m" , without this no WCS are sent to the client.

This is my complete and correct map file:

MAP
  OUTPUTFORMAT
      NAME "GTiff"
      DRIVER GDAL/GTiff
      MIMETYPE "image/tiff"
      IMAGEMODE FLOAT32
      EXTENSION "tif"
    TRANSPARENT ON
  END

  NAME "Modèle numérique de terrain"
    EXTENT  -6.0001389 39.9998611 10.0001389 52.0001389
    MAXSIZE 4096
    PROJECTION
        "init=epsg:2154"
  END

  WEB
    METADATA
        "wcs_label"           "WCS Server"
        "wcs_onlineresource"  "http://localhost/cgi-bin/mapserv?map=/tmp/testNaN.map&"
        "wcs_enable_request" "*"
            "wcs_fees"            "none"
            "wcs_accessconstraints"    "none"
            "wcs_keywordlist"          "wcs,dem"
            "wcs_metadatalink_type"    "TC211"
            "wcs_metadatalink_format"  "text/plain"
            "wcs_metadatalink_href"    "http://localhost"
            "wcs_address"              ""
            "wcs_city"                 "Paris"
            "wcs_stateorprovince"      "IDF"
            "wcs_postcode"             "75000"
            "wcs_country"              "France"
            "wcs_contactelectronicmailaddress" "[email protected]"
            "wcs_contactperson"            "me"
            "wcs_contactorganization"      "unemployed"
            "wcs_contactposition"          "manager"
            "wcs_contactvoicetelephone"    ""
            "wcs_contactfacimiletelephone" ""
            "wms_title"           "WMS Server"
            "wms_onlineresource"  "http://localhost/cgi-bin/mapserv?map=/tmp/testNaN.map&"
            "wms_srs"             "EPSG:2154"
            "wms_enable_request"  "*"
            "wfs_title"          "WFS Server" 
            "wfs_onlineresource" "http://localhost/cgi-bin/mapserv?map=/tmp/testNaN.map&" ## Recommended
            "wfs_srs"            "EPSG:2154 EPSG:4326 EPSG:5698" ## Recommended
            "wfs_abstract"       "WFS Server" 
            "wfs_enable_request" "*"  
      END
    END

  LAYER
        NAME TESTNAN
          DATA "/tmp/outputNaN.tif"
        STATUS ON
        TYPE RASTER
        PROCESSING "SCALE=AUTO"
        PROJECTION
           "init=epsg:2154"
        END
    METADATA
      "wms_title"         "DEM 75m"
      "wcs_description" "Modèle numérique de terrain"
      "wcs_name" "DEM 75m"
      "wcs_label" "DEM (rés: 75m)"
      "wcs_srs" "EPSG:2154"
      "wcs_enable_request" "*"
      "wcs_bandcount" "1"
      "wcs_band_names" "Altitude"
      "Altitude_band_description" "Altitude en mètres"
      "wcs_rangeset_nullvalue" "-99999"
      "wcs_rangeset_name" "DEM 75m"      
    END
  END
END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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