TreatyGraph: Mapping the World's Treaty Networks with Python, Wikidata, and Open-Source Geospatial Tools
2026-10-13 , Create 2

International treaty participation shapes the geopolitical landscape in ways that are rarely visible to analysts and researchers. TreatyGraph is an open-source, serverless geospatial visualization platform designed to surface these relationships, built entirely from free and open components across every layer of the stack.
A Python data pipeline harvests treaty membership data from Wikidata via SPARQL, integrates bilateral trade statistics from public databases, and cross-references the Correlates of War dataset. This produces a Graphology JSON graph representing approximately 200 countries, 500+ international treaties, and thousands of membership edges — entirely from open, citable data sources with no proprietary dependencies.
The graph is consumed by a browser-based frontend that requires no backend infrastructure. MapLibre GL provides the cartographic base. Deck.gl renders WebGL arc layers connecting co-signatory countries, with colour and thickness encoding trade balance, treaty count, or treaty category. D3.js drives animated donut charts, hierarchical edge bundling, and comparative bar charts that update dynamically as the user navigates. Sigma.js, built on the Graphology graph library, powers a force-directed network view enabling bilateral treaty comparison between any two countries.
The complete pipeline — from SPARQL query to rendered map — relies exclusively on open-source libraries. The output is a single static HTML file paired with a ~5 MB JSON graph, deployable on GitHub Pages, object storage, or any static host.
This talk presents the full architecture: how SPARQL queries are structured to extract treaty participation from Wikidata, how the Python graph builder normalizes and enriches the data, and how the visualization layers are composed to support two analytical modes — a country-centric co-membership view and a bilateral shared-treaty comparison.
The underlying pattern — Python preprocessing into a static graph consumed by a performant browser frontend — is broadly transferable to any domain where open geospatial data can be pre-aggregated. TreatyGraph demonstrates the analytical depth achievable within the open-source Python geospatial ecosystem, without a single proprietary dependency or a persistent server.

Morgan Grundy is a geospatial developer and open-source practitioner based in Cambridge, UK, working at the intersection of data visualisation, international relations data, and the Python geospatial ecosystem. He is the creator of TreatyGraph, an open-source platform for exploring global treaty networks.