Skip to content

Add local MBTiles server for Flight Maps layers#654

Draft
msupino wants to merge 18 commits into
devfrom
codex/local-mbtiles-server
Draft

Add local MBTiles server for Flight Maps layers#654
msupino wants to merge 18 commits into
devfrom
codex/local-mbtiles-server

Conversation

@msupino

@msupino msupino commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a local Python server that serves NavAid plus downloaded Flight Maps MBTiles for CVFR, Israel Navigation, Low Alt, and Helicopters.
  • Add --extract / --extract-only to expand all MBTiles into XYZ PNG folders under ~/Downloads/flight-maps-tiles/.
  • Prefer extracted PNG files when serving /tiles/...; SQLite MBTiles reads remain as a fallback when an extracted file is missing.
  • Add a localhost-only ?localTiles=1 switch that rewrites those Flight Maps chart layers to same-origin /tiles/... paths.
  • Keep Satellite / OpenStreetMap and normal production behavior on the existing online tile URLs.
  • Keep local tile requests out of the service-worker asset cache.

How to try

  1. Put these files in ~/Downloads/flight-maps-mbtiles/:
    • CVFR.mbtiles
    • Israel-Navigation.mbtiles
    • LSA-Low-Altitude.mbtiles
    • Israel-Helicopters.mbtiles
  2. Run python3 scripts/local-mbtiles-server.py --extract.
  3. Open http://127.0.0.1:8000/?localTiles=1.

Tests

  • python3 -m py_compile scripts/local-mbtiles-server.py
  • node --check docs/app/core.js docs/sw.js tests/local-mbtiles.spec.js tests/local-mbtiles-extract.spec.js
  • BASE_URL=http://127.0.0.1:8765 npx playwright test tests/local-mbtiles.spec.js tests/local-mbtiles-extract.spec.js tests/export-png-options.spec.js tests/bugfix-178-180-sw.spec.js
  • npm run lint:spell

Refs #111

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview deployed

Open PR preview →

https://msupino.github.io/NavigationApp/branch/codex/local-mbtiles-server/

Commit: eb5ed76

@msupino msupino force-pushed the codex/local-mbtiles-server branch from 9ec59ad to 3cfed2d Compare June 7, 2026 06:14
@github-actions github-actions Bot temporarily deployed to pr-preview-654 June 7, 2026 06:15 Inactive
@msupino msupino changed the title Add local MBTiles server for CVFR and Navigation Add local MBTiles server for Flight Maps layers Jun 7, 2026
@msupino msupino force-pushed the codex/local-mbtiles-server branch from 3cfed2d to 50f1ed9 Compare June 7, 2026 06:20
@github-actions github-actions Bot temporarily deployed to pr-preview-654 June 7, 2026 06:23 Inactive
msupino added 2 commits June 7, 2026 16:13
- Replace toolbar layer select with a button that opens a draggable modal
- Modal includes layer selection dropdown and zoom in/out controls
- Follows existing patterns used by route templates, frequency table, etc.
- Adds i18n support for English and Hebrew
- Persists layer selection to localStorage
msupino and others added 4 commits June 7, 2026 19:33
…e in /tmp

Tile resolution order:
1. Pre-extracted tile dir (--tile-dir, ~/Downloads/flight-maps-tiles)
2. /tmp/navaid-tiles download cache (--download-cache): if valid SHA-256 sidecar
   matches, serve immediately; otherwise download from flight-maps.com, write
   PNG + .sha256 sidecar atomically, serve.
3. MBTiles SQLite fallback (--mbtiles-dir, now optional — warns instead of errors)
4. 404

New flags: --download-cache (default /tmp/navaid-tiles), --no-download.
Startup no longer fails when MBTiles are absent; prints a warning instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
… /tmp

Co-authored-by: Cursor <cursoragent@cursor.com>
…ic defaults

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot temporarily deployed to pr-preview-654 June 7, 2026 16:38 Inactive
msupino and others added 4 commits June 7, 2026 19:39
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…D level

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot temporarily deployed to pr-preview-654 June 7, 2026 16:43 Inactive
@github-actions github-actions Bot temporarily deployed to pr-preview-654 June 7, 2026 16:47 Inactive
msupino and others added 2 commits June 7, 2026 19:48
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot temporarily deployed to pr-preview-654 June 7, 2026 16:53 Inactive
msupino and others added 2 commits June 7, 2026 19:56
- core.js: fall back to CVFR on boot if a CDN-only layer was saved in localStorage
- io.js: skip Satellite/OpenStreetMap in layer selector modal and export PNG
  modal when NavAid.localChartTiles is set

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant