Commit graph

17 commits

Author SHA1 Message Date
6927efca54 Add mobile bottom-sheet layout
On narrow screens the sidebar collapses to a 48px handle strip at the
bottom of the screen. Tapping the handle slides the panel up to 65vh,
revealing the full stop list and controls. The map takes the full
viewport width when the panel is closed or peek-visible.

The handle label updates dynamically to show the loaded route name.
The panel auto-opens when a route or route_master finishes loading.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 10:02:14 +00:00
2a82a9e8fa Fix sidebar scroll cut off by removing Bootstrap h-100 from main row
Bootstrap's h-100 class applies height:100% !important, overriding the
custom calc(100vh - 56px) on #main-row. This made the sidebar 900px tall
starting at y=56 (below the navbar), extending 56px below the viewport
and cutting off the bottom of the stop list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 21:09:10 +00:00
c2355a053d Set page title server-side for link preview compatibility
When a specific relation URL is loaded, fetch_relation_name() makes a
lightweight GET /relation/{id}.json call to get the name tag and pass
it to the template. The <title> and og:title are then set server-side,
so forum link previews and crawlers see the route name in the HTML
without executing JavaScript.

Errors are swallowed silently so a slow or failed API response just
falls back to the default title.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 21:01:25 +00:00
7a4cdfcca7 Include route name in page title
Update document.title to "<route name> – OSM Public Transport → GeoJSON"
when a route or route_master is loaded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 20:58:10 +00:00
f2989caaec Fix sidebar scroll not reaching last stop
Two issues:
1. Flex items default to min-height:auto, which allows them to grow
   beyond the flex container instead of being constrained and scrolling.
   Add min-height:0 to #sidebar so overflow-y:auto works correctly.
2. WebKit ignores padding-bottom on overflow containers entirely.
   Remove it from #sidebar and increase padding-bottom on #stop-list
   and #route-master-list (children inside the scroll container, where
   padding-bottom is respected) from 1rem to 2rem.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 20:57:16 +00:00
6424992264 Fix stop list cut off at bottom of sidebar
WebKit/Chrome ignores padding-bottom on overflow-y:auto containers,
so the sidebar's padding: 1rem wasn't creating scroll space below the
last stop. Fix by adding padding-bottom directly to #stop-list and
#route-master-list, which are inside the scrollable container.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 20:53:09 +00:00
335c31937e Add WSGI ProxyFix. 2026-02-27 20:33:29 +00:00
17df83d043 Use url_for() for all internal URLs; fix ProxyPass compatibility
All hardcoded paths (/load, /docs, /, /api/route/ etc.) are replaced
with url_for() in templates, so Flask's APPLICATION_ROOT and
ProxyFix generate correct URLs regardless of mount path.

For app.js (a static file), inject a URLS object from the template
alongside RELATION_ID:
  URLS.routeApi, .segmentApi, .routeMasterApi, .routePage
Each is generated with url_for(..., relation_id=0)[:-1] to give a
prefix that JS appends relation IDs to. The popstate handler now
strips the URLS.routePage prefix instead of matching a hardcoded
leading slash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 20:31:01 +00:00
53aab8c4bc Add web optional dependency and update docs
Flask is now declared under [project.optional-dependencies] as the
`web` extra, so `pip install osm-geojson[web]` installs both the CLI
and Flask. The `dev` extra includes Flask too so the test/dev venv
gets everything. Update README and AGENTS.md accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 20:05:14 +00:00
c37b463c0e Add homepage for openstreetmap.tools
Static index.html for the site root — lists the three tools (Public
Transport → GeoJSON, OWL Places, OWL Map) with descriptions, includes
an inline relation ID/URL form that redirects to the PT tool, and
credits Edward Betts with a link to edwardbetts.com.

Playfair Display headings + IBM Plex Sans body, dark navy header with
subtle OSM-green grid, three cards (featured card spans full width).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 19:37:06 +00:00
3a158c189c Add OSM website links for route and route_master panels
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 19:23:24 +00:00
9b5a510d02 Handle browser back/forward for in-page route navigation
Listen for popstate events and reload the relation from the URL path,
so the back button correctly returns to the route_master view after
navigating to an individual route.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 19:21:31 +00:00
f6dd68ed75 Avoid map zoom-out when navigating between routes
Route links (route_master list, other directions) now intercept clicks
and call loadRoute() + history.pushState() instead of doing a full page
reload, so the map stays at its current position and zooms smoothly into
the new route. Ctrl/cmd/middle-click still opens in a new tab via href.

Introduce currentRelationId (mutable) to track the loaded relation so
loadSegment() uses the correct ID after in-page navigation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 19:18:05 +00:00
3223d4b063 Add API docs page and update README/AGENTS
- Add /docs route serving web/templates/api.html: full Bootstrap 5
  documentation page covering all three API endpoints with parameter
  tables, example requests, and example responses
- Add 'API docs' link to the navbar on the main map page
- Update README.md: add web frontend section with feature list, dev
  server instructions, and API endpoint summary table
- Update AGENTS.md: add web/ layout, API endpoint table, Flask run
  instructions, and route_master example relation IDs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 19:03:37 +00:00
e0ade9e5ab Add web frontend and refactor core to use OsmError
- Refactor core.py: replace sys.exit() calls with OsmError exceptions
  so the library is safe to use from Flask and other callers
- Add fetch_sibling_routes and fetch_route_master_routes to core.py
- Add Flask web frontend (web/app.py, templates, static assets):
  - Map view with Leaflet; full route drawn in grey on load
  - Sidebar stop list; active-slot UX for From/To selection
  - Segment preview and download (full route or selected segment)
  - Include-stops toggle applied client-side
  - Bookmarkable URLs: GET /<relation_id>
  - Clear selection button
  - Other directions panel (sibling routes from same route_master)
  - route_master handling: draws all member routes in colour on map
    with links to each individual direction
- Add SVG favicon
- Add py.typed marker; add .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 18:59:21 +00:00
d3e6d7ac42 Reorganise 2026-02-27 14:27:38 +00:00
2a2a42fe5d Initial commit. 2026-02-27 10:59:27 +00:00