@dsh-gis/dsh-opengis-skill 0.1.3 → 0.3.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 +95 -0
- package/README.md +68 -28
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/adaptations/brutile.md +8 -0
- package/adaptations/cesiumjs.md +8 -0
- package/adaptations/common.md +19 -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 +9 -0
- package/adaptations/opengis-daf.md +9 -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 +283 -0
- package/assets/cesiumjs/SKILL.md +81 -35
- package/assets/deck-gl/SKILL.md +26 -34
- package/assets/duckdb-spatial/SKILL.md +363 -0
- package/assets/gdal/SKILL.md +55 -33
- package/assets/gdal/reference/raster-tools.md +14 -0
- package/assets/gdal/reference/vector-tools.md +5 -0
- package/assets/gdal-api/SKILL.md +12 -18
- package/assets/gdal-api/reference/raster-api.md +7 -0
- package/assets/gdal-api/reference/vector-api.md +9 -0
- package/assets/geolibre/SKILL.md +357 -0
- package/assets/geometry-api-java/SKILL.md +10 -16
- package/assets/geometry-api-net/SKILL.md +70 -32
- package/assets/geometry-api-net/reference/geometry-types.md +5 -0
- package/assets/geonode/SKILL.md +340 -0
- package/assets/geopandas/SKILL.md +21 -24
- package/assets/geopandas/reference/core-api.md +4 -0
- package/assets/geopipe-agent/SKILL.md +29 -31
- package/assets/geopipe-agent/reference/steps-reference.md +12 -0
- package/assets/geopipe-agent/reference/workflows.md +8 -0
- package/assets/geoserver/SKILL.md +10 -15
- package/assets/geoserver-cloud/SKILL.md +25 -33
- package/assets/geoserver-rest-api/SKILL.md +17 -19
- package/assets/geoserver-rest-api/reference/endpoints.md +16 -0
- package/assets/geotools/SKILL.md +12 -17
- package/assets/geotools/reference/raster-rendering.md +5 -0
- package/assets/geotools/reference/vector-io.md +7 -0
- package/assets/grass-gis/SKILL.md +26 -33
- package/assets/jts/SKILL.md +12 -16
- package/assets/jts/reference/geometry-operations.md +13 -0
- package/assets/kepler-gl/SKILL.md +306 -0
- package/assets/leaflet/SKILL.md +58 -40
- package/assets/mapbox-gl-js/SKILL.md +26 -33
- package/assets/mapserver/SKILL.md +21 -29
- package/assets/mapsui/SKILL.md +109 -63
- package/assets/nettopologysuite/SKILL.md +96 -31
- package/assets/opengis-all/SKILL.md +91 -289
- package/assets/opengis-all/reference/data-stages.md +269 -4
- package/assets/opengis-all/reference/workflow-cheatsheets.md +7 -0
- package/assets/opengis-daf/SKILL.md +10 -17
- package/assets/opengis-utils-for-java/SKILL.md +58 -49
- package/assets/opengis-utils-for-java/reference/common-tasks.md +16 -12
- package/assets/opengis-utils-for-net/SKILL.md +109 -48
- package/assets/opengis-utils-for-net/reference/code-patterns.md +15 -11
- package/assets/opengis-utils-for-net/reference/util-classes.md +35 -26
- package/assets/openlayers/SKILL.md +81 -28
- package/assets/pdal/SKILL.md +25 -27
- package/assets/postgis/SKILL.md +80 -35
- package/assets/proj/SKILL.md +32 -41
- package/assets/projnet4geoapi/SKILL.md +293 -0
- package/assets/pyqgis/SKILL.md +33 -30
- package/assets/pyqgis/reference/processing-rendering.md +6 -0
- package/assets/pyqgis/reference/vector-raster-layers.md +6 -0
- package/assets/qgis-process/SKILL.md +75 -33
- package/assets/qgis-process/reference/algorithm-cheatsheet.md +6 -0
- package/assets/qgis-server/SKILL.md +25 -31
- package/assets/shapely/SKILL.md +136 -84
- package/assets/shapely/reference/operations-reference.md +12 -0
- package/assets/sharpmap/SKILL.md +97 -60
- package/assets/spatialite/SKILL.md +358 -0
- package/assets/whitebox-tools/SKILL.md +262 -0
- package/lib/adaptations.d.ts +53 -0
- package/lib/adaptations.js +343 -0
- package/lib/catalog.d.ts +7 -1
- package/lib/catalog.js +9 -1
- package/lib/index.d.ts +10 -1
- package/lib/index.js +34 -3
- package/lib/skill-file.d.ts +12 -0
- package/lib/skill-file.js +133 -18
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +12 -2
- package/upstream.json +73 -57
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: openlayers
|
|
3
3
|
description: "Use when adding interactive 2D maps to web apps with npm ol 10.11.0 — Map/View, fromLonLat to EPSG:3857, WMS/WMTS/XYZ sources, MVT with featureClass, Draw/Modify/Snap interactions, or debugging blank layers (missing setStyle), offset centers and ol/... module-not-found errors."
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
- map
|
|
9
|
-
- wms
|
|
10
|
-
- wmts
|
|
11
|
-
- vector-tiles
|
|
12
|
-
- geojson
|
|
13
|
-
- drawing
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
category: gis
|
|
7
|
+
tags: "javascript, web, 2d, map, wms, wmts, vector-tiles, geojson, drawing"
|
|
14
8
|
---
|
|
15
9
|
|
|
16
10
|
> **项目地址:** <https://github.com/openlayers/openlayers>
|
|
@@ -21,7 +15,7 @@ tags:
|
|
|
21
15
|
>
|
|
22
16
|
> **示例:** <https://openlayers.org/en/latest/examples/>
|
|
23
17
|
>
|
|
24
|
-
> **最新版本:** 10.11.0(截至2026-
|
|
18
|
+
> **最新版本:** 10.11.0(截至 2026-11,[npm `ol`](https://www.npmjs.com/package/ol) 与 [GitHub Release](https://github.com/openlayers/openlayers/releases) 一致)
|
|
25
19
|
>
|
|
26
20
|
> **许可证:** BSD-2-Clause
|
|
27
21
|
|
|
@@ -226,12 +220,70 @@ new VectorLayer({ source: clusterSource, style: clusterStyleFn });
|
|
|
226
220
|
|
|
227
221
|
## 典型工作流
|
|
228
222
|
|
|
229
|
-
|
|
223
|
+
以「底图 + GeoJSON 行政区 + 绘制编辑」为例,输入 `public/data/districts.geojson`,输出可浏览、可勾绘的面图层页面。
|
|
224
|
+
|
|
225
|
+
1. **创建 Map**:`new Map({ target, layers, view })` → `new View({ center: fromLonLat([116.39, 39.9]), zoom: 10 })`
|
|
230
226
|
2. **添加底图**:`TileLayer` + `OSM`/`XYZ`/`TileWMS` Source
|
|
231
|
-
3. **加载矢量数据**:`VectorLayer` + `VectorSource` + `GeoJSON
|
|
232
|
-
4.
|
|
227
|
+
3. **加载矢量数据**:`VectorLayer` + `VectorSource` + `GeoJSON` Format
|
|
228
|
+
4. **应用样式**:`layer.setStyle(fn)` 按属性动态渲染(不设样式矢量图层不渲染)
|
|
233
229
|
5. **添加交互**:`Draw`/`Modify`/`Select`/`Snap` Interaction
|
|
234
|
-
6.
|
|
230
|
+
6. **导出结果**:`geojson.writeFeatures(source.getFeatures())` 落盘
|
|
231
|
+
7. **性能优化**:`declutter` 避让标注、`renderMode: 'image'` 静态图层
|
|
232
|
+
|
|
233
|
+
```js
|
|
234
|
+
import Map from 'ol/Map.js';
|
|
235
|
+
import View from 'ol/View.js';
|
|
236
|
+
import TileLayer from 'ol/layer/Tile.js';
|
|
237
|
+
import OSM from 'ol/source/OSM.js';
|
|
238
|
+
import VectorLayer from 'ol/layer/Vector.js';
|
|
239
|
+
import VectorSource from 'ol/source/Vector.js';
|
|
240
|
+
import GeoJSON from 'ol/format/GeoJSON.js';
|
|
241
|
+
import { fromLonLat } from 'ol/proj.js';
|
|
242
|
+
import { Style, Fill, Stroke, Text } from 'ol/style.js';
|
|
243
|
+
import Draw from 'ol/interaction/Draw.js';
|
|
244
|
+
|
|
245
|
+
// 显式 dataProjection / featureProjection,避免 4326 数据直接落在 3857 视图上偏移
|
|
246
|
+
const geojson = new GeoJSON({
|
|
247
|
+
dataProjection: 'EPSG:4326',
|
|
248
|
+
featureProjection: 'EPSG:3857'
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const vectorLayer = new VectorLayer({
|
|
252
|
+
source: new VectorSource({
|
|
253
|
+
url: '/data/districts.geojson',
|
|
254
|
+
format: geojson
|
|
255
|
+
}),
|
|
256
|
+
style: (feature) => new Style({
|
|
257
|
+
fill: new Fill({ color: 'rgba(70,130,180,0.25)' }),
|
|
258
|
+
stroke: new Stroke({ color: '#4682b4', width: 1.5 }),
|
|
259
|
+
text: new Text({
|
|
260
|
+
text: feature.get('name'),
|
|
261
|
+
font: '12px sans-serif',
|
|
262
|
+
overflow: true
|
|
263
|
+
})
|
|
264
|
+
})
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
const map = new Map({
|
|
268
|
+
target: 'map',
|
|
269
|
+
layers: [new TileLayer({ source: new OSM() }), vectorLayer],
|
|
270
|
+
view: new View({ center: fromLonLat([116.39, 39.9]), zoom: 9 })
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// 直接在同一个矢量图层上绘制;画完把全部要素序列化回 EPSG:4326
|
|
274
|
+
const drawSource = vectorLayer.getSource();
|
|
275
|
+
map.addInteraction(new Draw({ source: drawSource, type: 'Polygon' }));
|
|
276
|
+
|
|
277
|
+
drawSource.on('addfeature', () => {
|
|
278
|
+
const text = geojson.writeFeatures(drawSource.getFeatures(), {
|
|
279
|
+
dataProjection: 'EPSG:4326',
|
|
280
|
+
featureProjection: 'EPSG:3857'
|
|
281
|
+
});
|
|
282
|
+
console.log(text); // 可直接提交给后端保存
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**验证产物**:`npm run build` 后打开页面,底图与行政区面同时显示;再画一个多边形,控制台应输出对应 GeoJSON(坐标已转回 EPSG:4326)。
|
|
235
287
|
|
|
236
288
|
---
|
|
237
289
|
|
|
@@ -247,24 +299,25 @@ new VectorLayer({ source: clusterSource, style: clusterStyleFn });
|
|
|
247
299
|
|
|
248
300
|
## 常见问题
|
|
249
301
|
|
|
250
|
-
|
|
|
251
|
-
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
302
|
+
| 报错 / 现象 | 原因 | 处置 |
|
|
303
|
+
|------|------|------|
|
|
304
|
+
| 报错 `Uncaught AssertionError: Assertion failed: The view center is not defined` | `new View()` 未给 `center`,或给的是 `undefined`(坐标变量还没算出来) | 构造 View 时显式传 `center: fromLonLat([lng, lat])` 与 `zoom`;异步取数时等数据到了再 `view.setCenter()` |
|
|
305
|
+
| 报错 `Assertion failed: Expected a list of style instances` | `setStyle()` 收到单个 `Style` 之外的非法值(数组里混入 `null`/`undefined`,或传了函数却返回非 Style) | 传 `new Style({...})` 或其数组;用样式函数时确保每个分支都返回 Style |
|
|
306
|
+
| 中心点偏移 / 图层跑到别处 | 经纬度直接当投影坐标用,未做 `EPSG:4326 → EPSG:3857` 转换 | 所有经纬度经 `fromLonLat()` 转换;自定义投影先 `register(proj4)`;用 `map.getView().getCenter()` 回读核对 |
|
|
307
|
+
| 矢量图层完全不显示 | 矢量图层未设置样式时默认不渲染 | 为图层 `setStyle(new Style({...}))`,或在构造时传 `style` |
|
|
308
|
+
| WMS 返回空白或 404 | `LAYERS` 用了图层短名而非全名、`SRS`/`CRS` 与请求版本不匹配,或服务端未放行 CORS | 用 `GetCapabilities` 里的全名填 `LAYERS`;WMS 1.3.0 用 `CRS`、1.1.1 用 `SRS`;服务端补 CORS 头 |
|
|
309
|
+
| MVT 要素取不到属性 | MVT 源未指定要素类,属性被丢弃 | 用 `new MVT({ featureClass: Feature })`,再通过 `feature.getProperties()` 读取 |
|
|
310
|
+
| 文字标注不显示 / 字体不生效 | 字体尚未加载就创建了 Text 样式,或字体族名与服务端不一致 | 先用 `document.fonts.load()`/CSS 加载字体再建样式;确认 `font` 字符串里的字体族名可用 |
|
|
311
|
+
| 点击拾取不到要素 | 要素过小或触摸设备命中容差不足 | `map.forEachFeatureAtPixel(evt.pixel, cb, { hitTolerance: 5 })` 加大容差 |
|
|
312
|
+
| 运行时报 `ol/...` 模块找不到(如 `Failed to resolve module specifier "ol/Map.js"`) | 直接用 `<script>` 引 ESM 源码,或打包器未按 ESM 解析 | 用 npm 的 `ol` 包并配置打包器;不想打包就用官方全量构建 `dist/ol.js` |
|
|
259
313
|
|
|
260
314
|
---
|
|
261
315
|
|
|
262
|
-
##
|
|
316
|
+
## AI 使用建议
|
|
263
317
|
|
|
264
|
-
-
|
|
265
|
-
- **执行环境**:`npm install`、`npm run build` 交给 `pwsh`;Windows 下 `npm` 是 `npm.cmd`,长构建用后台作业并把输出落盘再读。
|
|
318
|
+
- **执行环境**:`npm install`、`npm run build` 在终端中执行;Windows 下 `npm` 是 `npm.cmd`,长构建放后台运行并把输出落盘再读。
|
|
266
319
|
- **先探测版本**:`npm ls ol`(未装则 `npm view ol version`);本技能按 10.11.0 编写,只使用 `ol/Map.js`、`ol/layer/Tile.js` 等 ESM 子路径,旧版 `ol.source.*` 全量命名空间写法不要混用。
|
|
267
|
-
- **验证产物**:`npm run build` 后用 `npx serve dist`(或 `python -m http.server 5173 -d dist`)起静态服务,`curl.exe -I http://localhost:5173/` 与打包出的 `assets/*.js` 应为 200;
|
|
320
|
+
- **验证产物**:`npm run build` 后用 `npx serve dist`(或 `python -m http.server 5173 -d dist`)起静态服务,`curl.exe -I http://localhost:5173/` 与打包出的 `assets/*.js` 应为 200;AI 助手通常看不到浏览器画面,请用户看页面与控制台,环境支持读图时用截图核对。
|
|
268
321
|
- **投影**:经纬度必须 `fromLonLat()` 转 EPSG:3857,自定义投影先 `register(proj4)`;否则中心点偏移或图层不显示。
|
|
269
322
|
- **图层样式**:矢量图层不设样式默认不渲染,务必 `setStyle()`;MVT 源要用 `MVT({ featureClass: Feature })` 才能保留属性。
|
|
270
323
|
- **常见症状**:WMS 空白先查 CORS、`LAYERS` 全名与 `SRS`;`ol/...` 模块找不到说明打包器没按 ESM 解析;容器尺寸变化后调用 `map.updateSize()`。
|
package/assets/pdal/SKILL.md
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pdal
|
|
3
3
|
description: "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."
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- lidar
|
|
8
|
-
- las
|
|
9
|
-
- laz
|
|
10
|
-
- pipeline
|
|
11
|
-
- dem
|
|
12
|
-
- gis
|
|
13
|
-
- geospatial
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
category: gis
|
|
7
|
+
tags: "pdal, point-cloud, lidar, las, laz, pipeline, dem, gis, geospatial"
|
|
14
8
|
---
|
|
15
9
|
|
|
16
10
|
> **项目地址:** <https://github.com/PDAL/PDAL>
|
|
17
11
|
>
|
|
18
12
|
> **官方文档:** <https://pdal.io/>
|
|
19
13
|
>
|
|
20
|
-
> **最新版本:** 2.10.2
|
|
14
|
+
> **最新版本:** 2.10.2(截至 2026-11,[GitHub Release](https://github.com/PDAL/PDAL/releases);conda-forge `pdal` 同为 2.10.2)
|
|
15
|
+
>
|
|
16
|
+
> **PyPI:** `pdal`(Python 绑定,最新 3.5.5,截至 2026-11;版本号与主库独立)
|
|
21
17
|
>
|
|
22
18
|
> **许可证:** BSD-3-Clause
|
|
23
19
|
|
|
@@ -66,9 +62,11 @@ pip install PDAL # 依赖系统已安装 PDAL 库(提供 pdal-config)
|
|
|
66
62
|
### 验证安装
|
|
67
63
|
|
|
68
64
|
```bash
|
|
69
|
-
pdal --version # 输出如
|
|
65
|
+
pdal --version # 输出如 PDAL 2.10.2 (…)
|
|
66
|
+
pdal --help # 列出全部子命令(info/translate/pipeline/…)
|
|
70
67
|
pdal --drivers # 列出可用的 readers/filters/writers
|
|
71
|
-
pdal --options filters.smrf # 查看某个
|
|
68
|
+
pdal --options filters.smrf # 查看某个 driver 的参数与默认值
|
|
69
|
+
pdal info --help # 查看单个子命令的参数
|
|
72
70
|
```
|
|
73
71
|
|
|
74
72
|
## 核心 API/命令
|
|
@@ -309,7 +307,7 @@ for las_file in glob.glob("tiles/*.las"):
|
|
|
309
307
|
- 重投影后用 writer 的 `scale_*/offset_* = "auto"`,防止坐标精度截断
|
|
310
308
|
- 输出统一用 LAZ(`compression: "true"`)减小体积,GDAL/QGIS 可直接读取
|
|
311
309
|
- 用 `tag` + `inputs` 构建分支与合并(filters.merge),tag 必须先定义
|
|
312
|
-
- `pdal ground`
|
|
310
|
+
- `pdal ground` 自 2.6.0 标记 DEPRECATED,2.7 从默认安装移除、2.8 完全移除;一律改用 `filters.smrf` 的 pipeline 写法
|
|
313
311
|
- SMRF 参数需按数据调整:window 参考最大建筑物尺寸,slope/threshold 可参考 SMRF 论文的参数组合
|
|
314
312
|
|
|
315
313
|
## 常见问题
|
|
@@ -324,13 +322,16 @@ for las_file in glob.glob("tiles/*.las"):
|
|
|
324
322
|
| writers.gdal 输出了多波段 | 默认 `output_type: "all"`,指定 `mean` 或 `idw` 等单值即可输出单波段 |
|
|
325
323
|
| 重投影后坐标精度变差 | 在 writer 中设置 `scale_x/y/z` 与 `offset_x/y/z: "auto"` |
|
|
326
324
|
| 地面分类效果不佳 | 调整 smrf 的 window/slope/threshold/scalar,先检查数据坐标系与高程单位 |
|
|
325
|
+
| 报 `Couldn't create <cls> stage of type '<type>'.` | stage 名拼错或该版本没有此 stage:先 `pdal --drivers` 确认存在,再核对 `readers.*`/`filters.*`/`writers.*` 前缀 |
|
|
327
326
|
|
|
328
|
-
##
|
|
327
|
+
## AI 使用建议
|
|
329
328
|
|
|
330
|
-
-
|
|
331
|
-
-
|
|
332
|
-
-
|
|
333
|
-
-
|
|
329
|
+
- **执行环境**:命令在终端 / shell 中执行(Windows 用 PowerShell)。正文的 `sudo apt`、`conda activate` 是 Bash/Linux 写法,Windows 改用 OSGeo4W 或 conda;Docker 挂载写成 `docker run --rm -v "${PWD}:/data" -w /data pdal/pdal pdal pipeline pipeline.json`。
|
|
330
|
+
- **先探测版本**:`pdal --version`(应为 2.10.2)、`pdal --drivers`;`pdal ground` 自 2.6 起弃用,低版本缺少 `filters.expression` 等 stage,回答里要写明按哪个版本写。
|
|
331
|
+
- **验证产物**:`pdal info --summary out.laz` 核对 `num_points`、`bounds`、`srs`;DEM 用 `gdalinfo -json dem.tif` 核对波段数与范围;pipeline 先 `pdal pipeline --validate` 再实跑,不要只看退出码。
|
|
332
|
+
- **注意执行模式**:stream mode 不能跑 `filters.outlier`、`filters.smrf` 这类需要全局统计的 stage,大文件先按 tile 拆分;`writers.gdal` 默认 `output_type: "all"` 会输出多波段,单波段 DEM 要显式写 `idw`/`mean`。
|
|
333
|
+
- **Python 场景**:`pipeline.execute()` 返回处理的点数而不是数组,数据在 `pipeline.arrays`(NumPy 结构化数组);排查失败看 `pipeline.log`,不要只看异常栈。
|
|
334
|
+
- **安全与权限**:`pdal translate` 与各 writer 会覆盖同名输出,先确认目标文件名;`pdal pipeline --stdin` 和 Docker 挂载以调用者/容器用户写盘,Linux 下注意属主;安装 PDAL 或下载大点云前先征得用户同意。
|
|
334
335
|
|
|
335
336
|
## 相关技能
|
|
336
337
|
|
|
@@ -339,12 +340,9 @@ for las_file in glob.glob("tiles/*.las"):
|
|
|
339
340
|
- **geopandas** — Python 矢量数据处理:[../geopandas/SKILL.md](../geopandas/SKILL.md)
|
|
340
341
|
- **shapely** — 几何对象计算,与裁剪范围构造相关:[../shapely/SKILL.md](../shapely/SKILL.md)
|
|
341
342
|
|
|
342
|
-
##
|
|
343
|
+
## 参考资源
|
|
343
344
|
|
|
344
|
-
-
|
|
345
|
-
-
|
|
346
|
-
-
|
|
347
|
-
-
|
|
348
|
-
- **注意执行模式**:stream mode 不能跑 `filters.outlier`、`filters.smrf` 这类需要全局统计的 stage,大文件先按 tile 拆分;`writers.gdal` 默认 `output_type: "all"` 会输出多波段,单波段 DEM 要显式写 `idw`/`mean`。
|
|
349
|
-
- **Python 场景**:`pipeline.execute()` 返回处理的点数而不是数组,数据在 `pipeline.arrays`(NumPy 结构化数组);排查失败看 `pipeline.log`,不要只看异常栈。
|
|
350
|
-
- **安全与权限**:`pdal translate` 与各 writer 会覆盖同名输出,先确认目标文件名;`pdal pipeline --stdin` 和 Docker 挂载以调用者/容器用户写盘,Linux 下注意属主;安装 PDAL 或下载大点云前先征得用户同意。
|
|
345
|
+
- **官方文档:** <https://pdal.io/en/stable/> | [Pipeline](https://pdal.io/en/stable/pipeline.html) | [命令行应用](https://pdal.io/en/stable/apps/index.html) | [Stage 参考](https://pdal.io/en/stable/stages/stages.html) | [维度列表](https://pdal.io/en/stable/dimensions.html) | [Python 绑定](https://pdal.io/en/stable/python.html)
|
|
346
|
+
- **GitHub:** <https://github.com/PDAL/PDAL>
|
|
347
|
+
- **Docker 镜像:** <https://hub.docker.com/r/pdal/pdal>
|
|
348
|
+
- **示例数据:** <https://github.com/PDAL/data>
|
package/assets/postgis/SKILL.md
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: postgis
|
|
3
|
-
description: "Use when extending PostgreSQL with PostGIS 3.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- spatial
|
|
9
|
-
- geometry
|
|
10
|
-
- geography
|
|
11
|
-
- raster
|
|
12
|
-
- vector
|
|
13
|
-
- wkt
|
|
14
|
-
- wkb
|
|
3
|
+
description: "Use when extending PostgreSQL with PostGIS 3.7.0 — geometry/geography/raster types, GiST and KNN distance-operator indexes, ST_Intersects/ST_Buffer/ST_Transform/ST_AsMVT, shp2pgsql -I and raster2pgsql import, and fixing \"Operation on mixed SRID\", slow spatial joins, and invalid polygons with ST_MakeValid."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
category: gis
|
|
7
|
+
tags: "postgresql, database, sql, spatial, geometry, geography, raster, vector, wkt, wkb"
|
|
15
8
|
---
|
|
16
9
|
|
|
17
10
|
> **项目地址:** <https://github.com/postgis/postgis>
|
|
18
11
|
>
|
|
19
12
|
> **官方文档:** <https://postgis.net/docs/>
|
|
20
13
|
>
|
|
14
|
+
> **最新版本:** 3.7.0(2026-10-30 发布,截至 2026-11;[发布公告](https://postgis.net/2026/10/PostGIS-3.7.0/)、[3.7 手册](https://postgis.net/docs/manual-3.7/en/))
|
|
15
|
+
>
|
|
21
16
|
> **许可证:** GPL-2.0+
|
|
22
17
|
|
|
23
18
|
## 概述
|
|
@@ -30,7 +25,7 @@ PostGIS 是基于 PostgreSQL 的开源空间数据库扩展,遵循 OGC Simple
|
|
|
30
25
|
- **坐标参考系**:内置 6000+ EPSG 投影,自动 ST_Transform
|
|
31
26
|
- **数据导入导出**:与 GDAL/ogr2ogr/shp2pgsql 无缝集成
|
|
32
27
|
|
|
33
|
-
**版本要求:**
|
|
28
|
+
**版本要求:** PostGIS 3.7 要求 PostgreSQL 14–19、GEOS ≥ 3.10、PROJ ≥ 6.1、libgmp(要启用全部扩展需 GEOS ≥ 3.15、SFCGAL ≥ 2.3);PostGIS 3.6 及更早版本仍可配 PostgreSQL 12+,升级前先确认 GEOS/PROJ 满足新下限
|
|
34
29
|
|
|
35
30
|
---
|
|
36
31
|
|
|
@@ -42,14 +37,14 @@ PostGIS 是基于 PostgreSQL 的开源空间数据库扩展,遵循 OGC Simple
|
|
|
42
37
|
# Debian/Ubuntu
|
|
43
38
|
sudo apt install postgresql-17-postgis-3 postgresql-17-postgis-3-scripts
|
|
44
39
|
|
|
45
|
-
# CentOS/RHEL
|
|
46
|
-
sudo yum install
|
|
40
|
+
# CentOS/RHEL(PGDG 仓库;包名格式 postgis<PostGIS 主版本>_<PG 主版本>)
|
|
41
|
+
sudo yum install postgis37_17
|
|
47
42
|
|
|
48
43
|
# macOS
|
|
49
44
|
brew install postgis
|
|
50
45
|
|
|
51
46
|
# Docker(推荐,标签格式 <PG 主版本>-<PostGIS 主版本>)
|
|
52
|
-
docker run --name pg -e POSTGRES_PASSWORD=pg -p 5432:5432 -d postgis/postgis:17-3.
|
|
47
|
+
docker run --name pg -e POSTGRES_PASSWORD=pg -p 5432:5432 -d postgis/postgis:17-3.7
|
|
53
48
|
```
|
|
54
49
|
|
|
55
50
|
### 启用扩展
|
|
@@ -191,14 +186,63 @@ SELECT ST_Clip(rast, geom, true) FROM dem, region WHERE region.id=1;
|
|
|
191
186
|
|
|
192
187
|
---
|
|
193
188
|
|
|
194
|
-
##
|
|
189
|
+
## 典型工作流:Shapefile 入 PostGIS → 空间连接 → 导出 GeoJSON
|
|
190
|
+
|
|
191
|
+
**输入**:`data/poi.shp`(点,EPSG:4326)、`data/districts.shp`(面,EPSG:4326)。
|
|
192
|
+
|
|
193
|
+
**步骤 1 —— 入库并建索引**(`shp2pgsql -I` 自动建 GiST 索引,`-s 4326` 指定 SRID):
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
shp2pgsql -s 4326 -I -W UTF-8 data/poi.shp public.poi \
|
|
197
|
+
| psql -d gisdb -v ON_ERROR_STOP=1
|
|
198
|
+
shp2pgsql -s 4326 -I -W UTF-8 data/districts.shp public.districts \
|
|
199
|
+
| psql -d gisdb -v ON_ERROR_STOP=1
|
|
200
|
+
psql -d gisdb -c "VACUUM ANALYZE poi, districts;"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**步骤 2 —— 空间连接**(点落在哪个区;先用 `&&` 走索引再 `ST_Within` 精筛):
|
|
204
|
+
|
|
205
|
+
```sql
|
|
206
|
+
CREATE TABLE poi_with_district AS
|
|
207
|
+
SELECT p.id, p.name, d.name AS district, p.geom
|
|
208
|
+
FROM poi AS p
|
|
209
|
+
JOIN districts AS d
|
|
210
|
+
ON p.geom && d.geom -- 包围盒粗筛,走 GiST
|
|
211
|
+
AND ST_Within(p.geom, d.geom); -- 精确判断
|
|
212
|
+
|
|
213
|
+
CREATE INDEX ON poi_with_district USING GIST (geom);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**步骤 3 —— 导出 GeoJSON**(`-t_srs EPSG:4326` 保证输出为经纬度):
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
ogr2ogr -f GeoJSON out/poi_with_district.geojson \
|
|
220
|
+
"PG:host=localhost dbname=gisdb user=postgres" poi_with_district \
|
|
221
|
+
-t_srs EPSG:4326
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**输出与验收**:
|
|
225
|
+
|
|
226
|
+
```sql
|
|
227
|
+
-- 落在区内的点数(INNER JOIN 会过滤掉区外的点,因此 <= POI 总数)
|
|
228
|
+
SELECT count(*) FROM poi_with_district;
|
|
229
|
+
|
|
230
|
+
-- 未匹配数 = POI 总数 - 已匹配数(差值即落在所有区之外的点)
|
|
231
|
+
SELECT (SELECT count(*) FROM poi)
|
|
232
|
+
- (SELECT count(*) FROM poi_with_district) AS unmatched;
|
|
233
|
+
|
|
234
|
+
-- SRID 应为 4326
|
|
235
|
+
SELECT ST_SRID(geom) FROM poi_with_district LIMIT 1;
|
|
236
|
+
|
|
237
|
+
-- 确认连接走 GiST:计划里应出现 poi_geom_idx 上的 Index/Bitmap Index Scan
|
|
238
|
+
EXPLAIN (ANALYZE, BUFFERS)
|
|
239
|
+
SELECT count(*) FROM poi AS p JOIN districts AS d
|
|
240
|
+
ON p.geom && d.geom AND ST_Within(p.geom, d.geom);
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
若两边 SRID 不一致,`&&` 会退化为逐行比较且可能报 `Operation on mixed SRID`;先 `ST_Transform` 统一到 4326 再入库。
|
|
195
244
|
|
|
196
|
-
|
|
197
|
-
2. **建表**:包含 `geometry(Point, 4326)` 或 `geography(Point, 4326)` 类型的几何列
|
|
198
|
-
3. **建索引**:`CREATE INDEX ON table USING GIST(geom)` —— 必建空间索引
|
|
199
|
-
4. **导入数据**:使用 `shp2pgsql`(Shapefile)、`ogr2ogr`(通用)、`raster2pgsql`(栅格)
|
|
200
|
-
5. **空间查询**:用 `&&` 先做包围盒粗筛(走 GiST 索引),再用 `ST_Within`/`ST_Intersects` 精筛
|
|
201
|
-
6. **验证结果**:`EXPLAIN ANALYZE` 查看查询计划,确认索引被使用
|
|
245
|
+
最后用 `ogrinfo -al -so out/poi_with_district.geojson` 核对要素数与字段,不要只凭 psql 的 `INSERT 0 n` 判定成功。
|
|
202
246
|
|
|
203
247
|
---
|
|
204
248
|
|
|
@@ -217,22 +261,23 @@ SELECT ST_Clip(rast, geom, true) FROM dem, region WHERE region.id=1;
|
|
|
217
261
|
|
|
218
262
|
## 常见问题
|
|
219
263
|
|
|
220
|
-
|
|
|
221
|
-
|
|
222
|
-
|
|
|
223
|
-
| `
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
| `CREATE
|
|
264
|
+
| 报错 / 现象 | 原因 | 处置 |
|
|
265
|
+
|------|------|------|
|
|
266
|
+
| 报错 `ERROR: Operation on mixed SRID geometries` | 运算两侧几何的 SRID 不一致(`geometry` 类型下 PostGIS 不做隐式转换) | 先统一 SRID:`ST_Transform(geom, 4326)`(换坐标系)或 `ST_SetSRID(geom, 4326)`(只标注不改坐标);用 `ST_SRID(geom)` 逐列核对 |
|
|
267
|
+
| 报错 `ERROR: Boundary geometry is invalid` / `Input Geometry contains invalid coordinates`(GEOS 触发的自相交多边形) | 多边形自相交、重复点或环未闭合,GEOS 精确算子在无效几何上会直接报错 | 用 `ST_IsValidReason(geom)` 定位、`ST_MakeValid(geom)` 修复后入库;长期方案是入库前校验 |
|
|
268
|
+
| 输出几何报 `transform: Failed to transform` 或 `couldn't project point` | `ST_Transform` 找不到目标 SRID,或 PROJ 缺少所需网格/参数 | 确认 `spatial_ref_sys` 中存在目标 SRID,且 PROJ 数据完整(`projinfo EPSG:<code>` 能解析);缺网格时安装 proj-data |
|
|
269
|
+
| 报错 `ERROR: type "geometry" does not exist` | 扩展没装,或装在别的 schema/数据库 | 在当前库执行 `CREATE EXTENSION postgis;`;确认 `search_path` 包含扩展所在 schema |
|
|
270
|
+
| 报错 `ERROR: could not open extension control file .../postgis.control` | PostgreSQL 版本与 PostGIS 软件包主版本不匹配 | 安装与 PostgreSQL 主版本对应的包(如 `postgis37_17` 对应 PG 17),必要时 `ALTER EXTENSION postgis UPDATE;` |
|
|
271
|
+
| 查询慢(全表扫描) | 缺 GiST 索引、几何经过函数包裹导致索引失效,或统计信息过期 | `CREATE INDEX ... USING GIST (geom)`;用 `geom && ST_MakeEnvelope(...)` 先走索引再精筛;大批量导入后 `VACUUM ANALYZE`;用 `EXPLAIN (ANALYZE, BUFFERS)` 验证 |
|
|
272
|
+
| 距离 / 面积数值明显偏大或偏小 | 在经纬度(4326)上直接 `ST_Distance`/`ST_Area`,单位是「度」 | 改用 `geography`(`geom::geography`,单位米)或先投影到米制 CRS 再计算 |
|
|
273
|
+
| 跨 180° 经线附近结果异常 | 平面几何在 ±180° 处被切开 | 用 `geography`,或先 `ST_ShiftLongitude` 把范围调整到 0–360° |
|
|
228
274
|
|
|
229
275
|
---
|
|
230
276
|
|
|
231
|
-
##
|
|
277
|
+
## AI 使用建议
|
|
232
278
|
|
|
233
|
-
-
|
|
234
|
-
-
|
|
235
|
-
- **先探测版本**:`psql -c "SELECT version(), PostGIS_Full_Version();"` 核对 PostgreSQL、PostGIS 3.6.4 与 GEOS/PROJ;扩展缺失时先看 `SELECT * FROM pg_available_extensions WHERE name LIKE 'postgis%';`。
|
|
279
|
+
- **执行环境**:命令在终端 / shell 中执行(Windows 用 `psql.exe`,或 `docker exec -i pg psql -U postgres`);psql 元命令(`\d`、`\c`)用 `psql -c "\d poi"` 单条传入,别依赖交互式会话。
|
|
280
|
+
- **先探测版本**:`psql -c "SELECT version(), PostGIS_Full_Version();"` 核对 PostgreSQL、PostGIS 3.7.0 与 GEOS/PROJ;扩展缺失时先看 `SELECT * FROM pg_available_extensions WHERE name LIKE 'postgis%';`。
|
|
236
281
|
- **验证产物**:导入后别只看 `INSERT 0 n`,跑 `SELECT count(*), ST_SRID(geom), ST_IsValid(geom) FROM t GROUP BY 2,3;` 核对要素数、SRID 与无效几何;性能结论必须用 `EXPLAIN (ANALYZE, BUFFERS)` 证明索引被使用。
|
|
237
282
|
- **写操作回读**:`CREATE/ALTER`、`UpdateGeometrySRID` 或批量 `UPDATE` 后回读 `\d+ t` 与 `geometry_columns`,确认列类型与 SRID 真的落库。
|
|
238
283
|
- **安全与权限**:密码不要写进命令行或报告(用 `PGPASSWORD`/`.pgpass`/连接串环境变量);`DROP TABLE/SCHEMA`、整表改写 geom、`VACUUM FULL`、重启 PostgreSQL 前必须先向用户确认并备份。
|
package/assets/proj/SKILL.md
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: proj
|
|
3
3
|
description: "Use when transforming coordinates or inspecting CRS definitions from the command line — cs2cs, projinfo -s/-t, proj projection math, cct, EPSG lookup, datum shift with grid files, WKT/PROJJSON export, or debugging \"Cannot find proj.db\" and latitude-first axis order. PROJ 9.9.0: the OSGeo engine behind GDAL/QGIS, with the proj.db SQLite database."
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- reprojection
|
|
9
|
-
- epsg
|
|
10
|
-
- projinfo
|
|
11
|
-
- cs2cs
|
|
12
|
-
- geodesy
|
|
13
|
-
- wkt
|
|
14
|
-
- gis
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
category: gis
|
|
7
|
+
tags: "proj, crs, coordinate-transformation, reprojection, epsg, projinfo, cs2cs, geodesy, wkt, gis"
|
|
15
8
|
---
|
|
16
9
|
|
|
17
10
|
> **项目地址:** <https://github.com/OSGeo/PROJ>
|
|
@@ -20,7 +13,7 @@ tags:
|
|
|
20
13
|
>
|
|
21
14
|
> **命令行文档:** <https://proj.org/en/stable/apps/index.html>
|
|
22
15
|
>
|
|
23
|
-
> **最新版本:** 9.9.0(截至 2026-
|
|
16
|
+
> **最新版本:** 9.9.0(截至 2026-11,[GitHub Release](https://github.com/OSGeo/PROJ/releases))
|
|
24
17
|
>
|
|
25
18
|
> **许可证:** MIT
|
|
26
19
|
|
|
@@ -147,15 +140,17 @@ projinfo --dump-db-structure
|
|
|
147
140
|
### cs2cs — 坐标系转换
|
|
148
141
|
|
|
149
142
|
```bash
|
|
150
|
-
# EPSG 代码:WGS 84 经纬度 → UTM
|
|
143
|
+
# EPSG 代码:WGS 84 经纬度 → UTM 32N(EPSG:4326 轴序为纬度在前,故 56 是纬度、12 是经度)
|
|
151
144
|
echo 56 12 | cs2cs EPSG:4326 EPSG:25832
|
|
152
145
|
|
|
153
|
-
#
|
|
154
|
-
cs2cs EPSG:4326 EPSG:32631 <<EOF
|
|
146
|
+
# 多行输入(45N 为纬度、2E 为经度)
|
|
147
|
+
cs2cs EPSG:4326 EPSG:32631 <<'EOF'
|
|
155
148
|
45N 2E
|
|
156
149
|
EOF
|
|
157
150
|
```
|
|
158
151
|
|
|
152
|
+
> **轴序要点:** 输入 `AUTHORITY:CODE` 或 WKT 时按该 CRS 定义的轴序解析,`EPSG:4326` 是纬度在前;用 `-r` 反转输入、`-s` 反转输出。下文示例一律先纬度后经度。
|
|
153
|
+
|
|
159
154
|
PROJ 字符串写法(`+to` 分隔源与目标):
|
|
160
155
|
|
|
161
156
|
```bash
|
|
@@ -242,8 +237,9 @@ projsync --list-files
|
|
|
242
237
|
### 模式 1:WGS 84 经纬度 → UTM / Web Mercator
|
|
243
238
|
|
|
244
239
|
```bash
|
|
245
|
-
|
|
246
|
-
echo 116.391
|
|
240
|
+
# 先纬度后经度:39.907 是纬度、116.391 是经度(北京)
|
|
241
|
+
echo 39.907 116.391 | cs2cs EPSG:4326 EPSG:32650 # 北京 → UTM 50N
|
|
242
|
+
echo 39.907 116.391 | cs2cs EPSG:4326 EPSG:3857 # → Web Mercator
|
|
247
243
|
```
|
|
248
244
|
|
|
249
245
|
### 模式 2:CGCS2000 中国坐标系操作
|
|
@@ -255,8 +251,8 @@ projinfo EPSG:4490
|
|
|
255
251
|
# 查询 3 度带高斯-克吕格投影(114E 中央经线,即 38 带)
|
|
256
252
|
projinfo EPSG:4547
|
|
257
253
|
|
|
258
|
-
# WGS 84 经纬度 → CGCS2000 3
|
|
259
|
-
echo 114.0
|
|
254
|
+
# WGS 84 经纬度 → CGCS2000 3 度带投影(30.5N 114.0E,纬度在前)
|
|
255
|
+
echo 30.5 114.0 | cs2cs EPSG:4326 EPSG:4547
|
|
260
256
|
```
|
|
261
257
|
|
|
262
258
|
### 模式 3:查找并确认转换路径
|
|
@@ -266,17 +262,15 @@ echo 114.0 30.5 | cs2cs EPSG:4326 EPSG:4547
|
|
|
266
262
|
projinfo -s EPSG:4326 -t EPSG:4547 --summary
|
|
267
263
|
|
|
268
264
|
# 再用 cs2cs 执行,必要时强制使用最佳转换
|
|
269
|
-
echo 114.0
|
|
265
|
+
echo 30.5 114.0 | cs2cs EPSG:4326 EPSG:4547 --only-best
|
|
270
266
|
```
|
|
271
267
|
|
|
272
268
|
### 模式 4:批量转换坐标文本
|
|
273
269
|
|
|
274
270
|
```bash
|
|
275
271
|
#!/bin/bash
|
|
276
|
-
# 输入文件每行 "lon
|
|
277
|
-
|
|
278
|
-
echo "$lat $lon" | cs2cs EPSG:4326 EPSG:3857
|
|
279
|
-
done < points.txt > points_3857.txt
|
|
272
|
+
# 输入文件每行 "lat lon"(纬度在前,与 EPSG:4326 轴序一致)
|
|
273
|
+
cs2cs EPSG:4326 EPSG:3857 points.txt > points_3857.txt
|
|
280
274
|
```
|
|
281
275
|
|
|
282
276
|
### 模式 5:为缺失网格下载数据
|
|
@@ -285,7 +279,7 @@ done < points.txt > points_3857.txt
|
|
|
285
279
|
# 按目标区域下载转换网格后执行高精度转换
|
|
286
280
|
projsync --bbox 73,18,135,54
|
|
287
281
|
export PROJ_NETWORK=ON
|
|
288
|
-
echo 116.391
|
|
282
|
+
echo 39.907 116.391 | cs2cs EPSG:4326 EPSG:4547 --only-best
|
|
289
283
|
```
|
|
290
284
|
|
|
291
285
|
---
|
|
@@ -316,15 +310,14 @@ echo 116.391 39.907 | cs2cs EPSG:4326 EPSG:4547 --only-best
|
|
|
316
310
|
|
|
317
311
|
---
|
|
318
312
|
|
|
319
|
-
##
|
|
313
|
+
## AI 使用建议
|
|
320
314
|
|
|
321
|
-
-
|
|
322
|
-
-
|
|
323
|
-
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
|
|
327
|
-
---
|
|
315
|
+
- **执行环境**:命令在终端 / shell 中执行(Windows 用 PowerShell)。正文的 `export PROJ_DATA=...` 在 PowerShell 写作 `$env:PROJ_DATA = "C:\OSGeo4W\share\proj"`;heredoc(`<<EOF`)在 PowerShell 中不可用,改用管道 `"56 12" | cs2cs EPSG:4326 EPSG:25832` 或先把输入写成文件再重定向。
|
|
316
|
+
- **先探测版本**:`projinfo --version`(同时打印 `proj.db` 路径)、`projinfo --searchpaths`;本技能按 PROJ 9.9.0 编写,低于 9.1 用 `PROJ_LIB` 而非 `PROJ_DATA`,低于 9.3 的 `proj` 不能直接接受 `EPSG:xxxx`。
|
|
317
|
+
- **验证转换**:用已知点对拍——`echo "39.907 116.391" | cs2cs EPSG:4326 EPSG:32650` 应得到东坐标约 44 万、北坐标约 442 万,量级不对通常是轴序或单位问题;结构化核对用 `projinfo -o PROJJSON -q EPSG:4326`,转换路径用 `projinfo -s A -t B --summary` 看候选操作与精度。
|
|
318
|
+
- **轴序与降级**:`EPSG:4326` 纬度在前(输入先 lat 后 lon),`proj` 命令内部经度在前要用 `-r`;高精度转换加 `--only-best`,否则缺网格时会静默退回精度更低的操作。
|
|
319
|
+
- **大输出处理**:`projinfo EPSG:4326` 的 WKT 有上百行,重定向到文件再分段读取;批量转换把 `cs2cs EPSG:4326 EPSG:3857 points.txt` 一次跑完,不要逐行起进程。
|
|
320
|
+
- **安全与权限**:`projsync --all` 会从 CDN 下载数 GB 网格、`PROJ_NETWORK=ON` 也会联网,先确认网络与磁盘;`sqlite3 proj.db` 只做只读查询,不要写库;改 `PROJ_DATA` 会影响同机 GDAL/PostGIS,先征得用户同意。
|
|
328
321
|
|
|
329
322
|
## 相关技能
|
|
330
323
|
|
|
@@ -335,12 +328,10 @@ echo 116.391 39.907 | cs2cs EPSG:4326 EPSG:4547 --only-best
|
|
|
335
328
|
|
|
336
329
|
---
|
|
337
330
|
|
|
338
|
-
##
|
|
331
|
+
## 参考资源
|
|
339
332
|
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
- **大输出处理**:`projinfo EPSG:4326` 的 WKT 有上百行,重定向到文件再分段 `read`;批量转换把 `cs2cs EPSG:4326 EPSG:3857 points.txt` 一次跑完,不要逐行起进程。
|
|
346
|
-
- **安全与权限**:`projsync --all` 会从 CDN 下载数 GB 网格、`PROJ_NETWORK=ON` 也会联网,先确认网络与磁盘;`sqlite3 proj.db` 只做只读查询,不要写库;改 `PROJ_DATA` 会影响同机 GDAL/PostGIS,先征得用户同意。
|
|
333
|
+
- **官方文档:** <https://proj.org/> | [命令行工具](https://proj.org/en/stable/apps/index.html) | [快速上手](https://proj.org/en/stable/usage/quickstart.html) | [资源文件与 proj.db](https://proj.org/en/stable/resource_files.html)
|
|
334
|
+
- **工具手册:** [projinfo](https://proj.org/en/stable/apps/projinfo.html) | [cs2cs](https://proj.org/en/stable/apps/cs2cs.html) | [proj](https://proj.org/en/stable/apps/proj.html) | [projsync](https://proj.org/en/stable/apps/projsync.html)
|
|
335
|
+
- **转换原理:** <https://proj.org/en/stable/operations/operations_computation.html>
|
|
336
|
+
- **EPSG 代码查询:** <https://epsg.io/>
|
|
337
|
+
- **源码仓库:** <https://github.com/OSGeo/PROJ>
|