spint
SPatial INTeraction models
What it is and what it does
SpInt is a spatial interaction modeling library that calibrates gravity-type models for analyzing flows between geographic origins and destinations. It implements the Wilson (1971) family of entropy-maximizing models, supporting unconstrained, production-constrained, attraction-constrained, and doubly-constrained variants. All models are fit using iteratively weighted least squares in a generalized linear modeling framework, with results verified against comparable R and statsmodels routines.
The package is designed for researchers studying spatial interaction processes—such as migration, trade, or commuting patterns. It provides Poisson and QuasiPoisson estimation, overdispersion tests, model fit statistics (including Moran's I for spatial autocorrelation), local subset calibration for mappable parameter estimates, and three types of spatial weights (origin-destination contiguity, network-based, and vector distance). Sparse data structures are used for memory efficiency and speed.
Use it for:
- Calibrate gravity models to predict origin-destination flows (e.g., commuting, migration, or trade volumes) from population and distance data.
- Test spatial autocorrelation in interaction residuals using vector-based Moran's I to detect model misspecification.
- Fit production- or attraction-constrained models when total outflows or inflows are known but individual flows must be estimated.
- Generate mappable local parameter estimates and diagnostics by calibrating models on spatial subsets.
- Compare overdispersion across Poisson and QuasiPoisson specifications to assess model adequacy for count data.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
SpInt calibrates spatial interaction models (gravity, production-constrained, attraction-constrained, and doubly-constrained) using an entropy-maximizing framework and iteratively weighted least squares, with support for Poisson and QuasiPoisson count models.
Yes. SpInt is actively maintained, has no known vulnerabilities, low install friction, and fills a specialized but well-defined niche in spatial interaction modeling. The BSD 3-Clause license is permissive. Install it if you need to calibrate gravity or constrained spatial interaction models; skip it if your work does not involve origin-destination flow analysis.
Install
spint on PyPI
pip
pip install spintuv
uv add spintpoetry
poetry add spintInstalling spint
Before you install
Low install friction; pure Python wheel. Actively maintained with a recent release (58 days old) and current Python 3.12+ support. Depends on established scientific stack (numpy, scipy, libpysal, spglm, spreg).
License in practice
BSD 3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install spint
import spint
from spint import gravity
# Calibrate a spatial interaction model with your origin-destination flow data
Requires Python 3.12 or later; depends on scipy, numpy, and libpysal for spatial data structures.
Verify before relying
- Whether local subset calibration produces parameter estimates suitable for direct mapping without post-processing.
- Performance characteristics when working with large origin-destination matrices or high-dimensional spatial weights.
- Current status of Spatial Autoregressive (Lag) model implementation listed as 'In Progress'.
Package facts
| License | BSD 3-Clause (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — libpysal, numpy, scipy, spglm, spreg |
| Maintenance | actively maintained — 58 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 101,387/month — #12,940 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: spint-1.1.0-py3-none-any.whl
Keywords: spatial, statistics
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
mgwrCalibrates multiscale and traditional…
permissive · top 15,000 on PyPI
spglmFits Gaussian, Poisson, QuasiPoisson, and…
permissive · top 15,000 on PyPI
spregspreg estimates simultaneous autoregressive…
permissive · top 15,000 on PyPI
spatial-accessComputes travel times and spatial access…
permissive · top 15,000 on PyPI
pysalPySAL is a meta-package that bundles 29 spatial…
permissive · top 15,000 on PyPI
segregationCalculates over 40 segregation indices—both…
permissive · top 15,000 on PyPI
inequalityInequality provides methods for measuring…
permissive · top 15,000 on PyPI
esdaesda computes global and local spatial…
permissive · top 15,000 on PyPI
spoptSpopt solves spatial optimization problems…
permissive · top 15,000 on PyPI
accessCalculates spatial accessibility metrics to…
permissive · top 15,000 on PyPI