Skip to main content
Glama
EquiPop

EquiPop

Official
by GeoCalista

EquiPop (Python)

k-nearest neighbour contexts/neighbourhoods on gridded and hexagonal data: bespoke neighbourhoods, friction-aware growth, distance decay, neighbourhood statistics and segregation measures - for very large datasets.

EquiPop finds, for every populated location, the k nearest individuals (by cumulative population count, expanding over a uniform grid) and reports the composition of that individualised neighbourhood. The gridded design means one pre-computed distance ordering serves every origin, which is what makes millions of locations feasible.

The EquiPop family

This is the first Python implementation. Its relatives: the original C# EquiPop (three generations, two public releases; radial and Flow models, downloadable via Uppsala University) and an R version covering I/O and the basic k-NN parts. This Python version additionally carries friction growth, five decay models, exact neighbourhood statistics (mean/median/SD/SE/Gini/entropy), segregation indices, hexagonal grids, area aggregation and metadata logging.

Related MCP server: geospatial-mcp

Install

pip install equipop            # core
pip install equipop[geo,io,viz]  # shapefiles/rasters, Excel/SPSS, maps
pip install "equipop[mcp]"     # the MCP server for AI assistants

From an AI assistant (MCP)

EquiPop is an MCP server too: Claude, ChatGPT, Copilot or VS Code can list its tools, read their help, cite it correctly and run tools 1, 1b, 2 and 3b on files on your own computer. What the assistant receives is descriptions and summaries, never the rows; results are written to a new file next to the input. Claude Desktop installs it from the equipop-<version>.mcpb file on the release page with one click. MANUAL_MCP.md is the gentle guide; README_MCP.md the short reference.

Quick start

import pandas as pd
from equipop import build_cells, run_knn_stats

df = pd.read_csv("individuals.csv")        # one row per individual
cd = build_cells(df, e_col="X", n_col="Y",
                 binary_vars=["treated"], value_vars=["income"],
                 unit_size=100)
res = run_knn_stats(cd, k_values=[100, 400, 1600, 6400],
                    stats={"treated": ["ratio"],
                           "income": ["mean", "median", "gini"]})

For aggregated counts at national scale use the vectorised run_knn_counts; for friction-constrained growth run_knn_friction; for segregation profiles seg_profile; for policy-area reporting aggregate_output; for quick maps map_output. See MANUAL_TOPICS.md.

Repository: https://github.com/GeoCalista/EquiPop

Citing

Please cite the software and the methods you use - see CITATION.cff, or run equipop cite (and equipop cite 2, equipop cite decay...). Core reference: Östh (2014), Introducing the EquiPop software, Uppsala University. Segregation measures: Östh, Clark & Malmberg (2015), Geographical Analysis 47(1). Decay parameters: Östh, Lyhagen & Reggiani (2016), EJTIR 16(2). Friction growth: Östh & Türk (2020), Handbook of Urban Segregation. Decay profiles in application: Türk, Östh, Kourtit & Nijkamp (2026), Journal of Urban Mobility 9.

Contributing

See CONTRIBUTING.md for how the code is laid out, how to run the tests and how a change gets in, and RULINGS.md for the method decisions the code must keep.

License

MIT. Attribution through citation is warmly requested (see above).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables local AI-powered retail location intelligence by exposing database schema and spatial query tools to LLMs. It supports executing validated SQL, retrieving example spatial analyses, and generating strategic business insights from retail siting data.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to inspect geospatial vector and raster metadata and run bounded analysis on administrator-registered datasets, including planar buffering, clipping, spatial joins, and PNG map rendering delivered as checksummed artifacts. All data access is read-only and controlled through a curated dataset catalog.
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Gives AI agents 24 validated tools for planning and mobility analysis — accessibility and public-transport accessibility levels, multi-criteria siting, space syntax, landscape metrics, slope-aware routing and isochrones, and spatial statistics such as Moran's I, LISA, Getis-Ord Gi*, GWR and Huff. Each tool returns analysis-ready summaries and, where useful, GeoJSON results pairing computed indicators with the input geometries.
      37 PyPI
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to discover local CSV and Parquet datasets, inspect schemas, profile columns, detect missing values and duplicate records, and run capped read-only SQL analytics.
      MIT