@geoman-io/leaflet-geoman-free

中文文档
2.20.6发布于 2026/11/05MITTypeScriptESM + CJS构建来源已验证近 30 天下载 116.2万

A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.0

原始使用文档
文档目录5 节
  1. Documentation
  2. Demo
  3. Feature Requests
  4. Developing
  5. Credit

Geoman Logo

Leaflet-Geoman

Leaflet Plugin For Creating And Editing Geometry Layers
Draw, Edit, Drag, Cut, Rotate, Split, Scale, Measure, Snap and Pin Layers
Supports Markers, CircleMarkers, Polylines, Polygons, Circles, Rectangles, ImageOverlays, LayerGroups, GeoJSON, MultiLineStrings and MultiPolygons

npm version NPM Downloads

Demo

Documentation

Visit geoman.io/docs to get started.

Demo

Check out the full power of Leaflet-Geoman Pro on geoman.io/demo

Feature Requests

I'm adopting the Issue Management of lodash which means, feature requests get the "Feature Request" Label and then get closed.
You can upvote existing feature requests (or create new ones). Upvotes make me see how much a feature is requested and prioritize their implementation.
Please see the existing Feature Requests here and upvote if you want them to be implemented.

Developing

This project uses mise to pin Node.js and pnpm. Clone the repository, install the declared tools, and then install all packages:

mise install
pnpm install

Compile and run dev watch version:

pnpm start

Compile and run build version:

pnpm run prepare

Run tests:

pnpm test            # E2E tests (Cypress)
pnpm run test:unit   # Unit tests (Vitest)

Open cypress window:

pnpm run cypress

Lint and format (oxlint + oxfmt):

pnpm run lint

Take a look into CONTRIBUTING

Credit

A big thanks goes to @Falke-Design, he invests a lot of time and takes good care of Leaflet-Geoman.

Thanks to @ryan-morris for the implementation of Typescript and support with Typescript questions.

As I never built a leaflet plugin before, I looked heavily into the code of leaflet.draw to find out how to do stuff. So don't be surprised to see some familiar code.

I also took a hard look at the great L.GeometryUtil for some of my helper functions.

The Rotate Mode are only working because of the great calculation code of L.Path.Transform

版本与发布记录

@geoman-io/leaflet-geoman-free 共发布 39 个版本,首次发布于 2019/09/30;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.20.6latest2026/11/0511 天前
2.20.52026/11/0312 天前
2.20.42026/10/2125 天前
2.20.32026/10/2026 天前
2.20.22026/09/211 个月前
2.20.12026/09/112 个月前

关于 @geoman-io/leaflet-geoman-free 的常见问题

@geoman-io/leaflet-geoman-free 是什么?

A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.0

如何安装 @geoman-io/leaflet-geoman-free?

在项目目录运行 npm install @geoman-io/leaflet-geoman-free,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:leaflet(^1.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@geoman-io/leaflet-geoman-free 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@geoman-io/leaflet-geoman-free 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@geoman-io/leaflet-geoman-free 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@geoman-io/leaflet-geoman-free 可以商用吗?

@geoman-io/leaflet-geoman-free 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@geoman-io/leaflet-geoman-free 的下载量有多少?

根据 npm 官方下载统计,@geoman-io/leaflet-geoman-free 在 2026/10/16 – 2026/11/14 这 30 天内被下载 1,161,631 次,日均约 38,721 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@geoman-io/leaflet-geoman-free 还在维护吗?

最新版本 2.20.6 发布于 2026/11/05(11 天前);至今共发布 39 个版本,其中过去 12 个月发布了 11 个;首次发布于 2019/09/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。