Replies: 4 comments 1 reply
-
|
In For the coverage stack, we could in practice also use the same handler for naming the layers that are part of the stack, but it's not supported. FYI The |
Beta Was this translation helpful? Give feedback.
-
|
To clarify I don't think the band should be part of the filename, but could it be in the names of the layers in the Spatraster object? Or could any metadata of the spatraster clarify which layer is which? I was about to try and introduce a hack where I'd assume if there is band A and B then all layers whose name end with "_1" are A and all layers whose name with "_2" are B but what if they are reordered. 🤪 Example (emodnet.wcs but we just call ows4R) with a stack library("emodnet.wcs")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115-3 XML schemas...
#> Loading ISO 19139 codelists...
wcs <- emdn_init_wcs_client(service = "biology")
#> ✔ WCS client created succesfully
#> ℹ Service: <https://geo.vliz.be/geoserver/Emodnetbio/wcs>
#> ℹ Service: "2.0.1"
coverage_id <- "Emodnetbio__cal_fin_19582016_L1_err"
cov <- emdn_get_coverage(
wcs,
coverage_id = coverage_id,
bbox = c(
xmin = 0,
ymin = 40,
xmax = 5,
ymax = 45
),
time = c(
"1958-02-16T01:00:00",
"1962-11-16T01:00:00"
)
)
#> Loading required package: sf
#> Linking to GEOS 3.12.2, GDAL 3.10.3, PROJ 9.4.1; sf_use_s2() is FALSE
#> No encoding supplied: defaulting to UTF-8.
#> ── Downloading coverage "Emodnetbio__cal_fin_19582016_L1_err" ──────────────────
#> <GMLEnvelope>
#> ....|-- lowerCorner: 40 0 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 45 5 "2016-11-16T01:00:00"<GMLEnvelope>
#> ....|-- lowerCorner: 40 0 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 45 5 "2016-11-16T01:00:00"
#> ✔ Coverage "Emodnetbio__cal_fin_19582016_L1_err" downloaded succesfully as a
#> terra <SpatRaster> Stack.
names(cov)
#> [1] "Emodnetbio__cal_fin_19582016_L1_err_1958-02-16T01_00_00_40,0,45,5_1"
#> [2] "Emodnetbio__cal_fin_19582016_L1_err_1958-02-16T01_00_00_40,0,45,5_2"
#> [3] "Emodnetbio__cal_fin_19582016_L1_err_1962-11-16T01_00_00_40,0,45,5_1"
#> [4] "Emodnetbio__cal_fin_19582016_L1_err_1962-11-16T01_00_00_40,0,45,5_2"Created on 2026-01-30 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
-
|
Just with ows4R library("ows4R")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115-3 XML schemas...
#> Loading ISO 19139 codelists...
client <- ows4R::WCSClient$new(
"https://geo.vliz.be/geoserver/Emodnetbio/wcs",
serviceVersion = "2.0.1",
headers = c(
"User-Agent" = "emodnet.wcs R package https://github.com/EMODnet/emodnet.wcs"
),
logger = "DEBUG"
)
#> [ows4R][INFO] OWSGetCapabilities - Fetching https://geo.vliz.be/geoserver/Emodnetbio/wcs?service=WCS&version=2.0.1&request=GetCapabilities
summary <- client$getCapabilities()$findCoverageSummaryById("Emodnetbio__cal_fin_19582016_L1_err")
summary$getDescription()$rangeType$field
#> [ows4R][INFO] WCSDescribeCoverage - Fetching https://geo.vliz.be/geoserver/Emodnetbio/wcs?service=WCS&version=2.0.1&coverageId=Emodnetbio__cal_fin_19582016_L1_err&request=DescribeCoverage
#> Loading required package: sf
#> Linking to GEOS 3.12.2, GDAL 3.10.3, PROJ 9.4.1; sf_use_s2() is FALSE
#> [[1]]
#> <SWEQuantity>
#> ....|-- description
#> ........|-- value: Relative abundance
#> ....|-- nilValues <SWENilValues>
#> ........|-- nilValue [reason=http://www.opengis.net/def/nil/OGC/0/unknown]
#> ............|-- value: 9.969209968386869E36
#> ....|-- uom [code=W.m-2.Sr-1]
#> ....|-- constraint
#> ........|-- AllowedValues
#> ............|-- interval
#> ................|-- value: -3.4028235E38 3.4028235E38
#> [[2]]
#> <SWEQuantity>
#> ....|-- description
#> ........|-- value: Relative error
#> ....|-- nilValues <SWENilValues>
#> ........|-- nilValue [reason=http://www.opengis.net/def/nil/OGC/0/unknown]
#> ............|-- value: 9.969209968386869E36
#> ....|-- uom [code=W.m-2.Sr-1]
#> ....|-- constraint
#> ........|-- AllowedValues
#> ............|-- interval
#> ................|-- value: -3.4028235E38 3.4028235E38
summary$getCoverageStack(
bbox = NULL,
crs = NULL,
time = c(
"1958-02-16T01:00:00",
"1962-11-16T01:00:00"
),
elevation = NULL,
format = NULL,
rangesubset = NULL,
filename = NULL
)
#> [ows4R][INFO] WCSCoverageSummary - Fetching Coverage envelope dimensions by CRS interpretation
#> No encoding supplied: defaulting to UTF-8.
#> [ows4R][INFO] WCSCoverageSummary - Fetching coverage stack with 'temporal' dimension
#> [ows4R][INFO] WCSCoverageSummary - 1958-02-16T01:00:00
#> [ows4R][WARN] WCSCoverageSummary - Coverage without vertical dimension: 'elevation' argument is ignored
#> <GMLEnvelope>
#> ....|-- lowerCorner: 34.95 -75.05 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 75.05 20.05 "2016-11-16T01:00:00"[ows4R][INFO] WCSGetCoverage - Fetching https://geo.vliz.be/geoserver/Emodnetbio/wcs?service=WCS&version=2.0.1&coverageId=Emodnetbio__cal_fin_19582016_L1_err&subset=Lat(34.95,75.05)&subset=Long(-75.05,20.05)&subset=time(%221958-02-16T01:00:00%22)&format=image/tiff&request=GetCoverage
#> [ows4R][INFO] WCSCoverageSummary - 1962-11-16T01:00:00
#> [ows4R][WARN] WCSCoverageSummary - Coverage without vertical dimension: 'elevation' argument is ignored
#> <GMLEnvelope>
#> ....|-- lowerCorner: 34.95 -75.05 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 75.05 20.05 "2016-11-16T01:00:00"[ows4R][INFO] WCSGetCoverage - Fetching https://geo.vliz.be/geoserver/Emodnetbio/wcs?service=WCS&version=2.0.1&coverageId=Emodnetbio__cal_fin_19582016_L1_err&subset=Lat(34.95,75.05)&subset=Long(-75.05,20.05)&subset=time(%221962-11-16T01:00:00%22)&format=image/tiff&request=GetCoverage
#> class : SpatRaster
#> size : 401, 951, 4 (nrow, ncol, nlyr)
#> resolution : 0.1, 0.1 (x, y)
#> extent : -75.05, 20.05, 34.95, 75.05 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> sources : Emodnetbio__cal_fin_19582016_L1_err_1958-02-16T01_00_00.tif (2 layers)
#> Emodnetbio__cal_fin_19582016_L1_err_1962-11-16T01_00_00.tif (2 layers)
#> names : Emodnet~00_00_1, Emodnet~00_00_2, Emodnet~00_00_1, Emodnet~00_00_2Created on 2026-01-30 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
-
|
In the case of coverageStack ideally the names of the layers would be To me having the default contain all the information would make sense. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@eblondel After opening EMODnet/emodnet.wcs#125 in emodnet.wcs, I'm actually also wondering if this is an ows4R feature request: when downloading several bands, several times, several elevations or any combination thereof for WCS with ows4R (
getCoverage()andgetCoverageStack()), could the names of the layers in the resulting raster reflect what band/time/elevation they represent?I see no relevant parameter, but maybe I'm missing something.
Beta Was this translation helpful? Give feedback.
All reactions