TransWikia.com

GeoServer not working with WCS parameters "subsettingcrs" and "outputcrs"

Geographic Information Systems Asked on December 21, 2020

Request GetCapabilities:

http://192.168.0.10:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCapabilities&

Response GetCapabilities (minify):

<wcs:Capabilities xmlns:wcs="http://www.opengis.net/wcs/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gmlcov="http://www.opengis.net/gmlcov/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wcscrs="http://www.opengis.net/wcs/service-extension/crs/1.0" xmlns:int="http://www.opengis.net/WCS_service-extension_interpolation/1.0" version="2.0.1" updateSequence="160" xsi:schemaLocation=" http://www.opengis.net/wcs/2.0 http://schemas.opengis.net/wcs/2.0/wcsGetCapabilities.xsd">
    <ows:ServiceIdentification>
        <ows:Title>Web Coverage Service</ows:Title>
        <ows:Abstract>This server implements the WCS specification 1.0 and 1.1.1, it's reference implementation of WCS 1.1.1. All layers published by this service are available on WMS also.</ows:Abstract>
        <ows:Keywords>
            <ows:Keyword>WCS</ows:Keyword>
            <ows:Keyword>WMS</ows:Keyword>
            <ows:Keyword>GEOSERVER</ows:Keyword>
        </ows:Keywords>
        <ows:ServiceType>urn:ogc:service:wcs</ows:ServiceType>
        <ows:ServiceTypeVersion>2.0.1</ows:ServiceTypeVersion>
        <ows:ServiceTypeVersion>1.1.1</ows:ServiceTypeVersion>
        <ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion>
        <ows:Profile>http://www.opengis.net/spec/WCS/2.0/conf/core</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_protocol-binding_get-kvp/1.0.1</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_protocol-binding_post-xml/1.0</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_crs/1.0/conf/crs-gridded-coverage</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_geotiff-coverages/1.0/conf/geotiff-coverage</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/GMLCOV/1.0/conf/gml-coverage</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/GMLCOV/1.0/conf/special-format</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/GMLCOV/1.0/conf/multipart</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_scaling/1.0/conf/scaling</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_crs/1.0/conf/crs</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_interpolation/1.0/conf/interpolation</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_interpolation/1.0/conf/interpolation-per-axis</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_interpolation/1.0/conf/nearest-neighbor</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_interpolation/1.0/conf/linear</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_interpolation/1.0/conf/cubic</ows:Profile>
        <ows:Profile>http://www.opengis.net/spec/WCS_service-extension_range-subsetting/1.0/conf/record-subsetting</ows:Profile>
        <ows:Fees>NONE</ows:Fees>
        <ows:AccessConstraints>NONE</ows:AccessConstraints>
    </ows:ServiceIdentification>
    <ows:ServiceProvider>
        <ows:ProviderName>The Ancient Geographers</ows:ProviderName>
        <ows:ProviderSite xlink:href="http://geoserver.org"/>
        <ows:ServiceContact>
            <ows:IndividualName>Claudius Ptolomaeus</ows:IndividualName>
            <ows:PositionName>Chief Geographer</ows:PositionName>
            <ows:ContactInfo>
                <ows:Phone/>
                <ows:Address>
                    <ows:City>Alexandria</ows:City>
                    <ows:Country>Egypt</ows:Country>
                    <ows:ElectronicMailAddress>[email protected]</ows:ElectronicMailAddress>
                </ows:Address>
                <ows:OnlineResource xlink:href="http://geoserver.org"/>
            </ows:ContactInfo>
        </ows:ServiceContact>
    </ows:ServiceProvider>
    <ows:OperationsMetadata>
        <ows:Operation name="GetCapabilities">
            <ows:DCP>
                <ows:HTTP><ows:Get xlink:href="http://192.168.0.10:8080/geoserver/wcs?"/></ows:HTTP>
            </ows:DCP>
            <ows:DCP>
                <ows:HTTP><ows:Post xlink:href="http://192.168.0.10:8080/geoserver/wcs?"/></ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="DescribeCoverage">
            <ows:DCP>
                <ows:HTTP><ows:Get xlink:href="http://192.168.0.10:8080/geoserver/wcs?"/></ows:HTTP>
            </ows:DCP>
            <ows:DCP>
                <ows:HTTP><ows:Post xlink:href="http://192.168.0.10:8080/geoserver/wcs?"/></ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetCoverage">
            <ows:DCP>
                <ows:HTTP><ows:Get xlink:href="http://192.168.0.10:8080/geoserver/wcs?"/></ows:HTTP>
            </ows:DCP>
            <ows:DCP>
                <ows:HTTP><ows:Post xlink:href="http://192.168.0.10:8080/geoserver/wcs?"/></ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Constraint name="PostEncoding">
            <ows:AllowedValues>
                <ows:Value>XML</ows:Value>
            </ows:AllowedValues>
        </ows:Constraint>
    </ows:OperationsMetadata>
    <wcs:ServiceMetadata>
        <wcs:formatSupported>application/gml+xml</wcs:formatSupported>
        <wcs:formatSupported>application/gtopo30</wcs:formatSupported>
        <wcs:formatSupported>application/x-gzip</wcs:formatSupported>
        <wcs:formatSupported>image/jpeg</wcs:formatSupported>
        <wcs:formatSupported>image/png</wcs:formatSupported>
        <wcs:formatSupported>image/tiff</wcs:formatSupported>
        <wcs:formatSupported>text/plain</wcs:formatSupported>
        <wcs:Extension>
            <wcscrs:crsSupported>http://www.opengis.net/def/crs/EPSG/0/3857</wcscrs:crsSupported>
            <wcscrs:crsSupported>http://www.opengis.net/def/crs/EPSG/0/4326</wcscrs:crsSupported>
            <int:interpolationSupported>http://www.opengis.net/def/interpolation/OGC/1/nearest-neighbor</int:interpolationSupported>
            <int:interpolationSupported>http://www.opengis.net/def/interpolation/OGC/1/linear</int:interpolationSupported>
            <int:interpolationSupported>http://www.opengis.net/def/interpolation/OGC/1/cubic</int:interpolationSupported>
        </wcs:Extension>
    </wcs:ServiceMetadata>
    <wcs:Contents>
        <wcs:CoverageSummary>
            <wcs:CoverageId>space__NDVI_20_07_2010_p1-4-0-1</wcs:CoverageId>
            <wcs:CoverageSubtype>RectifiedGridCoverage</wcs:CoverageSubtype>
            <ows:WGS84BoundingBox>
                <ows:LowerCorner>36.00720858977759 50.95515233905787</ows:LowerCorner>
                <ows:UpperCorner>36.07061177977759 50.99518248905787</ows:UpperCorner>
            </ows:WGS84BoundingBox>
            <ows:BoundingBox crs="http://www.opengis.net/def/crs/EPSG/0/EPSG:4326">
                <ows:LowerCorner>36.00720858977759 50.95515233905787</ows:LowerCorner>
                <ows:UpperCorner>36.07061177977759 50.99518248905787</ows:UpperCorner>
            </ows:BoundingBox>
        </wcs:CoverageSummary>
    </wcs:Contents>
</wcs:Capabilities>

Request DescribeCoverage:

http://192.168.0.10:8080/geoserver/ows?service=WCS&version=2.0.1&request=DescribeCoverage&coverageId=space:NDVI_20_07_2010_p1-4-0-1&

Response DescribeCoverage:

<wcs:CoverageDescriptions xmlns:wcs="http://www.opengis.net/wcs/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gmlcov="http://www.opengis.net/gmlcov/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:swe="http://www.opengis.net/swe/2.0" xmlns:wcsgs="http://www.geoserver.org/wcsgs/2.0" xsi:schemaLocation=" http://www.opengis.net/wcs/2.0 http://schemas.opengis.net/wcs/2.0/wcsDescribeCoverage.xsd">
    <wcs:CoverageDescription gml:id="space__NDVI_20_07_2010_p1-4-0-1">
        <gml:boundedBy>
            <gml:Envelope srsName="http://www.opengis.net/def/crs/EPSG/0/4326" axisLabels="Lat Long" uomLabels="Deg Deg" srsDimension="2">
                <gml:lowerCorner>50.95515233905787 36.00720858977759</gml:lowerCorner>
                <gml:upperCorner>50.99518248905787 36.07061177977759</gml:upperCorner>
            </gml:Envelope>
        </gml:boundedBy>
        <wcs:CoverageId>space__NDVI_20_07_2010_p1-4-0-1</wcs:CoverageId>
        <gml:coverageFunction>
            <gml:GridFunction>
                <gml:sequenceRule axisOrder="+2 +1">Linear</gml:sequenceRule>
                <gml:startPoint>0 0</gml:startPoint>
            </gml:GridFunction>
        </gml:coverageFunction>
        <gmlcov:metadata>
            <gmlcov:Extension/>
        </gmlcov:metadata>
        <gml:domainSet>
            <gml:RectifiedGrid gml:id="grid00__space__NDVI_20_07_2010_p1-4-0-1" dimension="2">
                <gml:limits>
                    <gml:GridEnvelope>
                        <gml:low>0 0</gml:low>
                        <gml:high>18999 18999</gml:high>
                    </gml:GridEnvelope>
                </gml:limits>
                <gml:axisLabels>i j</gml:axisLabels>
                <gml:origin>
                    <gml:Point gml:id="p00_space__NDVI_20_07_2010_p1-4-0-1" srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
                        <gml:pos>50.995181435632865 36.00721025828259</gml:pos>
                    </gml:Point>
                </gml:origin>
                <gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/4326">0.0 3.3370100000001315E-6</gml:offsetVector>
                <gml:offsetVector srsName="http://www.opengis.net/def/crs/EPSG/0/4326">-2.1068499999999877E-6 0.0</gml:offsetVector>
            </gml:RectifiedGrid>
        </gml:domainSet>
        <gmlcov:rangeType>
            <swe:DataRecord>
                <swe:field name="GRAY_INDEX">
                    <swe:Quantity>
                        <swe:description>GRAY_INDEX</swe:description>
                        <swe:uom code="W.m-2.Sr-1"/>
                        <swe:constraint>
                            <swe:AllowedValues>
                                <swe:interval>0 255</swe:interval>
                            </swe:AllowedValues>
                        </swe:constraint>
                    </swe:Quantity>
                </swe:field>
                <swe:field name="Band2">
                    <swe:Quantity>
                        <swe:description>Band2</swe:description>
                        <swe:uom code="W.m-2.Sr-1"/>
                        <swe:constraint>
                            <swe:AllowedValues>
                                <swe:interval>0 255</swe:interval>
                            </swe:AllowedValues>
                        </swe:constraint>
                    </swe:Quantity>
                </swe:field>
            </swe:DataRecord>
        </gmlcov:rangeType>
        <wcs:ServiceParameters>
            <wcs:CoverageSubtype>RectifiedGridCoverage</wcs:CoverageSubtype>
            <wcs:nativeFormat>image/tiff</wcs:nativeFormat>
        </wcs:ServiceParameters>
    </wcs:CoverageDescription>
</wcs:CoverageDescriptions>

Work GeoServer 2.11.1 and GeoServer 2.13.1 (origin project EPSG:4326):

http://192.168.0.10:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=space:NDVI_20_07_2010_p1-4-0-1&Format=png&subset=Long(36.03592873,36.04893208)&subset=Lat(50.98237063,50.98713902)

enter image description here

GeoServer 2.11.1

http://192.168.0.10:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=space:NDVI_20_07_2010_p1-4-0-1&Format=png&subset=Long(36.03592873,36.04893208)&subset=Lat(50.98237063,50.98713902)&subsettingcrs=http://www.opengis.net/def/crs/EPSG/0/3857&outputcrs=http://www.opengis.net/def/crs/EPSG/0/3857

But GeoServer ignores WCS parameters “subsettingcrs” and “outputcrs”!

GeoServer 2.13.1

http://192.168.0.10:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=space:NDVI_20_07_2010_p1-4-0-1&Format=png&subset=Long(36.03592873,36.04893208)&subset=Lat(50.98237063,50.98713902)&subsettingcrs=http://www.opengis.net/def/crs/EPSG/0/3857&outputcrs=http://www.opengis.net/def/crs/EPSG/0/3857

And

http://192.168.0.10:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=space:NDVI_20_07_2010_p1-4-0-1&Format=png&subset=Long(4011501.236486298,4012948.7627869043)&subset=Lat(6618175.883553186,6619019.079508785)&subsettingcrs=http://www.opengis.net/def/crs/EPSG/0/3857&outputcrs=http://www.opengis.net/def/crs/EPSG/0/3857

<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/2.0 http://schemas.opengis.net/ows/2.0/owsExceptionReport.xsd">
    <ows:Exception exceptionCode="InvalidAxisLabel" locator="Long">
        <ows:ExceptionText>Invalid axis label provided: Long []</ows:ExceptionText>
    </ows:Exception>
</ows:ExceptionReport>

Question

I need a fragment of the source by the bbox of a vector object (ideally by the vector contour).

Source in the projection EPSG:4326, and I need to get a fragment of the original DPI in the projection EPSG:3857.

How to do this?

One Answer

If you use EPSG:3857 for giving the subsets then you must use a) the axis names as they are defined for the SubsettingCRS and b) the coordinates expressed in the SubsettingCRS system.

The axis names can be checked from http://www.opengis.net/def/crs/EPSG/0/3857 and they appear to be

Cartesian 2D CS. Axes: easting, northing (X,Y). Orientations: east, north. UoM: m.

EDIT

The above link does not show axes order directly any more. Details and alternatives can be found from an answer to another question Where do I find CRS axis names?

Instead of using Lat and Long you must use X and Y for the subsets and the easting range must be something like 4011501.2364863,4012948.7627869 and northign range 6619019.07950879,6618175.88355319

Now you can see what is wrong with your subsets.

subset=Long(36.03592873,36.04893208)&subset=Lat(50.98237063,50.98713902)&subsettingcrs=http://www.opengis.net/def/crs/EPSG/0/3857&

If you actually want to do the selection with EPSG:4326 coordinates then you need just to fix the SubsettingCRS into http://www.opengis.net/def/crs/EPSG/0/4326. Or in this case you can leave the SubsettingCRS out because if you look at the DescribeCoverage you can see from the boundedBy that EPSG:4326 is the native CRS of this coverage and SubsettingCRS defaults to that.

Here are a few GetCoverage requests which have been tested to work today (2018-06-06)

Plain GetCoverage

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

GetCoverage with subset given as EPSG:4326 coordinates

https://demo.geo-solutions.it/geoserver/wcs?service=WCS&version=2.0.1&request=getcoverage&coverageid=nurc__Img_Sample&SUBSET=Long(-100,-80)&SUBSET=Lat(30,40)&SubsettingCRS=http://www.opengis.net/def/crs/EPSG/0/4326&format=image/geotiff&

GetCoverage with subset given as EPSG:3857 coordinates. Without OutputCSR the output is also in EPSG:3857

https://demo.geo-solutions.it/geoserver/wcs?service=WCS&version=2.0.1&request=getcoverage&coverageid=nurc__Img_Sample&SUBSET=X(-11131949.079327356,-8905559.263461886)&SUBSET=Y(3503549.843504374,4865942.279503176)&SubsettingCRS=http://www.opengis.net/def/crs/EPSG/0/3857&format=image/geotiff&

GetCoverage with subset given as EPSG:3857 coordinates and output defined to be in EPSG:3857

https://demo.geo-solutions.it/geoserver/wcs?service=WCS&version=2.0.1&request=getcoverage&coverageid=nurc__Img_Sample&SUBSET=X(-11131949.079327356,-8905559.263461886)&SUBSET=Y(3503549.843504374,4865942.279503176)&SubsettingCRS=http://www.opengis.net/def/crs/EPSG/0/3857&format=image/geotiff&OutputCRS=http://www.opengis.net/def/crs/EPSG/0/4326

Correct answer by user30184 on December 21, 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