Rocky Branches - Road Network Toolkit
rb-road-network (Rocky Branches - Road Network Toolkit), a GIS toolkit for creating market area reports.
Key features:
- Road-distance market area analysis - Calculate reachable areas based on road network distance from a given point
- US county demographics - Population and demographic data by county
- Map generation - Creates market area maps with visualization styles for QGIS
Tech stack:
- C++ executables (justPop, etc.) for core road network computation
- Python scripts for data processing and rendering (Plotly)
- Docker for containerized execution
- GDAL/OGR, shapelib for GIS operations
- QGIS style files for visualization
Typical workflow:
- Provide a lat/lon coordinate and radius (in meters)
- The tool calculates which areas are reachable via road network
- Produces:
- LaTeX-formatted population estimate timetable (
./output/OUTPUT.txt). - GIS
- LaTeX-formatted population estimate timetable (
# If you haven't yet,
# ensure the `uv` environment is initialized.
./scripts/uv-full-sync.sh
. ./.venv/bin/activate
# run the CLI
rb-road-network run
docker compose run rb-roads
(after setting environment variables, listed below)
- Build the docker image.
$ ./docker_build.sh
- Run the interactive tool.
$ ./docker_run.sh
GIS toolkit for creating market area reports, including:
- US county demographics
- Road-distance market area maps
Tested on:
- Arch Linux
- Debian 10
- Ubuntu
- shapelib (1.5)
- libshp-dev
- libcairo-dev [optional]
- libosmium-dev [optional]
- libgtk+-3 [optional]
- docker-desktop (for
dockerusage)
Use direnv to manage environment variables (./.envrc defines the following):
# absolute path of source/repo directory
# (also contains executables)
export RB_SRC=$HOME/Git/rb-road-network
export RB_PATH=$RB_SRC
# path for resources
export XDG_DATA_DIRS=$RB_PATH/share/
# absolute path of data,
# e.g. .SHP road map files
export RB_DATA=$HOME/Documents/rb_datasrc=justPop exe=justPop make arch=linuxsrc=justPop exe=justPop make arch=win# `--radius` should be given in meters!
$ ./justPop.exe \
-f ./output/justPopResult.txt \
--lat=30.2 --lon=-83.0 \
--radius=75000 \
--stride=0.009 \
--tons-per-person=4.5 \
--nthreads=8 \
--zoom=0.5$ ./scripts/download_gis_osm_roads.sh$RB_SRC/scripts/downloadCountyPop/downloadCountyPop.sh
(2.1) Build
$RB_SRC/scripts/build_scripts.sh(2.2) Update
$RB_DATA/county_pop/CSVs -> $RB_DATA/tl_2016_us_county_wgs84/tl_2016_us_county.dbf
$> $RB_SRC/scripts/build_scripts.sh
$> $RB_SRC/scripts/bin/countyPop2DBF.exeDownload $RB_DATA
$> $RB_SRC/scripts/download_rb_data.sh
$> $RB_SRC/scripts/downloadCountyPop.shDocker
$> $RB_SRC/docker_build.sh && $RB_SRC/docker_run.shInteractive script
$> $RB_SRC/scripts/roads_rb# for running container 'rb-road-network-rb-roads-run-77c22bf4c6b1'
$ docker cp rb-road-network-rb-roads-run-77c22bf4c6b1:/home/appuser/rb_app/SpanishCut.json ./
To copy a file from a running Docker container to your local filesystem, you can use the docker cp command. Here's a step-by-step guide to doing that:
- First, identify the container ID or name of the running container. You can list all running containers with the command:
docker ps
- Determine the full path of the file you want to copy from the container.
- Use the docker cp command to copy the file from the container to your local machine. The format for the command is as follows:
docker cp <container_id_or_name>:<container_file_path> <local_target_path>
Here's an example use case:
Let's say you have a container named my_container , and you want to copy a file /tmp/example.txt from the container to your local directory /home/user/ .
You would run:
docker cp my_container:/tmp/example.txt /home/user/
After this command runs successfully, the file example.txt should be present on your local filesystem in /home/user/ .
Please make sure you have appropriate permissions to access the targeted directory on your local filesystem, and take note that if a file with the same name already exists at the local path, it will be overwritten by default.
Recall: West longitude should be given as negative (e.g., 81.0W means -81.0)
g++ -std=gnu++2a *.cpp -lstdc++fs