npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

leaflet-polydraw

v2.0.2

Published

Advanced Leaflet plugin for freehand polygon drawing, with smart merging and powerful editing tools. Compatible with both Leaflet v1.x and v2.x.

Readme

Leaflet Polydraw

Leaflet Polydraw

A modern Leaflet plugin for intuitive freehand polygon drawing and advanced spatial editing — fully compatible with Leaflet 1.x and 2.x.

Live Demo: https://polydraw.ao-tech.se

Advanced Leaflet plugin for freehand polygon drawing, with smart merging and powerful editing tools

Leaflet.Polydraw lets you draw polygons directly on Leaflet maps in a natural freehand way — click and drag to sketch shapes.
It also supports point-to-point precision drawing, intelligent polygon merging, drag-and-drop repositioning, and a rich set of editing tools.
This makes it ideal for GIS platforms, mapping applications, and spatial data workflows.

npm License: MIT TypeScript CI


Key Features

Feature Overview

  • Freehand Drawing: Draw polygons naturally by sketching directly on the map — click and drag to create shapes in real time.
  • Smart Polygon Merging: Automatically detects and merges overlapping polygons (including smooth C-to-O shape completion).
  • Layer Management: Organize polygons into named layers with visibility, color, ordering, read-only/static policies, and metadata.
  • Drag & Drop Editing: Intuitive polygon repositioning with intelligent spatial interactions.
  • Clone Drag Mode: Duplicate polygons instantly by dragging a copy while the original remains in its starting position (preserves holes and metadata).
  • Advanced Vertex Editing: Drag vertices, add or remove points, and reshape polygons seamlessly.
  • Scaling & Rotation Handles: Transform polygons visually using interactive bounding boxes — scale, rotate, or stretch with precision.
  • Donut Transform Tool: Turn simple polygons into holes or outward donut-style shapes from the polygon menu with undo support.
  • Custom Polygon Menu Actions: Inject application-specific actions into the polygon menu with typed callbacks, async support, history control, and custom styling.
  • Undo & Redo History: Full action history with reversible edits — step backward or forward through vertex moves, shape changes, merges, and freehand strokes (Ctrl/Cmd+Z, Ctrl+Y or Cmd+Shift+Z).
  • Point-to-Point Mode: Optional precise vertex-by-vertex drawing for detailed or structured geometry.
  • Hole Support: Create complex polygons with holes and nested structures effortlessly.
  • Smart Markers: Adaptive marker placement prevents overlaps and maintains visual clarity.
  • Modifier Shortcuts: Hold Ctrl or Cmd (or user-defined keys) to temporarily switch to subtract while drawing or in point-to-point draw mode (modifierSubtractMode).
  • Performance Optimized: Efficient rendering and event handling even for large datasets.
  • GeoJSON Import: Add Polygon and MultiPolygon features directly from RFC 7946 GeoJSON
  • Coordinate Auto-Detection: Accepts multiple coordinate formats automatically (lat/lng, DMS, DDM, N/E, etc.).
  • Leaflet 1.x & 2.x Compatible: Fully compatible with both generations of the Leaflet API.
  • TypeScript Ready: Includes complete type definitions for modern development workflows.

Live Demo · Quick Start · Custom Actions · Full Documentation


Documentation

Full documentation and examples are available on GitHub:


Disclaimer

This project is provided "as is", without any warranty or guarantee of any kind. See the MIT License for full terms.