@dsh-gis/dsh-opengis-skill 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +131 -2
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/assets/cesiumjs/SKILL.md +291 -0
- package/assets/deck-gl/SKILL.md +450 -0
- package/assets/gdal/SKILL.md +493 -0
- package/assets/gdal/reference/data-formats.md +33 -0
- package/assets/gdal/reference/raster-tools.md +538 -0
- package/assets/gdal/reference/vector-tools.md +149 -0
- package/assets/gdal-api/SKILL.md +368 -0
- package/assets/gdal-api/reference/raster-api.md +424 -0
- package/assets/gdal-api/reference/vector-api.md +724 -0
- package/assets/geometry-api-java/SKILL.md +410 -0
- package/assets/geometry-api-net/SKILL.md +350 -0
- package/assets/geometry-api-net/reference/geometry-types.md +243 -0
- package/assets/geopandas/SKILL.md +404 -0
- package/assets/geopandas/reference/core-api.md +221 -0
- package/assets/geopipe-agent/SKILL.md +309 -0
- package/assets/geopipe-agent/reference/backends.md +31 -0
- package/assets/geopipe-agent/reference/knowledge.md +77 -0
- package/assets/geopipe-agent/reference/pipeline-schema.md +64 -0
- package/assets/geopipe-agent/reference/self-extension.md +34 -0
- package/assets/geopipe-agent/reference/steps-reference.md +862 -0
- package/assets/geopipe-agent/reference/workflows.md +220 -0
- package/assets/geoserver/SKILL.md +237 -0
- package/assets/geoserver-cloud/SKILL.md +280 -0
- package/assets/geoserver-rest-api/SKILL.md +392 -0
- package/assets/geoserver-rest-api/reference/endpoints.md +155 -0
- package/assets/geotools/SKILL.md +425 -0
- package/assets/geotools/reference/raster-rendering.md +108 -0
- package/assets/geotools/reference/vector-io.md +149 -0
- package/assets/grass-gis/SKILL.md +339 -0
- package/assets/jts/SKILL.md +291 -0
- package/assets/jts/reference/geometry-operations.md +303 -0
- package/assets/leaflet/SKILL.md +350 -0
- package/assets/mapbox-gl-js/SKILL.md +434 -0
- package/assets/mapserver/SKILL.md +294 -0
- package/assets/mapsui/SKILL.md +283 -0
- package/assets/nettopologysuite/SKILL.md +268 -0
- package/assets/opengis-all/SKILL.md +479 -0
- package/assets/opengis-all/reference/data-stages.md +608 -0
- package/assets/opengis-all/reference/workflow-cheatsheets.md +324 -0
- package/assets/opengis-daf/SKILL.md +271 -0
- package/assets/opengis-utils-for-java/SKILL.md +406 -0
- package/assets/opengis-utils-for-java/reference/common-tasks.md +384 -0
- package/assets/opengis-utils-for-net/SKILL.md +424 -0
- package/assets/opengis-utils-for-net/reference/code-patterns.md +124 -0
- package/assets/opengis-utils-for-net/reference/util-classes.md +291 -0
- package/assets/openlayers/SKILL.md +285 -0
- package/assets/pdal/SKILL.md +348 -0
- package/assets/postgis/SKILL.md +255 -0
- package/assets/proj/SKILL.md +357 -0
- package/assets/pyqgis/SKILL.md +459 -0
- package/assets/pyqgis/reference/processing-rendering.md +292 -0
- package/assets/pyqgis/reference/vector-raster-layers.md +318 -0
- package/assets/qgis-process/SKILL.md +414 -0
- package/assets/qgis-process/reference/algorithm-cheatsheet.md +194 -0
- package/assets/qgis-server/SKILL.md +250 -0
- package/assets/shapely/SKILL.md +359 -0
- package/assets/shapely/reference/operations-reference.md +199 -0
- package/assets/sharpmap/SKILL.md +309 -0
- package/cordis.patch.yml +9 -0
- package/icon.svg +11 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +119 -0
- package/lib/skill-file.d.ts +15 -0
- package/lib/skill-file.js +62 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +89 -4
- package/upstream.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dsh-gis/dsh-opengis-skill
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DeepSeek Harness 的 **OpenGIS 技能包插件**:把 [opengis-skills](https://github.com/znlgis/opengis-skills) 中 **gis/ 分类的 32 个 GIS 技能**打包成可安装、可启停的 DSH bundle。会话技能目录只列出名称与描述,技能正文与参考资料按需加载。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- **32 个 GIS 技能**:GDAL、GDAL API、QGIS(qgis_process / PyQGIS / QGIS Server)、GeoServer(含 REST API 与 Cloud)、MapServer、PostGIS、PROJ、PDAL、GRASS GIS、JTS、NetTopologySuite、Esri Geometry API(Java/.NET)、Shapely、GeoPandas、GeoPipeAgent、OpenGisDAF、CesiumJS、OpenLayers、Leaflet、Mapbox GL JS、deck.gl、SharpMap、Mapsui、GeoTools、OpenGIS Utils(Java/.NET)、opengis-all 全流程索引。
|
|
8
|
+
- **按需加载**:注册的是 skill provider(`ctx.skills.registerProvider`),发现阶段只读 frontmatter;正文每次加载时读取,参考资料(`reference/*.md`)通过技能目录(resource base)相对解析。
|
|
9
|
+
- **零运行时依赖**:只用 Node 内置模块,npm 包内自带全部资产(约 640 KB),不 import DSH 内部包。
|
|
10
|
+
- **可同步上游**:`npm run sync` 从 opengis-skills 检出复制资产,记录上游 commit 到 `upstream.json`,并重新生成本文下方技能表。
|
|
11
|
+
- **可启停**:单包同时是 bundle 与插件(`dsh.bundle.patch` 插入自身行),在 Plugins 里启用/停用即可。
|
|
12
|
+
|
|
13
|
+
## 技能清单
|
|
14
|
+
|
|
15
|
+
<!-- skills:start -->
|
|
16
|
+
| Skill | Description (upstream frontmatter) |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| `cesiumjs` | Use when building browser-based 3D globes, 3D Tiles visualization, time-dynamic geospatial data, or virtual globe applications. CesiumJS: high-performance WebGL 3D geospatial engine for interactive earth visualization. |
|
|
19
|
+
| `deck-gl` | Use when visualizing large geospatial or tabular datasets in the browser with GPU rendering — millions of points, GeoJSON polygons, vector tiles, aggregation layers (hexagon, screen grid, heatmap), and overlaying them on a MapLibre/Mapbox GL JS base map via @deck.gl/mapbox. |
|
|
20
|
+
| `gdal` | Use when processing geospatial raster/vector data via command line — format conversion (Shapefile to GeoJSON), reprojection, DEM analysis, NDVI calculation, mosaicking. GDAL/OGR CLI: the industry standard for batch geospatial data processing with 50+ command-line tools (ogr2ogr, gdalwarp, gdal_translate, gdal_calc). |
|
|
21
|
+
| `gdal-api` | Use when programming against GDAL/OGR in C, C++, Python, Java, or .NET for raster/vector I/O, coordinate transformation, or custom geospatial algorithms. GDAL API: low-level programming interface for reading/writing 70+ geospatial formats. |
|
|
22
|
+
| `geometry-api-java` | Use when working with Esri geometry types (Point, Polyline, Polygon, Envelope) in Java — spatial operations, JSON/GeoJSON/WKT I/O, geodesic calculations. Esri Geometry API for Java. |
|
|
23
|
+
| `geometry-api-net` | Use when working with Esri geometry types (Point, Polyline, Polygon, Envelope) in .NET/C# — spatial operations, JSON/GeoJSON/WKT I/O, geodesic calculations. Esri Geometry API for .NET. |
|
|
24
|
+
| `geopandas` | Use when performing vector spatial data analysis in Python — reading/writing shapefiles, spatial joins, overlay operations, choropleth maps. GeoPandas: extends pandas DataFrames with geometry columns for Pythonic spatial analysis. |
|
|
25
|
+
| `geopipe-agent` | Use when building AI-driven GIS data pipelines with YAML-defined steps — format conversion, spatial validation, QC reporting, and self-extending capability gaps. GeoPipe Agent: YAML-driven GIS ETL pipeline agent with a built-in offline GIS knowledge layer. |
|
|
26
|
+
| `geoserver` | Use when deploying OGC-compliant map services (WMS, WFS, WMTS, WCS) or configuring SLD styling, security, and tile caching. GeoServer: the leading open-source Java map server for publishing spatial data to the web. |
|
|
27
|
+
| `geoserver-cloud` | Use when deploying GeoServer on Kubernetes as cloud-native microservices with auto-scaling, service discovery, and centralized configuration. GeoServer Cloud: break monolithic GeoServer into independently scalable WMS/WFS/WCS services. |
|
|
28
|
+
| `geoserver-rest-api` | Use when automating GeoServer management — programmatic workspace, datastore, and layer creation, style upload, service configuration via REST API. GeoServer REST API: manage GeoServer without GUI using curl, Python, or any HTTP client. |
|
|
29
|
+
| `geotools` | Use when building Java GIS applications — feature reading/writing, coordinate transformations, map styling, spatial filters, WMS/WFS clients. GeoTools: the Java GIS toolkit and OGC standards reference implementation. |
|
|
30
|
+
| `grass-gis` | Use when doing GIS geoprocessing with GRASS GIS headlessly — grass --exec and --tmp-project for servers and CI, g.region computational region management, r.* raster, v.* vector, r3.* 3D raster and t.* temporal modules, r.import/v.import data import, or Python scripting with grass.script, grass.script.array and grass.tools. |
|
|
31
|
+
| `jts` | Use when performing precise 2D computational geometry in Java — spatial predicates (contains, intersects), overlay operations, buffering, triangulation. JTS (Java Topology Suite): the canonical geometry engine used as blueprint for GEOS, Shapely, and NetTopologySuite. |
|
|
32
|
+
| `leaflet` | Use when adding lightweight interactive 2D maps to web pages — tile layers, markers, GeoJSON overlays, layer control, popups. Leaflet: compact, mobile-friendly open-source JavaScript web mapping library. |
|
|
33
|
+
| `mapbox-gl-js` | Use when building interactive vector web maps with Mapbox GL JS — WebGL rendering, Style Spec, data-driven expressions, 3D terrain, layer-level events. Note: v2+ is proprietary under Mapbox TOS with an access token requirement; MapLibre GL JS is the open-source API-compatible fork. |
|
|
34
|
+
| `mapserver` | Use when publishing spatial data as OGC web services (WMS, WFS, WCS) from a mapfile, styling layers with SLD, or deploying the mapserv CGI/FastCGI. MapServer: the C-based OSGeo open-source map server for the web. |
|
|
35
|
+
| `mapsui` | Use when embedding interactive 2D maps in .NET desktop (WinForms/WPF) or mobile (MAUI) applications — tile layers, vector features, map controls. Mapsui: cross-platform .NET map component library. |
|
|
36
|
+
| `nettopologysuite` | Use when performing 2D computational geometry in .NET — spatial predicates, overlay operations, buffering, WKT/WKB I/O. NetTopologySuite: the .NET port of JTS, available via NuGet for spatial analysis in C# applications. |
|
|
37
|
+
| `opengis-all` | Use when navigating end-to-end GIS workflows — discover the full toolchain from GDAL data processing through GeoServer publishing to CesiumJS/OpenLayers visualization. One-stop index covering the complete open-source GIS data pipeline. |
|
|
38
|
+
| `opengis-daf` | Use when building plan-driven GIS data analysis or data quality-check pipelines with OpenGisDAF (.NET 10 / C# 14): define buffer, clip, intersect/containment checks, coordinate transform, field calculator, attribute/geometry QC rules purely in JSON plans, run the daf CLI, chain operators via DAG upstream bindings, output to GeoJSON/Shapefile/PostGIS, or extend with plugin operators loaded via AssemblyLoadContext. |
|
|
39
|
+
| `opengis-utils-for-java` | Use when needing common GIS utility functions in Java — CRS utilities, geometry helpers, format converters, spatial validation. OpenGIS Utils for Java: convenience toolkit for Java GIS projects. |
|
|
40
|
+
| `opengis-utils-for-net` | Use when needing common GIS utility functions in .NET/C# — CRS utilities, geometry helpers, format converters, spatial validation. OpenGIS Utils for .NET: convenience toolkit for .NET GIS projects. |
|
|
41
|
+
| `openlayers` | Use when adding interactive 2D maps to web applications — WMS/WFS/WMTS layers, vector styling, map controls, popups. OpenLayers: the most full-featured open-source JavaScript web mapping library. |
|
|
42
|
+
| `pdal` | Use when processing point cloud data (LAS/LAZ/BPF/EPT/COPC) via CLI or Python — pipeline JSON workflows, format conversion, reprojection, cropping, outlier removal, ground classification (SMRF), and DEM generation from LiDAR. PDAL (Point Data Abstraction Library) is the point cloud equivalent of GDAL: pdal info/translate/pipeline commands plus pdal.Pipeline Python bindings. |
|
|
43
|
+
| `postgis` | Use when extending PostgreSQL with spatial data types, spatial indexes (GiST/SP-GiST), geometry functions (ST_Intersects, ST_Buffer, ST_Transform), and spatial queries. PostGIS: the most widely used open-source spatial database extension. |
|
|
44
|
+
| `proj` | Use when performing coordinate reference system (CRS) transformation, reprojection, datum shift or EPSG lookup from the command line — converting coordinates between WGS 84, UTM, Web Mercator and CGCS2000. PROJ: the OSGeo library that powers GDAL/QGIS transformations, with projinfo, cs2cs, proj, cct and the proj.db SQLite database. |
|
|
45
|
+
| `pyqgis` | Use when extending QGIS with Python plugins, automating map composition, or scripting QGIS processing algorithms. PyQGIS: QGIS Python API for custom tools, processing scripts, and plugin development. |
|
|
46
|
+
| `qgis-process` | Use when running QGIS geoprocessing tools headless from command line or CI/CD — buffer, clip, reproject, raster analysis without GUI. QGIS Processing: batch spatial analysis via qgis_process CLI. |
|
|
47
|
+
| `qgis-server` | Use when publishing QGIS projects (.qgs/.qgz) as OGC web services (WMS, WFS, WMTS, OGC API Features) via FastCGI, Docker, or Apache/Nginx, and when tuning QGIS_SERVER_* environment variables. QGIS Server: the C++ map server that renders QGIS Desktop projects over HTTP. |
|
|
48
|
+
| `shapely` | Use when performing computational geometry in Python — intersection, union, buffer, convex hull, simplification. Shapely: Python bindings for GEOS, the C++ geometry engine that powers PostGIS. |
|
|
49
|
+
| `sharpmap` | Use when rendering 2D maps in legacy .NET WinForms or ASP.NET WebForms applications. SharpMap: an older .NET 2D mapping library. For new projects, prefer Mapsui. |
|
|
50
|
+
<!-- skills:end -->
|
|
51
|
+
|
|
52
|
+
## 安装
|
|
53
|
+
|
|
54
|
+
### 方式一:Plugins 界面(本地目录,适合开发)
|
|
55
|
+
|
|
56
|
+
1. 打开 DSH 的 **Plugins / 插件** 页面,选择安装 bundle(安装本地包目录)。
|
|
57
|
+
2. 目标填本仓库的绝对路径,例如 `D:\self\code\dsh-opengis-skill`。
|
|
58
|
+
3. 在列表中找到 **OpenGIS 技能包** 并启用。
|
|
59
|
+
|
|
60
|
+
### 方式二:npm
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
dsh plugin --profile <profile> add @dsh-gis/dsh-opengis-skill
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
安装后在 Plugins 页面启用该 bundle。desktop profile 由 Electron 应用独占,推荐直接用 Plugins 界面操作;安装、升级或启停之后,需要新会话(或重启 dsh)才会出现最新的技能目录。
|
|
67
|
+
|
|
68
|
+
## 使用
|
|
69
|
+
|
|
70
|
+
- 技能目录会列出 32 个技能的名称与描述;模型用 `skill("gdal")` 之类的调用加载,用户也可以在输入框直接输入 `/gdal`。
|
|
71
|
+
- 常用入口:
|
|
72
|
+
- `opengis-all` — 端到端 GIS 流程索引(GDAL → 处理 → GeoServer → 可视化);
|
|
73
|
+
- `gdal` / `gdal-api` — 命令行与编程式栅格/矢量处理;
|
|
74
|
+
- `qgis-process` / `pyqgis` — QGIS 批处理与二次开发;
|
|
75
|
+
- `geoserver` + `geoserver-rest-api` — 发布与管理 OGC 服务;
|
|
76
|
+
- `postgis` — 空间数据库;`proj` — 坐标转换;
|
|
77
|
+
- `openlayers` / `cesiumjs` / `deck-gl` — Web 2D/3D 可视化。
|
|
78
|
+
- 加载结果会给出该技能的 Base directory;正文中的 `reference/*.md` 与 `../<其他技能>/SKILL.md` 相对链接都据此解析(资源随包全量分发)。
|
|
79
|
+
|
|
80
|
+
## 上游同步
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 默认从 ../opengis-skills 读取,也可用 --from 或 OPENGIS_SKILLS_DIR 指定
|
|
84
|
+
npm run sync -- --from ../opengis-skills
|
|
85
|
+
|
|
86
|
+
# 只检查是否与上游一致(CI 可用)
|
|
87
|
+
npm run sync:check -- --from ../opengis-skills
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
同步脚本会:逐文件复制 `gis/<skill>/`(不含任何改写)、校验 frontmatter(name 必须为 kebab-case 且与目录同名)、清理上游已删除的技能目录、更新 `upstream.json`(仓库地址、commit、同步时间、技能清单)以及本文的技能表。
|
|
91
|
+
|
|
92
|
+
## 开发
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm test # Node 内置测试运行器,覆盖 provider 目录/加载/链接
|
|
96
|
+
npm run validate # 资产、元数据、bundle 接线与打包校验
|
|
97
|
+
npm pack --dry-run # 查看实际发布内容
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 目录结构
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
dsh-opengis-skill/
|
|
104
|
+
├── package.json # dsh.bundle.patch、engines、files、icons/locales 导出
|
|
105
|
+
├── cordis.patch.yml # bundle 层:把 opengis-skill provider 行插入 Host
|
|
106
|
+
├── lib/
|
|
107
|
+
│ ├── index.js # provider 插件(扫描 assets、注册 ctx.skills)
|
|
108
|
+
│ ├── skill-file.js # SKILL.md frontmatter 解析(插件/脚本/测试共用)
|
|
109
|
+
│ └── *.d.ts # 手写类型声明
|
|
110
|
+
├── assets/<skill>/ # 32 个技能资产(SKILL.md + reference/*.md,随上游同步)
|
|
111
|
+
├── locale/{en,zh}.json # Plugins 里显示的标题与描述
|
|
112
|
+
├── icon.svg # bundle 图标
|
|
113
|
+
├── scripts/ # 同步与校验脚本
|
|
114
|
+
├── test/plugin.test.mjs # 单元测试
|
|
115
|
+
└── upstream.json # 上游仓库、commit、同步时间与技能清单
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 设计说明
|
|
119
|
+
|
|
120
|
+
- `apply` 时扫描 `assets/*/SKILL.md`,解析并校验名称与描述,然后 `ctx.effect(() => ctx.skills.registerProvider(...))`;provider 名为 `opengis`,候选 rank 为 600(与官方内置技能包一致),模型与用户均可调用。
|
|
121
|
+
- 目录(list)只含元数据;正文(get)每次重新读盘,因此编辑资产后重新加载插件即可生效,无需清缓存。插件不注册工具、不注入提示段、不写会话状态。
|
|
122
|
+
- 相对链接不做改写:包内是全量 32 个技能目录,`reference/*.md` 与 `../<skill>/SKILL.md` 都能解析;如果将来裁剪技能,`npm run validate` 会报断链。
|
|
123
|
+
|
|
124
|
+
## 与 @dsh-gis 其他插件的关系
|
|
125
|
+
|
|
126
|
+
- ```dsh-gis/dsh-gis`:GIS 工具与地图界面(inspect/query/CRS/OGC/UI)。
|
|
127
|
+
- ```dsh-gis/dsh-prompt-gis`:一段 GIS system-prompt 与两个内联技能(`gis-inspect-first`、`gis-query-patterns`)。
|
|
128
|
+
- 本包:纯知识型技能包(32 个 GIS 技能),不提供工具,可与上述插件同时安装。
|
|
129
|
+
|
|
130
|
+
## 许可
|
|
131
|
+
|
|
132
|
+
MIT,见 [LICENSE](./LICENSE)。技能正文与参考资料来自 [opengis-skills](https://github.com/znlgis/opengis-skills)(MIT © 2024-2026 znlgis),详见 [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md)。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
## opengis-skills
|
|
4
|
+
|
|
5
|
+
The skill instructions under `assets/` are copied verbatim from the
|
|
6
|
+
[opengis-skills](https://github.com/znlgis/opengis-skills) repository
|
|
7
|
+
(`gis/` category), which is licensed under the MIT License:
|
|
8
|
+
|
|
9
|
+
> MIT License
|
|
10
|
+
>
|
|
11
|
+
> Copyright (c) 2024-2026 znlgis
|
|
12
|
+
|
|
13
|
+
The exact upstream commit, sync time, and the list of vendored skills are
|
|
14
|
+
recorded in [`upstream.json`](./upstream.json); the copy is performed by
|
|
15
|
+
[`scripts/sync-opengis-skills.mjs`](./scripts/sync-opengis-skills.mjs). The
|
|
16
|
+
skills are documentation: each one describes an independent open-source project
|
|
17
|
+
(GDAL, QGIS, GeoServer, PostGIS, JTS, CesiumJS, OpenLayers, and others) and
|
|
18
|
+
links to that project's own repository, documentation, and license. Those
|
|
19
|
+
projects keep their own licenses; nothing in this package re-licenses them.
|
|
20
|
+
|
|
21
|
+
## DeepSeek Harness
|
|
22
|
+
|
|
23
|
+
This package registers a skill provider on the public `ctx.skills` service of
|
|
24
|
+
DeepSeek Harness and mirrors the standard bundled-provider rank (600) documented
|
|
25
|
+
by `@deepseek-ai/dsh-skill`. No DeepSeek Harness source code is copied into
|
|
26
|
+
or redistributed with this package; DeepSeek Harness itself is MIT licensed.
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cesiumjs
|
|
3
|
+
description: "Use when building browser-based 3D globes, 3D Tiles visualization, time-dynamic geospatial data, or virtual globe applications. CesiumJS: high-performance WebGL 3D geospatial engine for interactive earth visualization."
|
|
4
|
+
tags:
|
|
5
|
+
- javascript
|
|
6
|
+
- webgl
|
|
7
|
+
- 3d
|
|
8
|
+
- 3d-tiles
|
|
9
|
+
- gltf
|
|
10
|
+
- earth
|
|
11
|
+
- map
|
|
12
|
+
- web
|
|
13
|
+
- visualization
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
> **项目地址:** <https://github.com/CesiumGS/cesium>
|
|
17
|
+
>
|
|
18
|
+
> **官方文档:** <https://cesium.com/learn/cesiumjs-learn/>
|
|
19
|
+
>
|
|
20
|
+
> **API 参考:** <https://cesium.com/learn/cesiumjs/ref-doc/>
|
|
21
|
+
>
|
|
22
|
+
> **Sandcastle:** <https://sandcastle.cesium.com/>
|
|
23
|
+
>
|
|
24
|
+
> **最新版本:** 1.146.0(截至2026-10,npm `cesium`)
|
|
25
|
+
>
|
|
26
|
+
> **许可证:** Apache-2.0
|
|
27
|
+
|
|
28
|
+
## 概述
|
|
29
|
+
|
|
30
|
+
CesiumJS 提供:
|
|
31
|
+
|
|
32
|
+
- **三维全球**:WGS84 椭球体、地形(Quantized-Mesh)、卫星影像
|
|
33
|
+
- **3D Tiles**:海量三维流式(倾斜摄影、BIM、点云、城市模型)
|
|
34
|
+
- **glTF / GLB 模型**:标准 PBR 渲染
|
|
35
|
+
- **CZML / Entity API**:高层声明式数据模型,时序动画
|
|
36
|
+
- **Primitive API**:底层高性能 API
|
|
37
|
+
- **可视化分析**:通视/剖面/缓冲/裁剪/视频投影/光影
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 安装
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install cesium
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<link href="https://cdn.jsdelivr.net/npm/cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/cesium/Build/Cesium/Cesium.js"></script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> **1.146 变更:** 数学/几何/时间/工具类被拆分为新包 `@cesium/core`。从 `cesium` 主包导入的代码不受影响;直接按子路径引用 `@cesium/engine` 的代码需改从 `@cesium/core` 导入(旧导出将在 1.150 移除)。
|
|
53
|
+
|
|
54
|
+
### Vite 集成
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import { defineConfig } from 'vite';
|
|
58
|
+
import cesium from 'vite-plugin-cesium';
|
|
59
|
+
export default defineConfig({ plugins: [cesium()] });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Webpack 集成
|
|
63
|
+
|
|
64
|
+
需将 `node_modules/cesium/Build/Cesium/{Workers,Assets,Widgets}` 拷贝到输出目录,并设置 `window.CESIUM_BASE_URL`。
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 快速上手
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<div id="cesiumContainer" style="width:100%;height:100vh"></div>
|
|
72
|
+
<script type="module">
|
|
73
|
+
import * as Cesium from 'cesium';
|
|
74
|
+
import 'cesium/Build/Cesium/Widgets/widgets.css';
|
|
75
|
+
|
|
76
|
+
Cesium.Ion.defaultAccessToken = 'YOUR_ION_TOKEN';
|
|
77
|
+
|
|
78
|
+
const viewer = new Cesium.Viewer('cesiumContainer', {
|
|
79
|
+
terrainProvider: await Cesium.createWorldTerrainAsync(),
|
|
80
|
+
timeline: false, animation: false
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
viewer.camera.flyTo({
|
|
84
|
+
destination: Cesium.Cartesian3.fromDegrees(116.397, 39.908, 5000)
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 核心概念
|
|
92
|
+
|
|
93
|
+
| 概念 | 说明 |
|
|
94
|
+
|------|------|
|
|
95
|
+
| `Viewer` | 顶层容器 |
|
|
96
|
+
| `Scene` | 渲染场景,含 globe/camera/primitives |
|
|
97
|
+
| `Entity` | 高层数据对象,时序、属性、可视化封装 |
|
|
98
|
+
| `DataSource` | Entity 集合(CZML/GeoJSON/KML) |
|
|
99
|
+
| `Primitive` | 低层渲染单元,性能最优 |
|
|
100
|
+
| `Cesium3DTileset` | 3D Tiles 数据集 |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 影像与地形
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
viewer.imageryLayers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
|
|
108
|
+
url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}'
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
|
|
112
|
+
requestVertexNormals: true,
|
|
113
|
+
requestWaterMask: true
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Entity 数据驱动
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
const ds = await Cesium.GeoJsonDataSource.load('/data/poi.geojson', {
|
|
123
|
+
stroke: Cesium.Color.RED, fill: Cesium.Color.RED.withAlpha(0.3),
|
|
124
|
+
strokeWidth: 2, clampToGround: true
|
|
125
|
+
});
|
|
126
|
+
viewer.dataSources.add(ds);
|
|
127
|
+
viewer.flyTo(ds);
|
|
128
|
+
|
|
129
|
+
viewer.entities.add({
|
|
130
|
+
position: Cesium.Cartesian3.fromDegrees(116.397, 39.908),
|
|
131
|
+
point: { pixelSize: 10, color: Cesium.Color.YELLOW },
|
|
132
|
+
label: { text: '天安门', font: '14px sans-serif',
|
|
133
|
+
verticalOrigin: Cesium.VerticalOrigin.BOTTOM }
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
viewer.entities.add({
|
|
137
|
+
polyline: {
|
|
138
|
+
positions: Cesium.Cartesian3.fromDegreesArray([116, 39, 121, 31]),
|
|
139
|
+
width: 3, material: Cesium.Color.CYAN, clampToGround: true
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
viewer.entities.add({
|
|
144
|
+
polygon: {
|
|
145
|
+
hierarchy: Cesium.Cartesian3.fromDegreesArray([116,39, 117,39, 117,40, 116,40]),
|
|
146
|
+
material: Cesium.Color.RED.withAlpha(0.5),
|
|
147
|
+
extrudedHeight: 1000
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 3D Tiles
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
const tileset = await Cesium.Cesium3DTileset.fromUrl('https://server/tileset.json', {
|
|
158
|
+
maximumScreenSpaceError: 16
|
|
159
|
+
});
|
|
160
|
+
viewer.scene.primitives.add(tileset);
|
|
161
|
+
viewer.flyTo(tileset);
|
|
162
|
+
|
|
163
|
+
tileset.style = new Cesium.Cesium3DTileStyle({
|
|
164
|
+
color: { conditions: [
|
|
165
|
+
['${height} >= 100', 'rgba(255,0,0,0.8)'],
|
|
166
|
+
['true', 'rgb(180,180,180)']
|
|
167
|
+
]}
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## glTF 模型
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
viewer.entities.add({
|
|
177
|
+
position: Cesium.Cartesian3.fromDegrees(116.4, 39.9, 0),
|
|
178
|
+
model: { uri: '/models/airplane.glb', minimumPixelSize: 64, maximumScale: 200 }
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 时序动画(CZML)
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
const czml = [
|
|
188
|
+
{ id: 'document', name: 'demo', version: '1.0',
|
|
189
|
+
clock: { interval: '2024-01-01/2024-01-02', currentTime: '2024-01-01' } },
|
|
190
|
+
{ id: 'plane',
|
|
191
|
+
position: { epoch: '2024-01-01T00:00:00Z',
|
|
192
|
+
cartographicDegrees: [0, 116, 39, 1000, 3600, 117, 40, 1000] },
|
|
193
|
+
point: { color: { rgba: [255, 0, 0, 255] }, pixelSize: 10 } }
|
|
194
|
+
];
|
|
195
|
+
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 交互与拾取
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
204
|
+
handler.setInputAction(e => {
|
|
205
|
+
const picked = viewer.scene.pick(e.position);
|
|
206
|
+
if (Cesium.defined(picked)) console.log(picked.id);
|
|
207
|
+
|
|
208
|
+
const c3 = viewer.camera.pickEllipsoid(e.position);
|
|
209
|
+
if (c3) {
|
|
210
|
+
const c = Cesium.Cartographic.fromCartesian(c3);
|
|
211
|
+
console.log(Cesium.Math.toDegrees(c.longitude),
|
|
212
|
+
Cesium.Math.toDegrees(c.latitude));
|
|
213
|
+
}
|
|
214
|
+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 摄像机
|
|
220
|
+
|
|
221
|
+
```js
|
|
222
|
+
viewer.camera.flyTo({
|
|
223
|
+
destination: Cesium.Cartesian3.fromDegrees(116.4, 39.9, 5000),
|
|
224
|
+
orientation: { heading: 0, pitch: -Cesium.Math.PI_OVER_FOUR, roll: 0 },
|
|
225
|
+
duration: 2
|
|
226
|
+
});
|
|
227
|
+
viewer.trackedEntity = entity;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 典型工作流
|
|
233
|
+
|
|
234
|
+
1. **初始化 Viewer**:使用 `Cesium.Viewer` 创建三维地球,设置地形和影像提供者
|
|
235
|
+
2. **加载数据**:根据数据类型选择合适 API——GeoJSON/CZML 用 `DataSource`,3D 瓦片用 `Cesium3DTileset`,单模型用 `Entity.model`
|
|
236
|
+
3. **设置相机**:使用 `camera.flyTo()` 定位到目标区域
|
|
237
|
+
4. **添加交互**:通过 `ScreenSpaceEventHandler` 处理点击拾取
|
|
238
|
+
5. **性能优化**:根据场景复杂度启用 `requestRenderMode`、调整 `maximumScreenSpaceError`
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 性能优化
|
|
243
|
+
|
|
244
|
+
1. 大量静态要素优先用 Primitive 而非 Entity
|
|
245
|
+
2. 3D Tiles 启用 `dynamicScreenSpaceError`、`skipLevelOfDetail`
|
|
246
|
+
3. 影像图层数量 ≤ 4
|
|
247
|
+
4. 启用 `requestRenderMode = true`(按需渲染)
|
|
248
|
+
5. `clampToGround` 适度使用
|
|
249
|
+
6. 释放:`viewer.entities.removeAll()`、`tileset.destroy()`
|
|
250
|
+
7. 监听 `webglcontextlost`
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 常见问题
|
|
255
|
+
|
|
256
|
+
| 问题 | 解决 |
|
|
257
|
+
|------|------|
|
|
258
|
+
| 黑屏 | 检查 `CESIUM_BASE_URL` 与静态资源 |
|
|
259
|
+
| 模型贴地不准 | `HeightReference.CLAMP_TO_GROUND` 或地形采样 |
|
|
260
|
+
| 性能卡顿 | 启用 `requestRenderMode`,降低 `maximumScreenSpaceError` |
|
|
261
|
+
| 国内瓦片偏移 | 使用 GCJ02→WGS84 纠偏 |
|
|
262
|
+
| Token 过期 | 不需要 ion 时不设置 token;或自托管 |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## AI 使用建议
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
### 关键注意事项
|
|
270
|
+
|
|
271
|
+
- **Ion Token**:使用 Cesium ion 服务需要设置 `Cesium.Ion.defaultAccessToken`;自托管数据则无需
|
|
272
|
+
- **坐标转换**:Cesium 内部使用 Cartesian3(地心地固坐标),通过 `Cesium.Cartesian3.fromDegrees(lon, lat, height)` 将经纬度转为内部坐标
|
|
273
|
+
- **Entity vs Primitive**:少量动态要素用 Entity API(简洁),大量静态要素用 Primitive API(高性能)
|
|
274
|
+
- **贴地(clampToGround)**:在三维地形上,需要明确设置 `clampToGround: true` 或 `HeightReference.CLAMP_TO_GROUND`
|
|
275
|
+
- **资源释放**:不再使用的 `DataSource` 调用 `viewer.dataSources.remove(ds)`,3D Tileset 调用 `tileset.destroy()`
|
|
276
|
+
- **静态资源部署**:使用 Webpack/Vite 时,确保 `Assets`、`Workers`、`Widgets` 目录正确复制到输出目录
|
|
277
|
+
|
|
278
|
+
## 相关技能
|
|
279
|
+
|
|
280
|
+
- **openlayers** — 二维 Web 地图库:[../openlayers/SKILL.md](../openlayers/SKILL.md)
|
|
281
|
+
- **geoserver** — 地图服务发布:[../geoserver/SKILL.md](../geoserver/SKILL.md)
|
|
282
|
+
- **geoserver-rest-api** — REST 自动化管理:[../geoserver-rest-api/SKILL.md](../geoserver-rest-api/SKILL.md)
|
|
283
|
+
- **postgis** — 空间数据库:[../postgis/SKILL.md](../postgis/SKILL.md)
|
|
284
|
+
- **mapsui** — .NET 跨平台地图组件:[../mapsui/SKILL.md](../mapsui/SKILL.md)
|
|
285
|
+
|
|
286
|
+
## 参考资源
|
|
287
|
+
|
|
288
|
+
- 学习中心:<https://cesium.com/learn/>
|
|
289
|
+
- API:<https://cesium.com/learn/cesiumjs/ref-doc/>
|
|
290
|
+
- Sandcastle:<https://sandcastle.cesium.com/>
|
|
291
|
+
- 中文教程(znlgis):<https://znlgis.github.io/gis/tutorial/cesium/>
|