Skip to content

Commit 12b4848

Browse files
committed
【fea】for mapboxgl skills
1 parent bf138dc commit 12b4848

363 files changed

Lines changed: 8223 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

skills/mapboxgl/SKILL.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: supermap-iclient-mapboxgl-skills
3+
description: 生成 SuperMap iClient for MapboxGL 代码片段和完整 HTML 示例,覆盖地图加载、图层管理、数据查询、空间分析、MapboxGL API 用法等场景,以及 iServer REST 服务、GeoJSON、WMTS/WMS、矢量瓦片等数据源接入。
4+
---
5+
6+
# SuperMap iClient for MapboxGL Skills
7+
8+
## 概述
9+
10+
本技能辅助开发者生成 SuperMap iClient for MapboxGL 的代码片段和完整 HTML 文件。采用两层策略:
11+
12+
- **metadata/**:完整 JSDoc JSON 元数据,优先查阅,用于 API 精确查询(参数名、类型、返回值结构等)
13+
- **modules/**:高频场景的预构建模板,作为补充,提供参数说明、返回结果示例、完整可运行代码
14+
15+
行为规则(CDN 约束、API 选择、错误预防等)见 `prompts/system-prompt.md`
16+
17+
## 目录结构
18+
19+
```
20+
skills/
21+
├── templates/ index.html
22+
├── modules/
23+
│ ├── core/ init-map.md, empty-map.md
24+
│ ├── mapping/ add-geojson.md, vector-tile.md, WMTS.md, WMS.md
25+
│ ├── services/ feature-service.md, query-service.md, buffer-analysis.md
26+
│ └── utils/ ogc-capabilities.md, rest-data-vector.md
27+
├── metadata/
28+
│ ├── iclient-mapboxgl/ # SDK API(JSDoc JSON)
29+
│ └── mapbox-gl-enhance/ # 原生 API + enhance 扩展(index.d.ts, style-spec.json)
30+
├── rules/ intent-mapping.json, url-patterns.json, param-defaults.json,
31+
│ coordinate-system.md, error-handling.md
32+
└── prompts/ system-prompt.md, fallback-questions.md, few-shot-examples/
33+
```
34+
35+
## 工作流
36+
37+
```
38+
用户请求
39+
40+
识别意图(关键词 → rules/intent-mapping.json)
41+
42+
优先从 metadata/iclient-mapboxgl/ 检索 API
43+
44+
检索成功 → 使用 metadata 参数定义,从 modules/ 获取代码示例
45+
检索失败 → 尝试 modules/ 中是否有相似模板
46+
47+
参数缺失 → 用 prompts/fallback-questions.md 补问
48+
49+
生成完整 HTML / 代码片段
50+
```
51+
52+
### 各目录职责
53+
54+
| 场景 | 来源 | 说明 |
55+
| ------------------------------ | ------------------------- | -------------------------------------------- |
56+
| 参数名、参数类型、返回值结构 | `metadata/` | JSDoc 是权威来源 |
57+
| 代码示例、模板、最佳实践 | `modules/` | 补充说明,提供完整可运行示例 |
58+
| 业务规则、叠加要求、坐标系说明 | `rules/` | 校验和约束条件 |
59+
| URL 格式校验 | `rules/url-patterns.json` | 不依赖 JSDoc(JSDoc 中 URL 类型仅为 string) |
60+
| CDN、API 选择、错误预防 | `prompts/system-prompt.md`| AI 行为规则,权威约束来源 |
61+
62+
## 限制与指南
63+
64+
### modules 仅包含高频模式
65+
66+
-**包含**:地图初始化、GeoJSON/矢量瓦片/WMTS/WMS 图层、SQL/几何/缓冲区查询、缓冲区分析
67+
-**不包含**:叠加分析、插值分析、量算、网络分析等 — 通过 metadata 检索对应 API
68+
69+
### 模块新增标准
70+
71+
仅在满足以下条件时才添加新模块:
72+
73+
- **频率**:多次用户请求表明为高频需求
74+
- **明确性**:存在稳定且清晰的最佳实践,变体少
75+
- **互补性**:填补核心工作流缺口(非小众场景)
76+
77+
### 开发原则
78+
79+
- **以元数据为权威**:模块未覆盖的 API 一律从 metadata 检索并校验
80+
- **可伸缩设计**:避免穷举式枚举,优先自助式元数据查询
81+
- **可组合性**:modules 提供通用模式,metadata 提供精确细节
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"kind":"class","name":"AddressMatchService","tags":[{"originalTitle":"category","title":"category","text":"iServer AddressMatch","value":"iServer AddressMatch"}],"classdesc":"<p>地址匹配服务类。此类提供了地址的正向匹配和反向匹配功能,正向匹配即通过地点名称关键词查找地址位置,反向匹配即根据位置坐标查询地点。</p>","modulecategory":{"globalParams":{"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":false},"namespace":"mapboxgl.supermap","moduleName":"mapboxgl","npm":"@supermapgis/iclient-mapboxgl","cdn":"https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"},"category":"Services","name":"mapboxgl.supermap.AddressMatchService","des_en":"AddressMatchService","className":"AddressMatchService","des":"地址匹配服务"},"examples":["new AddressMatchService(url,options)\n.code(function(result){\n //doSomething\n})"],"params":[{"type":{"names":["string"]},"description":"<p>服务地址。</p>","name":"url"},{"type":{"names":["Object"]},"description":"<p>参数。</p>","name":"options"},{"type":{"names":["string"]},"optional":true,"description":"<p>服务代理地址。</p>","name":"options.proxy"},{"type":{"names":["boolean"]},"optional":true,"description":"<p>请求是否携带凭据。默认情况下,仅同源请求包含凭据。</p>","name":"options.withCredentials"},{"type":{"names":["boolean"]},"optional":true,"description":"<p>是否允许跨域请求。</p>","name":"options.crossOrigin"},{"type":{"names":["Object"]},"optional":true,"description":"<p>请求头。</p>","name":"options.headers"}],"augments":["ServiceBase"],"usage":{"className":"AddressMatchService","aliasClass":"","globalParams":{"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":false},"namespace":"mapboxgl.supermap","moduleName":"mapboxgl","npm":"@supermapgis/iclient-mapboxgl","cdn":"https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"},"deprecatedClasses":[],"deprecatedClassInstance":null,"browserNamespace":""},"longname":"AddressMatchService","scope":"global","usageCodeBrowser":"<script type='text/javascript' src=\"https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js\"></script>\n<script>\n new mapboxgl.supermap.AddressMatchService(url, options, options.proxy, options.withCredentials, options.crossOrigin, options.headers);\n</script>","usageCodeES6":"import { AddressMatchService } from '@supermapgis/iclient-mapboxgl';\n\nnew AddressMatchService(url, options, options.proxy, options.withCredentials, options.crossOrigin, options.headers);"},{"kind":"function","name":"code","description":"<p>获取正向地址匹配结果。</p>","params":[{"type":{"names":["GeoCodingParameter"]},"description":"<p>正向匹配参数。</p>","name":"params"},{"type":{"names":["RequestCallback"]},"optional":true,"description":"<p>回调函数,该参数未传时可通过返回的 promise 获取结果。</p>","name":"callback"}],"returns":[{"type":{"names":["Promise"]},"description":"<p>Promise 对象。</p>"}],"memberof":"AddressMatchService","longname":"AddressMatchService#code","scope":"instance"},{"kind":"function","name":"decode","description":"<p>获取反向地址匹配结果。</p>","params":[{"type":{"names":["GeoDecodingParameter"]},"description":"<p>反向匹配参数。</p>","name":"params"},{"type":{"names":["RequestCallback"]},"optional":true,"description":"<p>回调函数,该参数未传时可通过返回的 promise 获取结果。</p>","name":"callback"}],"returns":[{"type":{"names":["Promise"]},"description":"<p>Promise 对象。</p>"}],"memberof":"AddressMatchService","longname":"AddressMatchService#decode","scope":"instance"}]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"kind":"class","name":"AggregationParameter","tags":[{"originalTitle":"deprecatedclass","title":"deprecatedclass","text":"SuperMap.AggregationParameter","value":"SuperMap.AggregationParameter"},{"originalTitle":"category","title":"category","text":"iServer Data FeatureResults","value":"iServer Data FeatureResults"}],"classdesc":"<p>聚合查询参数设置类,此类用于设置聚合查询的聚合名称、聚合字段等参数。<br>\n注意:该参数仅支持数据来源为 Elasticsearch 服务的 SuperMap iServer REST 数据服务。</p>","params":[{"type":{"names":["Object"]},"description":"<p>参数。</p>","name":"options"},{"type":{"names":["string"]},"description":"<p>聚合名称。</p>","name":"options.aggName"},{"type":{"names":["string"]},"description":"<p>聚合字段。</p>","name":"options.aggFieldName"}],"usage":{"className":"AggregationParameter","aliasClass":"","globalParams":{"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":false},"namespace":"mapboxgl.supermap","moduleName":"mapboxgl","npm":"@supermapgis/iclient-mapboxgl","cdn":"https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"},"deprecatedClasses":["SuperMap.AggregationParameter"],"deprecatedClassInstance":null,"browserNamespace":""},"longname":"AggregationParameter","scope":"global","usageCodeBrowser":"<script type='text/javascript' src=\"https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js\"></script>\n<script>\n new mapboxgl.supermap.AggregationParameter(options, options.aggName, options.aggFieldName);\n // 弃用的写法\n new SuperMap.AggregationParameter(options, options.aggName, options.aggFieldName);\n</script>","usageCodeES6":"import { AggregationParameter } from '@supermapgis/iclient-mapboxgl';\n\nnew AggregationParameter(options, options.aggName, options.aggFieldName);"},{"kind":"member","name":"aggName","type":{"names":["string"]},"description":"<p>聚合名称。</p>","memberof":"AggregationParameter","longname":"AggregationParameter#aggName","scope":"instance"},{"kind":"member","name":"aggFieldName","type":{"names":["string"]},"description":"<p>聚合字段。</p>","memberof":"AggregationParameter","longname":"AggregationParameter#aggFieldName","scope":"instance"},{"name":"aggName","longname":"BucketAggParameter#aggName","kind":"member","type":{"names":["string"]},"description":"<p>聚合名称。</p>","memberof":"BucketAggParameter","scope":"instance","inherits":"AggregationParameter#aggName","inherited":true},{"name":"aggFieldName","longname":"BucketAggParameter#aggFieldName","kind":"member","type":{"names":["string"]},"description":"<p>聚合字段。</p>","memberof":"BucketAggParameter","scope":"instance","inherits":"AggregationParameter#aggFieldName","inherited":true},{"name":"aggName","longname":"MetricsAggParameter#aggName","kind":"member","type":{"names":["string"]},"description":"<p>聚合名称。</p>","memberof":"MetricsAggParameter","scope":"instance","inherits":"AggregationParameter#aggName","inherited":true},{"name":"aggFieldName","longname":"MetricsAggParameter#aggFieldName","kind":"member","type":{"names":["string"]},"description":"<p>聚合字段。</p>","memberof":"MetricsAggParameter","scope":"instance","inherits":"AggregationParameter#aggFieldName","inherited":true},{"name":"aggName","longname":"GeoHashGridAggParameter#aggName","kind":"member","type":{"names":["string"]},"description":"<p>聚合名称。</p>","memberof":"GeoHashGridAggParameter","scope":"instance","inherits":"AggregationParameter#aggName","inherited":true},{"name":"aggFieldName","longname":"GeoHashGridAggParameter#aggFieldName","kind":"member","type":{"names":["string"]},"description":"<p>聚合字段。</p>","memberof":"GeoHashGridAggParameter","scope":"instance","inherits":"AggregationParameter#aggFieldName","inherited":true}]

0 commit comments

Comments
 (0)