This project creates a 3D population density “spike” map of Benin using openly available data from the Kontur Population dataset.
It uses R and the rayshader
package to render a high-quality 3D visualization of population density.
- Automated download of the latest Kontur Population dataset for Benin.
- Handles
.gz
extraction automatically and skips re-downloading if files already exist. - Uses tidyverse, sf, stars, and rayshader to:
- Load population raster data,
- Convert it to a matrix,
- Render a 3D spike map.
- Outputs a high-resolution PNG ready for sharing.
- R ≥ 4.3
- The following R packages:
tidyverse
R.utils
httr
sf
stars
rayshader
-
Clone this repository:
```bash
git clone https://github.com/YOURUSERNAME/benin-spike-map.git
cd benin-spike-map
-
Open benin-spike-map.R in RStudio or any R IDE
-
Run the whole script:
source("benin-spike-map.R")
This project is heavily inspired by and adapted from the work of the original author Milos Popovic. Watch the excellent tutorial here: 📺 YouTube Video Tutorial
Please check out and support their work!
This repository is shared under the same license as the original author’s code where applicable. All underlying population data © Kontur.io under their respective terms.