This set of functions should be called like mr_ogc_* or mr_wfs_ or mr_dp_* (data products)
We need at least:
[x] Retrieve list of layers including name, title and abstract. Extra: include column names and data type (easier to write a CQL filter later)
[x] Retrieve the layer (better to download and cache; could use ... to pass any parameter as column_name = "column_value_to_query". This would be transformed into a CQL query)
basic script
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
library(R6)
library(sf)
#> Linking to GEOS 3.6.2, GDAL 2.2.3, PROJ 4.9.3
wfs <- WFSClient$new("https://geo.vliz.be/geoserver/MarineRegions/wfs", "2.0.0", logger = "INFO")
#> [ows4R][INFO] OWSGetCapabilities - Fetching https://geo.vliz.be/geoserver/MarineRegions/wfs?service=WFS&version=2.0.0&request=GetCapabilities
#> Downloading: 8.2 kB Downloading: 8.2 kB Downloading: 8.2 kB Downloading: 8.2 kB Downloading: 8.2 kB Downloading: 8.2 kB Downloading: 16 kB Downloading: 16 kB Downloading: 19 kB Downloading: 19 kB Downloading: 19 kB Downloading: 19 kB Downloading: 19 kB Downloading: 19 kB
caps <- wfs$getCapabilities()
ft <- caps$findFeatureTypeByName("MarineRegions:high_seas")
ft$getAbstract()
#> [1] "High Seas from the VLIZ Maritime Boundaries Geodatabase. The United Nations Convention on the Law of the Sea describes the high seas as ‘all parts of the sea that are not included in the exclusive economic zone, in the territorial sea or in the internal waters of a State, or in the archipelagic waters of an archipelagic State.’ In the Maritime Boundaries Geodatabase, Marine Regions makes available most of the maritime areas defined in the Law of the Sea Convention: Exclusive Economic Zones (EEZ), Territorial Seas (TS), Contiguous Zones (CZ), Internal Waters (IW), Archipelagic Waters (AW) and High Seas (HS).\r\n\r\nFlanders Marine Institute (2020). Maritime Boundaries Geodatabase: High Seas, version 1. Available online at http://www.marineregions.org/ https://doi.org/10.14284/418.\r\n\r\nMethodology: https://www.marineregions.org/eezmethodology.php"
sf <- ft$getFeatures()
#> [ows4R][INFO] WFSDescribeFeatureType - Fetching https://geo.vliz.be/geoserver/MarineRegions/wfs?service=WFS&version=2.0.0&typeName=MarineRegions:high_seas&request=DescribeFeatureType
#> Downloading: 490 B Downloading: 490 B Downloading: 500 B Downloading: 500 B Downloading: 500 B Downloading: 500 B [ows4R][INFO] WFSGetFeature - Fetching https://geo.vliz.be/geoserver/MarineRegions/wfs?service=WFS&version=2.0.0&typeNames=MarineRegions:high_seas&request=GetFeature
sf
#> Simple feature collection with 1 feature and 5 fields
#> geometry type: MULTISURFACE
#> dimension: XY
#> bbox: xmin: -180 ymin: -76.80012 xmax: 180 ymax: 90
#> CRS: NA
#> gml_id X__gid mrgid source
#> 1 high_seas.1 1 63203 https://marineregions.org/eezmethodology.php
#> area_km2 the_geom
#> 1 212881389 MULTISURFACE (POLYGON ((-15...
Created on 2022-05-09 by the [reprex package](https://reprex.tidyverse.org/) (v2.0.1)
This set of functions should be called like
mr_ogc_*
ormr_wfs_
ormr_dp_*
(data products)We need at least:
basic script