@maplat/ui

中文文档
1.2.0发布于 2026/11/02Apache-2.0TypeScriptES Module构建来源已验证

Maplat is the cool Historical Map/Illustrated Map Viewer. It can transform each map coordinates with nonlinear but homeomorphic projection and makes possible that the maps can collaborate with GPS/accurate maps, without distorting original maps.

原始使用文档
文档目录18 节
  1. About Maplat
  2. Key Features
  3. Quick Start
  4. Install
  5. Minimal usage
  6. CDN (jsDelivr)
  7. POI specification ( setting.pois )
  8. Lifecycle
  9. API reference
  10. Development
  11. Prerequisites
  12. Peer Dependencies
  13. Ecosystem
  14. Sister repositories
  15. Links
  16. License
  17. Contributors
  18. Sponsors

Maplat logo

Maplat

CI License

About Maplat

Maplat is the cool Historical Map / Illustrated Map Viewer. It can transform each map's coordinates with a nonlinear but homeomorphic projection, which lets the maps collaborate with GPS and accurate maps without distorting the original map image. The companion data editor is provided as another project, MaplatEditor. This project won the Grand Prize / Educational Effectiveness Prize / Visitors Selection Prize on the Geo-Activity Contest 2018 held by the Ministry of Land, Infrastructure, Transport and Tourism.

Maplat is open-source under the Apache License 2.0 (from version 0.12.2).

Read this document in Japanese / 日本語で読む

Key Features

  • Historical map / illustrated map viewer with nonlinear but homeomorphic coordinate transformation
  • GPS / accurate map collaboration without distorting the original map image
  • Pluggable base maps (OpenLayers-based; optional Mapbox GL JS / MapLibre GL JS for vector tiles)
  • PWA-ready application shell (manifest, Service Worker, share, URL state)
  • Viewer UI available in 11 languages: English, Japanese, German, Spanish, French, Indonesian, Korean, Thai, Vietnamese, Chinese (Simplified), and Chinese (Traditional)
  • Open-source (Apache 2.0 from version 0.12.2) with a companion desktop editor (MaplatEditor)

Quick Start

Current release: 1.2.0. This block is the only place in this repository that carries a release version (ADR-0012); everything outside it is written against the 1.0 release. npm: @maplat/ui npm

Install

# pnpm (recommended)
pnpm add @maplat/ui

# npm
npm install @maplat/ui

Minimal usage

import { MaplatUi } from '@maplat/ui';
import '@maplat/ui/dist/maplat_ui.css'; // Import styles

const option = {
  appid: 'myMark',
  // ...
};

MaplatUi.createObject(option).then(app => {
  // Application initialized
});

CDN (jsDelivr)

For usage directly in the browser without a bundler, you must load OpenLayers before loading Maplat UI. Maplat Core is bundled, so you do not need to load it separately.

<!-- OpenLayers -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@10/ol.min.css">
<script src="https://cdn.jsdelivr.net/npm/ol@10/dist/ol.min.js"></script>

<!-- Maplat UI -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@maplat/[email protected]/dist/maplat_ui.css">
<script src="https://cdn.jsdelivr.net/npm/@maplat/[email protected]/dist/maplat_ui.umd.js"></script>

<div id="map_div"></div>
<script>
  var appOption = {
    appid: "tm",
    // ... options
  };
  MaplatUi.createObject(appOption).then(function(app) {
    console.log("Maplat initialized");
  });
</script>

Note: Make sure to use the latest compatible versions.

POI specification (setting.pois)

Maplat UI passes the pois field of an app/map setting straight through to MaplatApp.createObject, so every form accepted by MaplatCore is accepted here unchanged. The common ways to point at POI data are:

  • URL string — "pois/landmarks.geojson", fetched at initialization
  • Map-embedded POI — an inline FeatureCollection written directly in the setting
  • Layer ref (wrapper) — { layer: <URL|FeatureCollection>, hide?, title?, icon?, selectedIcon? }, which references a layer and overrides only its presentation for this app without editing the referenced file

The full list of accepted forms, the override precedence, and the rule for unknown keys are documented once in MaplatCore; see POI specification (setting.pois) in the MaplatCore README.

Lifecycle

API reference

Development

Setup

Clone the repository and install dependencies.

git clone https://github.com/code4history/Maplat.git
cd Maplat
pnpm install

Development Server

Start the development server with hot reload.

pnpm dev

Access http://localhost:5173/ in your browser.

Build

pnpm build        # Build npm package (dist/)
pnpm build:demo   # Build demo application (dist-demo/)

Test

pnpm test         # Run tests (Vitest)
pnpm typecheck    # Run type checks (TypeScript)
pnpm lint         # Run linter and formatter (ESLint/Prettier)

Prerequisites

Derived from the engines field in package.json (ADR-0012: release-dependent).

  • Node.js: v20 or v22 (LTS tested via GitHub Actions)
  • pnpm: >=9.0.0 (required; package.json enforces pnpm)

Peer Dependencies

Maplat UI depends on the following libraries as peer dependencies. You must install them manually.

  • OpenLayers (ol) — ^9.0.0 || ^10.0.0 (peer dependency of Maplat @maplat/ui and MaplatCore @maplat/core)
pnpm add ol

If you use Vector Tiles, you may also need Mapbox GL JS or MapLibre GL JS:

  • mapbox-gl: ^2.0.0 || ^3.0.0
  • maplibre-gl: ^5.0.0 || ^6.0.0

Ecosystem

Maplat is part of the Maplat ecosystem by Code for History. See the full ecosystem map (8 repositories + product/corporate sites):

📖 Ecosystem Map — (the diagram is currently kept in a private planning repository; the Sister repositories table below is the public substitute)

Sister repositories

RepositoryLicensenpmRole
MaplatApache 2.0@maplat/uiMain viewer
MaplatCoreApache 2.0@maplat/coreCore library
MaplatTinApache 2.0@maplat/tinTIN conversion
MaplatTransformApache 2.0@maplat/transformCoordinate transform
MaplatEditorApache 2.0—Data authoring tool (desktop)
ChuciMIT@c4h/chuciMultimedia swiper & viewer Web Components
QuyuanMIT@c4h/quyuanGeoJSON template engine + multimedia viewer Web Components
WeiwudiMIT@c4h/weiwudiService Worker for tile cache

MaplatEditor is the data authoring tool used to create the maps and POIs that the viewers above render. The Maplat ecosystem is end-to-end: author with MaplatEditor, serve with any of the viewer libraries.

AudienceLinkPurpose
Project info / features / caseshttps://www.maplat.jp/en/Product site
Sponsor / business inquiryhttps://www.nayuta-inc.co.jp/en/Corporate site (Nayuta, Inc.)

ADR-0013: Apache-licensed repositories (this one) link to both sites. MIT-licensed sister repos (Weiwudi / Quyuan / Chuci) carry no Nayuta link.

License

Apache License 2.0 — see LICENSE.

Copyright 2019-2026 Kohei Otsuka, Code for History / Nayuta, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Patent notice: The Maplat coordinate-transform technology is patented in Japan (Patent No. 6684776).

Past versions: Versions before 0.12.2 were distributed under the Maplat Limited License 1.1. The license restoration to Apache 2.0 takes effect from version 1.0.0-rc1 onward. Earlier versions available on npmjs.com remain under their original limited-license terms.

Contributors

This project exists thanks to all the people who contribute.

Sponsors

Maplat is supported by

Thank you to all our backers! 🙏 [Become a backer]

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

版本与发布记录

@maplat/ui 共发布 52 个版本,首次发布于 2019/09/16;过去 12 个月发布了 21 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.0latest2026/11/021 天前
1.2.0-rc.1next2026/10/268 天前
1.1.02026/10/0529 天前
1.1.0-rc.12026/09/281 个月前
1.0.02026/08/252 个月前
1.0.0-rc1rc2026/08/072 个月前

关于 @maplat/ui 的常见问题

@maplat/ui 是什么?

Maplat是一个很酷的历史地图/插图地图查看器。 它可以用非线性但同纯投影变换每个地图坐标,使地图可以与GPS/精确地图协作,而不会扭曲原始地图。

如何安装 @maplat/ui?

在项目目录运行 npm install @maplat/ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:ol(^9.0.0 || ^10.0.0)、mapbox-gl(^2.0.0 || ^3.0.0)、maplibre-gl(^5.0.0 || ^6.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@maplat/ui 支持 TypeScript 吗?

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

@maplat/ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@maplat/ui 可以商用吗?

@maplat/ui 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@maplat/ui 还在维护吗?

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