Skip to main content

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.

Live Demo

Atlantis demo map

What It Does

The pipeline is tree-first:

  1. load a rooted hierarchy from examples/atlantis/zone_edges.json
  2. generate a continent mask
  3. recursively partition each parent region among its children
  4. extract leaf polygons from the raster partition
  5. 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 tree
  • zone_index.json: { "id": "name" } mapping used for labels/tooling
  • zone_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 DCEL
  • docs/atlantis-map.png: static render
  • frontend/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 CHANGE in a commit body, or type!: in the subject, increments MAJOR
  • subjects starting with feat, add, or implement increment MINOR
  • 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:

  1. PyPI: Create the dcel-map-generator project on PyPI, then add a Trusted Publisher for this GitHub repository and the workflow file release.yml.

  2. npm: Create the @alonso-cancino/dcel-map-frontend package on npm, then add a Trusted Publisher for this GitHub repository and the workflow file release.yml.

  3. GitHub: If you want deployment protection, create pypi and npm environments 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dcel_map_generator-0.6.2.tar.gz (428.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dcel_map_generator-0.6.2-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file dcel_map_generator-0.6.2.tar.gz.

File metadata

  • Download URL: dcel_map_generator-0.6.2.tar.gz
  • Upload date:
  • Size: 428.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dcel_map_generator-0.6.2.tar.gz
Algorithm Hash digest
SHA256 3fe2100cc7d7fc057bbb94dc48b26f1df4faa10b4b92361cb91d9d6867d262ee
MD5 01081db50238f2e6130612645164f963
BLAKE2b-256 4af67673616bc2ca9f06a959873ada53958ff7694e257564b3cc40fa718e78a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for dcel_map_generator-0.6.2.tar.gz:

Publisher: release.yml on alonso-cancino/map-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dcel_map_generator-0.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dcel_map_generator-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f3687b534472437127f81446d70d9b12f43976f7a3f2f6d822045e52bc0c1b1d
MD5 9af2926605893026f280421a77602b4a
BLAKE2b-256 883e7d56b62209b88a284572b2e8194dac5fd85a4a03fce0d82d8ae0afa36485

See more details on using hashes here.

Provenance

The following attestation bundles were made for dcel_map_generator-0.6.2-py3-none-any.whl:

Publisher: release.yml on alonso-cancino/map-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page