A few questions about MapServer WCS

Rahkonen Jukka Jukka.Rahkonen at MMMTIKE.FI
Thu Oct 25 02:49:07 PDT 2007


> -----Alkuperäinen viesti-----
Frank Warmerdam wrote:

> Rahkonen Jukka wrote:
> > 1. Is it possible to set up a raster layer for delivering 7-band 
> > imagery in GeoTIFF/img formats? If it is, how?  I tried 
> > with setting "wcs_bandcount"
> > "7" in the LAYER METADATA, but that lead to error message 
> > saying that 
> > band count can not be higher that  four.
> 
> Jukka,
> 
> I suspect the problem relates to the selection of output format.
> 
> MapServer pre-declares an output format called "GTiff" which 
> is an RGB (or possibly RGBA) mode output format.  It also has 
> the mime type "image/tiff".  I suspect you are selecting the 
> format image/tiff via WCS and getting that built in 
> declaration instead of your own with the all important "BYTE" 
> imagemode.
> 
> My suggestion is either to use the name "GTIFF" for your 
> outputformat declaration (pre-empting the built in one) or 
> select the GeoTIFF output format by name instead of mimetype.

Hi Frank, 

Thanks, the problem really was caused by a misspelling in mapfile
and therefore imagemode BYTE was not used.

> > 2. Does layer PROCESSING directives have any effect with 
> > WCS?  I was 
> > trying to select certain bands from 7-band imagery by setting for 
> > example PROCESSING "BANDS=7,4,2" in LAYER definitions, but 
> > I received 
> > always just band combination 1,2,3.  In this case I used 
> > "wcs_bandcount" "3".  In addition to BANDS I would like to use also 
> > LUT and RESAMPLE options with WCS.
> 
> I believe the bands selector is superceeded by the bands 
> selected in the WCS call.

I made a test and I can affirm that "PROCESSING BANDS" in layer 
definitions is just discarded in WCS.

> Resampling types "NEAREST" and "BILINEAR" should be support 
> via WCS but have to be passed in via the WCS request.  I 
> don't think you can establish defaults in the mapfile.

MapServer WCS DescribeCoverage is listing nearest neigbour and
bilinear as supported interpolation methods so this should really
be possible.  From an OGC document
05-076_Web_Coverage_Service_WCS_Version_1.0.0_Corrigendum.pdf
I found that different interpolations should be asken in WCS 
request with key INTERPOLATION = interpolation-method.  I tried 
to add &interpolation=bilinear to my request. Request was accected
and I received three-band image as I was ordering, but it appears
like greyscale image on screen and I believe that all three 
channels are actually the same. I put my requests in the end of
this e-mail so somebody can check if there is something wrong 
it.

> I suspect the LUT operations are processed only in the image 
> modes other than "pure data".  That is, IMAGEMODE BYTE likely 
> precludes their use as things stand.  I could look at 
> altering this if you wanted.

I do not have any immediate use for that feature. But if somebody
is utilising LUT operations and keeps unadjusted images on server 
and delivers them through LUT processing to WMS, then images 
downloaded through WCS service would not look the same. But anyhow,
LUT processing works perhaps only for 1 of 3 band imagery and thus
it would not be useful for multichannel images in any case.

I prepared a minimum mapfile that allows me to download any bands 
I wish from 7-band Landsat image in GeoTIFF format. I was thinking 
that if somebody first checks if it makes sense then it could be 
added to MapServer WCS use case document.  I know the mapfile is 
not the most simple because I have there two projections, epsg:3067 
and 32636, but this is something I do know to work with my data.

Regards,

-Jukka Rahkonen-

Working wget request for the attached mapfile is like:

wget -O test321.tif "http://localhost:8060/cgi-bin/mapserv.exe?map=d:/ms4w/apps/data/wcs_minimal.map&SERVICE=WCS&VERSION=1.0.0&REQUEST=getcoverage&coverage=Baltic&CRS=epsg:3067&format=GEOTIFF&BBOX=544809.000,7301945.000,549807.000,7306943.000&ResX=30&ResY=30&bands=3,2,1"

(The otherwise same request ending
 "...bands=3,2,1&interpolation=bilinear" gives me for some
reason a three-channel grey image)

My mapfile is as follows.  I must say that I do not understand 
clearly the meaning of _rangeset_ items but by adding them I 
could make image bands selectable.

MAP
  NAME "Landsat_Baltic_WCS"
  STATUS ON
  EXTENT -1443340 5783960 613100 8033100
  SIZE 1000 1000 
  SHAPEPATH "d:/ms4w/apps/data"
    IMAGECOLOR 255 255 255
  UNITS METERS
  PROJECTION
    "init=epsg:32636" 
  END
  
  OUTPUTFORMAT
    NAME GEOTIFF
    MIMETYPE "image/tiff"
    DRIVER "GDAL/GTiff"
    EXTENSION "tif"
    IMAGEMODE "BYTE"
    END
    
  WEB
      IMAGEPATH "d:/ms4w/apps/data"
      IMAGEURL "/MS_TMP/"
     METADATA
      "ows_title"   "MapServer WCS for Baltic Sea Landsat imagery"
      "wws_onlineresource" "http://localhost:8060/cgi-bin/mapserv.exe?map=d:/ms4w/apps/data/WCS_minimal.map"
      "ows_label" "JRA_WCS"
     END
  END
  
  LAYER
        NAME "Baltic"
        STATUS DEFAULT
        TYPE RASTER
        PROCESSING "SCALE=AUTO"
        DATA "t:/baltic.img"
        UNITS METERS
          PROJECTION
            "init=epsg:32636" 
          END
        DUMP TRUE
        METADATA
              "wcs_description" "WCS service for Baltic Landsat imagery"
              "wcs_name" "Baltic"
              "ows_label" "JRA_WCS"
              "ows_srs" "EPSG:32636"
              "ows_extent" "-1443340 5783960 613100 8033100"
              "wcs_resolution" "28.5 28.5"
              "wcs_bandcount" "7"
              "wcs_rangeset_axes" "bands"
              "wcs_rangeset_label" "Landsat channels"
	        "wcs_rangeset_name" "bands"
              "wcs_formats" "GEOTIFF"
        END
  END
END



More information about the MapServer-users mailing list