[Geoserver-users] Define GeoServer bounding box using GDAL's WCS Driver

Hello,

Is it possible to define a bounding box in order to request a coverage subset using the GDAL WCS Driver? I’m using the GDAL Java API and need to access raster data delivered using GeoServer.

The driver documentation (http://www.gdal.org/frmt_wcs.html) does not contain a bounding box definition. I attempted to define the bounding box in the xml configuration, but the requests generated by the driver when using gdal.open(wcs.xml) return the entire coverage instead of the requested area.

<WCS_GDAL>
<ServiceURL>http://myserver/geoserver/wcs?</ServiceURL>
<Version>1.1.0</Version>
<CoverageName>MyWorkspace:MyCoverage</CoverageName>
<GetCoverageExtra>&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84</GetCoverageExtra>
</WCS_GDAL>

Ideally, I’d be able to retrieve the required data and process it using tools provided by the GDAL.

I’m able to define a url string (below) containing the desired bounding box, open an HttpUrlConnection, and get a MimeMessage containing the desired raster data as an InputStream. However, I haven’t attempted to use the InputStream to instantiate a GDAL DataSet object.

String url = ["http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84"](http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84);

···
-- 
Patrick

Hi,

The natural usage is that GDAL WCS source covers the whole area where there exist any data but you select only the part that you want while reading data with GDAL. For example the -srcwin and -projwin parameters of the gdal_translate utility http://www.gdal.org/gdal_translate.html perform this task.

I am not a programmer but by looking at http://www.gdal.org/gdal_tutorial.html I guess that you will want to use nXOff, nYOff, nXSize, nYSize arguments. Perhaps having a look at gdal_translate code will reveal what it is doing when user wants to select a subarea with the -projwin parameter.

Your GetCoverageExtra should work also if delimiting coverage to a a fixed value is what you want. If you get now the whole coverage your syntax may be wrong. Documantation says that extra should be url-encoded. Have you tried

<GetCoverageExtra>&amp;BBOX=......</GetCoverageExtra>

-Jukka Rahkonen-

________________________________
Patrick Henson<mailto:phenson@anonymised.com> wrote

Hello,

Is it possible to define a bounding box in order to request a coverage subset using the GDAL WCS Driver? I'm using the GDAL Java API and need to access raster data delivered using GeoServer.

The driver documentation (http://www.gdal.org/frmt_wcs.html) does not contain a bounding box definition. I attempted to define the bounding box in the xml configuration, but the requests generated by the driver when using gdal.open(wcs.xml) return the entire coverage instead of the requested area.

<WCS_GDAL>
<ServiceURL>http://myserver/geoserver/wcs?&lt;/ServiceURL&gt;
<Version>1.1.0</Version>
<CoverageName>MyWorkspace:MyCoverage</CoverageName>
<GetCoverageExtra>&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84</GetCoverageExtra>
</WCS_GDAL>

Ideally, I'd be able to retrieve the required data and process it using tools provided by the GDAL.

I'm able to define a url string (below) containing the desired bounding box, open an HttpUrlConnection, and get a MimeMessage containing the desired raster data as an InputStream. However, I haven't attempted to use the InputStream to instantiate a GDAL DataSet object.

String url = "http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84&quot;&lt;http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84&gt;;

--
Patrick

Thanks for the response. We need to be able to retrieve/deliver only the data that falls within the designated AOI and it is very likely that I'm formatting the GDAL 'GetCoverageExtra' flag or using the GDAL WCS driver incorrectly.

<Version>1.0.0</Version>
<GetCoverageExtra>&BBox=691515.8437877428,3455245.948685151,721085.843,3483925.949</GetCoverageExtra>

<Version>1.1.0</Version>
<GetCoverageExtra>&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84</GetCoverageExtra>

The WCS 1.0.0 delivery has to be requested in UTM, hence the slight difference. However, both return a GDAL Dataset containing the entire coverage, apparently overriding or ignoring the bounds passed in.

Patrick

On 12/4/2013 1:17 AM, Rahkonen Jukka wrote:

Hi,

The natural usage is that GDAL WCS source covers the whole area where there exist any data but you select only the part that you want while reading data with GDAL. For example the -srcwin and -projwin parameters of the gdal_translate utility http://www.gdal.org/gdal_translate.html perform this task.

I am not a programmer but by looking at http://www.gdal.org/gdal_tutorial.html I guess that you will want to use nXOff, nYOff, nXSize, nYSize arguments. Perhaps having a look at gdal_translate code will reveal what it is doing when user wants to select a subarea with the -projwin parameter.

Your GetCoverageExtra should work also if delimiting coverage to a a fixed value is what you want. If you get now the whole coverage your syntax may be wrong. Documantation says that extra should be url-encoded. Have you tried

  <GetCoverageExtra>&amp;BBOX=......</GetCoverageExtra>

-Jukka Rahkonen-

________________________________
Patrick Henson<mailto:phenson@anonymised.com> wrote

Hello,
Is it possible to define a bounding box in order to request a coverage subset using the GDAL WCS Driver? I'm using the GDAL Java API and need to access raster data delivered using GeoServer.
The driver documentation (http://www.gdal.org/frmt_wcs.html) does not contain a bounding box definition. I attempted to define the bounding box in the xml configuration, but the requests generated by the driver when using gdal.open(wcs.xml) return the entire coverage instead of the requested area.

<WCS_GDAL>
<ServiceURL>http://myserver/geoserver/wcs?&lt;/ServiceURL&gt;
<Version>1.1.0</Version>
<CoverageName>MyWorkspace:MyCoverage</CoverageName>
<GetCoverageExtra>&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84</GetCoverageExtra>
</WCS_GDAL>

Ideally, I'd be able to retrieve the required data and process it using tools provided by the GDAL.
I'm able to define a url string (below) containing the desired bounding box, open an HttpUrlConnection, and get a MimeMessage containing the desired raster data as an InputStream. However, I haven't attempted to use the InputStream to instantiate a GDAL DataSet object.

String url = "http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84&quot;&lt;http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84&gt;;

--
Patrick

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi,

It must be because of wrong syntax. Perhaps documentation really means what it says and url encoding instead of XML encoding that I used in my mail. So have a try by changing the "et" character into %26
<GetCoverageExtra>%26BBox ....

-Jukka Rahkonen-

Patrick Henson wrote:

Thanks for the response. We need to be able to retrieve/deliver only

the data that falls within the designated AOI and it is very likely that
I'm formatting the GDAL 'GetCoverageExtra' flag or using the GDAL WCS
driver incorrectly.

<Version>1.0.0</Version>
<GetCoverageExtra>&BBox=691515.8437877428,3455245.948685151,721085.843,3483925.949</GetCoverageExtra>

<Version>1.1.0</Version>
<GetCoverageExtra>&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84</GetCoverageExtra>

The WCS 1.0.0 delivery has to be requested in UTM, hence the slight

difference. However, both return a GDAL Dataset containing the entire
coverage, apparently overriding or ignoring the bounds passed in.

Patrick

On 12/4/2013 1:17 AM, Rahkonen Jukka wrote:

Hi,

The natural usage is that GDAL WCS source covers the whole area where there exist any data but you select only the part that you want while reading data with GDAL. For example the -srcwin and -projwin parameters of the gdal_translate utility http://www.gdal.org/gdal_translate.html perform this task.

I am not a programmer but by looking at http://www.gdal.org/gdal_tutorial.html I guess that you will want to use nXOff, nYOff, nXSize, nYSize arguments. Perhaps having a look at gdal_translate code will reveal what it is doing when user wants to select a subarea with the -projwin parameter.

Your GetCoverageExtra should work also if delimiting coverage to a a fixed value is what you want. If you get now the whole coverage your syntax may be wrong. Documantation says that extra should be url-encoded. Have you tried

  <GetCoverageExtra>&amp;BBOX=......</GetCoverageExtra>

-Jukka Rahkonen-

________________________________
Patrick Henson<mailto:phenson@anonymised.com> wrote

Hello,
Is it possible to define a bounding box in order to request a coverage subset using the GDAL WCS Driver? I'm using the GDAL Java API and need to access raster data delivered using GeoServer.
The driver documentation (http://www.gdal.org/frmt_wcs.html) does not contain a bounding box definition. I attempted to define the bounding box in the xml configuration, but the requests generated by the driver when using gdal.open(wcs.xml) return the entire coverage instead of the requested area.

<WCS_GDAL>
<ServiceURL>http://myserver/geoserver/wcs?&lt;/ServiceURL&gt;
<Version>1.1.0</Version>
<CoverageName>MyWorkspace:MyCoverage</CoverageName>
<GetCoverageExtra>&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84</GetCoverageExtra>
</WCS_GDAL>

Ideally, I'd be able to retrieve the required data and process it using tools provided by the GDAL.
I'm able to define a url string (below) containing the desired bounding box, open an HttpUrlConnection, and get a MimeMessage containing the desired raster data as an InputStream. However, I haven't attempted to use the InputStream to instantiate a GDAL DataSet object.

String url = "http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84&quot;&lt;http://myserver/geoserver/wcs?service=wcs&version=1.1.1&request=GetCoverage&format=image/geotiff&identifier=MyWorkspace:MyCoverage&BoundingBox=65.0104,31.1977,65.3287,31.4623,urn:ogc:def:crs:OGC:1.3:CRS84&gt;;

--
Patrick

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Little more information: GDAL is sending first this request with your sample WCS.XML

GET http://myserver/geoserver/wcs?SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=1.1.0&IDENTIFIERS=MyWorkspace:MyCoverage&FORMAT=text/xml

If you are on Windows, do this for debugging yourself:

- Install Fiddler2
- Open the GDAL command window
- set proxy with
SET HTTP_PROXY http://localhost:8888

Then do
gdal_translate -of GTiff wcs.xml temp.tif

and study what Fiddler shows you about the web traffic.

-Jukka-

Hi,

I made some final tests with default Geoserver installation and nurc:Arc_sample coverage.

Adding extra parameters is possible and "&" must be written as XML encoded.

<WCS_GDAL>
  <ServiceURL>http://localhost:8080/geoserver/wcs?version=1.0.0&amp;&lt;/ServiceURL&gt;
  <CoverageName>nurc:Arc_Sample</CoverageName>
  <GetCoverageExtra>&amp;BoundingBox=65.0104,31.1977,65.3287,31.4623</GetCoverageExtra>
</WCS_GDAL>

This perhaps work because of o tweak and possible Geoserver bug. Notice that version in 1.0.0. and bbox is given as BoundingBox. This results to following GetCoverage and BoundingBox may override on Geoserver side the automatically added BBOX.

http://localhost:8080/geoserver/wcs?version=1.0.0&SERVICE=WCS&VERSION=1.0.0&REQUEST=GetCoverage&COVERAGE=nurc%3AArc_Sample&FORMAT=GeoTIFF&BBOX=-180,-90,180,90&WIDTH=720&HEIGHT=360&CRS=EPSG:4326&BoundingBox=65.0104,31.1977,65.3287,31.4623&Band=1

However, GDAL WCS source is not meant to be used this way. GDAL reads DescribeCoverage and the advertised BBOX from there. You just must learn to use GDAL and add the projected window that you want to read from the coverage. Gdal-dev mailing list will help you in how to do that. Believe me that tweaking with BBOX in the XML definition file is not the right thing.

-Jukka Rahkonen-

Lähettäjä: Rahkonen Jukka [jukka.rahkonen@anonymised.com]
Lähetetty: 6. joulukuuta 2013 1:01
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: Re: [Geoserver-users] Define GeoServer bounding box using GDAL's WCS Driver

Little more information: GDAL is sending first this request with your sample WCS.XML

GET http://myserver/geoserver/wcs?SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=1.1.0&IDENTIFIERS=MyWorkspace:MyCoverage&FORMAT=text/xml

If you are on Windows, do this for debugging yourself:

- Install Fiddler2
- Open the GDAL command window
- set proxy with
SET HTTP_PROXY http://localhost:8888

Then do
gdal_translate -of GTiff wcs.xml temp.tif

and study what Fiddler shows you about the web traffic.

-Jukka-
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users