Authors: Aakriti Poudel, Leela Dixit, Megan Hessel, and Lucian Scher
This repository checks whether proposed dam sites around the world sit inside protected areas such as national parks, conservation areas, and nature reserves where building is not allowed. If a planned dam falls inside a protected area, we flag it as a "fatal-flaw." This means it is very unlikely to be approved and can be ruled out early.
This work is part of a larger project, NetZeroHydro, which looks for future hydropower dams that would do the least harm to nature. The results here feed into our scoring model in the companion MCDA-model repository.
| File | What it does |
|---|---|
protected_areas_global_strl_4.qmd |
It checks every proposed (FHReD) dam against the world's protected areas and saves a clear Yes/No result table and a map. Uses dams snapped to Strahler order 4 and higher rivers. |
protected-areas-global.qmd |
This is the global analysis. It also has a smaller exploration focused on Nepal. Useful for seeing the idea on one country before scaling to the world. |
environment.R |
A simple script that installs all the R packages for you. An easy alternative to renv. |
requirements.txt |
A plain list of the R packages the project needs. |
README.md |
This file. |
LICENSE |
The license for using this code (MIT). |
.gitignore |
A list of files that are kept off GitHub, such as large data and private settings. |
File Path
fatal-flaws/
├── protected_areas_global_strl_4.qmd
├── protected-areas-global.qmd
├── environment.R
├── requirements.txt
├── README.md
├── LICENSE
└── .gitignore
The raw data files are too large to keep here. Download them from the links below and save them on your own computer. You will point the code to those locations in the setup step further down.
| Dataset | What it contains | Source |
|---|---|---|
| Global Dam Watch (GDW) | Where existing large dams are and details about them | Global Dam Watch |
| Future Hydropower and Reservoir Data (FHReD) | Proposed future dams that could make at least 1 MW of power | FHReD |
| Protected Planet (WDPA) | A map of protected areas on land and at sea | Protected Planet |
All maps and results use the same map grid, EPSG:3857, so everything lines up.
You need R and Quarto installed. The steps below get everything else ready.
You have two ways to do this. Pick one.
Option A: renv Different versions of an R package can give slightly different results. To avoid that, this project uses renv. Think of renv as a packing list: it records the exact version of every package the project used, so you can install the same ones and get the same results.
# install renv once, if you don't have it
install.packages("renv")
# install every package at the exact version this project uses
renv::restore()renv reads the project's record (a file called renv.lock) and installs everything for you.
If you are starting this project's renv for the very first time and there is no record yet, set one up like this:
renv::init() # start tracking packages for this project
renv::snapshot() # save the current package versions into renv.lockOption B: environment.R If you do not want to use renv, just run the setup script. It checks each package and installs only the ones you are missing, then loads them all.
source("environment.R")The requirements.txt file is a plain list of the same packages, in case you want to see them at a glance.
The packages this project relies on are:
| Package | What it does |
|---|---|
sf |
Reads and works with map and location data |
tmap |
Makes maps you can print or explore |
leaflet |
Powers the interactive maps in your web browser |
tidyverse |
Cleans and organizes the data |
readr |
Reads and writes CSV files |
janitor |
Tidies up messy column names |
here |
Keeps file paths working on any computer |
The code needs to know where you saved the big data files. Instead of typing those file paths directly into the code, you keep them in a small settings file called .Renviron. This has two benefits:
- You only set the paths once, in one place, instead of editing the code.
- The file is kept off GitHub (it is already listed in
.gitignore), so your personal folder paths stay private.
A .Renviron file is just a plain text file. Create one in the main project folder and add your paths, one per line, like this:
FHRED_PATH=/capstone/netzerohydro/data/FhRED_prj_100m_from_StrOrd4_SNAPPED.gpkg
WDPA_PATH=/capstone/netzerohydro/data/raw/WDPA_WDOECM_Jan2026_Public/world_database_protected_areas.gdb
OUT_DIR=/capstone/netzerohydro/data/cleaned_data
FIGURES_DIR=/capstone/netzerohydro/figures
Change the paths on the right to match where the files actually live on your computer. A few simple rules: no spaces around the = sign, no quotation marks, and leave one empty line at the end of the file.
After you save the file, restart R so it reads the new settings. Inside the analysis, the code picks up these values with Sys.getenv(), for example:
# read the saved paths instead of typing them into the code
fhred_path <- Sys.getenv("FHRED_PATH")
wdpa_path <- Sys.getenv("WDPA_PATH")
out_dir <- Sys.getenv("OUT_DIR")
work_crs <- 3857 # the shared map gridIf a path comes back empty, R did not find your .Renviron file or has not been restarted yet. To check what R is reading, run Sys.getenv("FHRED_PATH") in the console.
Open protected_areas_global_strl_4.qmd and run it (click Render in RStudio, or run quarto render protected_areas_global_strl_4.qmd in the terminal). It will produce a results table, save two output files, and draw an interactive map.
The main file answers one question for every proposed dam: is this dam inside a protected area? The result is a table with one row per dam, including:
- a plain Yes/No for whether the dam is in a protected area,
- separate Yes/No columns for the main types of protection (national park, World Heritage Site, Ramsar wetland, biosphere reserve, and any other type),
- how many protected areas the dam overlaps and their names.
It also saves the results as a GeoPackage (keeps the dam locations for more map work) and a CSV (opens in any spreadsheet program), and it draws an interactive map where red dots are dams inside a protected area and blue dots are outside.
In the current run, 315 of 2,288 proposed dams fall inside a protected area at strahler order 4 and higher.
To read more, visit our Bren project page.