Generate a leaf-level DCEL map from a hierarchical zone tree
Project description
DCEL Map Generator
Generate whimsical continent-style maps from a rooted hierarchy and export them as:
- a leaf-level DCEL
- a rendered preview image
- a frontend-ready bundle for an interactive zoomable map
This repo is the reusable core. Domain-specific map projects can keep their own hierarchy data and consume this generator/render stack.
What It Does
The pipeline is tree-first:
- load a rooted hierarchy from
examples/atlantis/zone_edges.json - generate a continent mask
- recursively partition each parent region among its children
- extract leaf polygons from the raster partition
- build a DCEL and optional frontend bundle
The bundled demo dataset is a small fantasy world centered on Atlantis so you can run the project immediately without bringing your own taxonomy first.
Quickstart
Requirements:
- Python 3.11+
uv- Node.js 20+ for the frontend demo
Install Python dependencies:
uv sync --dev
Generate the demo outputs:
uv run python -m dcel_builder \
--zone-edges examples/atlantis/zone_edges.json \
--tree-stats examples/atlantis/zone_tree_stats.json \
--zone-index examples/atlantis/zone_index.json \
--output dcel_map.json \
--render \
--render-output docs/atlantis-map.png \
--frontend-bundle frontend/public/map_bundle.json \
--validate
Run the interactive renderer locally:
cd frontend
npm install
npm run dev
Open http://localhost:5173/.
Input Files
The generator expects three JSON files:
zone_edges.json: directed[parent, child]pairs forming a rooted treezone_index.json:{ "id": "name" }mapping used for labels/toolingzone_tree_stats.json: optional sidecar metadata; the generator currently tolerates an empty object
The bundled example describes a three-level fantasy continent:
Atlantis- major regions such as
Aurelia Reach,Tidehollow,Cinder Crown,Mistwood - smaller subregions and leaf territories beneath them
The tracked demo inputs live in examples/atlantis. Private or domain-specific datasets can stay in ignored folders such as local/.
Outputs
dcel_map.json: serialized DCELdocs/atlantis-map.png: static renderfrontend/public/map_bundle.json: interactive bundle consumed by the frontend
GitHub Pages Demo
The frontend is configured for GitHub Pages static hosting. A workflow in .github/workflows/deploy-pages.yml builds frontend/ and publishes the interactive demo using the bundled Atlantis example.
Versioning
This project uses Semantic Versioning and derives releases from commits on main.
BREAKING CHANGEin a commit body, ortype!:in the subject, incrementsMAJOR- subjects starting with
feat,add, orimplementincrementMINOR - all other changes increment
PATCH
The automation writes the chosen version into Python and frontend package metadata, commits Release vX.Y.Z, and creates the matching vX.Y.Z tag.
Releases
Pushing to main triggers the semantic version workflow in .github/workflows/semver-release.yml. That workflow computes the next version, commits the versioned files, and pushes the matching release tag. The tag then triggers .github/workflows/release.yml.
Each release publishes consumable artifacts:
- Python source distribution and wheel from
dist/ - a production frontend archive,
frontend-dist.tar.gz - an npm package tarball for the renderer,
alonso-cancino-dcel-map-frontend-<version>.tgz - the example frontend bundle,
map_bundle.json - the Atlantis example inputs as
atlantis-example-inputs.tar.gz - the demo screenshot,
atlantis-map.png
You can consume the renderer package from npm by installing the published tarball, or later from the npm registry once it is published there. The library entrypoint exports MapView, loadBundle, parseBundle, and the bundle/type definitions.
When the repository is configured for trusted publishing, the same release workflow also publishes:
- the Python package to PyPI
- the renderer package to npm
One-time registry setup
To make automated publishing work, you still need to configure each registry once:
-
PyPI: Create the
dcel-map-generatorproject on PyPI, then add a Trusted Publisher for this GitHub repository and the workflow filerelease.yml. -
npm: Create the
@alonso-cancino/dcel-map-frontendpackage on npm, then add a Trusted Publisher for this GitHub repository and the workflow filerelease.yml. -
GitHub: If you want deployment protection, create
pypiandnpmenvironments in the repository settings to match the workflow.
After that, pushing to main will create the next semantic version release and publish both packages automatically.
Development
uv run pytest
uv run ruff check .
cd frontend && npm run build
Contributor conventions live in AGENTS.md.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dcel_map_generator-0.6.0.tar.gz.
File metadata
- Download URL: dcel_map_generator-0.6.0.tar.gz
- Upload date:
- Size: 839.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c80a33a3e82807a5c7e3daa79287fd2783da7de96b8740b428a374caa490876
|
|
| MD5 |
aae3fb8fb9c9450c83b027f693840756
|
|
| BLAKE2b-256 |
805566613c61c2d54e2e00b3174c457da933a92d71a6a1d845c132db67e97a22
|
Provenance
The following attestation bundles were made for dcel_map_generator-0.6.0.tar.gz:
Publisher:
release.yml on alonso-cancino/map-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dcel_map_generator-0.6.0.tar.gz -
Subject digest:
3c80a33a3e82807a5c7e3daa79287fd2783da7de96b8740b428a374caa490876 - Sigstore transparency entry: 1204588876
- Sigstore integration time:
-
Permalink:
alonso-cancino/map-generator@5cc36d704b238ec12b59881fbe90b13e6bd81a19 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/alonso-cancino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5cc36d704b238ec12b59881fbe90b13e6bd81a19 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file dcel_map_generator-0.6.0-py3-none-any.whl.
File metadata
- Download URL: dcel_map_generator-0.6.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71b53889f1c4ec52fe2f2912c2d63c5aa7ff0682b081dce4ba42b5fa33b7bab4
|
|
| MD5 |
0976e4e4d0a9281e630d8ad39fd4b38d
|
|
| BLAKE2b-256 |
7c7ce0b4c7719aa8347c37d7b8e527da7f3043e23f27b48b58783cadb6f33f82
|
Provenance
The following attestation bundles were made for dcel_map_generator-0.6.0-py3-none-any.whl:
Publisher:
release.yml on alonso-cancino/map-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dcel_map_generator-0.6.0-py3-none-any.whl -
Subject digest:
71b53889f1c4ec52fe2f2912c2d63c5aa7ff0682b081dce4ba42b5fa33b7bab4 - Sigstore transparency entry: 1204588892
- Sigstore integration time:
-
Permalink:
alonso-cancino/map-generator@5cc36d704b238ec12b59881fbe90b13e6bd81a19 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/alonso-cancino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5cc36d704b238ec12b59881fbe90b13e6bd81a19 -
Trigger Event:
workflow_dispatch
-
Statement type: