Skip to content

Experiment: Voronoi-based kingdom territory map#431

Draft
baltinerdist wants to merge 2 commits intoamtgard:masterfrom
baltinerdist:experiment/kingdom-boundaries-map-v2
Draft

Experiment: Voronoi-based kingdom territory map#431
baltinerdist wants to merge 2 commits intoamtgard:masterfrom
baltinerdist:experiment/kingdom-boundaries-map-v2

Conversation

@baltinerdist
Copy link
Copy Markdown
Contributor

Closes #151

Summary

Adds map/build_map.py — a standalone Python script that generates an interactive Leaflet/OpenStreetMap HTML visualization of Amtgard kingdom territories.

  • Voronoi diagram — each active, non-freehold park is a node; every point on the map belongs to the nearest park's kingdom
  • Connected territories — adjacent same-kingdom parks form one contiguous region with no gaps
  • Land-clipped — territories are constrained to US and Canada borders (Natural Earth 110m)
  • Heraldry badges — each kingdom's heraldry is base64-embedded and placed at the centroid of its largest territory polygon
  • Coordinate recovery — parks missing latitude/longitude have their coordinates recovered by parsing the stored google_geocode blob (273 parks plotted vs 263 with direct coords only)
  • Freeholds excluded — kingdom_id 8 (The Freeholds of Amtgard) is not used as a Voronoi node

Running

pip install -r map/requirements.txt
python3 map/build_map.py
# Output: map/amtgard_kingdoms.html

Requires the ork3-php8-db Docker container to be running. The generated HTML file is self-contained and opens in any browser.

🤖 Generated with Claude Code

Avery Krouse and others added 2 commits March 17, 2026 17:10
Adds map/build_map.py — a standalone Python script that generates an
interactive Leaflet/OpenStreetMap HTML visualization of Amtgard kingdom
territories using a Voronoi diagram.

- Each active non-freehold park is a Voronoi node; every point on the
  map belongs to the nearest park's kingdom
- Adjacent same-kingdom parks form contiguous regions with no gaps
- Territories are clipped to US and Canada borders (Natural Earth 110m)
- Each kingdom's heraldry badge is base64-embedded at the centroid of
  its largest territory polygon
- Parks with lat=0 have coordinates recovered by parsing the stored
  google_geocode blob via regex (273 parks vs 263 with direct coords)
- Freeholds (kingdom_id=8) excluded from all calculations

Run: pip install -r map/requirements.txt && python3 map/build_map.py
Output: map/amtgard_kingdoms.html (self-contained, open in any browser)
Requires the ork3-php8-db Docker container to be running.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
map/amtgard_kingdoms.html is regenerated from live DB data on each run
and should not be tracked.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically Generate Kingdom Borders

1 participant