[GIS] How to set bounding box in geoserver WCS request

extentsgeoserverwcs

When making the below geoserver WCS request it seems that the BoundingBox param is ignored: &BoundingBox=-86,20,-76,40,urn:ogc:def:crs:EPSG::4269

Is my request written wrong or is BoundingBox not supported with WCS (I do see mention of it in the getcapabilities)? For WMS &bbox=-86,20,-76,40 works.

Here's the full WCS request but it's returning everything in the full extent of the raster (not just the part in the bounding box):

https://geoserver-dev.usanpn.org/geoserver/wcs?service=WCS&version=2.0.1&request=GetCoverage&coverageId=si-x:average_leaf_best&BoundingBox=-86,20,-76,40,urn:ogc:def:crs:EPSG::4269&SUBSET=time(%222003-01-01T00:00:00.000Z%22)&format=geotiff

Best Answer

I recommend to read the WCS 2.0.1 standard https://portal.opengeospatial.org/files/09-110r4.

First thing that you must do is to check the metadata of the coverage with DescribeCoverare. A sample request:

http://demo.geo-solutions.it/geoserver/wcs?service=WCS&version=2.0.1&request=describecoverage&coverageid=nurc__Img_Sample

Read the response and find out the names of the axis, in this case

<gml:Envelope srsName="http://www.opengis.net/def/crs/EPSG/0/4326" axisLabels="Lat Long" uomLabels="Deg Deg" srsDimension="2">

So the axis are "Lat" and "Long". Use them in the subset parameters of the GetCoverage query. For example for an area between 20 and 30 degrees N and between 100 and 90 degrees W use

subset=Lat("20","30")&subset=Long("-100","-90")

The whole request (with URL-encoding) would be like

http://demo.geo-solutions.it/geoserver/wcs?service=WCS&version=2.0.1&request=getcoverage&coverageid=nurc__Img_Sample&subset=Lat(%2220%22,%2230%22)&subset=Long(%22-100%22,%22-90%22)

Your request should work if you rewrite it into

https://geoserver-dev.usanpn.org/geoserver/wcs?service=WCS&version=2.0.1&request=GetCoverage&coverageId=si-x:average_leaf_best&subset=Lat(%2220%22,%2240%22)&subset=Long(%22-86%22,%22-76%22)&SUBSET=time(%222003-01-01T00:00:00.000Z%22)&format=geotiff

I am still not sure if the server at usanpn.org honors the Lat and Long subsets even it does accept the request.

Related Question