@maptec/cli 1.0.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +284 -0
  3. package/bin/maptec.js +2 -0
  4. package/dist/chunk-K574OFFK.js +122 -0
  5. package/dist/chunk-K574OFFK.js.map +1 -0
  6. package/dist/cli.js +899 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/store-ZU7HLXCV.js +18 -0
  9. package/dist/store-ZU7HLXCV.js.map +1 -0
  10. package/package.json +47 -0
  11. package/skills/README.md +30 -0
  12. package/skills/jsapi-skills/README.md +60 -0
  13. package/skills/jsapi-skills/SKILL.md +145 -0
  14. package/skills/jsapi-skills/package.json +31 -0
  15. package/skills/jsapi-skills/references/controls.md +195 -0
  16. package/skills/jsapi-skills/references/events.md +222 -0
  17. package/skills/jsapi-skills/references/geocoding.md +184 -0
  18. package/skills/jsapi-skills/references/map-style.md +123 -0
  19. package/skills/jsapi-skills/references/map.md +154 -0
  20. package/skills/jsapi-skills/references/marker.md +136 -0
  21. package/skills/jsapi-skills/references/operate.md +138 -0
  22. package/skills/jsapi-skills/references/overlay.md +311 -0
  23. package/skills/jsapi-skills/references/place-search.md +411 -0
  24. package/skills/jsapi-skills/references/poi-categories.md +123 -0
  25. package/skills/jsapi-skills/references/popup.md +146 -0
  26. package/skills/jsapi-skills/references/re-geocoding.md +183 -0
  27. package/skills/jsapi-skills/references/routing.md +347 -0
  28. package/skills/jsapi-skills/references/track.md +240 -0
  29. package/skills/jsapi-skills/scripts/validate_jsapi_skill.py +160 -0
  30. package/skills/webapi-skills/README.md +73 -0
  31. package/skills/webapi-skills/SKILL.md +63 -0
  32. package/skills/webapi-skills/package.json +32 -0
  33. package/skills/webapi-skills/references/direction-api.md +175 -0
  34. package/skills/webapi-skills/references/geocoding.md +195 -0
  35. package/skills/webapi-skills/references/ip-location.md +87 -0
  36. package/skills/webapi-skills/references/matrix-api.md +149 -0
  37. package/skills/webapi-skills/references/nearby-search.md +223 -0
  38. package/skills/webapi-skills/references/places.md +239 -0
  39. package/skills/webapi-skills/references/quick-start-cn.md +219 -0
  40. package/skills/webapi-skills/references/reverse-geocoding.md +157 -0
  41. package/skills/webapi-skills/references/suggest.md +111 -0
  42. package/skills/webapi-skills/references/text-search.md +282 -0
  43. package/skills/webapi-skills/scripts/validate_webapi_skill.py +158 -0
@@ -0,0 +1,311 @@
1
+ # 矢量覆盖物能力参考
2
+
3
+ 当用户要求绘制点、线、圆、多边形、范围、区域、业务面、GeoJSON 数据层,或要求矢量覆盖物样式配置、数据绑定、事件绑定时,使用本参考。
4
+
5
+ ## 能力范围
6
+
7
+ - 圆点/圆形范围:`Maptec.CircleOverlay`
8
+ - 折线/路径:`Maptec.PolylineOverlay`
9
+ - 多边形/区域:`Maptec.PolygonOverlay`
10
+ - 数据驱动点线面:`Maptec.GeoJSONOverlay`
11
+ - 统一添加与移除:`map.addOverlay(overlay)`、`map.removeOverlay(overlay)`
12
+ - 样式配置、显隐控制、事件绑定、数据更新、渲染查询
13
+
14
+ ## CircleOverlay
15
+
16
+ `CircleOverlay` 一个实例可管理一组圆,圆心通过 `centers` 传入。`unit: "pixels"` 适合点位圆点,`unit: "meters"` 适合地理范围。
17
+
18
+ ```js
19
+ const circle = new Maptec.CircleOverlay({
20
+ centers: [[103.8198, 1.3521]],
21
+ radius: 2000,
22
+ unit: "meters",
23
+ fillColor: "#2563eb",
24
+ fillOpacity: 0.18,
25
+ strokeColor: "#2563eb",
26
+ strokeWidth: 2,
27
+ strokeOpacity: 0.9
28
+ });
29
+
30
+ map.addOverlay(circle);
31
+ ```
32
+
33
+ 常用属性:
34
+
35
+ - `centers`: 圆心数组,格式为 `LngLatLike[]`。
36
+ - `radius`
37
+ - `unit`: `"meters"` 或 `"pixels"`。
38
+ - `fillColor`、`fillOpacity`
39
+ - `strokeColor`、`strokeOpacity`、`strokeWidth`、`strokeDasharray`
40
+ - `type`: `CircleOverlayType`,用于波纹、雷达扫描等圆效果。
41
+ - `visible`
42
+
43
+ 数据更新:
44
+
45
+ ```js
46
+ circle.centers = [
47
+ [103.8198, 1.3521],
48
+ [103.834, 1.31]
49
+ ];
50
+ circle.radius = 120;
51
+ ```
52
+
53
+ ## PolylineOverlay
54
+
55
+ ```js
56
+ const polyline = new Maptec.PolylineOverlay({
57
+ positions: [
58
+ [103.8318, 1.3048],
59
+ [103.8198, 1.3521],
60
+ [103.7764, 1.2966]
61
+ ],
62
+ strokeColor: "#108ee9",
63
+ strokeWeight: 6,
64
+ strokeOpacity: 0.9,
65
+ showDirection: true
66
+ });
67
+
68
+ map.addOverlay(polyline);
69
+ ```
70
+
71
+ 常用属性:
72
+
73
+ - `positions`: 折线顶点序列。
74
+ - `strokeColor`、`strokeWeight`、`strokeOpacity`
75
+ - `strokeDasharray`
76
+ - `strokeCap`: `"butt"`、`"round"`、`"square"`。
77
+ - `strokeJoin`: `"miter"`、`"round"`、`"bevel"`。
78
+ - `strokeGradient`: 按路径进度配置线性渐变。
79
+ - `showDirection`、`directionColor`
80
+ - `properties`
81
+
82
+ ## PolygonOverlay
83
+
84
+ ```js
85
+ const polygon = new Maptec.PolygonOverlay({
86
+ positions: [
87
+ [103.78, 1.29],
88
+ [103.84, 1.29],
89
+ [103.84, 1.34],
90
+ [103.78, 1.34]
91
+ ],
92
+ fillColor: "#22c55e",
93
+ fillOpacity: 0.3,
94
+ strokeColor: "#15803d",
95
+ strokeWeight: 3,
96
+ strokeOpacity: 0.85
97
+ });
98
+
99
+ map.addOverlay(polygon);
100
+ ```
101
+
102
+ 带洞多边形使用 `[outerRing, hole1, hole2]`:
103
+
104
+ ```js
105
+ const polygonWithHole = new Maptec.PolygonOverlay({
106
+ positions: [outerRing, hole],
107
+ fillColor: "#22c55e",
108
+ fillOpacity: 0.28,
109
+ strokeColor: "#15803d"
110
+ });
111
+ ```
112
+
113
+ ## GeoJSONOverlay
114
+
115
+ 大量点、线、面或需要数据驱动样式时,优先使用 `Maptec.GeoJSONOverlay`。
116
+
117
+ ```js
118
+ const overlay = new Maptec.GeoJSONOverlay({
119
+ data: featureCollection,
120
+ circleStyle: {
121
+ circleRadius: 8,
122
+ circleColor: "#00bcd4",
123
+ circleStrokeWidth: 2,
124
+ circleStrokeColor: "#004d40"
125
+ },
126
+ lineStyle: {
127
+ strokeColor: "#108ee9",
128
+ strokeWeight: 4
129
+ },
130
+ polygonStyle: {
131
+ fillColor: "#22c55e",
132
+ fillOpacity: 0.3,
133
+ strokeColor: "#15803d",
134
+ strokeWeight: 2
135
+ }
136
+ });
137
+
138
+ map.addOverlay(overlay);
139
+ ```
140
+
141
+ `GeoJSONOverlayOptions` 常用字段:
142
+
143
+ - `data`: GeoJSON `Feature`、`FeatureCollection` 或 `Geometry`。
144
+ - `circleStyle`: Point/MultiPoint 圆点样式。
145
+ - `symbolStyle`: Point/MultiPoint 图标或文字样式。
146
+ - `lineStyle`: LineString/MultiLineString 线样式。
147
+ - `polygonStyle`: Polygon/MultiPolygon 面样式。
148
+ - `pointCluster`: 点聚合配置。
149
+ - `hoverStyle`: 悬停样式。
150
+
151
+ GeoJSON 坐标也必须使用 `[lng, lat]`。要按单个要素覆盖样式时,可在 feature `properties` 中写入对应样式字段,例如 `circleRadius`、`circleColor`、`symbolText`、`textColor`。
152
+
153
+ ## GeoJSON 样式
154
+
155
+ 圆点样式:
156
+
157
+ - `circleRadius`
158
+ - `circleColor`
159
+ - `circleOpacity`
160
+ - `circleStrokeColor`
161
+ - `circleStrokeWidth`
162
+
163
+ 线样式:
164
+
165
+ - `strokeColor`
166
+ - `strokeWeight`
167
+ - `strokeOpacity`
168
+ - `strokeDasharray`
169
+ - `strokeCap`
170
+ - `strokeJoin`
171
+ - `strokeGradient`
172
+
173
+ 面样式:
174
+
175
+ - `fillColor`
176
+ - `fillOpacity`
177
+ - `strokeColor`
178
+ - `strokeWeight`
179
+ - `strokeOpacity`
180
+ - `strokeDasharray`
181
+
182
+ 符号样式:
183
+
184
+ - `iconSize`
185
+ - `iconOpacity`
186
+ - `iconAllowOverlap`
187
+ - `textSize`
188
+ - `textColor`
189
+ - `textAnchor`
190
+ - `textOffset`
191
+ - `textHaloColor`
192
+ - `textHaloWidth`
193
+
194
+ 点聚合:
195
+
196
+ ```js
197
+ const clustered = new Maptec.GeoJSONOverlay({
198
+ data: pointFeatureCollection,
199
+ pointCluster: {
200
+ enabled: true,
201
+ clusterRadiusPixels: 60,
202
+ clusterMinPoints: 3,
203
+ showClusterPointCount: true,
204
+ clusterFillColor: "#2563eb",
205
+ clusterStrokeColor: "#ffffff",
206
+ clusterStrokeWidth: 2
207
+ }
208
+ });
209
+ ```
210
+
211
+ 渲染查询:
212
+
213
+ ```js
214
+ const features = map.queryRenderedFeatures(point, {
215
+ overlays: [overlay],
216
+ validate: true
217
+ });
218
+ ```
219
+
220
+ ## 事件绑定
221
+
222
+ ```js
223
+ const onCircleClick = (event) => {
224
+ console.log("点击圆形", event.features);
225
+ };
226
+
227
+ circle.on("click", onCircleClick);
228
+
229
+ function cleanup() {
230
+ circle.off("click", onCircleClick);
231
+ map.removeOverlay(circle);
232
+ }
233
+ ```
234
+
235
+ ## 数据更新
236
+
237
+ ```js
238
+ circle.centers = [[103.8298, 1.3521]];
239
+ circle.radius = 1500;
240
+ circle.visible = true;
241
+
242
+ polyline.positions = [
243
+ [103.8318, 1.3048],
244
+ [103.7764, 1.2966]
245
+ ];
246
+
247
+ polygon.positions = [
248
+ [103.78, 1.29],
249
+ [103.84, 1.29],
250
+ [103.84, 1.34],
251
+ [103.78, 1.34]
252
+ ];
253
+
254
+ overlay.data = nextFeatureCollection;
255
+ ```
256
+
257
+ ## 视图适配
258
+
259
+ 绘制圆、线、面或 GeoJSON 覆盖物后,应根据覆盖物坐标自动适配地图视图,确保用户能看到完整几何。
260
+
261
+ ```js
262
+ const bounds = path.reduce((nextBounds, point) => [
263
+ [
264
+ Math.min(nextBounds[0][0], point[0]),
265
+ Math.min(nextBounds[0][1], point[1])
266
+ ],
267
+ [
268
+ Math.max(nextBounds[1][0], point[0]),
269
+ Math.max(nextBounds[1][1], point[1])
270
+ ]
271
+ ], [path[0], path[0]]);
272
+
273
+ map.fitBounds(bounds, { padding: 80, maxZoom: 16 });
274
+ ```
275
+
276
+ 圆形范围需要把半径换算成经纬度包围盒后适配,避免只把圆心居中而圆边缘不可见:
277
+
278
+ ```js
279
+ const metersPerDegreeLat = 111320;
280
+ const latDelta = radius / metersPerDegreeLat;
281
+ const lngDelta = radius / (metersPerDegreeLat * Math.cos(center[1] * Math.PI / 180));
282
+ map.fitBounds([
283
+ [center[0] - lngDelta, center[1] - latDelta],
284
+ [center[0] + lngDelta, center[1] + latDelta]
285
+ ], { padding: 80, maxZoom: 16 });
286
+ ```
287
+
288
+ ## 选型规则
289
+
290
+ - 半径、服务范围、搜索范围:`CircleOverlay`
291
+ - 路径、轨迹、连接线:`PolylineOverlay`
292
+ - 区域、围栏、行政边界:`PolygonOverlay`
293
+ - 大量点线面、聚合、按属性设置样式:`GeoJSONOverlay`
294
+
295
+ ## 注意事项
296
+
297
+ - 坐标始终使用 `[lng, lat]`。
298
+ - 真实驾车路线不要用手写 `PolylineOverlay` 冒充,必须使用路线规划能力。
299
+ - 大量数据优先使用 `GeoJSONOverlay`。
300
+ - 大量点位需要聚合时,优先使用 `GeoJSONOverlay` 的 `pointCluster`。
301
+ - `strokeDasharray: []` 表示实线;省略时使用 SDK 默认样式。
302
+ - 覆盖物事件要保存 handler,并在清理阶段解绑。
303
+
304
+ ## Agent 规则
305
+
306
+ - 圆、线、面和 GeoJSON 覆盖物必须使用已确认类:`CircleOverlay`、`PolylineOverlay`、`PolygonOverlay`、`GeoJSONOverlay`。
307
+ - 不要生成 `new Maptec.Circle()`、`new Maptec.Polyline()`、`new Maptec.Polygon()`。
308
+ - 所有地理坐标必须使用 `[lng, lat]`,GeoJSON 坐标也遵循经纬度顺序。
309
+ - 真实路线需求必须转到路线规划能力,不要用手写 `PolylineOverlay` 冒充。
310
+ - 添加覆盖物后必须说明清理方式:`map.removeOverlay(overlay)`,事件 handler 也要解绑。
311
+ - 添加覆盖物、检索结果或路线结果后必须进行视图适配:优先使用 `map.fitBounds(bounds, { padding, maxZoom })`;只有单点且没有范围时才使用 `map.easeTo` 或 `map.jumpTo`。