| Title: | Download Geographic Data on Various Topics Provided and Managed by the Spatial Data Infrastructure of Peru |
|---|---|
| Description: | Provides R users with easy access to official cartographic data from Peru across a range of topics, including society, transport, environment, agriculture, climate, and more. It also includes data from regional government entities and technical-scientific institutions, all managed by Peru's Spatial Data Infrastructure. For more information, please visit: <https://www.geoidep.gob.pe/>. |
| Authors: | antony barja [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-5921-2858>) |
| Maintainer: | antony barja <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.5.0 |
| Built: | 2026-10-01 19:51:49 UTC |
| Source: | https://github.com/ambarja/geoidep |
Download any public layer from the water resources IDE of the National
Water Authority - ANA
(https://www.gob.pe/ana).
When region is supplied, its bounding box is used to query the WFS
service and the downloaded features are then filtered to those falling
inside region. When region is NULL, the whole layer is downloaded.
get_ana_data( region = NULL, layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_ana_data( region = NULL, layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
region |
An sf object specifying the area of interest (must be in EPSG:4326 - WGS 84).
If |
layer |
A string. Layer key (e.g. |
dsn |
Character. Output filename. If supplied, the result is written to this file. If missing, a temporary file is used internally. |
show_progress |
Logical. Show cli progress. Default |
quiet |
Logical. Suppress messages from |
timeout |
Numeric. Seconds to wait for the server response (default 60). |
Column names are normalised to lowercase. The WFS 2.0.0 bbox filter
requires latitude/longitude axis order for EPSG:4326, which is handled
internally.
An sf object with the layer geometries and attributes.
## Not run: library(geoidep) get_data_sources("Ana") # Full layer download (tunnels inventory countrywide) tunnels <- get_ana_data(layer = "tuneles", show_progress = FALSE) head(tunnels) # Features inside a region of interest lima <- sf::st_sf(geometry = sf::st_sfc( sf::st_bbox(c(xmin = -77.2, ymin = -12.6, xmax = -76.6, ymax = -11.7), crs = sf::st_crs(4326)) |> sf::st_as_sfc() )) tunnels_lima <- get_ana_data(region = lima, layer = "tuneles", show_progress = FALSE) nrow(tunnels_lima) ## End(Not run)## Not run: library(geoidep) get_data_sources("Ana") # Full layer download (tunnels inventory countrywide) tunnels <- get_ana_data(layer = "tuneles", show_progress = FALSE) head(tunnels) # Features inside a region of interest lima <- sf::st_sf(geometry = sf::st_sfc( sf::st_bbox(c(xmin = -77.2, ymin = -12.6, xmax = -76.6, ymax = -11.7), crs = sf::st_crs(4326)) |> sf::st_as_sfc() )) tunnels_lima <- get_ana_data(region = lima, layer = "tuneles", show_progress = FALSE) nrow(tunnels_lima) ## End(Not run)
Download any public layer from the CEPLAN geoserver
(https://geo.ceplan.gob.pe/).
When region is supplied, its bounding box is used to query the WFS
service and the downloaded features are then filtered to those falling
inside region. When region is NULL, the whole layer is downloaded.
get_ceplan_data( region = NULL, layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_ceplan_data( region = NULL, layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
region |
An sf object specifying the area of interest (must be in EPSG:4326 - WGS 84).
If |
layer |
A string. Layer key (e.g. |
dsn |
Character. Output filename. If supplied, the result is written to this file. If missing, a temporary file is used internally. |
show_progress |
Logical. Show cli progress. Default |
quiet |
Logical. Suppress messages from |
timeout |
Numeric. Seconds to wait for the server response (default 60). |
Column names are normalised to lowercase. The WFS 2.0.0 bbox filter
requires latitude/longitude axis order for EPSG:4326, which is handled
internally.
An sf object with the layer geometries and attributes.
## Not run: library(geoidep) get_data_sources("Ceplan") # Full layer download (135 airports countrywide) airports <- get_ceplan_data(layer = "cn_aeropuertosx", show_progress = FALSE) head(airports) # Features inside a region of interest lima <- sf::st_sf(geometry = sf::st_sfc( sf::st_bbox(c(xmin = -77.2, ymin = -12.6, xmax = -76.6, ymax = -11.7), crs = sf::st_crs(4326)) |> sf::st_as_sfc() )) airports_lima <- get_ceplan_data(region = lima, layer = "cn_aeropuertosx", show_progress = FALSE) nrow(airports_lima) ## End(Not run)## Not run: library(geoidep) get_data_sources("Ceplan") # Full layer download (135 airports countrywide) airports <- get_ceplan_data(layer = "cn_aeropuertosx", show_progress = FALSE) head(airports) # Features inside a region of interest lima <- sf::st_sf(geometry = sf::st_sfc( sf::st_bbox(c(xmin = -77.2, ymin = -12.6, xmax = -76.6, ymax = -11.7), crs = sf::st_crs(4326)) |> sf::st_as_sfc() )) airports_lima <- get_ceplan_data(region = lima, layer = "cn_aeropuertosx", show_progress = FALSE) nrow(airports_lima) ## End(Not run)
List the available providers of the geoidep package.
get_data_sources(query = NULL)get_data_sources(query = NULL)
query |
A string. Default is NULL. Filter by provider name(s). For valid values use |
A tibble object.
## Not run: library(geoidep) get_data_sources() ## End(Not run)## Not run: library(geoidep) get_data_sources() ## End(Not run)
Download the latest version of the geometry and ubigeos corresponding to the official political division of the departament boundaries of Peru. For more information, visit INEI Spatial Data Portal.
get_departaments( departamento = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_departaments( departamento = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
departamento |
Character. Name or names in a vector of the level-1 administrative boundary (department) to query. Case-insensitive. |
dsn |
Character. Directory where the file will be saved. If |
show_progress |
Logical. Show a cli progress bar. Default |
quiet |
Logical. Suppress info message from |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object.
## Not run: library(geoidep) dep <- get_departaments(show_progress = FALSE) head(dep) loreto <- get_departaments(departamento = "loreto", show_progress = FALSE) head(loreto) ## End(Not run)## Not run: library(geoidep) dep <- get_departaments(show_progress = FALSE) head(dep) loreto <- get_departaments(departamento = "loreto", show_progress = FALSE) head(loreto) ## End(Not run)
Download the latest version of the geometry and ubigeos corresponding to the official political division of the district boundaries of Peru. For more information, visit INEI Spatial Data Portal.
get_districts( departamento = NULL, provincia = NULL, distrito = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_districts( departamento = NULL, provincia = NULL, distrito = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
departamento |
Character. Level-1 name. Case-insensitive. |
provincia |
Character. Level-2 name. Case-insensitive. |
distrito |
Character. Level-3 name. Case-insensitive. |
dsn |
Character. Directory where the file will be saved. If |
show_progress |
Logical. Show a cli progress bar. |
quiet |
Logical. Suppress info message. |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object.
## Not run: library(geoidep) dist <- get_districts(show_progress = FALSE) head(dist) lima <- get_districts(departamento = "lima", provincia = "lima", show_progress = FALSE) head(lima) ## End(Not run)## Not run: library(geoidep) dist <- get_districts(show_progress = FALSE) head(dist) lima <- get_districts(departamento = "lima", provincia = "lima", show_progress = FALSE) head(lima) ## End(Not run)
Download deforestation alert information detected by Geobosque for any polygon in Peru.
The points come from the official vector service
alertas_tempranas_pt_2026 (interop layer "Ultima semana") published at
Geobosque Interoperability.
For more details, visit Geobosque Platform.
get_early_warning(region, sf = TRUE, show_progress = TRUE)get_early_warning(region, sf = TRUE, show_progress = TRUE)
region |
An sf object. Area of interest (must be EPSG:4326). |
sf |
Logical. Return an |
show_progress |
Logical. Show cli progress. Default |
A tibble or sf object with the alert points (lng, lat,
fecha_alerta, dia_jul, mes_alerta, ubigeo).
## Not run: library(geoidep) loreto <- get_departaments(show_progress = FALSE) |> subset(nombdep == "LORETO") warning_point <- get_early_warning(region = loreto, sf = TRUE, show_progress = FALSE) head(warning_point) ## End(Not run)## Not run: library(geoidep) loreto <- get_departaments(show_progress = FALSE) |> subset(nombdep == "LORETO") warning_point <- get_early_warning(region = loreto, sf = TRUE, show_progress = FALSE) head(warning_point) ## End(Not run)
Download the ubigeos corresponding to the official political division of the district, province or region boundaries of Peru with forest and loss information. For more information, visit Geobosque Platform.
get_forest_loss_data(layer = NULL, ubigeo = NULL, show_progress = TRUE)get_forest_loss_data(layer = NULL, ubigeo = NULL, show_progress = TRUE)
layer |
A string. One of |
ubigeo |
A string. Ubigeo code: 6 digits (distrito), 4 digits (provincia), 2 digits (departamento). |
show_progress |
Logical. Show cli progress. Default |
Available layers:
stock_bosque_perdida_distrito: forest stock/loss for a district.
stock_bosque_perdida_provincia: forest stock/loss for a province.
stock_bosque_perdida_departamento: forest stock/loss for a region.
The data come from the wet-forest (bosque humedo) loss series of the
current Geobosques API (years 2001-2025) and are returned with the
historical column layout (anio, perdida, rango1-rango5, ubigeo).
A tibble object.
## Not run: library(geoidep) geobosque <- get_forest_loss_data( layer = "stock_bosque_perdida_distrito", ubigeo = "010101", show_progress = FALSE) head(geobosque) ## End(Not run)## Not run: library(geoidep) geobosque <- get_forest_loss_data( layer = "stock_bosque_perdida_distrito", ubigeo = "010101", show_progress = FALSE) head(geobosque) ## End(Not run)
Download the latest version of forest fire data available from the Satellite Monitoring Unit of the National Forestry and Wildlife Service of Peru. For more information, visit Serfor Platform.
get_hotspots_data(dsn = NULL, show_progress = TRUE, quiet = TRUE)get_hotspots_data(dsn = NULL, show_progress = TRUE, quiet = TRUE)
dsn |
Character. Output filename. If missing, a temporary file is created. |
show_progress |
Logical. Show a cli progress bar. Default |
quiet |
Logical. Suppress message from |
An sf object.
## Not run: library(geoidep) library(sf) hot_spots <- get_hotspots_data(show_progress = FALSE) head(hot_spots) ## End(Not run)## Not run: library(geoidep) library(sf) hot_spots <- get_hotspots_data(show_progress = FALSE) head(hot_spots) ## End(Not run)
Download the Peruvian seismic catalogs published by the Centro
Sismologico Nacional (CENSIS) of the Instituto Geofisico del Peru (IGP)
through the same endpoint used by the
IGP seismic data repository:
a GET request filtered by bounding box, magnitude and depth that returns
an XLSX file. The epicentres are returned as an sf POINT layer
(EPSG:4326) and, optionally, clipped to any user-supplied polygon with sf.
For more information, visit IGP.
get_igp_seismic_data( catalog = c("instrumental", "historic"), start_date = NULL, end_date = NULL, min_magnitude = 4, max_magnitude = 10, min_depth = 0, max_depth = 900, polygon = NULL, dsn = NULL, show_progress = TRUE, timeout = 180 )get_igp_seismic_data( catalog = c("instrumental", "historic"), start_date = NULL, end_date = NULL, min_magnitude = 4, max_magnitude = 10, min_depth = 0, max_depth = 900, polygon = NULL, dsn = NULL, show_progress = TRUE, timeout = 180 )
catalog |
A string. One of |
start_date, end_date
|
Strings ( |
min_magnitude, max_magnitude
|
Numerics. Magnitude range filter.
Default |
min_depth, max_depth
|
Numerics. Depth range filter in km.
Default |
polygon |
An |
dsn |
A string. Optional path where the raw XLSX file is saved.
Default |
show_progress |
Logical. Show cli progress. Default |
timeout |
Numeric. Seconds to wait for the server response. The IGP
service generates the XLSX on demand, so the default is |
The XLSX response is parsed with base R only (utils::unzip() plus a small
internal reader), so no additional package is required.
Very wide queries (e.g. the full historic catalog with low magnitudes)
may exceed the server capacity (HTTP 502); narrow the filters and retry.
An sf object (POINT, EPSG:4326). The instrumental catalog has
columns fecha_utc, hora_utc, latitud, longitud,
profundidad_km, magnitud; the historic catalog reports three
magnitude scales (magnitud_mb, magnitud_ms, magnitud_mw).
## Not run: library(geoidep) sismos <- get_igp_seismic_data( catalog = "instrumental", start_date = "2026-08-24", end_date = "2026-09-24", min_magnitude = 4, show_progress = FALSE) head(sismos) ## End(Not run)## Not run: library(geoidep) sismos <- get_igp_seismic_data( catalog = "instrumental", start_date = "2026-08-24", end_date = "2026-09-24", min_magnitude = 4, show_progress = FALSE) head(sismos) ## End(Not run)
Download the latest version of data available on the INAIGEM geoportal. For more information, visit INAIGEM Geoportal.
get_inaigem_data( layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_inaigem_data( layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
layer |
Select only one from the list of available layers, for more information please use |
dsn |
Character. Output filename. If missing, a temporary file is created. |
show_progress |
Logical. Show a cli progress bar. Default |
quiet |
Logical. Suppress info message. Default |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object.
## Not run: library(geoidep) library(sf) glaciar <- get_inaigem_data(layer = "glaciares_1989", show_progress = FALSE) head(glaciar) plot(st_geometry(glaciar)) ## End(Not run)## Not run: library(geoidep) library(sf) glaciar <- get_inaigem_data(layer = "glaciares_1989", show_progress = FALSE) head(glaciar) plot(st_geometry(glaciar)) ## End(Not run)
Download satellite imagery (before/after deforestation) for specific MapBiomas Alerta alerts from public Google Cloud Storage buckets. Progress uses cli.
get_mapbiomas_alert_images( alert_ids, download_dir = NULL, image_type = "both", show_progress = TRUE, overwrite = FALSE )get_mapbiomas_alert_images( alert_ids, download_dir = NULL, image_type = "both", show_progress = TRUE, overwrite = FALSE )
alert_ids |
Character or numeric vector. Alert IDs to download images for. |
download_dir |
Character. Directory where images will be saved. If NULL, a temporary directory is used. |
image_type |
Character. Which images to download: "both" (default), "before", or "after". |
show_progress |
Logical. Show cli progress. Default |
overwrite |
Logical. Overwrite existing files. Default |
File names follow the pattern alert_{id}_before_deforestation.png and
alert_{id}_after_deforestation.png. Each image has a 120-second timeout.
A tibble with columns alert_id, image_type, url, local_path, status, error_message.
## Not run: library(geoidep) aoi <- get_departaments(show_progress = FALSE) |> subset(nombdep == "UCAYALI") alerts <- get_mapbiomas_peru_alerta(region = aoi, show_progress = FALSE) alert_ids <- alerts$id[1:5] download_dir <- file.path(tempdir(), "mapbiomas_images") results <- get_mapbiomas_alert_images( alert_ids = alert_ids, download_dir = download_dir, show_progress = FALSE ) head(results) ## End(Not run)## Not run: library(geoidep) aoi <- get_departaments(show_progress = FALSE) |> subset(nombdep == "UCAYALI") alerts <- get_mapbiomas_peru_alerta(region = aoi, show_progress = FALSE) alert_ids <- alerts$id[1:5] download_dir <- file.path(tempdir(), "mapbiomas_images") results <- get_mapbiomas_alert_images( alert_ids = alert_ids, download_dir = download_dir, show_progress = FALSE ) head(results) ## End(Not run)
Download the latest deforestation alerts detected by MapBiomas Alerta Peru for a specific geographic area using an sf object (bounding box or polygon). For more details, please visit: MapBiomas Peru Platform
get_mapbiomas_peru_alerta( region = NULL, from = NULL, to = NULL, dsn = NULL, method = "within", show_progress = TRUE, quiet = TRUE, timeout = 60 )get_mapbiomas_peru_alerta( region = NULL, from = NULL, to = NULL, dsn = NULL, method = "within", show_progress = TRUE, quiet = TRUE, timeout = 60 )
region |
An sf object specifying the area of interest (must be in EPSG:4326 - WGS 84). |
from |
Character. Start date in |
to |
Character. End date in |
dsn |
Character. Output filename. If missing, a temporary GeoJSON file is created. |
method |
Character. Spatial predicate used to filter the downloaded alerts against |
show_progress |
Logical. Show cli progress. Default |
quiet |
Logical. Suppress messages from |
timeout |
Numeric. Seconds to wait for the server response (default 60). |
The bounding box of region is used to query the WFS service. Image URLs
are generated from the alert id and point to public Google Cloud Storage buckets.
Column names are normalised to lowercase.
An sf object with alert geometries, attributes and image URLs.
Lazily reads a MapBiomas Fuego (Fire) Peru raster from a given
sub-product, hosted as a GeoTIFF on Google Cloud Storage. Only the bytes
required for the requested extent are downloaded (via GDAL's
/vsicurl/ driver). Optionally crops and masks the raster to an
area of interest.
get_mapbiomas_peru_fire(product, year, crop_to = NULL, collection = 1)get_mapbiomas_peru_fire(product, year, crop_to = NULL, collection = 1)
product |
Character. One of the products listed in
|
year |
Integer. For |
crop_to |
Optional. An |
collection |
Integer. MapBiomas Fuego Peru collection. Default |
A SpatRaster with one layer.
## Not run: library(geoidep) lima <- get_departaments("LIMA") burned_2024 <- get_mapbiomas_peru_fire(product = "annual_burned", year = 2024, crop_to = lima) ## End(Not run)## Not run: library(geoidep) lima <- get_departaments("LIMA") burned_2024 <- get_mapbiomas_peru_fire(product = "annual_burned", year = 2024, crop_to = lima) ## End(Not run)
Returns a lookup table with the pixel value codes, English/Spanish class
names, and hexadecimal colors used by a given MapBiomas Fuego Peru
sub-product (Collection 1). Useful for building color scales (see
scale_fill_mapbiomas_peru_fire_d).
get_mapbiomas_peru_fire_legend(product)get_mapbiomas_peru_fire_legend(product)
product |
Character. One of the products listed in
|
annual_burned and accumulated_burned: binary classification (1 = "Burned area").
annual_burned_coverage and accumulated_burned_coverage: share the LULC legend.
monthly_burned: values 1-12 = month of burning.
frequency_burned: values 1-12 = burn count (12 = "12 or more times").
year_last_fire: values are years (2013-2024).
annual_burned_scar_size_range: values 1-5 = scar size class.
A tibble with columns id, class_en, class_es, and hex.
library(geoidep) get_mapbiomas_peru_fire_legend("frequency_burned")library(geoidep) get_mapbiomas_peru_fire_legend("frequency_burned")
Returns a lookup table describing the MapBiomas Fuego (Fire) Peru
sub-products available for download, including their internal codes,
descriptions, and whether they are indexed by a single year or by
a year range (starting in 2013).
get_mapbiomas_peru_fire_products()get_mapbiomas_peru_fire_products()
A tibble with columns product, description_en,
description_es, and temporal ("annual" or "range").
library(geoidep) get_mapbiomas_peru_fire_products()library(geoidep) get_mapbiomas_peru_fire_products()
Lazily reads a single-year Land Use and Land Cover (LULC) classification
raster from the MapBiomas Peru collection. Only the bytes required for the
requested extent are downloaded (via GDAL's /vsicurl/ driver).
Optionally crops and masks the raster to an area of interest.
get_mapbiomas_peru_lulc(year, crop_to = NULL, collection = 4)get_mapbiomas_peru_lulc(year, crop_to = NULL, collection = 4)
year |
Integer. Year of the classification (e.g. |
crop_to |
Optional. An |
collection |
Integer. MapBiomas Peru collection number ( |
A SpatRaster with one layer named classification_<year>.
## Not run: library(geoidep) lima <- get_departaments("LIMA", show_progress = FALSE) lulc_2024 <- get_mapbiomas_peru_lulc(year = 2024, crop_to = lima) lulc_2024 lulc_2025 <- get_mapbiomas_peru_lulc(year = 2025, collection = 4, crop_to = lima) lulc_2025 ## End(Not run)## Not run: library(geoidep) lima <- get_departaments("LIMA", show_progress = FALSE) lulc_2024 <- get_mapbiomas_peru_lulc(year = 2024, crop_to = lima) lulc_2024 lulc_2025 <- get_mapbiomas_peru_lulc(year = 2025, collection = 4, crop_to = lima) lulc_2025 ## End(Not run)
Downloads and stacks multiple single-year LULC rasters from MapBiomas
Peru (see get_mapbiomas_peru_lulc), each cropped to the same
area of interest if provided. Progress uses cli.
get_mapbiomas_peru_lulc_series( years, crop_to = NULL, collection = 4, show_progress = TRUE )get_mapbiomas_peru_lulc_series( years, crop_to = NULL, collection = 4, show_progress = TRUE )
years |
Integer vector. Years to download (e.g. |
crop_to |
Optional. An |
collection |
Integer. MapBiomas Peru collection number ( |
show_progress |
Logical. Show a cli progress bar. Default |
A SpatRaster with one layer per year, named classification_<year>.
## Not run: library(geoidep) lima <- get_departaments("LIMA", show_progress = FALSE) lulc_series <- get_mapbiomas_peru_lulc_series(years = 2020:2024, crop_to = lima) lulc_series ## End(Not run)## Not run: library(geoidep) lima <- get_departaments("LIMA", show_progress = FALSE) lulc_series <- get_mapbiomas_peru_lulc_series(years = 2020:2024, crop_to = lima) lulc_series ## End(Not run)
Download the latest version of data available on the MTC geoportal. For more information, visit MTC Geoportal.
get_mtc_data( layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_mtc_data( layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
layer |
Select only one from the list of available layers, for more information please use |
dsn |
Character. Output filename with the spatial format. If missing, a temporary file is created. |
show_progress |
Logical. Show a cli progress bar. Default |
quiet |
Logical. Suppress info message. Default |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object.
## Not run: library(geoidep) library(sf) aerodromo <- get_mtc_data(layer = "aerodromos_2023", show_progress = FALSE) head(aerodromo) plot(st_geometry(aerodromo)) ## End(Not run)## Not run: library(geoidep) library(sf) aerodromo <- get_mtc_data(layer = "aerodromos_2023", show_progress = FALSE) head(aerodromo) plot(st_geometry(aerodromo)) ## End(Not run)
Download any public layer from the environmental enforcement IDE of the
Environmental Assessment and Enforcement Agency - OEFA
(https://sistemas.oefa.gob.pe/pifa/mfe/#/interoperabilidad).
When region is supplied, its bounding box is used to query the WFS
service and the downloaded features are then filtered to those falling
inside region. When region is NULL, the whole layer is downloaded.
get_oefa_data( region = NULL, layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_oefa_data( region = NULL, layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
region |
An sf object specifying the area of interest (must be in EPSG:4326 - WGS 84).
If |
layer |
A string. Layer key (e.g. |
dsn |
Character. Output filename. If supplied, the result is written to this file. If missing, a temporary file is used internally. |
show_progress |
Logical. Show cli progress. Default |
quiet |
Logical. Suppress messages from |
timeout |
Numeric. Seconds to wait for the server response (default 60). |
Column names are normalised to lowercase. The WFS 2.0.0 bbox filter
requires latitude/longitude axis order for EPSG:4326, which is handled
internally.
An sf object with the layer geometries and attributes.
## Not run: library(geoidep) get_data_sources("Oefa") # Full layer download (mining rights countrywide) mining <- get_oefa_data(layer = "derechos_mineros", show_progress = FALSE) head(mining) # Features inside a region of interest lima <- sf::st_sf(geometry = sf::st_sfc( sf::st_bbox(c(xmin = -77.2, ymin = -12.6, xmax = -76.6, ymax = -11.7), crs = sf::st_crs(4326)) |> sf::st_as_sfc() )) mining_lima <- get_oefa_data(region = lima, layer = "derechos_mineros", show_progress = FALSE) nrow(mining_lima) ## End(Not run)## Not run: library(geoidep) get_data_sources("Oefa") # Full layer download (mining rights countrywide) mining <- get_oefa_data(layer = "derechos_mineros", show_progress = FALSE) head(mining) # Features inside a region of interest lima <- sf::st_sf(geometry = sf::st_sfc( sf::st_bbox(c(xmin = -77.2, ymin = -12.6, xmax = -76.6, ymax = -11.7), crs = sf::st_crs(4326)) |> sf::st_as_sfc() )) mining_lima <- get_oefa_data(region = lima, layer = "derechos_mineros", show_progress = FALSE) nrow(mining_lima) ## End(Not run)
Summary of providers.
get_providers(query = NULL)get_providers(query = NULL)
query |
Character. Default is NULL (only |
A tibble with columns provider and layer_count.
## Not run: library(geoidep) get_providers() ## End(Not run)## Not run: library(geoidep) get_providers() ## End(Not run)
Download the latest version of the geometry and ubigeos corresponding to the official political division of the province boundaries of Peru. For more information, visit INEI Spatial Data Portal.
get_provinces( departamento = NULL, provincia = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_provinces( departamento = NULL, provincia = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
departamento |
Character. Name of the level-1 administrative boundary (department). Case-insensitive. |
provincia |
Character. Name of the level-2 administrative boundary (province). Case-insensitive. Requires |
dsn |
Character. Directory where the file will be saved. If |
show_progress |
Logical. Show a cli progress bar. |
quiet |
Logical. Suppress info message. |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object.
## Not run: library(geoidep) prov <- get_provinces(show_progress = FALSE) head(prov) ## End(Not run)## Not run: library(geoidep) prov <- get_provinces(show_progress = FALSE) head(prov) ## End(Not run)
Download the latest version of data available on the sernanp geoviewer. For more information, visit Sernanp Platform.
get_sernanp_data( layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )get_sernanp_data( layer = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
layer |
Select only one from the list of available layers, for more information please use |
dsn |
Character. Output filename. If missing, a temporary file is created. |
show_progress |
Logical. Show a cli progress bar. Default |
quiet |
Logical. Suppress info message. Default |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object.
## Not run: library(geoidep) library(sf) anp <- get_sernanp_data(layer = "zonificacion_anp", show_progress = FALSE) plot(st_geometry(anp)) ## End(Not run)## Not run: library(geoidep) library(sf) anp <- get_sernanp_data(layer = "zonificacion_anp", show_progress = FALSE) plot(st_geometry(anp)) ## End(Not run)
A ggplot2 discrete fill scale that applies the official
MapBiomas Fuego Peru (Collection 1) color palette for a given sub-product
to a classified SpatRaster (as a factor), for use with
tidyterra::geom_spatraster().
scale_fill_mapbiomas_peru_fire_d( product, ..., lang = c("en", "es"), na.translate = FALSE )scale_fill_mapbiomas_peru_fire_d( product, ..., lang = c("en", "es"), na.translate = FALSE )
product |
Character. One of the products listed in
|
... |
Additional arguments passed to |
lang |
Character. Legend language, either |
na.translate |
Logical. Should |
A ggplot2 discrete scale object.
## Not run: library(geoidep) library(ggplot2) library(tidyterra) lima <- get_departaments("LIMA", show_progress = FALSE) freq <- get_mapbiomas_peru_fire(product = "frequency_burned", year = 2024, crop_to = lima) ggplot() + geom_spatraster(data = as.factor(freq)) + scale_fill_mapbiomas_peru_fire_d("frequency_burned", lang = "es") + theme_minimal() ## End(Not run)## Not run: library(geoidep) library(ggplot2) library(tidyterra) lima <- get_departaments("LIMA", show_progress = FALSE) freq <- get_mapbiomas_peru_fire(product = "frequency_burned", year = 2024, crop_to = lima) ggplot() + geom_spatraster(data = as.factor(freq)) + scale_fill_mapbiomas_peru_fire_d("frequency_burned", lang = "es") + theme_minimal() ## End(Not run)
A ggplot2 discrete fill scale that applies the official MapBiomas
Peru Collection 3 color palette to a classified SpatRaster (as a
factor), for use with tidyterra::geom_spatraster().
scale_fill_mapbiomas_peru_lulc_d( ..., lang = c("en", "es"), na.translate = FALSE )scale_fill_mapbiomas_peru_lulc_d( ..., lang = c("en", "es"), na.translate = FALSE )
... |
Additional arguments passed to |
lang |
Character. Legend language, either |
na.translate |
Logical. Should |
A ggplot2 discrete scale object.
## Not run: library(geoidep) library(ggplot2) library(tidyterra) lima <- get_departaments("LIMA") lulc_2024 <- get_mapbiomas_peru_lulc(year = 2024, crop_to = lima) ggplot() + geom_spatraster(data = as.factor(lulc_2024)) + scale_fill_mapbiomas_peru_lulc_d(lang = "es") + theme_minimal() + labs(fill = "Cobertura/Uso", title = "MapBiomas Peru 2024") ## End(Not run)## Not run: library(geoidep) library(ggplot2) library(tidyterra) lima <- get_departaments("LIMA") lulc_2024 <- get_mapbiomas_peru_lulc(year = 2024, crop_to = lima) ggplot() + geom_spatraster(data = as.factor(lulc_2024)) + scale_fill_mapbiomas_peru_lulc_d(lang = "es") + theme_minimal() + labs(fill = "Cobertura/Uso", title = "MapBiomas Peru 2024") ## End(Not run)
Filter Senamhi alerts by number
senamhi_alert_by_number(data, nro)senamhi_alert_by_number(data, nro)
data |
A data frame of meteorological alerts. |
nro |
A numeric vector indicating the alert number(s). |
A filtered tibble.
Filter Senamhi alerts by year
senamhi_alerts_by_year(data, year)senamhi_alerts_by_year(data, year)
data |
A data frame of meteorological alerts. |
year |
A numeric value indicating the year. |
A filtered tibble.
This function filters the sf object from Senamhi by alert level (e.g., 1 to 4).
senamhi_geometry_by_level(sf_data, level)senamhi_geometry_by_level(sf_data, level)
sf_data |
An sf object returned by |
level |
Numeric or character vector: values like 1, 2, 3, 4 or "Nivel 1", etc. |
Filtered sf object.
## Not run: senamhi_get_meteorological_table() |> senamhi_alert_by_number(295) |> senamhi_alerts_by_year(2024) |> senamhi_get_spatial_alerts(show_progress = FALSE) |> senamhi_geometry_by_level(3) |> plot() ## End(Not run)## Not run: senamhi_get_meteorological_table() |> senamhi_alert_by_number(295) |> senamhi_alerts_by_year(2024) |> senamhi_get_spatial_alerts(show_progress = FALSE) |> senamhi_geometry_by_level(3) |> plot() ## End(Not run)
This function downloads the table of weather warnings provided by Senamhi. For more information, please visit the following link: https://www.senamhi.gob.pe/?&p=aviso-meteorologico
senamhi_get_meteorological_table(show_progress = TRUE, timeout = 60)senamhi_get_meteorological_table(show_progress = TRUE, timeout = 60)
show_progress |
Logical. Show a cli progress bar. Default |
timeout |
Numeric. Seconds to wait for the server response. Default 60. |
A tibble object containing the weather alert data.
## Not run: data <- senamhi_get_meteorological_table(show_progress = FALSE) head(data) ## End(Not run)## Not run: data <- senamhi_get_meteorological_table(show_progress = FALSE) head(data) ## End(Not run)
This function downloads the spatial alert geometry (shapefile) from Senamhi for a given alert.
senamhi_get_spatial_alerts( data = NULL, nro = NULL, year = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )senamhi_get_spatial_alerts( data = NULL, nro = NULL, year = NULL, dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60 )
data |
A data frame with a single alert (with columns |
nro |
A numeric value (optional if |
year |
A numeric value (optional if |
dsn |
Path to save the downloaded .zip. If NULL, a temporary file is used. |
show_progress |
Logical, show cli progress bar. |
quiet |
Logical, suppress messages from |
timeout |
Numeric. Seconds to wait for a response. Default 60. |
An sf object with the alert geometry.