Skip to main content

geo4cambodia

Subnational development data for Cambodia, ready to analyse, at every spatial scale.

geo4cambodia is the Python package of the GeoDevelopment Observatory of Cambodia. It loads the observatory's indicators (district GDP per capita, province population, night-time lights, PM2.5, Global Data Lab HDI...) as tidy panels, with boundaries for every scale. It also lets you build your own indicators: link your tables to the same unit IDs, summarise rasters over units, move data across scales and combine datasets. It works out of the box in Google Colab.

!pip install geo4cambodia -q            # in Colab; `pip install geo4cambodia` elsewhere

import geo4cambodia as geo

geo.datasets()                                       # what is available, at which scale and years
gdf = geo.load("gdppc", years=2022, geometry=True)   # 202 districts, with boundaries
gdf.plot(column="y", scheme="quantiles", k=5, legend=True)

What it does

Task Functions
Load panels (one row per unit and year), names and boundaries datasets, dictionary, load, units, boundaries, crosswalk
Link your own tables by unit names or codes, whatever the spelling link, check
Extract indicators from rasters (Earth Engine exports, WorldPop, ...) zonal
Move data up the hierarchy or onto grids and custom zones aggregate, overlay, overlay_weights
Combine datasets at one scale and save new ones in the same format combine, save
Analyse with geometrics (convergence, spatial dependence, inequality) for_geometrics

One ID for every unit, at every scale

Every unit has a geo ID that nests by prefix (GADM 4.1 hierarchy): district KH-16-01 lies in province KH-16 (Phnom Penh), which lies in Cambodia KH. Global Data Lab regions (KH-GDL-02) are unions of whole provinces. Each dataset is a long panel keyed by geo_id and year.

Scale Units Example
country 1 KH
province 25 KH-16
district 202 KH-16-01
gdl (Global Data Lab regions) 17 KH-GDL-02

Build your own indicator in five lines

import pandas as pd
import geo4cambodia as geo

mine = pd.read_csv("schools_by_province.csv")             # e.g. columns Province, year, schools
mine = geo.link(mine, scale="province", on="Province")     # "BântéayMéanchey" -> KH-01
panel = geo.combine(["env"], scale="province", extra=[mine])
panel["schools_per_10k"] = panel["schools"] / panel["total_GlobPOP_Count"] * 1e4
geo.save(panel, "schools", scale="province", directory="my_data")

From a raster:

lights = geo.zonal("viirs_2020.tif", scale="district", stats=["sum", "mean"], name="ntl", year=2020)

Then analyse with geometrics:

import geometrics as gm
gdf, df, df_dict = geo.for_geometrics("gdppc")
df = gm.set_labels(df, df_dict, set_panel=True)
gm.analyze_beta_convergence(df, "ln_y", gdf=gdf, w=gm.make_weights(gdf)).interpret()

Without the package

Every file is also a plain URL, for R, Stata, Excel or pandas alone:

import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/quarcs-lab/geo4cambodia/main/data/district/gdppc.csv")

Installation

pip install geo4cambodia                    # core: pandas, geopandas, pyarrow, requests, pyyaml
pip install "geo4cambodia[raster]"          # + rasterio, for zonal()
pip install git+https://github.com/quarcs-lab/geo4cambodia   # development version

Python 3.11 or later. The data are not inside the package. It reads them from the GitHub repository, so installation is quick and you always get the files the website links to. For reproducible research, pin a release of the data with geo.load(..., ref="v0.3.0") or the environment variable GEO4CAMBODIA_REF=v0.3.0.

Documentation

Citation

Mendez, C., Khoun, T., & Poortinga, A. (2026). GeoDevelopment Observatory of Cambodia. https://quarcs-lab.github.io/geo4cambodia/

MIT License. Original data sources are credited on each dataset page.

Metadata

Release files for geo4cambodia 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geo4cambodia 0.3.0
File Size Uploaded Provenance Actions
geo4cambodia-0.3.0.tar.gz 30.2 kB With provenance Details for geo4cambodia-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geo4cambodia 0.3.0
File Interpreter ABI Platform Actions
geo4cambodia-0.3.0-py3-none-any.whl Python 3 none any Details for geo4cambodia-0.3.0-py3-none-any.whl

Total release size: 70.6 kB

Release files / geo4cambodia-0.3.0.tar.gz

Download URL geo4cambodia-0.3.0.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a52b154d4a456b59df50550fd8cce0b3b607bf543a963706c54fc46535d04873
BLAKE2b-256 checksum
How to use checksums
7955354ba1f4a554a8ca10d29af151d8fada13d90eca676a4484a0d707c494ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / geo4cambodia-0.3.0-py3-none-any.whl

Download URL geo4cambodia-0.3.0-py3-none-any.whl
Size 40.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b63a511fa46fd30953e8499a86293fe6bf5b54ea0ad2a86c95f909d248fb3659
BLAKE2b-256 checksum
How to use checksums
e72a81bb0cbe4c8f2ef1b94b1ebeace9dfca7e9440692e86c3d23b3648617c64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Security for geo4cambodia 0.3.0

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.

Select from 2 files

Attestation for geo4cambodia-0.3.0.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 Oct 28, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page