1

This is a rephrasing of an earlier question that I have deleted.

I have a collection of GeoTiffs that form a mosaic on a GeoServer. These files contain a simple raster of terrain elevation data. I want to be able to use the WCS slicing function to get a single point, by slicing in the X-axis and Y-axis. Problem is that such axes are not defined in the coverage. It appears to only have a single GRAY_INDEX axis.

I've been searching for two days for a solution, but this doesn't seem like a commonly discussed topic as keywords only return a handful of results and few of them are even remotely relevant.

Here's the coverage description, in case it helps with finding an answer:

<?xml version="1.0" encoding="UTF-8"?>
<wcs:CoverageDescriptions
  xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:ows="http://www.opengis.net/ows/1.1"
  xmlns:gml="http://www.opengis.net/gml"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/wcs/1.1.1
  http://***.***.***.***:****/geoserver/schemas/wcs/1.1.1/wcsDescribeCoverage.xsd">
    <wcs:CoverageDescription>
        <ows:Title>nh_riks_Sweref_99_TM_geotiff</ows:Title>
        <ows:Abstract>Generated from ImageMosaic</ows:Abstract>
        <ows:Keywords>
            <ows:Keyword>nh_riks_Sweref_99_TM_geotiff</ows:Keyword>
            <ows:Keyword>WCS</ows:Keyword>
            <ows:Keyword>ImageMosaic</ows:Keyword>
        </ows:Keywords>
        <wcs:Identifier>swe:elev</wcs:Identifier>
        <wcs:Domain>
            <wcs:SpatialDomain>
                <ows:BoundingBox crs="urn:ogc:def:crs:OGC:1.3:CRS84" dimensions="2">
                    <ows:LowerCorner>7.39871779882174 54.79672820200517</ows:LowerCorner>
                    <ows:UpperCorner>27.54744509481714 69.39062671463897</ows:UpperCorner>
                </ows:BoundingBox>
                <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::3006" dimensions="2">
                    <ows:LowerCorner>6100000.000000001 199999.99999999994</ows:LowerCorner>
                    <ows:UpperCorner>7700000.000000002 1000000.0000000001</ows:UpperCorner>
                </ows:BoundingBox>
                <wcs:GridCRS>
                    <wcs:GridBaseCRS>urn:ogc:def:crs:EPSG::3006</wcs:GridBaseCRS>
                <wcs:GridType>urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs</wcs:GridType>
                    <wcs:GridOrigin>200025.0 7699975.0</wcs:GridOrigin>
                    <wcs:GridOffsets>50.0 0.0 0.0 -50.0</wcs:GridOffsets>
                    <wcs:GridCS>urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS</wcs:GridCS>
                </wcs:GridCRS>
            </wcs:SpatialDomain>
        </wcs:Domain>
        <wcs:Range>
            <wcs:Field>
                <wcs:Identifier>contents</wcs:Identifier>
                <wcs:Definition>
                    <ows:AllowedValues>
                        <ows:Range>
                            <ows:MinimumValue>-Infinity</ows:MinimumValue>
                            <ows:MaximumValue>Infinity</ows:MaximumValue>
                        </ows:Range>
                    </ows:AllowedValues>
                </wcs:Definition>
                <wcs:InterpolationMethods>
                    <wcs:Default>nearest neighbor</wcs:Default>
                </wcs:InterpolationMethods>
                <wcs:Axis identifier="Bands">
                    <wcs:AvailableKeys>
                        <wcs:Key>GRAY_INDEX</wcs:Key>
                    </wcs:AvailableKeys>
                </wcs:Axis>
            </wcs:Field>
        </wcs:Range>
        <wcs:SupportedCRS>urn:ogc:def:crs:EPSG::3006</wcs:SupportedCRS>
        <wcs:SupportedCRS>EPSG:3006</wcs:SupportedCRS>
        <wcs:SupportedCRS>urn:ogc:def:crs:EPSG::4326</wcs:SupportedCRS>
        <wcs:SupportedCRS>EPSG:4326</wcs:SupportedCRS>
        <wcs:SupportedFormat>image/png</wcs:SupportedFormat>
        <wcs:SupportedFormat>image/jpeg</wcs:SupportedFormat>
        <wcs:SupportedFormat>image/tiff</wcs:SupportedFormat>
    </wcs:CoverageDescription>
</wcs:CoverageDescriptions>

This is my attempt at using slice on the coverage:

<wcs:GetCoverage xmlns:wcs="http://www.opengis.net/wcs/2.0"
  xmlns:gml="http://www.opengis.net/gml/3.2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/wcs/2.0 ../../wcsAll.xsd"
  service="WCS" version="2.0.1">
    <wcs:CoverageId>swe:elev</wcs:CoverageId>
    <wcs:DimensionSlice>
        <wcs:Dimension>x</wcs:Dimension>
        <wcs:SlicePoint>588000</wcs:SlicePoint>
    </wcs:DimensionSlice>
    <wcs:DimensionSlice>
        <wcs:Dimension>y</wcs:Dimension>
        <wcs:SlicePoint>6228000</wcs:SlicePoint>
    </wcs:DimensionSlice>
    <wcs:Output store="true" format="image/tiff">
        <wcs:GridCRS>
            <wcs:GridBaseCRS>urn:ogc:def:crs:EPSG::3006</wcs:GridBaseCRS>
            <wcs:GridType>urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs</wcs:GridType>
            <wcs:GridOrigin>200025 7699975</wcs:GridOrigin>
            <wcs:GridOffsets>50 0 0 -50</wcs:GridOffsets>
            <wcs:GridCS>urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS</wcs:GridCS>
        </wcs:GridCRS>
    </wcs:Output>
</wcs:GetCoverage>

The server returns an error that the axis 'x' doesn't exist.

  • 1
    With WCS 2.0 it might go by making a request with so that you give only one value as a SUBSET range for X and Y. See DescribeCoverage for seeing what are the real axis names for your coverage. – user30184 Nov 14 '17 at 17:27
  • Could you elaborate? From what I see from DescribeCoverage is that the only axis name is GRAY_INDEX (I already pasted the result into the question). – Kapten-N Nov 15 '17 at 8:59
  • 1
    Slicing is an operation of the WCS, not something that can be enabled in the data – nmtoken Nov 15 '17 at 9:10
  • 1
    Spatial dimensions come from the coordinate system of the output. If it is EPSG:4326 then there are automatically axis for latitude and longitude. You don't need to add them through the configuration, nor can you take them away. – user30184 Nov 15 '17 at 9:52
  • 1
    You must slice with the axis names that you read from the DescribeCoverarage of your server. If you show the WCS 2.0.1 DescribeCoverage I can have a look. – user30184 Nov 15 '17 at 10:32
1

Have a look at the "nurc__Img_Sample" coverage http://demo.geo-solutions.it/geoserver/wcs?service=WCS&version=2.0.1&request=DescribeCoverage&coverageID=nurc__Img_Sample

Find the axis names

<gml:boundedBy>
<gml:Envelope srsName="http://www.opengis.net/def/crs/EPSG/0/4326" axisLabels="Lat Long" uomLabels="Deg Deg" srsDimension="2">
<gml:lowerCorner>20.7052 -130.85168</gml:lowerCorner>
<gml:upperCorner>54.1141 -62.0054</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>

Ok, the names are "Lat" and "Long". Make a query with a slice point by using subsets like

&subset=Long("-100")&subset=Lat("22")

Send the query and you will get back a GeoTIFF that contains one pixel

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

Verify with gdalinfo

gdalinfo nurc__Img_Sample.tif
Driver: GTiff/GeoTIFF
Files: nurc__Img_Sample.tif
Size is 1, 1
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
GeoTransform =
  22.0460254180602, 0, -0.05586772575250837
  -99.96540382502543, 0.07003690742624616, 0
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (      22.046,     -99.965) ( 22d 2'45.69"E, 99d57'55.45"S)
Lower Left  (      21.990,     -99.965) ( 21d59'24.57"E, 99d57'55.45"S)
Upper Right (      22.046,     -99.895) ( 22d 2'45.69"E, 99d53'43.32"S)
Lower Right (      21.990,     -99.895) ( 21d59'24.57"E, 99d53'43.32"S)
Center      (      22.018,     -99.930) ( 22d 1' 5.13"E, 99d55'49.39"S)
Band 1 Block=16x16 Type=Byte, ColorInterp=Red
  NoData Value=0
Band 2 Block=16x16 Type=Byte, ColorInterp=Green
  NoData Value=0
Band 3 Block=16x16 Type=Byte, ColorInterp=Blue
  NoData Value=0

It looks that the longitude value 100 that we used in the request is not inside the returned pixel. That may be a bug.

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.