knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  cache = TRUE
)

mregions2

Funding Status at rOpenSci Software Peer Review CRAN_Status_Badge R-CMD-check Codecov test coverage

mregions2 offers a streamlined interface to access data from Marine Regions in R for researchers, marine scientists, and geospatial analysts seeking marine geographical information

Marine Regions offers two key resources: the Marine Regions Gazetteer, a list of standardized marine place names with unique identifiers, and the Marine Regions Data Products, including popular features like the world maritime boundaries.

You can find detailed information in the articles online:

Installation

You can install the latest CRAN version with:

install.packages("mregions2")

Or install the development version of mregions2 from GitHub with:

# install.packages("devtools")
devtools::install_github("ropensci/mregions2", build_vignettes = TRUE)

Load the library with:

library(mregions2)

The function mrp_view() requires two extra packages that are not listed as Imports, hence they are not installed along with mregions2 but you must install yourself:

install.packages("leaflet")
install.packages("leaflet.extras2")

Some of the examples below use the pipe operator %>%. Install and load magrittr:

# install.packages("magrittr")
library(magrittr)

Query the Marine Regions Gazetteer

The Marine Regions Gazetteer is a standard list of marine georeferenced place names.

Gazetteer: a dictionary of geographical names.

https://www.thefreedictionary.com/gazetteer

You can search the Gazetteer in many ways:

Search by free text:

gaz_search("Belgian Part of the North Sea")

Search by unique identifier. See ?MRGID:

gaz_search(3293)

Search by location:

gaz_search(x = 2.927, y = 51.21551)

Search by place type:

gaz_search_by_type("EEZ")

Search by authortative source:

gaz_search_by_source("Flanders Marine Institute (VLIZ)")

The list of place types and sources are available with gaz_types() and gaz_sources() respectively.

You can add the geometry of the Gazetteer entries with gaz_geometry():

# Get a record and turn into a sf object with geometry
gaz_search(3293) %>% gaz_geometry()

# Or get only the geometry 
gaz_geometry(3293, format = "sfc")

The entries of the Marine Regions Gazetteer are organized hierarchically. You can browse this hierarchy up and down with gaz_relations()

# Get all relations
gaz_search(3293) %>% gaz_relations()

# Or get the relations directly
gaz_relations(3293)

Marine Regions Data Products

In addition to the Marine Regions Gazetteer, the Marine Regions Team creates and hosts geographical Data Products, being the most popular one the Marine Regions Maritime Boundaries.

An overview of all available products can be consulted with mrp_list

mrp_list

Their attributes are explained in the Marine Regions Data Products Ontology article, or simply run mrp_ontology

mrp_ontology

You can visualize the Marine Regions Data Products with mrp_view(). It opens an interactive leaflet::leaflet viewer.

mrp_view("eez")

Or you can download and read the data products into R with mrp_get()

mrp_get("eez")

You can specify the download path in the path argument:

mrp_get("eez", path = "path/to/data")

Get to know more in the Get Started vignette.

# Copy and paste output - do not include to not add more deps
get_md <- function(pkgs){
  get_titles <- function(x) packageDescription(x, fields = "Title")
  titles <- purrr::map_chr(pkgs, get_titles)
  cat(glue::glue("* [{pkgs}](https://docs.ropensci.org/{pkgs}): _{titles}_. \n"), sep = "\n")
}

Related packages

Marine biodiversity data

The main purpose of Marine Regions is to serve as the geographical backbone for the World Register of Marine Species (WoRMS), an authoritative classification and catalogue of marine names. Here is a list of R packages to access Marine taxonomical and biogeographic data that can be combined with data from mregions2:

get_md(c("worrms", "eurobis", "robis", "rgbif"))
# Change links manually

More geographical data

There are other R packages that allow to access other gazetteers and boundaries data. Here is a non-exhaustive list:

get_md(c("geonames", "osmdata", "osmextract", "rnaturalearth"))

Citation

citation("mregions2")

License

MIT. See LICENSE.md

This software is developed for scientific, educational and research purposes. It is not meant to be used for legal, economical (in the sense of exploration of natural resources) or navigational purposes. See the Marine Regions disclaimer for more information.

Code of Conduct

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



lifewatch/mregions2 documentation built on April 17, 2025, 10:40 a.m.