Closed annakrystalli closed 1 year ago
Thanks @annakrystalli for the comprehensive report. I think that's something for which i forgot to add a 'TODO', and EPSG:4326 was still hardcoded in the getBBOX()
of OWSBoundingBox
(common to all OGC WxS capabilities). I've pushed some code for you to test. let me know
Great, I'm back on the project tomorrow so will take a look and let you know!
Just checked and all is working as expected!
I've done some more work and noticed that there might now be a problem with the coordinates returned now through getBBOX()
. They now do not match the boundedBy
limits even though the crs seems correct:
library(ows4R)
#> Loading required package: geometa
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> Loading IANA mime types...
#> No encoding supplied: defaulting to UTF-8.
#> Loading required package: keyring
wcs <- ows4R::WCSClient$new(url = "https://ows.emodnet-humanactivities.eu/wcs",
serviceVersion = "2.0.1", logger = "DEBUG")
#> [ows4R][INFO] OWSGetCapabilities - Fetching https://ows.emodnet-humanactivities.eu/wcs?service=WCS&version=2.0.1&request=GetCapabilities
summary <- wcs$getCapabilities()$findCoverageSummaryById("emodnet__2017_01_st_00")
bbox <- summary$BoundingBox$BoundingBox$getBBOX()
bbox
#> xmin ymin xmax ymax
#> -9763441 1684719 10868459 22822360
attr(bbox, "crs")
#> Coordinate Reference System:
#> User input: EPSG:3857
#> wkt:
#> PROJCRS["WGS 84 / Pseudo-Mercator",
#> BASEGEOGCRS["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)"],
#> ELLIPSOID["WGS 84",6378137,298.257223563,
#> LENGTHUNIT["metre",1]],
#> ENSEMBLEACCURACY[2.0]],
#> PRIMEM["Greenwich",0,
#> ANGLEUNIT["degree",0.0174532925199433]],
#> ID["EPSG",4326]],
#> CONVERSION["Popular Visualisation Pseudo-Mercator",
#> METHOD["Popular Visualisation Pseudo Mercator",
#> ID["EPSG",1024]],
#> PARAMETER["Latitude of natural origin",0,
#> ANGLEUNIT["degree",0.0174532925199433],
#> ID["EPSG",8801]],
#> PARAMETER["Longitude of natural origin",0,
#> ANGLEUNIT["degree",0.0174532925199433],
#> ID["EPSG",8802]],
#> PARAMETER["False easting",0,
#> LENGTHUNIT["metre",1],
#> ID["EPSG",8806]],
#> PARAMETER["False northing",0,
#> LENGTHUNIT["metre",1],
#> ID["EPSG",8807]]],
#> CS[Cartesian,2],
#> AXIS["easting (X)",east,
#> ORDER[1],
#> LENGTHUNIT["metre",1]],
#> AXIS["northing (Y)",north,
#> ORDER[2],
#> LENGTHUNIT["metre",1]],
#> USAGE[
#> SCOPE["Web mapping and visualisation."],
#> AREA["World between 85.06°S and 85.06°N."],
#> BBOX[-85.06,-180,85.06,180]],
#> ID["EPSG",3857]]
summary$getDescription()$boundedBy
#> [ows4R][INFO] WCSDescribeCoverage - Fetching https://ows.emodnet-humanactivities.eu/wcs?service=WCS&version=2.0.1&coverageId=emodnet__2017_01_st_00&request=DescribeCoverage
#> Loading required package: sf
#> Linking to GEOS 3.9.1, GDAL 3.4.0, PROJ 8.1.1; sf_use_s2() is TRUE
#> <GMLEnvelope>
#> ....|-- lowerCorner: -622999.999999999 604000.000000006
#> ....|-- upperCorner: 6885000 7035000.00000001
summary$getBoundingBox()$BoundingBox$attrs$crs
#> [1] "http://www.opengis.net/def/crs/EPSG/0/EPSG:3857"
Created on 2022-08-17 by the reprex package (v2.0.1)
Here's also the header of the downloaded coverage which agrees with the boundaries returned from boundedBy
:
class : SpatRaster
dimensions : 6431, 7508, 1 (nrow, ncol, nlyr)
resolution : 1000, 1000 (x, y)
extent : -623000, 6885000, 604000, 7035000 (xmin, xmax, ymin, ymax)
coord. ref. : ETRS89-extended / LAEA Europe (EPSG:3035)
source : emodnet__2017_01_st_00.tif
name : emodnet__2017_01_st_00
@annakrystalli i'm afraid the info is given in two distinct SRS and not EPSG:3857 for both:
summary$BoundingBox$BoundingBox$getBBOX()
is retrieved through the WCS Capabilities document, and indeed srs is EPSG:3857Still if you do summary$getBoundingBox()$BoundingBox$attrs$crs
you get the BoundingBox SRS associated to the coverage summary as defined in the capabilities: EPSG:3857
summary$getDescription()$boundedBy
is got from the WCS coverage description at https://ows.emodnet-humanactivities.eu/wcs?service=WCS&version=2.0.1&coverageId=emodnet__2017_01_st_00&request=DescribeCoverage If you look at the envelope, we have a different srsName:
In R, if you type summary$getDescription()$boundedBy$attrs$srsName
you will not get EPSG:3857
Hi @eblondel ,
I noticed that the crs information appended to
bbox
objects returned bygetBBOX
are incorrect. The crs seems to default to EPSG:4326 so when the coverage crs deviates from that it returns the correct coordinates but attaches the wrong crs to thecrs
bbox
attribute. In the example below, when usinggetBBOX
on theBoundingBox
returned bygetBoundingBox()
, the coordinates are different but the crs attached is the same as when usinggetWGS84BoundingBox()
(which correctly returns EPSG:4326). The correct crs should be EPSG:3857, as indicated when interrogating theBoundingBox
attrs themselves.Created on 2022-08-09 by the reprex package (v2.0.1)