Title: | Access Data from Marineregions.org: Gazetteer & Data Products |
---|---|
Description: | Explore and retrieve marine geospatial data from the Marine Regions Gazetteer <https://marineregions.org/gazetteer.php?p=webservices> and the Marine Regions Data Products <https://marineregions.org/webservices.php>. |
Authors: | Salvador Jesús Fernández Bejarano [aut, cre] (<https://orcid.org/0000-0003-0535-7677>, salvafern), Lotte Pohl [aut] (<https://orcid.org/0000-0002-7607-7018>, lottepohl), Julia Gustavsen [rev], Muralidhar M.A. [rev], Sheila M. Saia [rev], LifeWatch Belgium [fnd] (lifewatch.be) |
Maintainer: | Salvador Jesús Fernández Bejarano <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.1 |
Built: | 2024-12-21 06:13:53 UTC |
Source: | https://github.com/ropensci/mregions2 |
Get the geometries of a Marine Regions Geo-Object
gaz_geometry(x, ...) ## S3 method for class 'numeric' gaz_geometry(x, ...) ## S3 method for class 'mr_df' gaz_geometry(x, ...)
gaz_geometry(x, ...) ## S3 method for class 'numeric' gaz_geometry(x, ...) ## S3 method for class 'mr_df' gaz_geometry(x, ...)
x |
object to retrieve the geometries from. Accepted:
|
... |
Arguments passed on to
|
You can pass the output of most gaz_*
functions to gaz_geometry()
to retrieve the
geometry the gazetteer entry. The data frame is then transformed into a sf::sf object.
This is done in the method gaz_geometry.mr_df()
. mr_df
is a class defined in
this package to ensure the data frame passed to gaz_geometry has a variable with MRGID.
A sfc object (default), a sf data frame, a WKT string or an RDF object
gaz_geometry(3293) gaz_geometry(3293, format = "wkt") gaz_geometry(3293, format = "rdf") gaz_search(3293) |> gaz_geometry()
gaz_geometry(3293) gaz_geometry(3293, format = "wkt") gaz_geometry(3293, format = "rdf") gaz_search(3293) |> gaz_geometry()
Walk the hierarchy of the MarineRegions Gazetter given a Gazetteer MRGID or Gazetteer entries
gaz_relations(x, ...) ## S3 method for class 'numeric' gaz_relations(x, ...) ## S3 method for class 'mr_df' gaz_relations(x, ...)
gaz_relations(x, ...) ## S3 method for class 'numeric' gaz_relations(x, ...) ## S3 method for class 'mr_df' gaz_relations(x, ...)
x |
the object from which the relations are retrieved. Can be:
|
... |
Arguments passed on to
|
You can pass the output of most gaz_*
functions to gaz_relations()
to retrieve the
related gazetteer entries
This is done in the method gaz_relations.mr_df()
. mr_df
is a class defined in
this package to ensure the data frame passed to gaz_relations has a variable with MRGID.
A data frame with Gazetteer entries
# Get the relations of the Belgian Exclusive Economic Zone gaz_search("Belgian Exclusive Economic Zone") |> gaz_relations() # Or using its mrgid gaz_relations(3293)
# Get the relations of the Belgian Exclusive Economic Zone gaz_search("Belgian Exclusive Economic Zone") |> gaz_relations() # Or using its mrgid gaz_relations(3293)
RESTful service REST (REpresentational State Transfer) is a simple stateless architecture that generally runs over HTTP.
mregions2 makes use of the RESTful API created and maintained by
Marine Regions. The functions with names starting as gaz_rest_*
perform
HTTP requests to read the Marine Regions REST API.
They are closer to the definition of each function in the Marine Regions
REST API. All the gazetteer functions such as gaz_search()
or
gaz_relations()
make use of these gaz_rest_*
functions.
Returns a help page: gaz_rest
is not a function but documentation.
gaz_rest_geometries()
, gaz_rest_names_by_mrgid()
,
gaz_rest_record_by_mrgid()
, gaz_rest_records_by_lat_long()
,
gaz_rest_records_by_name()
, gaz_rest_records_by_names()
,
gaz_rest_records_by_source()
, gaz_rest_records_by_type()
,
gaz_rest_relations_by_mrgid()
, gaz_rest_sources()
,
gaz_rest_source_by_sourceid()
, gaz_rest_types()
, gaz_rest_wmses()
?gaz_rest
?gaz_rest
Get the geometries associated with a gazetteer record
gaz_rest_geometries(mrgid, format = "sfc", multipart = TRUE, ...)
gaz_rest_geometries(mrgid, format = "sfc", multipart = TRUE, ...)
mrgid |
(integer) A valid Marine Regions Gazetteer Identifier (MRGID) |
format |
(character) The preferred output format. One of:
Default is "sfc" |
multipart |
(logical) Some Geo-Objects are compound of more than one part.
|
... |
reserved for internal use |
A sfc object (default), a sf data frame, a WKT string or an RDF object
gaz_rest_geometries(3293) gaz_rest_geometries(3293, format = "wkt") gaz_rest_geometries(3293, format = "rdf")
gaz_rest_geometries(3293) gaz_rest_geometries(3293, format = "wkt") gaz_rest_geometries(3293, format = "rdf")
Get the names for a given MRGID
gaz_rest_names_by_mrgid(mrgid)
gaz_rest_names_by_mrgid(mrgid)
mrgid |
(integer) A valid Marine Regions Gazetteer Identifier (MRGID) |
a vector with all the names of a Marine Regions Gazetteer entry
gaz_rest_names_by_mrgid(3293) gaz_rest_names_by_mrgid(14)
gaz_rest_names_by_mrgid(3293) gaz_rest_names_by_mrgid(14)
Get one record for the given MRGID
gaz_rest_record_by_mrgid(mrgid, with_geometry = FALSE, rdf = FALSE)
gaz_rest_record_by_mrgid(mrgid, with_geometry = FALSE, rdf = FALSE)
mrgid |
(integer) A valid Marine Regions Gazetteer Identifier (MRGID) |
with_geometry |
(logical) Add geometry to the result data frame? Default = FALSE |
rdf |
(logical) Return an object of class rdflib::rdf? |
A data frame with the Gazetteer entry
gaz_rest_record_by_mrgid(3293) gaz_rest_record_by_mrgid(3293, with_geometry = TRUE) gaz_rest_record_by_mrgid(3293, rdf = TRUE)
gaz_rest_record_by_mrgid(3293) gaz_rest_record_by_mrgid(3293, with_geometry = TRUE) gaz_rest_record_by_mrgid(3293, rdf = TRUE)
Get all gazetteer records where the geometry intersects with the given latitude and longitude
gaz_rest_records_by_lat_long( latitude, longitude, with_geometry = FALSE, typeid = NULL )
gaz_rest_records_by_lat_long( latitude, longitude, with_geometry = FALSE, typeid = NULL )
latitude |
(double) A decimal number which ranges from -90 to 90. Coordinates are assumed to be in WGS84 |
longitude |
(double) A decimal number which ranges from -180 to 180. Coordinates are assumed to be in WGS84 |
with_geometry |
(logical) Add geometries to the result data frame? Default = FALSE |
typeid |
(numeric) Restrict to one or more placetypeIDs. Retrieve a list of placetypeIDs with |
A data frame with Gazetteer entries
gaz_rest_records_by_lat_long(51.21551, 2.927) gaz_rest_records_by_lat_long(51.21551, 2.927, with_geometry = TRUE, typeid = c(255, 259))
gaz_rest_records_by_lat_long(51.21551, 2.927) gaz_rest_records_by_lat_long(51.21551, 2.927, with_geometry = TRUE, typeid = c(255, 259))
Get Gazetteer Records for a given name
gaz_rest_records_by_name( name, with_geometry = FALSE, typeid = NULL, language = NULL, like = TRUE, fuzzy = TRUE )
gaz_rest_records_by_name( name, with_geometry = FALSE, typeid = NULL, language = NULL, like = TRUE, fuzzy = TRUE )
name |
(character) Term to search in the Marine Regions Gazetteer |
with_geometry |
(logical) Add geometry to the result data frame? Default = FALSE |
typeid |
(numeric) Restrict to one or more placetypeIDs. Retrieve a list of placetypeIDs with |
language |
(character) Restrict to one language. Provide as a 2 digits ISO-639. See ISOcodes::ISO_639_2. |
like |
(logical) Add a '%'-sign before and after the name? (SQL LIKE function). Default = TRUE |
fuzzy |
(logical) Use Levenshtein query to find nearest matches? Default = TRUE |
A data frame with Gazetteer entries
gaz_rest, gaz_rest_records_by_name
gaz_rest_records_by_name("Belgian Exclusive Economic Zone", with_geometry = TRUE) gaz_rest_records_by_name("Bélgica", language = "es") gaz_rest_records_by_name("Belgium", typeid = c(350, 351))
gaz_rest_records_by_name("Belgian Exclusive Economic Zone", with_geometry = TRUE) gaz_rest_records_by_name("Bélgica", language = "es") gaz_rest_records_by_name("Belgium", typeid = c(350, 351))
Get Gazetteer Records for all given names
gaz_rest_records_by_names( names, with_geometry = FALSE, like = TRUE, fuzzy = TRUE )
gaz_rest_records_by_names( names, with_geometry = FALSE, like = TRUE, fuzzy = TRUE )
names |
(character) Vector with the terms to search in the Marine Regions Gazetteer |
with_geometry |
(logical) Add geometry to the result data frame? Default = FALSE |
like |
(logical) Add a '%'-sign before and after the name? (SQL LIKE function). Default = TRUE |
fuzzy |
(logical) Use Levenshtein query to find nearest matches? Default = TRUE |
A data frame with Gazetteer entries
gaz_rest, gaz_rest_records_by_name
gaz_rest_records_by_names( c("Belgian Exclusive Economic Zone", "Dutch Exclusive Economic Zone") )
gaz_rest_records_by_names( c("Belgian Exclusive Economic Zone", "Dutch Exclusive Economic Zone") )
Retrieve Gazetteer Records by Source
gaz_rest_records_by_source(source, with_geometry = FALSE)
gaz_rest_records_by_source(source, with_geometry = FALSE)
source |
(character) A source from |
with_geometry |
(logical) Add geometries to the result data frame? Default = FALSE |
A data frame with Gazetteer entries
gaz_rest_records_by_source("ICES Ecoregions")
gaz_rest_records_by_source("ICES Ecoregions")
Retrieve Gazetteer Records by Placetype
gaz_rest_records_by_type(type, with_geometry = FALSE)
gaz_rest_records_by_type(type, with_geometry = FALSE)
type |
(character) The placetype from |
with_geometry |
(logical) Add geometries to the result data frame? Default = FALSE |
A data frame with Gazetteer entries
gaz_rest_records_by_type("FAO Subdivisions") gaz_rest_records_by_type("EEZ")
gaz_rest_records_by_type("FAO Subdivisions") gaz_rest_records_by_type("EEZ")
Retrieve Gazetter Relations by MRGID
gaz_rest_relations_by_mrgid( mrgid, with_geometry = FALSE, direction = "both", type = "all" )
gaz_rest_relations_by_mrgid( mrgid, with_geometry = FALSE, direction = "both", type = "all" )
mrgid |
(integer) A valid Marine Regions Gazetteer Identifier (MRGID) |
with_geometry |
(logical) Add geometries to the result data frame? Default = FALSE |
direction |
(character) Must be one of upper, lower, both:
|
type |
(character) Must be one of partof, partlypartof, adjacentto, similarto, administrativepartof, influencedby, all. |
A data frame with Gazetteer entries
List of types (Object Properties), gaz_rest, MRGID
gaz_rest_relations_by_mrgid(7378)
gaz_rest_relations_by_mrgid(7378)
Get the name of a source by providing a sourceID
gaz_rest_source_by_sourceid(sourceid)
gaz_rest_source_by_sourceid(sourceid)
sourceid |
(integer) A valid sourceID |
a named vector with the source name and, if available, the url to the source.
gaz_rest_source_by_sourceid(390) gaz_rest_source_by_sourceid(657)
gaz_rest_source_by_sourceid(390) gaz_rest_source_by_sourceid(657)
Get all the Marine Regions sources
gaz_rest_sources()
gaz_rest_sources()
gaz_search() is a memoised function from gaz_rest_search(). See memoise::memoise()
.
a data frame with three columns:
sourceID
: the identifier of the source in the Marine Regions Gazetteer database.
source
: the name of the source.
sourceURL
: if available, the URL of the source.
gaz_rest, gaz_search_by_source()
, gaz_rest_records_by_source()
, gaz_rest_source_by_sourceid()
# This gaz_rest_sources() # is the same as gaz_sources()
# This gaz_rest_sources() # is the same as gaz_sources()
Get all the place types of the Marine Regions Gazetteer
gaz_rest_types()
gaz_rest_types()
a data frame with three columns:
typeID
: the identifier of the place type in the Marine Regions Gazetteer database.
type
: the name of the place type.
description
: if available, the description of the place type.
# This gaz_rest_types() # is the same as gaz_types()
# This gaz_rest_types() # is the same as gaz_types()
Get WMS information for a given MRGID
gaz_rest_wmses(mrgid)
gaz_rest_wmses(mrgid)
mrgid |
(integer) A valid Marine Regions Gazetteer Identifier (MRGID) |
a data frame with information from the WMS services including:
value
: the value to filter on
MRGID
: see MRGID
url
: the base URL of the WMS service
namespace
: see mrp_view()
details
featureType
: see mrp_view()
details
featureName
: see mrp_view()
details
gaz_rest_wmses(3293)
gaz_rest_wmses(3293)
Search in the Marine Regions Gazetteer by names, MRGID or reverse geocode with a pair of WGS84 coordinates x and y
gaz_search(x, ...) ## S3 method for class 'character' gaz_search(x, ...) ## S3 method for class 'numeric' gaz_search(x, ..., y = NULL) ## S3 method for class 'sfg' gaz_search(x, ...) ## S3 method for class 'sf' gaz_search(x, ...) ## S3 method for class 'sfc' gaz_search(x, ...)
gaz_search(x, ...) ## S3 method for class 'character' gaz_search(x, ...) ## S3 method for class 'numeric' gaz_search(x, ..., y = NULL) ## S3 method for class 'sfg' gaz_search(x, ...) ## S3 method for class 'sf' gaz_search(x, ...) ## S3 method for class 'sfc' gaz_search(x, ...)
x |
object to perform the search with. Can be: |
... |
Arguments passed on to
|
y |
(double) Latitude in WGS84 (Optional) |
A data frame with Gazetteer entries
# Look-up a name in the Gazetteer gaz_search("North Sea") # Get the entries of two known MRGID including their geometry gaz_search(c(14, 17), with_geometry = TRUE) # Maybe the name is in another language... gaz_search("Noordzee", language = "nl") # Get all the records intersecting with the longitude 51.21551 and latitude 2.927 # restricting to some placetypes gaz_search(x = 2.927, y = 51.21551, typeid = c(255, 259))
# Look-up a name in the Gazetteer gaz_search("North Sea") # Get the entries of two known MRGID including their geometry gaz_search(c(14, 17), with_geometry = TRUE) # Maybe the name is in another language... gaz_search("Noordzee", language = "nl") # Get all the records intersecting with the longitude 51.21551 and latitude 2.927 # restricting to some placetypes gaz_search(x = 2.927, y = 51.21551, typeid = c(255, 259))
Retrieve Gazetteer Records by Source
gaz_search_by_source(x, ...) ## S3 method for class 'character' gaz_search_by_source(x, ...) ## S3 method for class 'numeric' gaz_search_by_source(x, ...)
gaz_search_by_source(x, ...) ## S3 method for class 'character' gaz_search_by_source(x, ...) ## S3 method for class 'numeric' gaz_search_by_source(x, ...)
x |
source as free text or |
... |
Arguments passed on to
|
A data frame with Gazetteer entries
# Check out all sources gaz_sources() # Look up by source name gaz_search_by_source("Gazetteer of Greenland") # Or query by SourceID gaz_search_by_source(386)
# Check out all sources gaz_sources() # Look up by source name gaz_search_by_source("Gazetteer of Greenland") # Or query by SourceID gaz_search_by_source(386)
Retrieve Gazetteer Records by Placetype
gaz_search_by_type(x, ...) ## S3 method for class 'character' gaz_search_by_type(x, ...) ## S3 method for class 'numeric' gaz_search_by_type(x, ...)
gaz_search_by_type(x, ...) ## S3 method for class 'character' gaz_search_by_type(x, ...) ## S3 method for class 'numeric' gaz_search_by_type(x, ...)
x |
A place type. Either:
|
... |
Arguments passed on to
|
A data frame with Gazetteer entries
# This gaz_search_by_type("EEZ") # is the same as gaz_search_by_type(70)
# This gaz_search_by_type("EEZ") # is the same as gaz_search_by_type(70)
Get all the Marine Regions sources
gaz_sources()
gaz_sources()
gaz_search() is a memoised function from gaz_rest_search(). See memoise::memoise()
.
a data frame with three columns:
sourceID
: the identifier of the source in the Marine Regions Gazetteer database.
source
: the name of the source.
sourceURL
: if available, the URL of the source.
gaz_rest, gaz_search_by_source()
, gaz_rest_records_by_source()
, gaz_rest_source_by_sourceid()
# This gaz_rest_sources() # is the same as gaz_sources()
# This gaz_rest_sources() # is the same as gaz_sources()
Get all the place types of the Marine Regions Gazetteer
gaz_types()
gaz_types()
a data frame with three columns:
typeID
: the identifier of the place type in the Marine Regions Gazetteer database.
type
: the name of the place type.
description
: if available, the description of the place type.
# This gaz_rest_types() # is the same as gaz_types()
# This gaz_rest_types() # is the same as gaz_types()
Many functions of mregions2 make use of the argument mrgid
or return data with the numeric variable MRGID
.
But what is this identifier?
This is an unique and persistent identifier of each entry in the Marine Regions Gazetteer. This identifier consists in a URI containing a number, unique for each entry in the Marine Regions Gazetteer. The R package mregions2 uses this number in its functions, and it should be considered a synonym of the standard definition of MRGID.
See the section details for a more in depth definition of the MRGID
From https://marineregions.org/mrgid.php :
Place names change over time, and the same names may be used for different locations. Available gazetteers may find locations of some marine place names, but a truly global standard for marine place names is lacking. Marine Regions tries to establish for the first time a standardized list of georeferenced marine place names and marine areas. In order to preserve the identity of the marine geographic objects from the database, and to name and locate the geographic resources on the web, we promote the Marine Regions Geographic IDentifier, or the MRGID.
The Marine Regions Geographic IDentifier is:
unique by using a URI (Uniform Resource Identifier), it's unique across the internet.
Syntax http://marineregions.org/mrgid/<number>
persistent we will never delete, nor change the concept behind an MRGID
resolvable pointing your client to an MRGID will return
- the reply of the webservice call getGazetteerRecordByMRGID
, when using content negotiation
(text/turtle
or application/ld+json
)
- the webpage of the MRGID, when using a browser
For an identifier to be persistent, it requires the governing body to arrange for the identifier to be available for the long term. Use of the MRGID, as URI and persistent identifier has the commitment of the Flanders Marine Institute, issuing the identifier to maintain the http domain registration, and a strategy for managing the domain and the web servers.
Returns a help page: MRGID
is not a function but documentation.
?MRGID
?MRGID
Get all the possible values of a column of a Marine Regions data product
mrp_col_unique(layer, colname) mrp_col_distinct(layer, colname)
mrp_col_unique(layer, colname) mrp_col_distinct(layer, colname)
layer |
(character) Identifier of the data product. See mrp_list |
colname |
(character) Column name in the data product. See |
This function becomes useful to write CQL or OGC filters that you can pass to mrp_get()
or mrp_view()
as
it helps to know all the possible values in the column name that you want to query on beforehand. Use it
together with mrp_colnames()
to know the columns and data types in the data product.
Note that columns of type geometry
are forbidden as their performance is sub-optimal and would likely
crash your R session.
A numeric or character vector with the unique values of a column of a Marine Regions data product.
mrp_list to describe the list of products, mrp_colnames()
to get the names and data type of
the columns of a data product, useful to write queries that can be passed to mrp_get()
or mrp_view()
via
the arguments cql_filter
or filter
.
mrp_col_unique("ecs", "pol_type") mrp_col_unique("ecs_boundaries", "line_type")
mrp_col_unique("ecs", "pol_type") mrp_col_unique("ecs_boundaries", "line_type")
Get the names of the columns and data type of the data product
mrp_colnames(layer)
mrp_colnames(layer)
layer |
(character) Identifier of the data product. See mrp_list |
This function becomes useful to write CQL or OGC filters that you can pass to mrp_get()
or mrp_view()
as
it allows you to know the column names and the data types beforehand. Use it together with mrp_col_unique()
to
know all the possible values in the column name that you want to query on.
The actual description of each column is available only to the Maritime Boundaries products. See https://marineregions.org/eezattribute.php
A data frame with the column names and data type in the Marine Regions data product
mrp_list to describe the list of products, mrp_col_unique()
to get the unique values of a the
columns of a data product, useful to write queries that can be passed to mrp_get()
or mrp_view()
via the
arguments cql_filter
or filter
.
mrp_colnames("eez") mrp_colnames("ecoregions")
mrp_colnames("eez") mrp_colnames("ecoregions")
Get a data product
mrp_get( layer, path = getOption("mregions2.download_path", tempdir()), cql_filter = NULL, filter = NULL, count = NULL )
mrp_get( layer, path = getOption("mregions2.download_path", tempdir()), cql_filter = NULL, filter = NULL, count = NULL )
layer |
(character) Identifier of the data product. See mrp_list |
path |
(character) Path to save the requests. Default is |
cql_filter |
(character) Contextual Query Language (CQL) filter. See details. |
filter |
(character) Standard OGC filter specification. See details. |
count |
(numeric) Maximum number of features to be retrieved. |
This function uses WFS services to download the Marine Regions layers as ESRI Shapefiles.
By default, the layers are downloaded to a temporal directory (base::tempdir()
). You can provide
a path in the path
argument. But you can also set a path with # options("mregions2.download_path" = "my/path/")
.
Because it is possible to add filters, each request is identified with a crc32 hash, provided with
digest::digest()
and attached to the file downloaded.
Once a layer is downloaded, it will be read from the cache during the next two weeks. To avoid this, simply delete the layers in the cache path.
Both the Contextual Query Language (CQL) filter and the standard OGC filter specification allow to query the server before performing a request. This will boost performance as you will only retrieve the area of your interest. It is possible to query on attributes, but also perform geospatial queries. For instance, you can query a bounding box of interest.
CQL filters are possible only in geoserver. Marine Regions uses a geoserver instance to serve its data products. A tutorial on CQL filters is available in the geoserver web site.
An sf object with the Marine Regions data product
mrp_list to describe the list of products, mrp_view()
to visualize the data product in advance, mrp_colnames()
and mrp_col_unique()
to get the name, data type and unique values of a the columns of a data product, useful to query
with the arguments cql_filter
or filter
# Set cache path. Default is a temporal directory options(mregions2.download_path = tempdir()) getOption("mregions2.download_path") #> [1] "/tmp/RtmpARLgoE" # See the list of all data products mrp_list # We want the Exclusive Economic Zones of Portugal. Let's first visualize the product: mrp_view("eez") # See all the columns on this data product mrp_colnames("eez") # We should query on sovereign # See all the possible values of sovereign1, sovereign2 and sovereign3 sov1 = mrp_col_unique("eez", "sovereign1") sov2 = mrp_col_unique("eez", "sovereign2") sov3 = mrp_col_unique("eez", "sovereign3") # Is Portugal a value in the sovereign1, 2 and 3? "Portugal" %in% sov1 #> [1] TRUE "Portugal" %in% sov2 #> [1] FALSE "Portugal" %in% sov3 #> [1] FALSE # Portugal is only in sovereign1. Let's write a CQL filter to get only # the EEZs of Portugal, or those where Portugal is a party of a dispute or a joint regime portugal_eez <- mrp_get("eez", cql_filter = "sovereign1 = 'Portugal'") # If you perform this request again, it will be read from the cache instead portugal_eez <- mrp_get("eez", cql_filter = "sovereign1 = 'Portugal'") #> Cache is fresh. Reading: /tmp/RtmpARLgoE/eez-1951c8b7/eez.shp #> (Last Modified: 2023-04-24 17:45:16) # You can also limit the number of features to be requested mrp_get("eez", count = 5)
# Set cache path. Default is a temporal directory options(mregions2.download_path = tempdir()) getOption("mregions2.download_path") #> [1] "/tmp/RtmpARLgoE" # See the list of all data products mrp_list # We want the Exclusive Economic Zones of Portugal. Let's first visualize the product: mrp_view("eez") # See all the columns on this data product mrp_colnames("eez") # We should query on sovereign # See all the possible values of sovereign1, sovereign2 and sovereign3 sov1 = mrp_col_unique("eez", "sovereign1") sov2 = mrp_col_unique("eez", "sovereign2") sov3 = mrp_col_unique("eez", "sovereign3") # Is Portugal a value in the sovereign1, 2 and 3? "Portugal" %in% sov1 #> [1] TRUE "Portugal" %in% sov2 #> [1] FALSE "Portugal" %in% sov3 #> [1] FALSE # Portugal is only in sovereign1. Let's write a CQL filter to get only # the EEZs of Portugal, or those where Portugal is a party of a dispute or a joint regime portugal_eez <- mrp_get("eez", cql_filter = "sovereign1 = 'Portugal'") # If you perform this request again, it will be read from the cache instead portugal_eez <- mrp_get("eez", cql_filter = "sovereign1 = 'Portugal'") #> Cache is fresh. Reading: /tmp/RtmpARLgoE/eez-1951c8b7/eez.shp #> (Last Modified: 2023-04-24 17:45:16) # You can also limit the number of features to be requested mrp_get("eez", count = 5)
A data frame including the name, abstract and some other relevant about each data product in Marine Regions.
mrp_list
mrp_list
mrp_list
A data frame with 21 rows and 7 columns:
Data product name
Workspace in geoserver
Identifier of the data product. Use in mrp_get()
terms of use of the data products
preferred citation of the data products
ISO 26324 Digital Object Identifier)
Url of the data products in the Integrated Marine Information System (IMIS)
Description of the data product
Direct downloads are also available at: https://marineregions.org/downloads.php
https://marineregions.org/sources.php https://marineregions.org/eezmethodology.php
mrp_list
mrp_list
More information available at vignette("mrp_ontology", package = "mregions2")
mrp_ontology
mrp_ontology
mrp_ontology
A data frame with 374 rows and 4 columns:
Identifier of the data product. Use in mrp_get()
Name of the columns of each data product.
Data type of the column.
Definition of the column.
https://marineregions.org/sources.php https://marineregions.org/eezattribute.php
mrp_ontology
mrp_ontology
Visualize a Marine Regions data product without downloading.
A series of helpers are available to ease the selection of the data products. Example: instead of running
mrp_view("eez")
You can use
mrp_view_eez()
Try mrp_view_*()
with the identifier of the data product (see mrp_list)
mrp_view(layer, cql_filter = NULL, filter = NULL) mrp_view_eez(...) mrp_view_eez_boundaries(...) mrp_view_eez_12nm(...) mrp_view_eez_24nm(...) mrp_view_eez_internal_waters(...) mrp_view_eez_archipelagic_waters(...) mrp_view_high_seas(...) mrp_view_ecs(...) mrp_view_ecs_boundaries(...) mrp_view_iho(...) mrp_view_goas(...) mrp_view_eez_iho(...) mrp_view_eez_land(...) mrp_view_longhurst(...) mrp_view_cds(...) mrp_view_eca_reg13_nox(...) mrp_view_eca_reg14_sox_pm(...) mrp_view_worldheritagemarineprogramme(...) mrp_view_lme(...) mrp_view_ecoregions(...) mrp_view_seavox_v18(...)
mrp_view(layer, cql_filter = NULL, filter = NULL) mrp_view_eez(...) mrp_view_eez_boundaries(...) mrp_view_eez_12nm(...) mrp_view_eez_24nm(...) mrp_view_eez_internal_waters(...) mrp_view_eez_archipelagic_waters(...) mrp_view_high_seas(...) mrp_view_ecs(...) mrp_view_ecs_boundaries(...) mrp_view_iho(...) mrp_view_goas(...) mrp_view_eez_iho(...) mrp_view_eez_land(...) mrp_view_longhurst(...) mrp_view_cds(...) mrp_view_eca_reg13_nox(...) mrp_view_eca_reg14_sox_pm(...) mrp_view_worldheritagemarineprogramme(...) mrp_view_lme(...) mrp_view_ecoregions(...) mrp_view_seavox_v18(...)
layer |
(character) Identifier of the data product. See mrp_list |
cql_filter |
(character) Contextual Query Language (CQL) filter. See details. |
filter |
(character) Standard OGC filter specification. See details. |
... |
pass the |
This function uses WMS services to load quickly a Leaflet viewer of a Marine Regions data product. It uses the EMODnet Bathymetry Digital Terrain Model as background layer.
Both the Contextual Query Language (CQL) filter and the standard OGC filter specification allow to query the server before performing a request. This will boost performance as you will only retrieve the area of your interest. It is possible to query on attributes, but also perform geospatial queries. For instance, you can query a bounding box of interest.
CQL filters are possible only in geoserver. Marine Regions uses a geoserver instance to serve its data products. A tutorial on CQL filters is available in the geoserver web site.
A leaflet map with a data product visualized via WMS
mrp_list to describe the list of products, mrp_colnames()
and mrp_col_unique()
to get the name, data type and unique values of a the columns of a data product, useful to query
with the arguments cql_filter
or filter
, mrp_get()
to get the data products as a simple feature object.
# You can pass a product name from mrp_list mrp_view('eez') # Or use the helper mrp_view_eez() # Example: filter a the Ecoregions 'Azores Canaries Madeira' with mrgid 21885 # You can check the names of the columns beforehand with mrp_colnames('ecoregions') mrp_view_ecoregions(filter = " <Filter> <PropertyIsEqualTo> <PropertyName>ecoregion</PropertyName> <Literal>Azores Canaries Madeira</Literal> </PropertyIsEqualTo> </Filter> ") # OGC filter are very verbose... but luckily you can use a CQL filter instead mrp_view_ecoregions(cql_filter = "ecoregion = 'Azores Canaries Madeira'") # View all the Extended Continental Shelf (ECS) boundary lines published during the first # decade of the 21st century mrp_view_ecs_boundaries( cql_filter = "doc_date > '2000-01-01' AND doc_date < '2009-12-31'" ) # Or as timestamp mrp_view_eez_boundaries( cql_filter = "doc_date AFTER 2000-01-01T00:00:00Z AND doc_date BEFORE 2009-12-31T00:00:00Z" )
# You can pass a product name from mrp_list mrp_view('eez') # Or use the helper mrp_view_eez() # Example: filter a the Ecoregions 'Azores Canaries Madeira' with mrgid 21885 # You can check the names of the columns beforehand with mrp_colnames('ecoregions') mrp_view_ecoregions(filter = " <Filter> <PropertyIsEqualTo> <PropertyName>ecoregion</PropertyName> <Literal>Azores Canaries Madeira</Literal> </PropertyIsEqualTo> </Filter> ") # OGC filter are very verbose... but luckily you can use a CQL filter instead mrp_view_ecoregions(cql_filter = "ecoregion = 'Azores Canaries Madeira'") # View all the Extended Continental Shelf (ECS) boundary lines published during the first # decade of the 21st century mrp_view_ecs_boundaries( cql_filter = "doc_date > '2000-01-01' AND doc_date < '2009-12-31'" ) # Or as timestamp mrp_view_eez_boundaries( cql_filter = "doc_date AFTER 2000-01-01T00:00:00Z AND doc_date BEFORE 2009-12-31T00:00:00Z" )