New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCS 2.0.1 single band RangeSubset writes out 3-band GeoTIFF #5415

Closed
jratike80 opened this Issue Mar 28, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@jratike80

jratike80 commented Mar 28, 2017

With Mapserver 7.0.0 and with an attached mapfile, the following GetCoverage request that selects only one band with RangeSubset yields a 3-band GeoTIFF which only appears greyscale because the requested BandA is copied to all three bands.

http://localhost/cgi-bin/mapserv?map=wcs_demo_01.map&service=wcs&version=2.0.1&request=GetCoverage&coverageId=orthophotos&FORMAT=image/tiff&SUBSET=x(257000,258000)&SUBSET=y(6997000,6998000)&RangeSubset=BandA

Part of gdalinfo report from the "out.tif" file
Band 1 Block=2000x1 Type=Byte, ColorInterp=Red
Band 2 Block=2000x1 Type=Byte, ColorInterp=Green
Band 3 Block=2000x1 Type=Byte, ColorInterp=Blue

wcs_demo_01.txt

@jratike80

This comment has been minimized.

jratike80 commented May 3, 2017

More information:
This happens with the default GeoTIFF driver. The default driver has also another unwanted feature: it writes a RGB output from multi-band source like RGB-NIR 4-band imagery. It feels like the default IMAGEMODE is RGB even it is documented to be FLOAT32, and that the "wcs_imagemode" metadata item does not have any effect on the default image/tiff outputformat.

Single band / dual band / 4-band output is successful with a self-configured outputformat that sets the imagemode into BYTE.

OUTPUTFORMAT
  NAME GEOTIFF
  DRIVER "GDAL/GTiff"
  MIMETYPE "image/tiff"
  IMAGEMODE BYTE
  EXTENSION "tif"
END

For RBG-NIR imagery it seems also good to add this formatoption that prevents labeling the fourth band as alpha:

FORMATOPTION "ALPHA=UNSPECIFIED"

I wonder if it will be enough to improve the documentation or if the default GeoTIFF outputformat for WCS should be changed in the code. An out-of-the-box support for more than 3 bands would be convenient.

@sanfilippopablo

This comment has been minimized.

sanfilippopablo commented Feb 16, 2018

@jratike80 Is it necessary to add the PROCESSING "BANDS=1,2,3,4" directive for it to output the 4 bands?

Schpidi added a commit to constantinius/mapserver that referenced this issue Mar 22, 2018

@Schpidi

This comment has been minimized.

Member

Schpidi commented Mar 22, 2018

I added tests for this in #5566 hoping this was fixed recently as I can't reproduce. Please re-open if still valid.

@Schpidi Schpidi closed this Mar 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment