// the find
mapbox/mapbox-gl-draw
Draw tools for mapbox-gl-js
Official Mapbox plugin for drawing and editing GeoJSON features (points, lines, polygons) on a mapbox-gl-js map. It's the standard answer when someone asks 'how do I let users draw shapes on a map?' — but it only works with Mapbox GL JS, not MapLibre or anything else without a fork.
The custom modes API is genuinely well-designed: you can drop in community modes for snapping, cut/split, freehand drawing, etc. without forking the library. Test coverage is thorough — every mode and most utility functions have dedicated test files. Performance benchmarks are baked in with fixture data for large geometries, which is rare for a drawing library. GeoJSON in, GeoJSON out — no proprietary format to convert from.
Hard dependency on the commercial Mapbox GL JS means you're dragging in their licensing model; MapLibre users need a separate fork (mapbox-gl-draw-lite or similar) that's not officially maintained. The TypeScript types live in DefinitelyTyped rather than the package itself, so they lag behind releases and you'll hit cases where the types don't match reality. No built-in snapping to edges or vertices — a surprisingly basic feature for a drawing tool that requires a third-party mode. The state machine for modes is underdocumented; writing a custom mode means reading source code rather than following a guide.