| Title: | R Interface to Get French Heritage Data |
|---|---|
| Description: | Get spatial vector data from the Atlas du Patrimoine (<http://atlas.patrimoines.culture.fr/atlas/trunk/>), the official national platform of the French Ministry of Culture, and facilitate its use within R geospatial workflows. The package provides functions to list available heritage datasets, query and retrieve heritage data using spatial queries based on user-provided sf objects, perform spatial filtering operations, and return results as sf objects suitable for spatial analysis, mapping, and integration into heritage management and landscape studies. |
| Authors: | Matthieu Chevereau [aut, cre] |
| Maintainer: | Matthieu Chevereau <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.1 |
| Built: | 2026-05-17 09:30:53 UTC |
| Source: | https://github.com/mucau/frheritage |
A dataset containing available layer datasets from the French Ministry of Culture's "Atlas du Patrimoine" service.
all_idsall_ids
A data.frame with 5 columns:
(character) Layer id.
(character) Layer title.
(integer) Layer guid.
(character) Internal code, determined from tile.
(character) Layer department
Contains only data available on the 96 departments of metropolitan France.
This function retrieves the INSEE administrative department codes
(code_insee) intersecting the features of a given sf object.
It relies on the Admin Express COG WFS service provided by IGN,
accessed via the happign package.
get_deps(x)get_deps(x)
x |
An |
The function performs the following steps:
Transforms the input geometries to CRS:4326.
Computes centroids of the geometries.
Queries the IGN WFS service (Admin Express COG) to retrieve departments.
Performs a spatial join using sf::st_intersects().
Extracts and returns unique code_insee values.
Notes:
The function depends on the availability of the IGN WFS service.
Large or complex geometries may cause the request to fail.
In such cases, consider simplifying or reducing the spatial extent of x.
A character vector of unique INSEE department codes intersecting
the input geometries. Returns NULL if no intersection is found or if the
WFS request fails.
if (interactive()) { # Minimal sf object (point in Paris) x <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.35, 48.85)), crs = 4326 ) ) # Retrieve department code get_deps(x) # Multiple locations (Paris and Rouen) x2 <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.35, 48.85)), # 75 sf::st_point(c(1.09, 49.44)), # 76 crs = 4326 ) ) get_deps(x2) }if (interactive()) { # Minimal sf object (point in Paris) x <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.35, 48.85)), crs = 4326 ) ) # Retrieve department code get_deps(x) # Multiple locations (Paris and Rouen) x2 <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.35, 48.85)), # 75 sf::st_point(c(1.09, 49.44)), # 76 crs = 4326 ) ) get_deps(x2) }
This function retrieves and downloads spatial heritage datasets from the French Ministry of Culture’s "Atlas du Patrimoine" service.
get_heritage(x, data_code, buffer = 2500, crs = 2154, verbose = TRUE)get_heritage(x, data_code, buffer = 2500, crs = 2154, verbose = TRUE)
x |
An |
data_code |
A single |
buffer |
A |
crs |
An |
verbose |
Logical. If |
It uses the spatial extent and inferred department(s) of the input sf
object to query an internal registry of heritage datasets, then downloads
and merges the corresponding spatial layers.
This function currently supports metropolitan France departments (96 units).
Internally, the function:
Validates the input data_code against an internal registry.
Prepares and optionally buffers the input geometry.
Computes spatial extents (bounding boxes) for each feature.
Assigns each feature to one or more administrative departments.
Filters available heritage records using an internal dataset registry.
Builds query URLs for the Atlas du Patrimoine service.
Downloads ZIP archives containing shapefiles.
Reads, validates, and merges the resulting sf objects.
Partial failures are tolerated: invalid or empty responses for individual requests are skipped.
A single sf object containing all retrieved heritage features.
Returns an empty sf object if no data is found or all requests fail.
if (interactive()) { # Define a minimal spatial object (WGS84 point) my_sf_layer <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.21, 48.82)), crs = 4326 ) ) # Retrieve heritage spatial data res <- get_heritage( x = my_sf_layer, data_code = "IMMH", buffer = 2000, crs = 2154, verbose = TRUE ) }if (interactive()) { # Define a minimal spatial object (WGS84 point) my_sf_layer <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.21, 48.82)), crs = 4326 ) ) # Retrieve heritage spatial data res <- get_heritage( x = my_sf_layer, data_code = "IMMH", buffer = 2000, crs = 2154, verbose = TRUE ) }
This function retrieves available heritage dataset identifiers from the French Ministry of Culture’s "Atlas du Patrimoine" service.
get_heritage_ids(x, buffer = 2500, crs = 2154, verbose = TRUE)get_heritage_ids(x, buffer = 2500, crs = 2154, verbose = TRUE)
x |
An |
buffer |
A |
crs |
An |
verbose |
Logical. If |
It uses the spatial extent and inferred department(s) of the input sf
object to query the service.
Internally, the function:
Aggregates nearby geometries using buffer input.
Determines the corresponding INSEE department code for each geometry, using happign::get_wfs().
Computes the bounding box of each geometry.
Queries the "Atlas du Patrimoine" service feed for all available metadata records (IDs, titles, GUIDs) within each bounding box.
A data.frame with the following columns:
Numeric identifier extracted from the record GUID.
Record title as published in the service feed.
Full GUID (unique resource identifier).
Department code associated with the spatial query.
Internal code associated with the layer.
Returns an empty data.frame if no records are found or the request fails.
if (interactive()) { # Create a minimal sf object defining the area of interest. # A simple point geometry is sufficient to trigger spatial queries. my_sf_layer <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.21, 48.82)), crs = 4326 ) ) # Retrieve available heritage dataset identifiers intersecting # the spatial extent derived from the sf object. ids <- get_heritage_ids(my_sf_layer) }if (interactive()) { # Create a minimal sf object defining the area of interest. # A simple point geometry is sufficient to trigger spatial queries. my_sf_layer <- sf::st_sf( geometry = sf::st_sfc( sf::st_point(c(2.21, 48.82)), crs = 4326 ) ) # Retrieve available heritage dataset identifiers intersecting # the spatial extent derived from the sf object. ids <- get_heritage_ids(my_sf_layer) }
This function provides a reference table mapping internal codes to explore heritage layer available datasets from French Ministry of Culture's "Atlas du Patrimoine". Optionally, it can filter the table to return only selected codes.
get_heritage_layernames(code = NULL)get_heritage_layernames(code = NULL)
code |
Optional |
The available codes and their meanings are:
IMDN — Domaines nationaux
IMMH — Immeubles classes ou inscrits
IMUN — Patrimoine Mondial UNESCO – Emprise surfacique des biens
LACR — Architecture Contemporaine Remarquable
PADN — Protection au titre des abords de domaines nationaux
PAMH — Protection au titre des abords de monuments historiques
PAUN — Patrimoine Mondial UNESCO – Zone tampon des biens
SICI — Sites classes ou inscrits
SIPR — Sites patrimoniaux remarquables
ZPPA — Zones de presomption de prescriptions archeologiques
A data.frame with two columns:
Official heritage layer code (character).
Descriptive label (character).
# Get the full table of heritage layer codes get_heritage_layernames() # Filter for specific codes get_heritage_layernames(c("IMMH", "SICI"))# Get the full table of heritage layer codes get_heritage_layernames() # Filter for specific codes get_heritage_layernames(c("IMMH", "SICI"))