Root cause: osm-data.mjs emitted ways with 'out center' (no geometry) as a
flat [lon,lat] labeled 'LineString'. Leaflet reads those as two invalid
points and threw 'Invalid LatLng', which aborted the entire layer load loop
in onMount -- so no layers rendered and the checkboxes all showed unchecked.
Toggling then appeared to do nothing.
Fixes:
- osm-data.mjs: coordsFor/geometryFor now emit a proper Point for any flat
[lon,lat] (from nodes / 'out center' ways) instead of a malformed LineString
- MapView.svelte: isolate each layer's load + each feature's searchable build
in try/catch so one bad feature/layer can't break all layers; skip invalid
bounds in fitBounds
- osm-data.mjs: preserve manifest entries it doesn't generate (e.g. dump
layers from osm-dump.mjs) so data/osm-dump scripts don't clobber each other
- scripts/test.mjs: add geometry-integrity checks (no malformed coords)
Verified in a real browser: all 6 layers render, each toggles off/on
independently (33361->0 overlays), and the Directions panel loads.
- scripts/osm-dump.mjs: download & stream-parse regional .osm.pbf extracts
(Geofabrik/BBBike etc). Clips to bbox, extracts POI features (poiTags),
and builds a routable road graph (coords + weighted adj) from road ways.
Caches the downloaded .pbf under scripts/.cache/ (git-ignored). Default:
Geofabrik Oklahoma extract -> tulsa-dump layer (12.8k POIs, 55k-node graph).
- src/lib/routing.ts: client-side A* routing over the graph. Snaps A/B to
nearest nodes, supports avoid-rules (category + radius, block or penalty)
built from nearby POIs; returns waypoints + distance.
- src/lib/components/DirectionsPanel.svelte: Directions UI — pick A/B by
clicking the map, choose POI categories to avoid, compute & draw the route.
- MapView: adds a Directions toggle when a dump layer with a graph is present.
- package.json: add 'build:dump'; build now runs data + dump + static.
- scripts/test.mjs: validate dump manifest entries + routing graph structure.
- README: document dump ingestion and the routing/avoid feature.
- SvelteKit project with @sveltejs/adapter-static (runs fully static)
- scripts/osm-data.mjs: pulls OSM data from Overpass API and converts to
static GeoJSON under static/data/ with per-area manifest
- Leaflet map frontend that loads the static data and renders features
with popups and area selection dropdown
- npm run build fetches data then produces a self-contained static site