Skip to content

feat: first running workflow (retrieve, clean, build) + interactive map output - #3

Merged
bobbyxng merged 12 commits into
mainfrom
major-dev
Sep 25, 2026
Merged

bobbyxng merged 12 commits into
mainfrom
major-dev

Conversation

@bobbyxng

@bobbyxng bobbyxng commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary of changes in this pull request

  • Rename clean_osm_data.py/build_osm_network.py and their rules to clean.py/build_network.py/network.smk, with output paths moved from osm/retrieve|clean|build to retrieve|clean|build;

  • Fix crash on route relations with no way geometry, and a voltage tag-correction rule that was corrupting invalid, long tags into number

  • Add build_interactive_map.py/plot.smk, a self-contained interactive HTML map of the built network (layer toggles, voltage/text filtering, multi-circuit line rendering, light/dark theming, click-through OSM links), now the workflow's default target; documented in README.md/INTERFACE.yaml and exercised by the integration test. Ported over from PyPSA-Eur's prepare_osm_network_release

  • Move include_relations to network config, and add an interactive_map config section for geometry simplification and coordinate rounding: The higher the numbers chosen, the longer the distance between geometry points, the lower the resolution, the smaller the file of the html

  • Add regional defaults and example configs for Brazil, Mexico, the Philippines, and the US (work-in-progress)

  • There are no pip dependencies in the module's environment files (workflow/envs/).

  • All rules use pathvars (e.g., <results>) in their inputs and outputs.

  • The integration test-suite is successful, including:

    • pre-commit.ci tests pass.
    • tests pass for all relevant OS configurations (linux, osx, windows).
  • Module documentation is up-to-date, including:

    • INTERFACE.yaml mentions all relevant pathvars and wildcards.
    • README.md describes how to use the module and has the necessary citations.

Replace clean_osm_data.py/build_osm_network.py and the build.smk/clean.smk
rules with clean.py/build_network.py/network.smk, moving output paths from
osm/retrieve|clean|build to retrieve|clean|build directly.

Also fixes a crash in relation-to-line merging for route relations whose
members are all nodes (no way geometry at all) - previously a raw KeyError,
now correctly dropped as having nothing to merge.
The "m"/"medium"/"low"/etc. voltage corrections matched as substrings, so
any unrelated text containing those letters got mangled - one Philippines
line's freeform garbage tag ballooned into a 30+ digit number and crashed
the pipeline. Match those rules on the whole value instead, and drop any
voltage that's still implausibly long as a defensive backstop.
New build_interactive_map rule renders buses/lines/transformers/stations
as a standalone HTML map (pydeck), with layer toggles, voltage and text
search, multi-circuit line rendering, light/dark theming, and click-through
OSM links - now the workflow's default target. Also builds it in the
integration test.
include_relations is a modelling decision, not a retrieval one, so it now
lives under network instead of retrieve. Also adds an interactive_map
config section (geometry simplification tolerances, coordinate rounding)
and a clearer error for an unrecognised country code, which used to
surface as a raw traceback from earth-osm instead of the intended message.
README and INTERFACE.yaml didn't mention map.html at all, and
INTERFACE.yaml's old description pointed at a "release" directory that
doesn't exist anywhere in the actual rules.
Regional defaults (60 Hz, lower minimum voltage) plus runnable example
configs, matching the existing BE-NL example.
Local Claude Code settings and a test-run PBF cache, neither of which
belong in the repo.
@bobbyxng

Copy link
Copy Markdown
Collaborator Author

# Conflicts:
#	tests/integration_test.py
Comment thread workflow/scripts/build_interactive_map.py Fixed
bobbyxng and others added 2 commits September 25, 2026 11:38
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Fixes CI lint failure from ruff format --check on the re.split call
that grew a re.IGNORECASE flag; no logic change.
@bobbyxng
bobbyxng merged commit 38b2e35 into main Sep 25, 2026
5 checks passed
@bobbyxng
bobbyxng deleted the major-dev branch September 25, 2026 11:19
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.

2 participants