Itinera
Anisotropic least-cost path (LCP), corridor (LCC), From-Everywhere-To-Everywhere (FETE), stochastic / probabilistic paths and route validation (Path Deviation Index + buffer overlap) primitives for movement modelling — a pure numpy / scipy library extracted from the Itinera QGIS plugin.
Cost is directional (uphill ≠ downhill): each DEM cell becomes a graph node,
edge weights come from a directional cost function of the signed slope, so the
conductance matrix is asymmetric — true anisotropy. Paths are solved with
scipy.sparse.csgraph.dijkstra.
pip install itinera
Only numpy and scipy are required.
Quick start
import numpy as np
from itinera import build_conductance, least_cost_path, tobler, rowcol_to_node
# A small DEM (elevations in metres) on a 10 m grid.
dem = np.random.default_rng(0).random((50, 50)) * 100.0
matrix, rows, cols = build_conductance(
dem, cellsize=10.0, cost_fn=tobler, neighbours=8)
origin = rowcol_to_node(0, 0, cols)
dest = rowcol_to_node(49, 49, cols)
path, total_cost = least_cost_path(matrix, origin, dest) # path = node indices
Turn node indices back into (row, col) with node_to_rowcol(node, cols).
What's included
- Cost functions (ten):
tobler,tobler_offpath,herzog,naismith,llobera_sluckin,irmischer_clarke,minetti,pandolf,wheeled,pack_animal— each(slope, distance, **params) -> cost.pandolfreadsmass/load/terrain;wheeled/pack_animalare experimental heuristics — anisotropic critical-slope presets with illustrative default thresholds, not calibrated published functions. - Conductance:
build_conductance(slope, optional barrier/multiplier,cost_params),build_conductance_friction(friction raster, optional DEM). - Paths:
accumulated_cost,least_cost_path,corridor/corridor_band,fete. - Accessibility:
accessibility— cost-distance surface + catchment mask + isochrone bands from source(s). - Randomized shortest paths:
rsp_passages— a θ-tunable movement-density surface that spans the least-cost path (θ→∞) and the random-walk / circuit current (θ→0), plus the RSP free-energy distance. - Circuit theory:
current_density(graph-Laplacian current + pinch points) andrestoration_score(McRae 2012 barrier / restoration improvement map). - Multi-criteria:
composite_friction— a generic heuristic combiner (not a Litvine 2024 reproduction) merging several penalty rasters into one friction multiplier (weighted sum/product, per-layer invert, NoData masks); min-max normalisation makes it extent-dependent. - Stochastic:
stochastic_lcp(DEM-error + edge-drop + cost-model randomisation viacost_fns/cost_weights/param_jitter, with an early-stop convergence criterion viatol/convergence/return_diagnostics),add_dem_error,simulate_error_field(variogram-based DEM error field),add_global_stochasticity. - Validation:
pdi(Jan et al. 2000: area / straight-line O–D distance, endpoints snapped to the reference O/D),buffer_overlap(Goodchild & Hunter buffer method),mean_pairwise_overlap(route-stability across a set of paths). - Grid helpers:
xy_to_rowcol,check_/assert_regular_geotransform,check_/assert_grids_aligned. - Utilities:
estimate_conductance_bytes,format_bytes,block_reduce_mean.
Scope: bring your own raster I/O
This is a numerics library — it works on numpy arrays + a GDAL-style
geotransform tuple. It does not depend on GDAL and does not read or
write raster files. Load your DEM with whatever you already use
(rasterio, osgeo.gdal, xarray/rioxarray, …) and pass the array in.
Use a projected CRS in metres so slope and distance are metric.
Relation to the QGIS plugin
The same code ships inside the
Itinera QGIS plugin (where it is the
plugin's private core package, plus QGIS/GDAL wrappers). The PyPI package and
the QGIS plugin share the top-level import name itinera; they are meant for
separate environments. Don't pip install itinera into the Python
interpreter that runs QGIS — the plugin already bundles this code, and the two
would shadow each other on sys.path.
Licence
MIT — see LICENSE. The QGIS plugin wrapper is licensed separately
under GPLv3. References for the methods (Tobler, Naismith,
Herzog, Llobera & Sluckin, Irmischer & Clarke, Minetti, Pandolf/Santee, White &
Barber, Lewis, Jan et al. for PDI, Goodchild & Hunter for buffer overlap,
Panzacchi/Saerens & van Etten for RSP, McRae for circuit theory) are in
docs/REFERENCES.md.
Metadata
Release files for itinera 0.14.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| itinera-0.14.2.tar.gz | 36.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| itinera-0.14.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.4 kB
Release files / itinera-0.14.2.tar.gz
| Download URL | itinera-0.14.2.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b11759761e295c1132a21324762955d6ca0df921fd5c01bfbfd2c027f135bda2
|
|
BLAKE2b-256 checksum How to use checksums |
c4233214fc535e6d6d01ffcbbed5b7d6b9d4ff1fe739d7b986810bdffe942d25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logRelease files / itinera-0.14.2-py3-none-any.whl
| Download URL | itinera-0.14.2-py3-none-any.whl |
|---|---|
| Size | 37.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66e360f4da554701d383c532477a133739fa79b384fb4b6ab218691e48bcf91e
|
|
BLAKE2b-256 checksum How to use checksums |
5640005ff94b4f4a2a84a175cf8980eac78e28dd6303e54c2849fe009b54ef08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logSecurity for itinera 0.14.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for itinera-0.14.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.