TransWikia.com

Extract multiple bands from a raster layer with wps ras:BandSelect

Geographic Information Systems Asked by SamFranklin on December 10, 2020

I’m trying to use the WPS process ras:BandSelect tool to select multiple bands from a 10-band raster layer. Specifically, I want to select band indices "0, 1, 2" from the 10-band image.

The DescribeProcess abstract for ras:BandSelect is "Returns a raster generated by the selection of some bands from the input raster" which suggests selecting multiple bands is possible.

Below is the XML payload that I’m posting to the WPS service. However, this payload ONLY returns band index "0" and not the three bands I’m interested in.

Is selecting multiple bands possible and if so, what synatax can I try next?

Note, WPS server is Geosever 2.15.

<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
      <ows:Identifier>ras:BandSelect</ows:Identifier>
      <wps:DataInputs>
        <wps:Input>
          <ows:Identifier>coverage</ows:Identifier>
          <wps:Reference mimeType="image/tiff" xlink:href="http://geoserver/wcs" method="POST">
            <wps:Body>
              <wcs:GetCoverage service="WCS" version="1.1.1">
                <ows:Identifier>the_layer</ows:Identifier>
                <wcs:DomainSubset>
                  <ows:BoundingBox crs="http://www.opengis.net/gml/srs/epsg.xml#27700">
                    <ows:LowerCorner>bbox_ll</ows:LowerCorner>
                    <ows:UpperCorner>bbox_ur</ows:UpperCorner>
                  </ows:BoundingBox>
                </wcs:DomainSubset>
                <wcs:Output format="image/tiff"/>
              </wcs:GetCoverage>
            </wps:Body>
          </wps:Reference>
        </wps:Input>
        <wps:Input>
          <ows:Identifier>SampleDimensions</ows:Identifier>
          <wps:Data>
            <wps:LiteralData>0 1 2</wps:LiteralData>
          </wps:Data>
        </wps:Input>
        <wps:Input>
          <ows:Identifier>VisibleSampleDimension</ows:Identifier>
          <wps:Data>
            <wps:LiteralData>0 1 2</wps:LiteralData>
          </wps:Data>
        </wps:Input>
      </wps:DataInputs>
      <wps:ResponseForm>
        <wps:RawDataOutput mimeType="image/tiff">
          <ows:Identifier>result</ows:Identifier>
        </wps:RawDataOutput>
      </wps:ResponseForm>
    </wps:Execute>

One Answer

Answering my own question as I found the solution.

Rather than seperating the band indices by a space, you can use multiple inputs, each specifying a single band, in any preferred order:

    <wps:Input>
      <ows:Identifier>SampleDimensions</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>2</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>SampleDimensions</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>1</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>SampleDimensions</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>0</wps:LiteralData>
      </wps:Data>
    </wps:Input>    
    <wps:Input> 
      <ows:Identifier>VisibleSampleDimension</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>0</wps:LiteralData>
      </wps:Data>
    </wps:Input>

Correct answer by SamFranklin on December 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP