# @ido-team/map

> ``` IdoMap.mapOptions = { lat: 31.936722, lng: 120.050611, zoom: 11, layer: [ { url: "http://t1.tianditu.gov.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk=key", Subdomains: ["0", "1", "2", "3"], }, ], }; ```

Latest version **1.2.134-changji** (published 2026-09-01) · 0 weekly downloads

## Install

```sh
npm install @ido-team/map
pnpm add @ido-team/map
yarn add @ido-team/map
bun add @ido-team/map
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; large bundle.

## Facts

| | |
|---|---|
| Version | 1.2.134-changji |
| Published | 2026-09-01 |
| First published | 2023-06-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 13 |
| Unpacked size | 11.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Maintainers | sleeping-ceremony, guijixing, xin7459517, junnes01, gxx-17, ttarn, caterpillar_ac, maoguojun, chenmiaomiao, liumuyuan, wangdabaoqq, jian_hao, zhangqi_xy, devman2025 |

## Links

- npm: https://www.npmjs.com/package/@ido-team/map
- npm.io page: https://npm.io/package/@ido-team/map

## Dependencies (13)

- [leaflet](https://npm.io/package/leaflet.md) ^1.6.0
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.21
- [heatmap.js](https://npm.io/package/heatmap.js.md) ^2.0.5
- [leaflet-draw](https://npm.io/package/leaflet-draw.md) ^1.0.4
- [proj4leaflet](https://npm.io/package/proj4leaflet.md) ^1.0.2
- [patch-package](https://npm.io/package/patch-package.md) ^7.0.0
- [leaflet-ant-path](https://npm.io/package/leaflet-ant-path.md) ^1.3.0
- [leaflet-editable](https://npm.io/package/leaflet-editable.md) ^1.2.0
- [iso8601-js-period](https://npm.io/package/iso8601-js-period.md) ^0.2.1
- [leaflet-rotatedmarker](https://npm.io/package/leaflet-rotatedmarker.md) ^0.2.0
- [leaflet-timedimension](https://npm.io/package/leaflet-timedimension.md) ^1.1.1
- [postinstall-postinstall](https://npm.io/package/postinstall-postinstall.md) ^2.1.0
- [@supermap/iclient-leaflet](https://npm.io/package/@supermap/iclient-leaflet.md) ^11.1.1

## Recent versions

- 1.2.134-changji (latest) — 2026-09-01
- 1.1.9-alpha.1 (alpha) — 2023-06-26
- 1.2.133-changji — 2026-09-01
- 1.2.132-temp — 2026-04-23
- 1.2.131-temp — 2026-04-22
- 1.2.130 — 2025-10-14
- 1.2.129 — 2025-10-14
- 1.2.128 — 2025-10-14
- 1.2.127 — 2025-10-14
- 1.2.126 — 2025-10-14
- 1.2.125 — 2025-10-14
- 1.2.124 — 2025-10-14
- 1.2.123 — 2025-10-14
- 1.2.122 — 2024-12-19
- 1.2.12 — 2024-12-19
- … 109 more at https://npm.io/package/@ido-team/map/versions

## README

# 地图 api 说明

## 地图配置项示例

```
IdoMap.mapOptions = {
  lat: 31.936722,
  lng: 120.050611,
  zoom: 11,
  layer: [
    {
      url: "http://t1.tianditu.gov.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk=key",
      Subdomains: ["0", "1", "2", "3"],
    },
  ],
};
```

### 地图配置项详细

```
lat: number;
lng: number;
CRS?: "4490";
layer?: {
    url: string;
    Subdomains?: string[];
    maxZoom?: number;
    minZoom?: number;
    errorTileUrl?: string;
    attribution?: string;
  }[];
attribution?: string;
```

### 初始化

```
const mapInstance = new IdoMap("divId");
```

## 方法

### 创建点位 createMarkers

```
const collections = mapInstance.createMarkers([
  {
    id: "1", //唯一标识,可根据数据对比进行局部点位更新
    lat: "31.936722", //纬度
    lng: "120.050611", //经度,
    iconAnchor: [12, 0],
    className: "leaflet-div-icon",
    html: "XXXX公司",
    popupHtml:
      '<div style="background: #ffffff;"><a href=javascript:alert("当前企业:${obj.html}")>${obj.html}</a></div>',
    enterprise_id: "aaaa",
  },
  {
    id: "3", //唯一标识,可根据数据对比进行局部点位更新
    clickEvent: "alert('当前企业id:${obj.enterprise_id}')", //点击事件
    lat: "31.936722", //纬度
    lng: "120.050611", //经度,
    enterprise_id: "12345678",
  },
  {
    lat: "31.906707", //纬度
    lng: "120.151291", //经度,
    popupHtml: '<div style="background: #ffffff;">222</div>',
  },
]);

```

### 通过 geojson 生成图层/集合 createByGeoJson

```
const geoLayer = mapInstance.createByGeoJson(lineString, {
  style: { color: "red", weight: 1, dashArray: 3 },
  popupHtml: "多边形",
  enterprise_id: "2222",
  clickEvent: "alert('当前企业id:${obj.enterprise_id}')", //点击事件
});
```

### 创建图层 createLayer

```
const layer = mapInstance.createLayer(
  {
    layerType: "special_enterprise",
    collections
  }
);

```

### 为地图/图层添加图层/集合 addLayer

```
mapInstance.addLayer(layer);
或
mapInstance.addLayer(geoLayer,layer);

```

---
_Source: https://npm.io/package/@ido-team/map · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
