-
-
Notifications
You must be signed in to change notification settings - Fork 364
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 GetCoverage request should not return multipart response when mediaType unset #6551
Comments
|
Other related issue: https://trac.osgeo.org/mapserver/ticket/3666 |
|
Just found out that by adding: To add to that, the default value of I suspect this is the case for camptocamp/docker-mapserver, since I did not see the multipart response occuring with that Docker image. |
|
I wonder why do you need to add If you do create a GeoTIFF then there must be some other metadata, either coming from the source data or added by Mapserver, that GDAL cannot store into GeoTIFF tags and that triggers the creation of PAM (.aux.xml). |
|
I think it is caused by the Outputformat config: I suppose if you do not have data with NODATA values you will not be running into this issue. Another explanation could be that GDAL has been compiled with a default of |
|
I suppose that in this case GDAL should rather save the nodata value into TIFFTAG_GDAL_NODATA ASCII tag as documented in https://gdal.org/drivers/raster/gtiff.html#nodata-value. Could you try to add `FORMATOPTION "PROFILE=GDALGeoTIFF" to see if it forces GDAL to save the nodata inside TIFF? Another possibility is that GDAL thinks that your nodata value I apologize that we have not been guiding you to right direction before. We should have asked you to show your mapfile and outputformat immediately. |
|
There may indeed be something in my latest guess: However, gdal_translate did not create a PAM file but stored the nodata this way: Not a solution for your original problem but perhaps you should have a look at your nodata value anyway. |
|
@jratike80 thanks for looking into the issue, much appreciated! Your suggestion of using The interesting thing is that the issue occurs with WCS v2.0.1 and not with v1.0.0 (I did not test all available WCS versions). I suppose the wcs 2.0.1 uses a different codepath in Mapserver to generate the geotiff. What is a bit confusing to me is that the NODATA value reported by gdal_info of the geotiff file that has been generated with the curl -s "http://localhost?SERVICE=WCS&VERSION=1.0.0&REQUEST=GetCoverage&FORMAT=GEOTIFF_FLOAT32&COVERAGE=ahn3_5m_dtm&BBOX=231620,580897,235620,584897&CRS=EPSG:28992&RESPONSE_CRS=EPSG:28992&WIDTH=1000&HEIGHT=1000" | gdalinfo /vsistdin/ | grep NoData
> NoData Value=3.40282344818115234The reported NODATA value does not look right, despite that the resulting tif looks good with respect to rendering the NODATA values in QGIS: Any idea what is happening here? |
Sorry no, I am not an expert on NaN values, extreme values of floating point numbers, or inaccuracies in floating point arithmetics but I have seen before that they can make troubles so they are my usual suspects. |
|
Issue of the NaN values with GDAL are partially explained/touch upon in this GDAL issue: |
|
Regarding the NoData value reported by GDAL as export LC_NUMERIC=en_US.UTF-8
gdal_translate -ot float32 -a_nodata 3.4028234663852886e+38 test.tif nodata.tif
# or
export LC_NUMERIC=nl_NL.UTF-8
gdal_translate -ot float32 -a_nodata 3,4028234663852886e+38 test.tif nodata.tifIn the end I added the following outputformat config to my mapfile: Which results in the same curl -s "http://localhost?version=2.0.1&request=GetCoverage&service=WCS&CoverageID=ahn3_5m_dtm&crs=http://www.opengis.net/def/crs/EPSG/0/28992&format=image/tiff&scalesize=x(1000),y(1000)&subset=x(231620,235620)&subset=y(580897,584897)" | gdalinfo /vsistdin/ | grep NoData
> NoData Value=3.4028234663852886e+38 |
|
This bug is really annoying. I'm getting multipart content in WCS 2.0.1 and not in WCS 1.0.0 which is fine... Is this bug fixed or not? |
|
Do you also use some special value as nodata in the outputformat? If you read the comments you'll see that nothing was done for the Mapserver code but the line FORMATOPTION "NULLVALUE=3.4028234663852886e+38" was just fixed in the mapfile. |
|
My Mapserver instance produces map tiles for elevation with BIL16 format, which is used by a 3D globe, but that's not the point. It also happens with ASCII Grid output format. Another user complains about it here: WCS 2.0.1 sends multipart response for ascii grid format Well it's really strange I have no issue with WCS 1.0.0 and when I'm doing the same request, I obtain a multipart response with 4 files. Here are the 4 elements that are present in the multipart response instead of my image data:
If I ask for the same part of the image in a different format, like PNG, I obtain only the image as expected. When using the bil16 output format, I have a Multipart document which content the BIL16 but also auxiliary data I don't care about. According to the documentation that shouldn't happen as I NEVER setup a "mediaType", which enforces a multi-part encoding (the only possible value is "multipart/related") |
|
Mapserver is using GDAL for creating the output. You can simulate what happens by converting a GeoTIFF file into EHdr format https://gdal.org/drivers/raster/ehdr.html
The result contains 4 parts: The meaning of WCS service it to deliver coverage data as original as possible without altering it. So I think that the current behavior is a good default. If the data cannot be expressed properly with one file then it is expressed with as many files as the format requires independently about the mediaType. Certainly the meaning of the WCS standard is not that if the coverage format requires many files then without mediaType only one part would be sent. But if the format supports saving all data and metadata into one file, like GeoTIFF, then the output is only one file. I understand that for some use cases users could want to use WCS in an innovative way and then for example dropping out information about georeferencing and projection would not harm. In that case it may be possible to get the desired result by editing the outputformat:
When it comes to EHdr format, is it even valid without the header file? It seems that the one who complained about the ASCII Grid format was I. I do not remember right now how we resolved that problem but anyway, we have resolved that and we deliver WCS 2.0 data in GeoTIFF and .asc formats and the responses are in single part. About how to resolve your special need to rip off all but the .bil part of your response, I suggest to write mail to mapserver-users list and ask. Maybe some other user has had similar need and resolved it already. |
|
@jratike80 , thanks for your reply. |
|
By reading the WCS 1.0.0 standard Mapserver behaves badly with WCS 1.0.0 and what feels fine to you (and to most other users I think) is a bug.
And if I read the WCS version 1.1.0 right that version does not really support direct single part response at all even if the format itself does not require many files. I believe that option mediaType=multipart/related in WCS 2.0 was meant to produce a similar output than the default output of the previous WCS version:
|
|
I checked that we could not configure Mapserver to serve ascii grid format as single part in 2019. As a workaround we wrote a small routine that separates the .asc part from the multipart response before sending GetCoverage response to our clients and therefore I lost my interest in making test with newer Mapserver versions. A test with gdal_translate shows that with |
|
I've reviewed the code a bit, and I believe what mapserver does is the best it can do
|
Definitely not I would say, and I am not ever sure if it would be more conforming. Or can you show a place in the standard that states that some of the supported formats may require the use of the otherwise optional mediaType=multipart/ |

Expected behavior and actual behavior.
Expected behaviour:
A WCS 2.0.1 GetCoverage request without
mediaType=multipart/relatedandformat=image/tiffparameter should return a response withContent-Type=image/tiff.http://localhost/?service=WCS&Request=GetCoverage&version=2.0.1&CoverageId=coverage&format=image/tiff&subset=x(190365.000,190465.000)&subset=y(444075.000,444175.000)Only WCS 2.0.1 GetCoverage with
mediaType=multipart/relatedparameter should return a multipart response, withContent-Type=multipart/related; boundary=wcs.http://localhost/?service=WCS&Request=GetCoverage&version=2.0.1&CoverageId=coverage&format=image/tiff&subset=x(190365.000,190465.000)&subset=y(444075.000,444175.000)&mediaType=multipart/relatedActual behaviour:
WCS 2.0.1 GetCoverage requests with
format=image/tiffparameter and withoutmediaType=multipart/relatedparameter return a response withContent-Type=multipart/related; boundary=wcs.Background issue
The WCS 2.0.1 specification (page 32) states regarding multipart response the following:
Below Requirement 27
Requirement 29 /req/core/getCoverage-acceptable-mediaType
Table 16
This states clearly that when the
mediaTypeparameter is set tomultipart/relatedthe response must have multi-part encoding.Requirement 27 states that when the
mediaTypeparameter is not set the response should have adhere to theformatparameter. And thus should not return amultipart/relatedrespones. This was also proposed in the old issue as well.Steps to reproduce the problem.
To reproduce the issue first start this Docker container, which runs MapServer v7.6.4 on
http://localhost/?service=WCS&request=getcapabilities:docker run \ --rm -d \ -e MS_MAPFILE=/srv/data/service.map \ -p 80:80 \ --name mapserver-example \ -v `pwd`/example:/srv/data \ pdok/mapserver:7.6.4-buster-lighttpdThen run the following Bash script:
My expectation is that the
WCS 2.0.1 - no multipartrequest returns a response only containing a geotiff file with aContent-Type=image/tiffresponse header.Attached Test Case
example.zip
The text was updated successfully, but these errors were encountered: