Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Tweeted twitter.com/StackGIS/status/827922201118724096
added 177 characters in body
Source Link
Kapten-N
  • 265
  • 1
  • 8
 

If "<REQUEST>GetCoverage</REQUEST>" isn't included it seems that GDAL defaults to DescribeCoverage. (EDIT: This is incorrect. GDAL doesn't allow you to do DescribeCoverage. GDAL automatically does DescribeCoverage before it does GetCoverage.) And if version is not included GDAL seems to default to 1.0.0.

In short:In short: I need help with finding a way to fetch a GeoTiff of a small area via WCS.

 
 
 
 

If "<REQUEST>GetCoverage</REQUEST>" isn't included it seems that GDAL defaults to DescribeCoverage. And if version is not included GDAL seems to default to 1.0.0.

In short: I need help with finding a way to fetch a GeoTiff of a small area via WCS.

 

If "<REQUEST>GetCoverage</REQUEST>" isn't included it seems that GDAL defaults to DescribeCoverage. (EDIT: This is incorrect. GDAL doesn't allow you to do DescribeCoverage. GDAL automatically does DescribeCoverage before it does GetCoverage.) And if version is not included GDAL seems to default to 1.0.0.

In short: I need help with finding a way to fetch a GeoTiff of a small area via WCS.

 
 
 
 
We found the problem, but are going to have to bypass GDAL to solve it.
Source Link
Kapten-N
  • 265
  • 1
  • 8

UPDATE: We seem to have found where the trouble lies, but sadly it is a problem that is built into GDAL's handling of WCS requests and it doesn't seem like we can bypass it. Instead we are going to write our own WCS client to fetch the GeoTiff data and then load in into GDAL from memory. See "EDIT 4" at the bottom for details.

The trouble I'm having is in writing the xml string which I send to the server. I either get an error message from the server when I try to fetch the Dataset src or it passes but I've apparently fetched all the data on the server (which can be seen on the size of the raster) despite wanting just a piece of it.

EDIT 3: After URL-escaping the ampersands in the GetCoverageExtra tag the URL is more complete: /geoserver/wcs?SERVICE=WCS&VERSION=1.1.0&REQUEST=GetCoverage&IDENTIFIER=swe%3Anh_riks_Sweref_99_TM_geotiff&FORMAT=image%2Ftiff&BOUNDINGBOX=200025,7699925,200075,7699975,urn:ogc:def:crs:EPSG::3006&RangeSubset=contents&BOUNDINGBOX=372500.0,6164500.0,373000.0,6165000.0,urn:ogc:def:crs:EPSG:3006&WIDTH=200 Something is still off though. There's two bounding boxes! Both the one which is wrong, which seems like some kind of default value, and the one which I wrote. WIDTH is included, but not HEIGHT, however I found that this was my own fault because I screwed up the ampersand before HEIGHT. After fixing it I get the following exception from the server: java.util.ArrayList cannot be cast to net.opengis.ows11.BoundingBoxType. The default value seems to have double colons between EPSG and 3006, but even after adding another colon I get the same error. I also tried to remove the ".0" from the bounding box values.

EDIT 4 (final?): By looking at the GDAL source code we seem to have found what GDAL is doing wrong. When opening a Dataset via WCS GDAL first automatically sends a DescribeCoverage to the server and uses the returned data to set a bounding box. This means that the bounding box is set to cover all the data in the coverage I'm asking for. This bounding box is then sent with the GetCoverage request regardless of what data you try to give GDAL and the server seems to be unable to handle receiving two bounding boxes in a single request. So there seems to be no way of getting a specified area in WCS via GDAL. My colleague is writing a separate class to fetch specific areas from the server without GDAL and then load that data into GDAL from memory. It seems to be the only way for now, other than compiling our own version of GDAL.

The trouble I'm having is in writing the xml string which I send to the server. I either get an error message from the server when I try to fetch the Dataset src or it passes but I've apparently fetched all the data on the server (which can be seen on the size of the raster) despite wanting just a piece of it.

EDIT 3: After URL-escaping the ampersands in the GetCoverageExtra tag the URL is more complete: /geoserver/wcs?SERVICE=WCS&VERSION=1.1.0&REQUEST=GetCoverage&IDENTIFIER=swe%3Anh_riks_Sweref_99_TM_geotiff&FORMAT=image%2Ftiff&BOUNDINGBOX=200025,7699925,200075,7699975,urn:ogc:def:crs:EPSG::3006&RangeSubset=contents&BOUNDINGBOX=372500.0,6164500.0,373000.0,6165000.0,urn:ogc:def:crs:EPSG:3006&WIDTH=200 Something is still off though. There's two bounding boxes! Both the one which is wrong, which seems like some kind of default value, and the one which I wrote. WIDTH is included, but not HEIGHT, however I found that this was my own fault because I screwed up the ampersand before HEIGHT. After fixing it I get the following exception from the server: java.util.ArrayList cannot be cast to net.opengis.ows11.BoundingBoxType. The default value seems to have double colons between EPSG and 3006, but even after adding another colon I get the same error. I also tried to remove the ".0" from the bounding box values.

UPDATE: We seem to have found where the trouble lies, but sadly it is a problem that is built into GDAL's handling of WCS requests and it doesn't seem like we can bypass it. Instead we are going to write our own WCS client to fetch the GeoTiff data and then load in into GDAL from memory. See "EDIT 4" at the bottom for details.

The trouble I'm having is in writing the xml string which I send to the server. I either get an error message from the server when I try to fetch the Dataset src or it passes but I've apparently fetched all the data on the server (which can be seen on the size of the raster) despite wanting just a piece of it.

EDIT 3: After URL-escaping the ampersands in the GetCoverageExtra tag the URL is more complete: /geoserver/wcs?SERVICE=WCS&VERSION=1.1.0&REQUEST=GetCoverage&IDENTIFIER=swe%3Anh_riks_Sweref_99_TM_geotiff&FORMAT=image%2Ftiff&BOUNDINGBOX=200025,7699925,200075,7699975,urn:ogc:def:crs:EPSG::3006&RangeSubset=contents&BOUNDINGBOX=372500.0,6164500.0,373000.0,6165000.0,urn:ogc:def:crs:EPSG:3006&WIDTH=200 Something is still off though. There's two bounding boxes! Both the one which is wrong, which seems like some kind of default value, and the one which I wrote. WIDTH is included, but not HEIGHT, however I found that this was my own fault because I screwed up the ampersand before HEIGHT. After fixing it I get the following exception from the server: java.util.ArrayList cannot be cast to net.opengis.ows11.BoundingBoxType. The default value seems to have double colons between EPSG and 3006, but even after adding another colon I get the same error. I also tried to remove the ".0" from the bounding box values.

EDIT 4 (final?): By looking at the GDAL source code we seem to have found what GDAL is doing wrong. When opening a Dataset via WCS GDAL first automatically sends a DescribeCoverage to the server and uses the returned data to set a bounding box. This means that the bounding box is set to cover all the data in the coverage I'm asking for. This bounding box is then sent with the GetCoverage request regardless of what data you try to give GDAL and the server seems to be unable to handle receiving two bounding boxes in a single request. So there seems to be no way of getting a specified area in WCS via GDAL. My colleague is writing a separate class to fetch specific areas from the server without GDAL and then load that data into GDAL from memory. It seems to be the only way for now, other than compiling our own version of GDAL.

added 1029 characters in body
Source Link
Kapten-N
  • 265
  • 1
  • 8
Loading
added 532 characters in body
Source Link
Kapten-N
  • 265
  • 1
  • 8
Loading
Added latest XML attempt as requested by iant.
Source Link
Kapten-N
  • 265
  • 1
  • 8
Loading
edited title
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading
Source Link
Kapten-N
  • 265
  • 1
  • 8
Loading