MerchantryTidbits

frontend-tooling / library

MapLibre route snapper

Capability: MapLibre route snapper

Use it when

  • Users of a MapLibre GL web app need to draw routes that follow actual streets instead of straight freehand lines
  • You want route or polygon sketching on a map to work without sending every edit to a remote routing API, e.g. for planning cycle lanes along existing roads

What it solves

Not the fit when

  • areas without a pre-built graph file (graph must be generated ahead of time for a fixed region)
  • navigation or ETA computation
  • turn-by-turn navigation
  • planet-wide routing without a pre-built graph file
  • server-side routing API hosting
  • raster map rendering

Install

npm install route-snapper

Invoke

Build a graph file covering a fixed area, construct the RouteSnapper object with the graph file and a MapLibre GL map, then listen to its events to consume the drawn routes

Alternatives

No reviewed alternatives recorded yet.