2

How do you add a tif image to a MapServer .map file and keep the MapServer image transparent beyond the extent of the tif image?

I have a MapServer .map file with the following OUTPUTFORMAT declarations:

  OUTPUTFORMAT
    NAME "png24"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE RGBA
    TRANSPARENT TRUE
    FORMATOPTION "DPI=100"
  END # OUTPUTFORMAT

  OUTPUTFORMAT
    NAME "print"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE RGBA
    TRANSPARENT TRUE
  END # OUTPUTFORMAT

When I add a tif image as a raster layer, the mapfile becomes opaque and I can't see any background colour or image through it. This opaque change happens outside the extent of the raster image. My raster layer declaration is:

  LAYER
    COMPOSITE
    END # COMPOSITE
    DATA "D:\\raster.tif"
    METADATA
      "epsg"    "28356"
      "coordsys_name"   "GDA94 /  MGA zone 56"
    END # METADATA
    NAME "my raster image"
    PROJECTION
      "proj=utm"
      "zone=56"
      "south"
      "ellps=GRS80"
      "towgs84=0,0,0,0,0,0,0"
      "units=m"
      "no_defs<>"
    END # PROJECTION
    STATUS OFF
    TILEITEM "location"
    TYPE RASTER
    UNITS METERS
  END # LAYER

I have tried adding an alpha band to my raster, and, I have tried making a PROCESSING "BANDS = 1,2,3,4" declaration but these don't appear to help.

4
  • a map file is a configuration file not an output, so the mapfile becomes opaque doesn't make sense; what actual output are we discussing WMS, WCS, something else?
    – nmtoken
    Sep 2 '20 at 7:42
  • Does the same happen with an inline layer?
    – CL.
    Sep 2 '20 at 9:51
  • Yes, the same occurs with an inline layer. Sep 2 '20 at 21:00
  • I assume our output is a WMS raster. I am trying to confirm this. Sep 2 '20 at 21:06

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.