[gdal-dev] Bounding box restriction in WCS driver

Frank Warmerdam warmerdam at pobox.com
Thu Mar 20 15:50:05 EDT 2008


Lúbia Vinhas wrote:
> Hi,
> 
> I'm trying to use the GDAL driver to access a WCS server,
> and it worked fine. Except that it seems that it doesn't recognize
> the bounding box restriction... it always returns the entire coverage.
> 
> I tried two different descriptions for the coverage:
> 
> 1)  using the GDAL elements:
> 
> <WCS_GDAL>
> <ServiceURL>http://nsidc.org/cgi-bin/atlas_north?SERVICE=WCS&amp;request=GetCoverage&amp;crs=EPSG:32661</ServiceURL>
> <CoverageName>sea_ice_concentration_01</CoverageName>
> <PreferredFormat>GeoTIFF</PreferredFormat>
> <GetCoverageExtra>&amp;resx=25000&amp;resy=25000&amp;bbox=-2500000,-2500000,6700000,6700000</GetCoverageExtra> 
> </WCS_GDAL>
> 
> 2) setting the parameters in the serviceURL  element:
> <WCS_GDAL>
> <ServiceURL>http://nsidc.org/cgi-bin/atlas_north?SERVICE=WCS&amp;request=GetCoverage&amp;crs=EPSG:32661&amp;format=GeoTIFF&amp;resx=25000&amp;resy=25000&amp;bbox=-2500000,-2500000,6700000,6700000</ServiceURL>
> <CoverageName>sea_ice_concentration_01</CoverageName>
> </WCS_GDAL>
> 
> I always get the entire coverage, even when I specify a smaller BB. The server
> works fine, I mean it responds to different bounding boxes or resolutions when
> being accessed by other clients. 
> 
> Can anyone give me a hint about it?

Lúbia,

The GDAL WCS driver will always push it's own BBOX values into the URL
it uses internally to make requests, so it is dangerous to put a BBOX
into either the base url or the GetCoverageExtra as this results in two
BBOXes being sent to the remote server.

Ideally you would just request a subarea of the whole coverage
from GDAL instead of trying to configure the WCS service to only
know about a subarea.

So for instance, do something like:

gdal_translate -projwin 2500000 -2500000 6700000 6700000 your.wcs out.tif

Then the GDAL driver should only make the necessary requests to satisfy your
request (or possibly a little extra if it is doing it in tile oriented
chunks).

If you really wanted to treat it as a restricted WCS you would need to
substantially doctor the coverage fetched and kept in the XML service
file.  For instance, in a WCS 1.0 service you could modify:

         <RectifiedGrid dimension="2">
           <limits>
             <GridEnvelope>
               <low>0 0</low>
               <high>189235 273028</high>
             </GridEnvelope>
           </limits>
           <axisName>x</axisName>
           <axisName>y</axisName>
           <origin>
             <pos>-82.351242 13.0499433</pos>
           </origin>
           <offsetVector>0.00025602 0</offsetVector>
           <offsetVector>0 -0.00025602</offsetVector>
         </RectifiedGrid>

to refer only to a subarea.

But this is a pretty dangerous approach.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list