Skip to main content

region_geo

Coastline geometry for a region. New Zealand is the default region, so calls need no region argument. More regions and layers (boundaries, basins, back-arc, subduction interfaces) can be added later without changing the API.

Replaces nzgeom in NZGMDB.

Install

pip install git+https://github.com/ucgmsim/region_geo.git

Development

CI uses the shared meta-ci-action workflows: ruff, deptry, npdlint, ty and pytest (95% coverage). To run the same checks as git hooks:

uv sync --all-groups --all-extras
uvx lefthook install

Usage

import region_geo

# Which points are on land (main islands of the default region)
on_land = region_geo.points_on_land(df["lon"], df["lat"])

# Coastline polygons as a GeoDataFrame (EPSG:4326 by default)
coast = region_geo.get_coastline(include_outlying=True, crs="EPSG:2193")

# Land as one shapely geometry
land = region_geo.get_land()

Pick another region with region="xx", or set REGION_GEO_REGION=xx for the whole process.

include_outlying adds islands left out by default. For NZ these are the Chatham and Kermadec Islands, which sit across 180 degrees.

Replacing nzgeom

# Before
nz_coast = nzgeom.coastlines.get_NZ_coastlines().to_crs("EPSG:4326").union_all()
points = gpd.GeoSeries([Point(lon, lat) for lon, lat in zip(df["lon"], df["lat"])])
df = df[points.within(nz_coast).to_numpy()]

# After
df = df[region_geo.points_on_land(df["lon"], df["lat"])]

Same result on 5000 random points across NZ, about twice as fast. The merged land polygon is cached, so later calls are almost instant.

Data

Region File Source
nz region_geo/data/nz_coastline.gpkg LINZ NZ Coastlines and Islands Polygons (Topo 1:50k), layer 51153, CC BY 4.0

Coastline files are GeoPackages in EPSG:4326 with columns name, group, outlying. Rebuild the NZ file with:

uv sync --extra scripts
python scripts/build_nz_coastline.py nz-coastlines-and-islands-polygons-topo-150k.gpkg

Adding a region

  1. Write region_geo/data/<key>_coastline.gpkg with the standard columns
  2. Add a Region to REGIONS in region_geo/regions.py

Metadata

Release files for region-geo 2026.11.1

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

Source distribution (sdist)

Source distribution for region-geo 2026.11.1
File Size Uploaded Provenance Actions
region_geo-2026.11.1.tar.gz 9.1 MB With provenance Details for region_geo-2026.11.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for region-geo 2026.11.1
File Interpreter ABI Platform Actions
region_geo-2026.11.1-py3-none-any.whl Python 3 none any Details for region_geo-2026.11.1-py3-none-any.whl

Total release size: 18.1 MB

Release files / region_geo-2026.11.1.tar.gz

Download URL region_geo-2026.11.1.tar.gz
Size 9.1 MB
Tags Source
SHA-256 checksum
How to use checksums
f28c6868f1b662df8579d3911945d198444ebe99c1a200dac3723e1af33e7202
BLAKE2b-256 checksum
How to use checksums
83593a225d765ddf837ed94c7a041a5f3b6cf09b1f1162d9e3c6e0cead93c788
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Nov 24, 2026.

Transparency log

Release files / region_geo-2026.11.1-py3-none-any.whl

Download URL region_geo-2026.11.1-py3-none-any.whl
Size 9.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
aefb6dd3e59bfe9c7ad7355e4908b2fa313b7c30e6b3fdedac856ecc35c463f6
BLAKE2b-256 checksum
How to use checksums
4490bc34dd52a6d5c4e8193b754bef099aa858a41c5830f5d330f161adebbe3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Nov 24, 2026.

Transparency log

Security for region-geo 2026.11.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for region_geo-2026.11.1.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 Nov 24, 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.

Release history Release notifications | RSS feed

This release

2026.11.1 This release

2 release files Full provenance

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