ropensci / mregions2

Access the Marine Regions Gazetteer and the Marine Regions Data Products in R. Maintained by @salvafern.
https://docs.ropensci.org/mregions2/
Other
5 stars 2 forks source link

Access data products via WFS #6

Closed salvafern closed 1 year ago

salvafern commented 2 years ago

This set of functions should be called like mr_ogc_* or mr_wfs_ or mr_dp_* (data products)

We need at least:

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)
salvafern commented 1 year ago

Done from tag v1.0.0 https://github.com/lifewatch/mregions2/commit/644a2207c28f2f36fad52bd0a1bc67b270786281