finds.dev← search

// the find

Wildhoney/Leaflet.FreeDraw

★ 575 · JavaScript · MIT · updated May 2025

:earth_asia: FreeDraw allows the free-hand drawing of shapes on your Leaflet.js map layer – providing an intuitive and familiar UX for creating geospatial boundaries similar to Zoopla and others. Included out-of-the-box is the concaving of polygons, polygon merging and simplifying, as well as the ability to add edges and modify existing shapes.

Leaflet.FreeDraw adds freehand polygon drawing to Leaflet maps with automatic concave hull generation, polygon merging, and simplification. It fires lat/lng coordinates on draw events so you handle the data side yourself. The target is anyone building map-based search UIs where users draw boundaries instead of typing addresses.

Bitfield mode system (CREATE | EDIT | DELETE) is clean API design — composing modes with bitwise operators beats passing string arrays. Ships CJS, ESM, and IIFE builds so it works across bundler setups without configuration gymnastics. The separation of concerns is correct: FreeDraw handles drawing geometry, you handle markers — no opinion forced on you about how to render results. Concave hull and polygon merging are on by default with tunable parameters rather than buried behind undocumented flags.

Last meaningful activity was years ago and the README still references Bower and Travis CI badges pointing to dead builds — the 2025 push is likely minor maintenance, not active development. No TypeScript types in the package, which means a modern TypeScript project gets no autocomplete and has to write its own declarations. The simplifyFactor and elbowDistance options are documented as 'tweak and see' with no guidance on what values produce sane results at different zoom levels — you will spend time guessing. Tests exist but functional tests likely require a browser environment; CI is broken so you have no confidence the test suite actually passes.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →