Skip to content

New module: map.js

Choose a tag to compare

@github-actions github-actions released this 10 Nov 22:31
· 72 commits to main since this release

map.js (new) - a slippy map written from scratch, with no Leaflet.

  • Raster tile basemap (OpenStreetMap by default, any {z}/{x}/{y} URL, or none) with GeoJSON drawn as SVG on top.
  • createMap / removeMap, addGeoJSON (style and popup options, returns remove()) / clearMap, fitMap / setMapView / getMapView, onMapClick (position and the clicked feature), showPopup / closePopup.
  • Drag, wheel and trackpad zoom, pinch, double click, zoom buttons and keyboard. Tiles of the previous zoom level stay, scaled, until the new ones load.
  • All positions are [longitude, latitude], the same order as GeoJSON. Popup text is inserted as text, never HTML.
  • Injects its own stylesheet and re-exports geo.js, so a map page needs a single import.