2

I'm using QGIS 3.2.8 as a client for my WCS (1.0.0) server. I can successfully add and view layers, and they are displayed with the correct values at the right positions.

However, my use case is to compute zonal statistics on my WCS-served layers. And these are clearly wrong as they always show a count of 0 pixels, no matter what layers I choose as input. And indeed, raster layer properties show me that my WCS-served layer supposedly has height and width of 0 pixels:

{'BAND_COUNT': 1,
'CRS_AUTHID': 'EPSG:4326',
'EXTENT': '20.0000000000000000,59.6923076920306883 : '
'26.8515421779061363,61.0277777780547837',
'HAS_NODATA_VALUE': True,
'HEIGHT_IN_PIXELS': 0,
'NODATA_VALUE': nan,
'PIXEL_HEIGHT': 1.0,
'PIXEL_WIDTH': 1.0,
'WIDTH_IN_PIXELS': 0,
'X_MAX': 26.851542177906136,
'X_MIN': 20.0,
'Y_MAX': 61.027777778054784,
'Y_MIN': 59.69230769203069}

That's suspicious. And more so, I cannot even select "Histogram" from the layer properties - I guess that is due to those false width and height values.

For debugging, I am logging the requests by QGIS in my WCS. This is a sample request, made when I computed the raster layer properties:

http://localhost:8081/wcs/kvp?service=WCS&version=1.0.0&request=GetCoverage&SERVICE=WCS&VERSION=1.0.0&REQUEST=GetCoverage&FORMAT=netcdf&COVERAGE=FI_HROC_L4D_1M.CHL_mean&TIME=2020-01-01T00:00:00Z&BBOX=21.13517266280027229,59.69230769203068832,24.73223230620099855,61.02777777805478365&CRS=EPSG:4326&RESPONSE_CRS=EPSG:4326&WIDTH=943&HEIGHT=352

The CDL of the response NetCDF is

netcdf kvp10 {
dimensions:
    time = 1 ;
    lat = 352 ;
    lon = 943 ;
variables:
    int64 time(time) ;
        time:long_name = "time" ;
        time:standard_name = "time" ;
        time:units = "days since 2020-01-01 00:00:00" ;
        time:calendar = "proleptic_gregorian" ;
    double lat(lat) ;
        lat:_FillValue = NaN ;
        lat:long_name = "y coordinate of projection" ;
        lat:standard_name = "projection_y_coordinate" ;
    double lon(lon) ;
        lon:_FillValue = NaN ;
        lon:long_name = "x coordinate of projection" ;
        lon:standard_name = "projection_x_coordinate" ;
    float CHL_mean(time, lat, lon) ;
        CHL_mean:_FillValue = NaNf ;
        CHL_mean:long_name = "Chlorophyll-a concentration" ;
        CHL_mean:standard_name = "mass_concentration_of_chlorophyll_a_in_sea_water" ;
        CHL_mean:units = "mg m-3" ;
        CHL_mean:valid_min = 0. ;
        CHL_mean:grid_mapping = "crs" ;
    int64 crs ;
        crs:crs_wkt = "GEOGCRS[\"WGS 84\",ENSEMBLE[\"World Geodetic System 1984 ensemble\",MEMBER[\"World Geodetic System 1984 (Transit)\"],MEMBER[\"World Geodetic System 1984 (G730)\"],MEMBER[\"World Geodetic System 1984 (G873)\"],MEMBER[\"World Geodetic System 1984 (G1150)\"],MEMBER[\"World Geodetic System 1984 (G1674)\"],MEMBER[\"World Geodetic System 1984 (G1762)\"],MEMBER[\"World Geodetic System 1984 (G2139)\"],ELLIPSOID[\"WGS 84\",6378137,298.257223563,LENGTHUNIT[\"metre\",1]],ENSEMBLEACCURACY[2.0]],PRIMEM[\"Greenwich\",0,ANGLEUNIT[\"degree\",0.0174532925199433]],CS[ellipsoidal,2],AXIS[\"geodetic latitude (Lat)\",north,ORDER[1],ANGLEUNIT[\"degree\",0.0174532925199433]],AXIS[\"geodetic longitude (Lon)\",east,ORDER[2],ANGLEUNIT[\"degree\",0.0174532925199433]],USAGE[SCOPE[\"Horizontal component of 3D system.\"],AREA[\"World.\"],BBOX[-90,-180,90,180]],ID[\"EPSG\",4326]]" ;
        crs:semi_major_axis = 6378137. ;
        crs:semi_minor_axis = 6356752.31424518 ;
        crs:inverse_flattening = 298.257223563 ;
        crs:reference_ellipsoid_name = "WGS 84" ;
        crs:longitude_of_prime_meridian = 0. ;
        crs:prime_meridian_name = "Greenwich" ;
        crs:geographic_crs_name = "WGS 84" ;
        crs:grid_mapping_name = "latitude_longitude" ;
data:

 time = 0 ;

 lat = 61.0258753990149, 61.0220814807016, 61.0182875623884, 
    61.0144936440752, 61.0106997257619, 61.0069058074487, 61.0031118891355, [...]

 lon = 21.1370819301269, 21.1408964111341, 21.1447108921412, 
    21.1485253731484, 21.1523398541556, 21.1561543351627, 21.1599688161699, [...]

 CHL_mean =
  5.315124, 5.233703, 5.257952, 5.2307, 4.849386, 4.86493, 5.227843, 
    5.232719, 4.819328, 5.192392, 5.173487, 5.082797, 5.130269, 5.094828, [...]
 
 crs = 0 ;
}

It looks fine to me, but still I suspect there is something wrong with my WCS response, I only cannot figure out what exactly. The WCS 1.0.0 specification does not exactly specify the response, so I guess I have to know what QGIS expects to make my WCS work with QGIS.

2

1 Answer 1

1

It turned out that the source of the error was the information the WCS provided in DescribeCoverage.

<spatialDomain>
  ...
  <gml:RectifiedGrid dimension="2" srsName="EPSG:4326">
  <gml:limits>
    <gml:GridEnvelope>
      <gml:low>0 0</gml:low>
      <gml:high>7080 1380</gml:high>
    </gml:GridEnvelope>
  </gml:limits>
  ...
</spatialDomain>

The WCS has to provide as gml:high the width and height of the full scene. Once this was set, it all worked like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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