Skip to content

Migrate map from Leaflet to MapLibre GL JS with PMTiles#138

Draft
maorcc wants to merge 10 commits intomainfrom
maor/maplibre-migration
Draft

Migrate map from Leaflet to MapLibre GL JS with PMTiles#138
maorcc wants to merge 10 commits intomainfrom
maor/maplibre-migration

Conversation

@maorcc
Copy link
Copy Markdown
Owner

@maorcc maorcc commented Apr 7, 2026

Summary

  • Replace Leaflet + OSM raster tiles with MapLibre GL JS using self-hosted PMTiles (Middle East extract on Cloudflare R2) and a warm Protomaps basemap flavor with Hebrew labels
  • Alert polygons now use a GeoJSON source with `alerts-fill` / `alerts-hit` / `alerts-stroke` layers; polygon state drives data properties (`fillColor`, `fillOpacity`, etc.) instead of Leaflet `setStyle`
  • Leaflet popups replaced by a slide-in location panel (`#location-panel`) — bottom-sheet on mobile, sidebar on desktop
  • Country borders split into solid (non-disputed) and dashed (disputed) layers; road widths narrowed to 40%
  • `prediction-mode.js` migrated off Leaflet overlays (`L.polyline`, `L.polygon`, `map.removeLayer`) to a MapLibre GeoJSON source with three layers (`prediction-band`, `prediction-line`, `prediction-arrow`)
  • `ellipse-mode.js` fully migrated: replaced all Leaflet layers/markers with `maplibregl.Marker` and four dedicated GeoJSON sources (`ellipse-overlays`, `ellipse-visual`, `ellipse-editing`, `algc-overlay`); replaced `map.distance()` with haversine, `map.options.crs` with Web Mercator math, `L.DomEvent` with native listeners
  • `ensureOrefPoints` consolidated from duplicate extension-local copies into `AppState` as a shared singleton
  • Leaflet CDN removed entirely

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 12b99e35-550a-4245-a6e8-a2799be115ac

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch maor/maplibre-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Replace Leaflet + OSM raster tiles with MapLibre GL JS using self-hosted
PMTiles (Middle East extract on R2) and a warm Protomaps basemap flavor.
Alert polygons are now a GeoJSON source with fill/stroke/hit layers.
Popups replaced by a slide-in location panel (bottom-sheet on mobile,
sidebar on desktop). Prediction mode migrated off Leaflet overlays to
a MapLibre GeoJSON source. ensureOrefPoints consolidated into AppState.
@maorcc maorcc force-pushed the maor/maplibre-migration branch from 101a646 to 102cf42 Compare April 7, 2026 10:51
maorcc added 9 commits April 7, 2026 14:41
- Replace Leaflet layers/markers with maplibregl.Marker and GeoJSON sources
- Add 4 GeoJSON sources (ellipse-overlays, ellipse-visual, ellipse-editing, algc-overlay) via setupLayers()
- Replace map.distance() calls with haversineMeters() helper
- Replace CRS project/unproject with Web Mercator math
- Replace L.DomEvent.* with native event listeners
- Replace map interaction handlers (dragging/scrollWheelZoom/...) with MapLibre equivalents
- Replace getLocationPolygons with getFeatureMap (GeoJSON feature objects)
- Replace polygonRings() to work with GeoJSON coordinates instead of Leaflet getLatLngs()
- Add featureBbox() for bbox intersection check replacing getBounds().intersects()
- Delegate ensureOrefPoints to window.AppState
- Register dblclick handlers for cluster overlay (→ algC) and algC overlay (→ clear) via setupEventHandlers()
- Add openLocationPanel to AppState for pin click callbacks
- Update architecture.md: replace Leaflet/Voronoi/d3-delaunay references with MapLibre GL JS + PMTiles + pre-computed GeoJSON polygons
- Update CLAUDE.md project description
- Update ellipse-feature.md: locationPolygons → featureMap (GeoJSON), Web Mercator projection note
- Update ellipse-alg-C.md: remove Leaflet geometry reference
- Extend maxBounds south to lat 11.0 (was 24.0) to cover Yemen
Road narrowing, border filters, and sub-regional boundary visibility
are now applied to the Protomaps layer list before MapLibre is
initialized, instead of patching post-load with setPaintProperty.
Add future basemap style tweaks to customizeBasemapLayers().
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