Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

How to define a BoundingBox when using GDAL's WCS Driver (Java API)?

$
0
0

Is it possible to define a bounding box when requesting a coverage subset using the GDAL WCS Driver, accessed using GDAL’s Java API? I’ve read several mailing lists and related posts on gis.stackexchange, but have not located a clear solution.

The driver documentation (http://www.gdal.org/frmt_wcs.html) does not contain a bounding box definition, unlike the WMS driver. 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>

AND

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

Ideally, I’d be able to retrieve the required data and process it using tools provided by the GDAL. I am 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.

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";

However, I haven’t figured out how to convert the InputStream to a GDAL DataSet object.


Viewing all articles
Browse latest Browse all 397

Trending Articles