@dsh-gis/dsh-opengis-skill 0.1.2 → 0.2.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/CHANGELOG.md +71 -0
- package/README.md +79 -43
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/adaptations/brutile.md +8 -0
- package/adaptations/cesiumjs.md +8 -0
- package/adaptations/common.md +16 -0
- package/adaptations/deck-gl.md +8 -0
- package/adaptations/duckdb-spatial.md +8 -0
- package/adaptations/gdal-api.md +8 -0
- package/adaptations/gdal.md +8 -0
- package/adaptations/geolibre.md +8 -0
- package/adaptations/geometry-api-java.md +8 -0
- package/adaptations/geometry-api-net.md +8 -0
- package/adaptations/geonode.md +8 -0
- package/adaptations/geopandas.md +8 -0
- package/adaptations/geopipe-agent.md +8 -0
- package/adaptations/geoserver-cloud.md +8 -0
- package/adaptations/geoserver-rest-api.md +8 -0
- package/adaptations/geoserver.md +8 -0
- package/adaptations/geotools.md +8 -0
- package/adaptations/grass-gis.md +8 -0
- package/adaptations/jts.md +8 -0
- package/adaptations/kepler-gl.md +8 -0
- package/adaptations/leaflet.md +8 -0
- package/adaptations/mapbox-gl-js.md +8 -0
- package/adaptations/mapserver.md +8 -0
- package/adaptations/mapsui.md +8 -0
- package/adaptations/nettopologysuite.md +8 -0
- package/adaptations/opengis-all.md +8 -0
- package/adaptations/opengis-daf.md +8 -0
- package/adaptations/opengis-utils-for-java.md +8 -0
- package/adaptations/opengis-utils-for-net.md +8 -0
- package/adaptations/openlayers.md +8 -0
- package/adaptations/pdal.md +8 -0
- package/adaptations/postgis.md +8 -0
- package/adaptations/proj.md +8 -0
- package/adaptations/projnet4geoapi.md +8 -0
- package/adaptations/pyqgis.md +8 -0
- package/adaptations/qgis-process.md +8 -0
- package/adaptations/qgis-server.md +8 -0
- package/adaptations/shapely.md +8 -0
- package/adaptations/sharpmap.md +8 -0
- package/adaptations/spatialite.md +8 -0
- package/adaptations/whitebox-tools.md +8 -0
- package/assets/brutile/SKILL.md +289 -0
- package/assets/cesiumjs/SKILL.md +78 -29
- package/assets/deck-gl/SKILL.md +20 -20
- package/assets/duckdb-spatial/SKILL.md +370 -0
- package/assets/gdal/SKILL.md +50 -55
- package/assets/gdal-api/SKILL.md +12 -29
- package/assets/geolibre/SKILL.md +364 -0
- package/assets/geometry-api-java/SKILL.md +11 -19
- package/assets/geometry-api-net/SKILL.md +66 -29
- package/assets/geonode/SKILL.md +347 -0
- package/assets/geopandas/SKILL.md +22 -28
- package/assets/geopipe-agent/SKILL.md +25 -30
- package/assets/geoserver/SKILL.md +21 -24
- package/assets/geoserver-cloud/SKILL.md +23 -34
- package/assets/geoserver-rest-api/SKILL.md +18 -23
- package/assets/geotools/SKILL.md +13 -21
- package/assets/grass-gis/SKILL.md +19 -20
- package/assets/jts/SKILL.md +12 -17
- package/assets/kepler-gl/SKILL.md +313 -0
- package/assets/leaflet/SKILL.md +42 -17
- package/assets/mapbox-gl-js/SKILL.md +19 -18
- package/assets/mapserver/SKILL.md +18 -18
- package/assets/mapsui/SKILL.md +87 -58
- package/assets/nettopologysuite/SKILL.md +96 -27
- package/assets/opengis-all/SKILL.md +80 -292
- package/assets/opengis-all/reference/data-stages.md +262 -4
- package/assets/opengis-daf/SKILL.md +12 -14
- package/assets/opengis-utils-for-java/SKILL.md +52 -47
- package/assets/opengis-utils-for-java/reference/common-tasks.md +12 -12
- package/assets/opengis-utils-for-net/SKILL.md +106 -40
- package/assets/opengis-utils-for-net/reference/code-patterns.md +11 -11
- package/assets/opengis-utils-for-net/reference/util-classes.md +25 -26
- package/assets/openlayers/SKILL.md +71 -14
- package/assets/pdal/SKILL.md +21 -15
- package/assets/postgis/SKILL.md +66 -18
- package/assets/proj/SKILL.md +29 -42
- package/assets/projnet4geoapi/SKILL.md +299 -0
- package/assets/pyqgis/SKILL.md +28 -54
- package/assets/qgis-process/SKILL.md +67 -39
- package/assets/qgis-server/SKILL.md +21 -32
- package/assets/shapely/SKILL.md +133 -84
- package/assets/sharpmap/SKILL.md +96 -61
- package/assets/spatialite/SKILL.md +365 -0
- package/assets/whitebox-tools/SKILL.md +269 -0
- package/lib/adaptations.d.ts +47 -0
- package/lib/adaptations.js +268 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -2
- package/lib/skill-file.js +31 -7
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +12 -2
- package/upstream.json +56 -40
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: geoserver-cloud
|
|
3
|
-
description: "Use when deploying GeoServer on Kubernetes
|
|
3
|
+
description: "Use when deploying GeoServer Cloud 3.0.2 on Docker Compose or Kubernetes — gateway serving WMS/WFS/WCS/WPS/GWC microservices under /geoserver/cloud, PgConfig vs datadir backends, RabbitMQ config-bus sync, Helm chart geoservercloud 3.0.2, and diagnosing 502s via actuator/health and Consul registration."
|
|
4
4
|
tags:
|
|
5
5
|
- java
|
|
6
6
|
- server
|
|
@@ -18,9 +18,9 @@ tags:
|
|
|
18
18
|
>
|
|
19
19
|
> **官方文档:** <https://geoserver.org/geoserver-cloud/>
|
|
20
20
|
>
|
|
21
|
-
> **Docker Hub:** <https://hub.docker.com/u/geoservercloud>(镜像标签与 GeoServer 主版本对应,如 `3.0.
|
|
21
|
+
> **Docker Hub:** <https://hub.docker.com/u/geoservercloud>(镜像标签与 GeoServer 主版本对应,如 `3.0.2`)
|
|
22
22
|
>
|
|
23
|
-
> **最新版本:** 3.0.
|
|
23
|
+
> **最新版本:** 3.0.2(2026-10-20,[GitHub Releases](https://github.com/geoserver/geoserver-cloud/releases))
|
|
24
24
|
>
|
|
25
25
|
> **许可证:** GPL-2.0
|
|
26
26
|
|
|
@@ -43,7 +43,7 @@ GeoServer Cloud(GS Cloud):
|
|
|
43
43
|
| 服务 | 镜像 | 用途 |
|
|
44
44
|
|------|------|------|
|
|
45
45
|
| `gateway` | `geoservercloud/geoserver-cloud-gateway` | 网关 |
|
|
46
|
-
| `discovery` | `geoservercloud/geoserver-cloud-discovery`
|
|
46
|
+
| `discovery` | —(3.x 不再发布该镜像) | 服务发现:官方 compose/K8s 改用 `hashicorp/consul`,`geoservercloud/geoserver-cloud-discovery:3.0.2` 在 Docker Hub 已 404 |
|
|
47
47
|
| `config` | `geoservercloud/geoserver-cloud-config` | 配置中心 |
|
|
48
48
|
| `web-ui` | `geoservercloud/geoserver-cloud-webui` | 管理界面 |
|
|
49
49
|
| `rest` | `geoservercloud/geoserver-cloud-rest` | REST API |
|
|
@@ -98,7 +98,7 @@ PGCONFIG_SCHEMA: "pgconfig" # 启动时自动创建 schema
|
|
|
98
98
|
## Kubernetes(Helm)
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
|
-
# Chart:camptocamp/helm-geoserver-cloud(chart 名 geoservercloud,最新 3.0.
|
|
101
|
+
# Chart:camptocamp/helm-geoserver-cloud(chart 名 geoservercloud,最新 3.0.2)
|
|
102
102
|
helm repo add geoserver-cloud https://camptocamp.github.io/helm-geoserver-cloud
|
|
103
103
|
helm repo update
|
|
104
104
|
```
|
|
@@ -110,7 +110,7 @@ helm repo update
|
|
|
110
110
|
> dependencies:
|
|
111
111
|
> - name: geoservercloud
|
|
112
112
|
> repository: https://camptocamp.github.io/helm-geoserver-cloud
|
|
113
|
-
> version: 3.0.
|
|
113
|
+
> version: 3.0.2
|
|
114
114
|
> ```
|
|
115
115
|
>
|
|
116
116
|
> ```yaml
|
|
@@ -182,7 +182,7 @@ management:
|
|
|
182
182
|
```bash
|
|
183
183
|
docker run -e SPRING_PROFILES_ACTIVE=datadir \
|
|
184
184
|
-v /mnt/gsdata:/opt/app/data_directory \
|
|
185
|
-
geoservercloud/geoserver-cloud-wms:3.0.
|
|
185
|
+
geoservercloud/geoserver-cloud-wms:3.0.2
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
---
|
|
@@ -198,17 +198,6 @@ docker run -e SPRING_PROFILES_ACTIVE=datadir \
|
|
|
198
198
|
|
|
199
199
|
---
|
|
200
200
|
|
|
201
|
-
## 常见问题
|
|
202
|
-
|
|
203
|
-
| 问题 | 解决 |
|
|
204
|
-
|------|------|
|
|
205
|
-
| 配置不同步 | 检查 RabbitMQ 可达 + `GEOSERVER_BUS_ENABLED=true` |
|
|
206
|
-
| Web UI 改了 wms 没生效 | 检查事件订阅 |
|
|
207
|
-
| 启动顺序错乱 | `depends_on` + 健康检查;K8s 用 `initContainers` |
|
|
208
|
-
| OOM | 调整 `-Xmx`,按服务独立资源 |
|
|
209
|
-
| Gateway 502 / 服务不可达 | 检查目标服务健康状态与 Consul 注册(服务名解析:`wms`、`wfs` 等) |
|
|
210
|
-
| 瓦片 404 / 缓存未命中 | 确认 gwc 服务已部署、`GEOSERVER_BASE_PATH` 与请求路径一致,必要时重新 seed |
|
|
211
|
-
|
|
212
201
|
---
|
|
213
202
|
|
|
214
203
|
## 典型工作流
|
|
@@ -247,25 +236,25 @@ kubectl -n gis get deploy | grep wms
|
|
|
247
236
|
kubectl -n gis scale deploy <wms-deployment> --replicas=10
|
|
248
237
|
```
|
|
249
238
|
|
|
250
|
-
##
|
|
251
|
-
|
|
252
|
-
### 推荐工作流
|
|
239
|
+
## 常见问题
|
|
253
240
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
241
|
+
| 问题 | 解决 |
|
|
242
|
+
|------|------|
|
|
243
|
+
| 配置不同步 | 检查 RabbitMQ 可达 + `GEOSERVER_BUS_ENABLED=true` |
|
|
244
|
+
| Web UI 改了 wms 没生效 | 检查事件订阅 |
|
|
245
|
+
| 启动顺序错乱 | `depends_on` + 健康检查;K8s 用 `initContainers` |
|
|
246
|
+
| OOM | 调整 `-Xmx`,按服务独立资源 |
|
|
247
|
+
| Gateway 502 / 服务不可达 | 检查目标服务健康状态与 Consul 注册(服务名解析:`wms`、`wfs` 等) |
|
|
248
|
+
| 瓦片 404 / 缓存未命中 | 确认 gwc 服务已部署、`GEOSERVER_BASE_PATH` 与请求路径一致,必要时重新 seed |
|
|
260
249
|
|
|
261
|
-
|
|
250
|
+
## AI 使用建议
|
|
262
251
|
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
252
|
+
- **执行环境**:命令在终端 / shell 中执行(Windows 无 `wget`,改 `curl.exe -LO`);先用 `docker version`、`helm version`、`kubectl version --client` 确认工具在 PATH。
|
|
253
|
+
- **先探测版本**:`curl.exe -s -u admin:geoserver http://localhost:9090/geoserver/cloud/rest/about/version.json` 读 GeoServer 版本;`curl.exe -s http://localhost:9090/actuator/health` 取 `{"status":"UP"}`(被 profile 关掉时改用 `kubectl -n gis get pods` 判活)。
|
|
254
|
+
- **验证产物**:部署后逐服务探活,再经网关 `.../rest/workspaces.json` 与一次 WMS `GetMap` 走通全链路;`docker compose ps` 显示 Up 不等于 OGC 服务可用。
|
|
255
|
+
- **排障顺序**:502 → 查 Consul 注册与目标服务健康(`kubectl -n gis logs deploy/<wms>`);配置不生效 → 查 RabbitMQ 与 `GEOSERVER_BUS_ENABLED`;瓦片 404 → 查 gwc 是否部署、`GEOSERVER_BASE_PATH` 前缀是否一致。
|
|
256
|
+
- **安全与权限**:`admin:geoserver`、`PGCONFIG_PASSWORD`、RabbitMQ 口令不要回显到报告;`docker compose down -v`、`helm uninstall`、删 PVC 或 PgConfig schema 会丢配置,先向用户确认并备份。
|
|
257
|
+
- **先本地复现**:能在 docker compose 复现的问题再上 K8s;镜像标签与 chart 版本保持同一版本号(3.0.2),避免网关与服务错配。
|
|
269
258
|
|
|
270
259
|
## 相关技能
|
|
271
260
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: geoserver-rest-api
|
|
3
|
-
description: "Use when automating GeoServer
|
|
3
|
+
description: "Use when automating GeoServer 3.0.2 over REST — POST /rest/workspaces, datastores, featuretypes, PUT Shapefile ZIP to file.shp, GeoTIFF to coveragestores, upload SLD as application/vnd.ogc.sld+xml, ?recurse=true deletes. curl -u admin:geoserver, single-key JSON like {\"workspace\":{...}}, 401 on POST but 200 on GET, GWC cache masking style changes."
|
|
4
4
|
tags:
|
|
5
5
|
- rest
|
|
6
6
|
- api
|
|
@@ -20,7 +20,7 @@ tags:
|
|
|
20
20
|
>
|
|
21
21
|
> **API 参考:** <https://docs.geoserver.org/stable/en/user/rest/api/index.html>
|
|
22
22
|
>
|
|
23
|
-
> **最新版本:** GeoServer 3.0.
|
|
23
|
+
> **最新版本:** GeoServer 3.0.2(2026-10-17 发布,安全修复版;[官方下载](https://geoserver.org/release/stable/))
|
|
24
24
|
>
|
|
25
25
|
> **许可证:** GPL-2.0
|
|
26
26
|
|
|
@@ -47,14 +47,19 @@ REST API 的典型用途包括:
|
|
|
47
47
|
|
|
48
48
|
所有写操作(POST / PUT / DELETE)均需认证。GeoServer 默认使用 HTTP Basic Auth:
|
|
49
49
|
|
|
50
|
+
推荐用 `-u`,curl 自动生成 Basic 头;需要显式传头时用下面的等价写法(`YWRtaW46Z2Vvc2VydmVy` 是 `admin:geoserver` 的 base64):
|
|
51
|
+
|
|
50
52
|
```bash
|
|
51
|
-
# curl
|
|
52
|
-
curl -u admin:geoserver
|
|
53
|
+
# 方式 1:curl -u(推荐)
|
|
54
|
+
curl -u admin:geoserver http://localhost:8080/geoserver/rest/about/version.json
|
|
53
55
|
|
|
54
|
-
#
|
|
55
|
-
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
|
|
56
|
+
# 方式 2:显式 Authorization 头
|
|
57
|
+
curl -H "Authorization: Basic YWRtaW46Z2Vvc2VydmVy" \
|
|
58
|
+
http://localhost:8080/geoserver/rest/about/version.json
|
|
56
59
|
```
|
|
57
60
|
|
|
61
|
+
> 凭据务必用环境变量传入(`curl -u "$GS_USER:$GS_PASS"`),不要写进脚本或提交到仓库。
|
|
62
|
+
|
|
58
63
|
---
|
|
59
64
|
|
|
60
65
|
## API 端点一览
|
|
@@ -356,23 +361,13 @@ await workspaceService.CreateWorkspaceAsync("myws");
|
|
|
356
361
|
|
|
357
362
|
## AI 使用建议
|
|
358
363
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
6. **验证发布**:GET `/rest/layers.json` 确认图层列表,访问 WMS GetMap 测试
|
|
367
|
-
|
|
368
|
-
### 关键注意事项
|
|
369
|
-
|
|
370
|
-
- **JSON 包装结构**:GeoServer REST API 的 JSON 请求/响应使用单层包装(如 `{"workspace":{...}}`)
|
|
371
|
-
- **recurse 参数**:删除 Workspace/Store 时务必添加 `?recurse=true` 级联删除
|
|
372
|
-
- **Shapefile 上传**:必须打包为 ZIP(含 .shp/.shx/.dbf/.prj),用 PUT 方式上传
|
|
373
|
-
- **URL 后缀**:可用 `.json` / `.xml` 后缀替代 `Accept` 头指定响应格式
|
|
374
|
-
- **Content-Type**:样式上传使用 `application/vnd.ogc.sld+xml`,栅格上传使用 `image/tiff`
|
|
375
|
-
- **认证**:所有 POST/PUT/DELETE 操作需要 HTTP Basic Auth(默认 admin:geoserver)
|
|
364
|
+
- **本技能的组织**:主文件给高频用法,完整参数表与高级示例在 `reference/endpoints.md`,需要时再展开;示例工程与生成的数据写到工作目录,不要改动技能目录本身。
|
|
365
|
+
- **执行环境**:示例在终端 / shell 中执行(显式 `curl.exe`,Windows 的 `curl` 是别名、参数不同);`\` 续行在 PowerShell 无效,压成单行;请求体先写成 `body.json`,用 `curl.exe --data "@body.json"` 传,避开各 shell 的引号差异。
|
|
366
|
+
- **先探测版本**:`curl.exe -s -u admin:geoserver http://localhost:8080/geoserver/rest/about/version.json`,确认是 3.0.2 并顺带看到组件版本;返回 401 是凭据/安全规则问题,不是版本问题。
|
|
367
|
+
- **验证产物**:写操作后立刻 GET 回读同一资源(`.../rest/workspaces/myws.json`、`.../rest/layers/myws:roads.json`),再发一次 WMS `GetMap` 取 `image/png` 确认非空图;不要只凭 201 或退出码报告成功。
|
|
368
|
+
- **幂等与坑**:同名资源重复 POST 会报已存在(重跑脚本前先 GET 判断或改 PUT);改了样式记得清 GWC 缓存,否则瓦片还是旧的。
|
|
369
|
+
- **安全与权限**:`admin:geoserver` 不要硬编码进脚本或回显到报告;`?recurse=true` 删除 workspace、`POST /rest/reset`、清缓存均不可逆,执行前向用户确认。
|
|
370
|
+
- **批量脚本**:循环建资源时检查 `$LASTEXITCODE`,一失败即停;半套配置留在服务端比报错更难排查。
|
|
376
371
|
|
|
377
372
|
## 相关技能
|
|
378
373
|
|
package/assets/geotools/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: geotools
|
|
3
|
-
description: "Use when building Java GIS
|
|
3
|
+
description: "Use when building Java GIS apps on GeoTools 35.2 (JDK 17) — org.geotools:gt-main / gt-shapefile / gt-geopkg / gt-epsg-hsql from repo.osgeo.org (not Maven Central), CQL/ECQL filters, CRS.decode plus JTS.transform reprojection, StreamingRenderer PNG output, and disposing DataStore/SimpleFeatureIterator."
|
|
4
4
|
tags:
|
|
5
5
|
- java
|
|
6
6
|
- gis
|
|
@@ -18,7 +18,7 @@ tags:
|
|
|
18
18
|
>
|
|
19
19
|
> **Maven GroupId:** `org.geotools`
|
|
20
20
|
>
|
|
21
|
-
> **最新版本:** 35.
|
|
21
|
+
> **最新版本:** 35.2(2026-10-16,[OSGeo Maven 仓库](https://repo.osgeo.org/repository/release/))
|
|
22
22
|
>
|
|
23
23
|
> **许可证:** LGPL 2.1
|
|
24
24
|
>
|
|
@@ -36,7 +36,9 @@ GeoTools 是一个成熟、模块化的开源 Java GIS 工具库,由 OSGeo 基
|
|
|
36
36
|
- **OGC Web 服务**:WMS / WFS / WCS 客户端
|
|
37
37
|
- **几何运算**:基于 JTS Topology Suite 的全套几何计算
|
|
38
38
|
|
|
39
|
-
**环境要求:** JDK
|
|
39
|
+
**环境要求:** GeoTools 34+(当前 35.x)要求 **JDK 17**,35.x 官方构建文档另列出可选 JDK 21;更早分支的历史矩阵为 ≤28 用 JDK 8、29–33 用 JDK 11,具体以官方安装文档为准。
|
|
40
|
+
|
|
41
|
+
> 官方构建要求(实测 <https://docs.geotools.org/stable/userguide/build/install/index.html>):"Java Development Kit 17 (JDK 17)",可选 JDK 21;PR 同时用 JDK 17 与 21 测试。
|
|
40
42
|
|
|
41
43
|
---
|
|
42
44
|
|
|
@@ -60,7 +62,7 @@ GeoTools 发布在 OSGeo Maven 仓库,需在 `pom.xml` 中添加:
|
|
|
60
62
|
|
|
61
63
|
```xml
|
|
62
64
|
<properties>
|
|
63
|
-
<geotools.version>35.
|
|
65
|
+
<geotools.version>35.2</geotools.version><!-- 最新稳定版;版本列表见 https://geotools.org/ -->
|
|
64
66
|
</properties>
|
|
65
67
|
|
|
66
68
|
<dependencies>
|
|
@@ -388,23 +390,13 @@ store.dispose();
|
|
|
388
390
|
|
|
389
391
|
## AI 使用建议
|
|
390
392
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
6. **释放资源**:`store.dispose()`、关闭 `SimpleFeatureIterator`
|
|
399
|
-
|
|
400
|
-
### 关键注意事项
|
|
401
|
-
|
|
402
|
-
- **Maven 仓库必需**:GeoTools 不在 Maven Central,必须配置 OSGeo 仓库
|
|
403
|
-
- **EPSG 数据库**:使用 CRS 功能需引入 `gt-epsg-hsql`,否则 `CRS.decode()` 抛出异常
|
|
404
|
-
- **资源释放**:`DataStore`、`Reader`、`Writer`、`MapContent` 使用后必须调用 `dispose()`
|
|
405
|
-
- **坐标轴顺序**:GeoTools 默认遵循 EPSG 规范(纬度在前),使用 `CRS.decode("EPSG:4326", true)` 强制经度在前
|
|
406
|
-
- **线程安全**:`DataStore` 线程安全可共享;`SimpleFeatureIterator` 非线程安全
|
|
407
|
-
- **JTS 包名**:GeoTools 20+ 使用 `org.locationtech.jts`(GeoTools ≤19 为旧版 `com.vividsolutions.jts`)
|
|
393
|
+
- **本技能的组织**:主文件给高频用法,完整参数表与高级示例在 `reference/raster-rendering.md`、`reference/vector-io.md`,需要时再展开;示例工程与生成的数据写到工作目录,不要改动技能目录本身。
|
|
394
|
+
- **执行环境**:命令在终端 / shell 中执行;先 `java -version` 与 `mvn -v` 确认 JDK 17,35.x 在 JDK 8/11 下编译即失败。
|
|
395
|
+
- **先探测版本**:`mvn dependency:tree -Dincludes=org.geotools` 确认解析到 35.2 且未被其他依赖压回旧版;`pom.xml` 里必须有指向 `repo.osgeo.org/repository/release/` 的 `<repository>`。
|
|
396
|
+
- **验证产物**:`mvn -q -DskipTests package` 后跑最小读图层程序(`FileDataStoreFinder` → `getFeatures()` → 打印 count 与 CRS)或 `mvn -q test`;`CRS.decode("EPSG:4326")` 抛异常说明缺 `gt-epsg-hsql`。
|
|
397
|
+
- **常见失败信号**:`getDataStore()` 返回 null 或报找不到工厂,是 SPI 模块没进 classpath;出现 `com.vividsolutions.jts` 是包名没升级(GeoTools 20+ 用 `org.locationtech.jts`)。
|
|
398
|
+
- **安全与权限**:测试别全量加载要素到内存(用 `Query` 限制属性与 bbox);连接串/密码不要回显,对生产库批量写入前先向用户确认。
|
|
399
|
+
- **按需读文件**:本 SKILL 较长,先按章节标题定位,再按行区间分段读取,避免整篇占满上下文。
|
|
408
400
|
|
|
409
401
|
## 相关技能
|
|
410
402
|
|
|
@@ -46,9 +46,9 @@ sudo apt update && sudo apt install grass
|
|
|
46
46
|
# Conda / mamba / pixi(conda-forge 提供 Linux、macOS、Windows 64 位包)
|
|
47
47
|
conda install -c conda-forge grass
|
|
48
48
|
|
|
49
|
-
# Docker
|
|
50
|
-
docker pull osgeo/grass
|
|
51
|
-
docker run --rm osgeo/grass grass --version
|
|
49
|
+
# Docker(官方镜像名是 osgeo/grass-gis;标签形如 8.5.0-ubuntu / releasebranch_8_5-ubuntu)
|
|
50
|
+
docker pull osgeo/grass-gis:latest
|
|
51
|
+
docker run --rm osgeo/grass-gis grass --version
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Windows 可通过 OSGeo4W 安装器安装,之后在 "OSGeo4W Shell" 中使用 `grass` 命令。
|
|
@@ -310,16 +310,14 @@ grass $HOME/grassdata/ndvi_project/PERMANENT --exec sh -c '
|
|
|
310
310
|
| Docker 中结果文件属主为 root | 运行时加 `--user=$(id -u):$(id -g)` 与 `--env HOME=/data/` |
|
|
311
311
|
| `t.*` 报时空数据库错误 | 时空数据库按地图集独立且自动创建;确认在正确地图集内运行并检查 `t.connect -p` 状态 |
|
|
312
312
|
|
|
313
|
-
##
|
|
313
|
+
## AI 使用建议
|
|
314
314
|
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
- **Docker 镜像说明:** <https://grass.osgeo.org/download/docker/>
|
|
322
|
-
- **官方示例数据:** <https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip>
|
|
315
|
+
- **执行环境**:命令在终端 / shell 中执行(Windows 用 PowerShell)。正文里 `grass ... --exec sh -c '...'` 的多行引用在 PowerShell 下不可靠,改为把模块序列写进 `.py` 脚本(首行 `#!/usr/bin/env python3`),再 `grass --tmp-project EPSG:3857 --exec python3 analysis.py`。
|
|
316
|
+
- **先探测版本**:`grass --version`(应为 8.5.0,LTR 8.4.2)、`grass --tmp-project EPSG:3857 --exec g.region -p`;8.4 之前没有 `grass.tools`,Python 脚本改用 `gs.run_command`。
|
|
317
|
+
- **验证产物**:`--tmp-project` 内的地图最后必须导出——`r.out.gdal input=slope output=/work/slope.tif format=GTiff`,随后 `gdalinfo -json slope.tif` 核对 CRS 与范围;会话内核对用 `g.region -p format=json`、`g.list type=raster`。
|
|
318
|
+
- **区域语义优先**:栅格模块只处理计算区域内的像元,结果范围不对先看 `g.region -p`;重复运行加 `--overwrite`,否则模块报地图已存在并非零退出。
|
|
319
|
+
- **错误识别**:GRASS 模块的失败以 `ERROR:` 开头并返回非零码(如 `Raster map <x> not found`),据此区分地图名、区域为空还是输出已存在问题,不要只读最后一行日志。
|
|
320
|
+
- **安全与权限**:`g.remove`、`--overwrite`、`t.connect` 会改/删地图集数据;`--tmp-project`/`--tmp-mapset` 结束即删除目录,结果必须先导出;启动 Docker 或改文件属主(`--user=$(id -u):$(id -g)`)前先确认写入路径。
|
|
323
321
|
|
|
324
322
|
## 相关技能
|
|
325
323
|
|
|
@@ -328,12 +326,13 @@ grass $HOME/grassdata/ndvi_project/PERMANENT --exec sh -c '
|
|
|
328
326
|
- **geopandas** — Python 矢量数据分析:[../geopandas/SKILL.md](../geopandas/SKILL.md)
|
|
329
327
|
- **pyqgis** — QGIS Python 绑定:[../pyqgis/SKILL.md](../pyqgis/SKILL.md)
|
|
330
328
|
|
|
331
|
-
##
|
|
329
|
+
## 参考资源
|
|
332
330
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
331
|
+
- **GRASS GIS 源码:** <https://github.com/OSGeo/grass>
|
|
332
|
+
- **官方文档:** <https://grass.osgeo.org/>
|
|
333
|
+
- **模块手册(grass-stable):** <https://grass.osgeo.org/grass-stable/manuals/>
|
|
334
|
+
- **grass 启动器说明:** <https://grass.osgeo.org/grass-stable/manuals/grass.html>
|
|
335
|
+
- **Python 脚本 API:** <https://grass.osgeo.org/grass-stable/manuals/libpython/>
|
|
336
|
+
- **时空框架介绍:** <https://grass.osgeo.org/grass-stable/manuals/temporalintro.html>
|
|
337
|
+
- **Docker 镜像说明:** <https://grass.osgeo.org/download/docker/>
|
|
338
|
+
- **官方示例数据:** <https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip>
|
package/assets/jts/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jts
|
|
3
|
-
description: "Use when
|
|
3
|
+
description: "Use when doing precise 2D computational geometry in Java with org.locationtech.jts:jts-core 1.20.0 — GeometryFactory construction, contains/intersects predicates, overlay via OverlayNGRobust, buffer, STRtree and PreparedGeometry speedups, WKT/WKB/GeoJSON I/O, and fixing TopologyException or unclosed rings."
|
|
4
4
|
|
|
5
5
|
tags:
|
|
6
6
|
- java
|
|
@@ -56,7 +56,7 @@ JTS Topology Suite(简称 JTS)是 LocationTech 项目组下的开源 Java
|
|
|
56
56
|
</dependency>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
如需 GeoJSON 等 I/O
|
|
59
|
+
如需 GeoJSON 等 I/O 支持(注意 groupId 是 `org.locationtech.jts.io`,与 jts-core 的 `org.locationtech.jts` 不同):
|
|
60
60
|
|
|
61
61
|
```xml
|
|
62
62
|
<dependency>
|
|
@@ -66,6 +66,8 @@ JTS Topology Suite(简称 JTS)是 LocationTech 项目组下的开源 Java
|
|
|
66
66
|
</dependency>
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
`jts-io-common` 的 `GeoJsonWriter` 在运行期还依赖 `com.googlecode.json-simple:json-simple`(Maven/Gradle 会自动带入);手工拼 classpath 时漏掉它会在写出 GeoJSON 时抛 `NoClassDefFoundError: org/json/simple/JSONAware`。
|
|
70
|
+
|
|
69
71
|
### Gradle
|
|
70
72
|
|
|
71
73
|
```groovy
|
|
@@ -247,27 +249,20 @@ String geoJson = new GeoJsonWriter().write(buffered);
|
|
|
247
249
|
| 批量空间查询慢 | 用 `STRtree` 建索引;重复关系判断用 `PreparedGeometry`;大量合并用 `UnaryUnionOp` |
|
|
248
250
|
| 多线程复用 Reader/Writer 出错 | `GeometryFactory` 与 `Geometry` 线程安全;`WKTReader` / `WKTWriter` 等非线程安全,每线程独立创建 |
|
|
249
251
|
| 叠加运算抛 TopologyException | 优先用 `OverlayNGRobust.overlay()`,比传统叠加引擎更鲁棒 |
|
|
252
|
+
| 写 GeoJSON 抛 `NoClassDefFoundError: org/json/simple/JSONAware` | 手工 classpath 缺 `json-simple`,用 Maven/Gradle 引入 `jts-io-common` 让其传递依赖生效 |
|
|
250
253
|
| 旧代码升级后 import 报错 | JTS 1.15+ 包名由 `com.vividsolutions.jts` 迁移为 `org.locationtech.jts` |
|
|
251
254
|
|
|
252
255
|
---
|
|
253
256
|
|
|
254
257
|
## AI 使用建议
|
|
255
258
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
1.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
### 关键注意事项
|
|
265
|
-
|
|
266
|
-
- **坐标顺序**:JTS 使用 `(x, y)` 即 `(经度, 纬度)`,注意与部分 GIS 系统的 `(y, x)` 区分
|
|
267
|
-
- **SRID 不参与计算**:JTS 所有计算在笛卡尔平面进行,不处理地球曲率
|
|
268
|
-
- **OverlayNG 优先**:叠加运算优先使用 `OverlayNGRobust.overlay()`,比传统方法更鲁棒
|
|
269
|
-
- **线程安全**:`GeometryFactory` 和 `Geometry` 线程安全;Reader/Writer 非线程安全
|
|
270
|
-
- **有效性检查**:外部导入的几何用 `isValid()` 检查后用 `GeometryFixer.fix()` 修复
|
|
259
|
+
- **本技能的组织**:主文件给高频用法,完整参数表与高级示例在 `reference/geometry-operations.md`,需要时再展开;示例工程与生成的数据写到工作目录,不要改动技能目录本身。
|
|
260
|
+
- **执行环境**:命令在终端 / shell 中执行;JTS 只依赖 `jts-core`,Maven Central 直接可解析,不需要额外仓库,JDK 8+ 即可。
|
|
261
|
+
- **先探测版本**:`mvn dependency:tree -Dincludes=org.locationtech.jts` 确认解析到 1.20.0;同时确认 classpath 里没有遗留的 `com.vividsolutions.jts` 旧包。
|
|
262
|
+
- **验证产物**:`mvn -q test`,或最小 main 做 WKT 往返 + `geom.isValid()` + `buffer(0)` 断言;导出 GeoJSON 后用 `GeoJsonReader` 读回比对坐标数,别只看日志。
|
|
263
|
+
- **失败信号**:`TopologyException` 改用 `OverlayNGRobust.overlay()`;`isValid()` 为 false 先 `GeometryFixer.fix()`;结果为空多半是把坐标写成了 `(lat, lon)`。
|
|
264
|
+
- **注意事项**:SRID 在 JTS 里只是元数据、计算全在笛卡尔平面,跨投影需自己先转换;`WKTReader`/`WKTWriter` 非线程安全,不要多线程共享。
|
|
265
|
+
- **性能验证**:批量判断用 `PreparedGeometry` 前后各计时一次(`System.nanoTime()`),用数据证明优化有效,别凭感觉。
|
|
271
266
|
|
|
272
267
|
## 相关技能
|
|
273
268
|
|