@2gis/deck2gis-layer

中文文档
3.0.19发布于 2026/10/30TypeScriptCommonJS近 30 天下载 3134

Deck.gl layers implementations into 2gis map

原始使用文档
文档目录8 节
  1. Usage
  2. Use # deck2gisLayer
  3. Contributing
  4. Tests
  5. Run tests
  6. Release
  7. npm
  8. Demo

deck2gisLayer

Deck.gl layers implementations into 2gis map

Usage

Install with NPM

npm install @2gis/deck2gis-layer

Important

The current version of the Deck2gisLayer plugin is only compatible with the deck.gl@^8

Use # deck2gisLayer

Import the deck2gisLayer plugin to your project and use it:

import { Deck2gisLayer, initDeck } from '@2gis/deck2gis-layer';
// Init mapgl
const map = new mapgl.Map('container', {
    center: [55.31878, 25.23584],
    zoom: 13,
    key: 'Your API access key',
});
// Init deck.gl
const deck = initDeck(map, Deck, { antialiasing: 'msaa' });

// create Deck2gisLayer
const layer = new Deck2gisLayer<HexagonLayer<any>>({
    id: 'deckgl-HexagonLayer',
    deck,
    type: HexagonLayer,
    data,
    antialiasing: true,
    parameters: { depthTest: true },
    radius: 480,
    getPosition: (d: any) => [d.point.lon, d.point.lat],
});

// add deck layer into map
 map.addLayer(deckLayer);

Contributing

Deck2gisLayer uses github-flow to accept & merge fixes and improvements. Basic process is:

  • Fork the repo.
  • Create a branch.
  • Add or fix some code.
  • Run testing suite with npm run test:screenshots and make sure nothing is broken
  • Add some tests for your new code or fix broken tests.
  • Commit & push.
  • Create a new pull request to original repo.

Pull requests with failing tests will not be accepted. Also, if you modify packages or add them to package.json, make sure you use npm and update package-lock.json.

Tests

Run tests

npm run test:screenshots

Release

npm

  1. Update the package version by running npm version patch|minor|major. This command returns a new package version. Let assume it's 1.2.3
  2. Push changes to github and merge them to the «master» branch
  3. Go to https://github.com/2gis/deck2gisLayer/releases/new
  4. Click the «Choose tag» button and create a new tag according to the version in package.json, for example v1.2.3
  5. Make sure the release target is the «master» branch
  6. Paste the release tag into the «Release title» field, for example v1.2.3
  7. Add a release description
  8. Click the «Publish release» button
  9. Go to https://github.com/2gis/deck2gisLayer/actions and wait for completing the release workflow

Demo

  1. Just execute npm run deploy-gh-pages on your local machine from a commit you want to deploy as a demo.

版本与发布记录

@2gis/deck2gis-layer 共发布 50 个版本,首次发布于 2022/10/04;过去 12 个月发布了 7 个版本。

版本发布日期距今
3.0.19latest2026/10/308 天前
3.0.182026/09/301 个月前
3.0.162026/09/291 个月前
3.0.152026/09/032 个月前
3.0.142026/08/122 个月前
3.0.132026/07/213 个月前

其他发布通道:internal → 2.0.5-alpha。

关于 @2gis/deck2gis-layer 的常见问题

@2gis/deck2gis-layer 是什么?

Deck.gl layers implementations into 2gis map

如何安装 @2gis/deck2gis-layer?

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

@2gis/deck2gis-layer 支持 TypeScript 吗?

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

@2gis/deck2gis-layer 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@2gis/deck2gis-layer 可以商用吗?

@2gis/deck2gis-layer 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@2gis/deck2gis-layer 的下载量有多少?

根据 npm 官方下载统计,@2gis/deck2gis-layer 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,134 次,日均约 104 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@2gis/deck2gis-layer 还在维护吗?

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