
Processing residential buildings in BD Topo®
bd_topo_dwelling_en.Rmd
Introduction
This vignette provides a step-by-step guide to processing residential
buildings in the BD-Topo® using the floodam.data
package.
The BD-Topo® is a comprehensive database of geographical information
from France. This process involves downloading the data, extracting
relevant residential building and dwelling information, analyzing it,
summarizing the results, and generating reports.
Prerequisites
Before you begin, ensure that you have the following:
- Sufficient disk space to store the downloaded and processed data.
- A stable internet connection.
Step 2: Define Paths
Define the paths to the directories where the data will be downloaded and processed. Important: Update these paths to match your local file system.
path_bd_topo = "~/data/data-local/original/bd-topo"
path_building = "~/data/data-local//adapted/bd-topo/building"
path_dwelling = "~/data/data-local//adapted/bd-topo/dwelling"
path_department = "~/data/data-local//adapted/admin-express"
path_eaip = "~/data/data-local//adapted/eaip"
Step 3: Get Latest Archive and Vintage
Download the BD Topo data for each department and extract the vintage information. Here we use department 34 (Hérault) as an example:
download_info = floodam.data::download_bd_topo(
file.path(path_bd_topo, vintage),
department = 34,
type = "GPKG"
)
vintage = floodam.data::analyse_archive(download_info[["task"]][2])["vintage"]
This step downloads the data and stores it in the specified directory.
Step 4: Extract Building Data
Extract the building data from the downloaded archive:
extract_building(
origin = file.path(path_bd_topo, vintage),
destination = file.path(path_building, vintage),
map = TRUE,
path_eaip = path_eaip
)
Step 5: Extract Dwelling Data
Extract the dwelling data from the building data:
extract_dwelling(
origin = file.path(path_building, vintage),
destination = file.path(path_dwelling, vintage),
department = path_department,
map = TRUE
)
Step 6: Analyze Dwelling Data
Analyze the extracted dwelling data:
analyse_dwelling(
file.path(path_building, vintage),
retrieve = FALSE
)
Step 7: Summarize Dwelling Data
Summarize the analyzed dwelling data:
summarise_dwelling(file.path(path_dwelling, vintage))
summarise_dwelling(file.path(path_dwelling, vintage), flood = "eaip")
Step 8: Generate Report
Generate a report for each department:
generate_report(
file.path(path_dwelling, vintage, "analysed"),
quiet = TRUE,
purge = TRUE,
complete = TRUE
)