@dhis2/maps-gl

中文文档
4.4.5发布于 2026/10/27BSD-3-ClauseESM + CJS近 30 天下载 2014

A WebGL rendering engine for DHIS2 maps based on Mapbox GL JS.

原始使用文档
文档目录6 节
  1. Link to DHIS2 Maps:
  2. Vendored files
  3. Build from source
  4. Publishing
  5. Publishing pre-release versions during app development
  6. Report an issue

maps-gl

DHIS2 Build and Release

WebGL mapping engine for DHIS2 Maps

maps-gl folder: yarn link maps-app folder: yarn link @dhis2/maps-gl

Vendored files

yarn install writes two third-party files, each with its license, into src/vendor (gitignored) through scripts/prepare-vendor-files.js:

  • mapbox-gl-rtl-text.js, from @mapbox/mapbox-gl-rtl-text: the plugin MapLibre's workers load to render right-to-left text. Version 1.0.0 dropped the single-file script MapLibre loads, so stay on 0.x.
  • ee_api_js_worker.js, from @google/earthengine: the Earth Engine API, adapted to run in the Earth Engine web worker, which we use for performance reasons.

To upgrade either one:

  1. Update its pinned version in package.json
  2. Run yarn install
  3. Test it in maps-app: Arabic labels for the plugin, Earth Engine layers for the API

Build from source

In order to use the library you must first build it from source using the command yarn build

You may also watch the src directory for changes with the command yarn watch

Both of these commands will run the javascript files in the src directory through babel to produce both CommonJS and ES Module builds in the build directory.

Publishing

Publication is done automatically by a GitHub action for all commits on the master branch. Commits (including pull-request squashed commits) should follow the Conventional Commit guidelines so that the release bot can determine which version to cut - breaking, feature, or bug

Publishing pre-release versions during app development

Builds for all non-production branches are automatically copied to d2-ci/maps-gl for use during development and testing, prior to production release.

To test changes in a development branch, change the maps-gl dependency of package.json of the app you are testing with. There are a few options:

  1. point to a specific commit:
"dependencies": {
        "@dhis2/maps-gl": "git+https://github.com/d2-ci/maps-gl.git#70249ebe8be39051fa10142f850de449e1ec488c",
        ...
}
  1. point to a branch:
"dependencies": {
        "@dhis2/maps-gl": "git+https://github.com/d2-ci/maps-gl.git#chore/some-chore",
        ...
}

Report an issue

The issue tracker can be found in DHIS2 JIRA under the LIBS project.

Deep links:

版本与发布记录

@dhis2/maps-gl 共发布 119 个版本,首次发布于 2020/02/05;过去 12 个月发布了 17 个版本。

版本发布日期距今
4.4.5latest2026/10/2718 天前
4.4.42026/10/2619 天前
4.4.32026/09/032 个月前
4.4.22026/09/032 个月前
4.4.12026/09/022 个月前
4.4.02026/09/012 个月前

关于 @dhis2/maps-gl 的常见问题

@dhis2/maps-gl 是什么?

A WebGL rendering engine for DHIS2 maps based on Mapbox GL JS.

如何安装 @dhis2/maps-gl?

在项目目录运行 npm install @dhis2/maps-gl,或使用 pnpm add / yarn add / bun add。

@dhis2/maps-gl 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dhis2__maps-gl 是否存在。

@dhis2/maps-gl 支持 ESM 还是 CommonJS?

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

@dhis2/maps-gl 可以商用吗?

@dhis2/maps-gl 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@dhis2/maps-gl 的下载量有多少?

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

@dhis2/maps-gl 还在维护吗?

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