3

I know that WCS is used to get the "raw" data of a coverage (such as an image), but is it possible to download only a subset of the image, for example a block of pixel 1000*1000 from the original image?

If not, is there a another GeoServer interface for that?

  • 2
    Of course, with standard WCS parameters which are rather different in different WCS versions. Usage is well documented in the standards. – user30184 Apr 22 '16 at 20:51
  • I was trying to find it in the geoserver WCS but they don't say anything about a subset parameter, is there an example how to subset a WCS request? – MikeHuber Apr 22 '16 at 21:52
2

GeoServer provides a WCS Request builder under demos that allows you to construct and/or run WCS requests against your local server. WCS allows you to specify the subset that you require as a bounding box in map units as in this example:

<?xml version="1.0" encoding="UTF-8"?><GetCoverage version="1.0.0" service="WCS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wcs" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xsi:schemaLocation="http://www.opengis.net/wcs http://schemas.opengis.net/wcs/1.0.0/getCoverage.xsd">
  <sourceCoverage>nurc:mosaic</sourceCoverage>
  <domainSubset>
    <spatialSubset>
      <gml:Envelope srsName="EPSG:4326">
        <gml:pos>15.0 40.0</gml:pos>
        <gml:pos>17.0 41.0</gml:pos>
      </gml:Envelope>
      <gml:Grid dimension="2">
        <gml:limits>
          <gml:GridEnvelope>
            <gml:low>0 0</gml:low>
            <gml:high>34 24</gml:high>
          </gml:GridEnvelope>
        </gml:limits>
        <gml:axisName>x</gml:axisName>
        <gml:axisName>y</gml:axisName>
      </gml:Grid>
    </spatialSubset>
  </domainSubset>
  <output>
    <crs>EPSG:4326</crs>
    <format>GeoTIFF</format>
  </output>
</GetCoverage>
2

WCS 2.0 support direct subset call from the url, example like below:

$wcs_url = 'http://127.0.0.1:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCoverage&CoverageId=Canada:canada_clay_250_sl1&subset=Long('.$minX.','.$maxX.')&subset=Lat('.$minY.','.$maxY.')';

You can use Curl to download and store data locally. Same as WCS version 1.0, the two sets of coordinates are bottom left and top right. This will provide you are bounding box for data subset. Check OGC WCS2.0 document here, subset section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.