Skip to content

Repository files navigation

UNA — Urban Network Analysis

UNA is a free, open-source Python package for computing accessibility and pedestrian-flow metrics on spatial networks, developed by Andres Sevtsuk and Raul Kalvo at the MIT City Form Lab. It loads a spatial network, weighted origin and destination point layers, and optionally obstacle or observed point layers, and runs analyses to answer two families of questions:

  • Accessibility — what can each origin reach on the network within a given walking range? Metrics: Reach (cumulative opportunities), exponential and logistic gravity, and K-nearest-neighbor access.
  • Flow — how many trips does each street segment carry between origins and destinations? Two route-choice engines: aggregate_flow (the default — spreads each OD pair's trips over the full envelope of viable routes; scales to regional and state-wide models) and k_alternatives (enumerates discrete alternative paths; supports turn-aware routing and route-geometry export. Suitable for neighborhood scale analyses).

Impedance can go beyond geometric length: custom "perceived length" edge costs, uphill elevation penalties, turn penalties, and obstacle penalties. Hot loops are Numba-compiled and searches are radius-bounded, which keeps large-scale runs feasible. Results export to GeoJSON, Feather, and CSV for mapping in QGIS or any GIS.

Installation

Two steps — a conda environment for the geospatial dependencies, then the package itself. Requires Python ≥ 3.11.

# 1. environment (una.yml is in this repo's setup/ folder)
conda env create -f setup/una.yml
conda activate una

# 2. the package
pip install git+https://github.com/City-Form-Lab/urban_network_analysis.git

To modify the code, clone and install in editable mode instead:

git clone https://github.com/City-Form-Lab/urban_network_analysis.git
pip install -e ./urban_network_analysis

Quick start

import urban_network_analysis as una

project = una.UNA()

project.settings.data_folder       = "Boston"     # this repo's docs/Boston has tutorial data
project.settings.network_file      = "20260703_PercLenNetwork_InnerCore.geojson"
project.settings.origins_file      = "Cambridge_building_centroids.geojson"
project.settings.destinations_file = "MA_bus_stops.geojson"

project.settings.search_radius             = 500
project.settings.destination_weight_column = "weekly_departures"

project.RunAccessibility()

Ready-to-edit driver scripts are in examples/UNA_Workspace.py for single analyses and UNA_Batch.py for running many analyses from a pairings CSV.

Documentation and tutorials

Full documentation lives in docs/: installation, a first-analysis walkthrough, the complete settings reference, concept pages on the gravity/decay models and both flow engines, and four hands-on tutorials (networks, accessibility, flow, and design-impact analysis). The tutorial dataset — a pedestrian network of the Boston inner core with building, transit, and amenity layers — ships in docs/Boston/, so the tutorials run out of the box.

Build the docs locally with Sphinx:

pip install -r docs/requirements.txt
sphinx-build -b html docs docs/_build/html

Versioning

The package version is defined once, in src/urban_network_analysis/__init__.py (__version__), and read by the build system at install time. Check yours with:

import urban_network_analysis
print(urban_network_analysis.__version__)

Citing UNA

If you use UNA in academic work, please cite:

License

MIT — see LICENSE.

About

UNA is a free, open-source Python package for computing accessibility and pedestrian-flow metrics on spatial networks.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages