map3d v0.6.0
map3d 渲染的照片级真实感三维城市,上方打开着绘图编辑器

巴黎 Google Photorealistic 3D Tiles 48.8584° N · 2.2945° E

React 19 · three.js ≥ 0.160 · ESM + CJS + types

面向 React 的
实时三维
地图库

Real-time 3D cartography for React.

一个由 React 挂载后便自行运转的命令式 Three.js 引擎。MapEngine 掌管相机、瓦片与图层,渲染循环从不等待组件重渲染。

npm i @pasquelin/map3d three react react-dom

版本
0.6.0
对等依赖
react 19 · three ≥ 0.160
构建产物
ESM + CJS + .d.ts
许可协议
PolyForm Noncommercial

在线演示

直接在浏览器里试用

无需安装,无需密钥。下方演示在每次推送时从本仓库构建,并由 GitHub Pages 直接提供。

能力

开箱即有

每一层界面 —— 工具栏、控件、搜索、坐标网格、聚合 —— 都挂载在 <Map> 内部,由配置驱动。你只需要提供数据。

实际运行

工具在工作中

下方每一张截图都来自上方可直接打开的演示 —— 没有任何效果图。

快速上手

十几行代码画出带聚合的地图

import { Map, markersLayer, type MarkerData } from '@pasquelin/map3d'

type Alert = { title: string }

const alerts: MarkerData<Alert>[] = [
  { id: 1, type: 'critical', position: { lat: 48.8566, lng: 2.3522 }, title: 'Intrusion', data: { title: 'Intrusion' } },
  { id: 2, type: 'info', position: { lat: 48.8606, lng: 2.3376 }, title: 'Patrol', data: { title: 'Patrol' } },
]

export function App() {
  return (
    <div style={{ height: '100vh' }}>
      <Map
        center={{ lat: 48.8566, lng: 2.3522 }}
        zoom={13}
        layers={[markersLayer<Alert>({ points: alerts, cluster: { enabled: true } })]}
      />
    </div>
  )
}

可选插件 —— IGN Géoplateforme、Windy、室内平面图 —— 位于独立仓库,你也可以用插件 API 编写自己的插件。