This function serves as a wrapper for the wdpar package, facilitating the
retrieval of Marine Protected Areas (MPAs) from the World Database on Protected
Areas (WDPA) and optionally intersecting them with provided planning units.
When Raw = FALSE (the default), the result is an sf object indicating
which planning units are covered by the selected marine protected areas.
When Raw = TRUE, the function returns the dissolved WDPA polygon layer
directly — after fetching, filtering, cleaning, and dissolving — without
intersecting against planning units. This is useful for inspecting the raw
MPA geometries, reprojecting them, or passing them to a custom gridding step.
Arguments
- PlanUnits
An
sfobject representing the planning units to be used for intersection. Required whenRaw = FALSE. Ignored (and may beNULL) whenRaw = TRUE. This object should have a valid CRS defined.- Countries
A character vector specifying the countries for which to extract MPAs. To retrieve all global MPAs, use the value
"global". Country names should match those recognized by the WDPA database.- Status
A character vector specifying the desired status of protected areas to include. Defaults to
c("Designated", "Established", "Inscribed").- Desig
A character vector specifying the desired designation types of protected areas. Defaults to
c("National", "Regional", "International", "Not Applicable").- Category
A character vector specifying the desired IUCN Protected Area Management Categories. Defaults to
c("Ia", "Ib", "II", "III", "IV").- Raw
Logical. If
FALSE(the default), the fetched and cleaned WDPA data are intersected withPlanUnitsand the function returns a planning-unitsfobject with awdpacoverage column. IfTRUE, the function returns the dissolved WDPA polygon layer directly (after fetching, filtering, cleaning, and dissolving), without any intersection.PlanUnitsis not required in this case.- ...
Other arguments that are passed directly to the
wdpa_fetch()function from thewdparpackage (e.g.,verbose = TRUE).
Value
Raw = FALSEAn
sfobject of planning units with an additionalwdpacolumn (set to 1) for planning units that intersect with the selected MPAs.Raw = TRUEAn
sfobject of dissolved WDPA polygons with all columns returned bywdpar::wdpa_dissolve(), prior to any geometry-only selection or planning-unit intersection.
Details
This function leverages the robust capabilities of the wdpar package by
Jeffrey O. Hanson to access and process WDPA data. It allows filtering of MPAs
based on country, status, designation type, and IUCN category, and then
optionally spatially intersects these MPAs with your defined planning units.
For a comprehensive understanding of the WDPA data fields:
Status: Refers to the establishment, designation, or proposal status of a protected area at the time of data submission. Valid options include "Designated", "Established", "Inscribed", "Proposed", and "Adopted".
Desig (Designation Type): Categorizes the legal or official designation of the protected area. Valid options include "National", "Regional", "International", and "Not Applicable".
Category (IUCN Protected Area Management Categories): Represents the IUCN management categories for protected areas. Valid options include "Ia", "Ib", "II", "III", "IV", "V", "VI", "Not Reported", "Not Applicable", and "Not Assigned".
Examples
if (FALSE) { # \dontrun{
# Assuming 'dat_PUs' is an existing sf object of planning units in your package.
# Example: Get MPAs for Australia and intersect with planning units (default).
dat_mpas <- splnr_get_MPAs(PlanUnits = dat_PUs, Countries = "Australia", force = TRUE)
# Example: Get raw dissolved WDPA polygons without intersecting planning units.
raw_mpas <- splnr_get_MPAs(Countries = "Australia", Raw = TRUE)
# Example: Get MPAs for multiple countries with specific status and categories.
dat_mpas_specific <- splnr_get_MPAs(
PlanUnits = dat_PUs,
Countries = c("Australia", "New Zealand"),
Status = c("Designated", "Proposed"),
Category = c("II", "IV")
)
# Example: Visualize the result using ggplot2.
# Assuming 'aust' is an sf object representing Australia's coastline,
# perhaps loaded from rnaturalearth::ne_countries.
aust <- rnaturalearth::ne_countries(country = "Australia", returnclass = "sf")
gg <- ggplot2::ggplot() +
ggplot2::geom_sf(data = dat_mpas, ggplot2::aes(fill = wdpa)) +
ggplot2::geom_sf(data = aust, fill = "grey50") +
ggplot2::labs(title = "Marine Protected Areas in Australia") +
ggplot2::theme_minimal()
print(gg)
} # }
