Pdal 标志

Pdal

社区
znlgis
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.

概览

发布者znlgis
代码仓库opengis-skills
技能名称pdal
星标数
76
复刻数
12
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 znlgis 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Pdal AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/znlgis/opengis-skills/tree/main/gis/pdal
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/znlgis/opengis-skills.git /tmp/opengis-skills
mkdir -p .claude/skills
cp -r /tmp/opengis-skills/gis/pdal .claude/skills/pdal
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Pdal,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Pdal。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Pdal 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

项目地址: https://github.com/PDAL/PDAL

官方文档: https://pdal.io/

Conda: pdal / python-pdal(conda-forge,最新 2.10.2,截至 2026-10)

PyPI: pdal(Python 绑定,最新 3.5.5,截至 2026-10;版本号与主库独立)

许可证: BSD-3-Clause

概述

PDAL(Point Data Abstraction Library)是处理点云数据的开源库与命令行工具集,常被称作“点云界的 GDAL”。它把点云读取、过滤、写入抽象为统一的 stage 模型,用 JSON pipeline 描述整条处理链。支持 LAS/LAZ、BPF、EPT、COPC、文本等多种格式。既提供 pdal 命令行(info/translate/pipeline 等),也提供 Python、C++ 绑定,常与 GDAL 配合完成地面分类与 DEM 生成。

  • Stage 模型:reader → filter → writer 串联,每个 stage 由 type 与参数描述
  • 流式优先:默认尽量使用 stream mode,大文件不必整体载入
  • 格式广泛:内置 LazPerf,LAZ 压缩读写开箱即用
  • 生态衔接:writers.gdal 直接输出 GeoTIFF DEM,Python 绑定返回 NumPy 数组

环境准备

安装方法一:apt(Debian/Ubuntu)

bash
sudo apt update
sudo apt install pdal libpdal-dev python3-pdal

安装方法二:conda(推荐,跨平台)

bash
conda install -c conda-forge pdal python-pdal
# 或先建环境再安装
conda create -n pdal -c conda-forge pdal python-pdal
conda activate pdal

安装方法三:Docker

bash
docker pull pdal/pdal:latest
docker run --rm pdal/pdal pdal --version
# 交互式使用,将当前目录挂载到 /data
docker run --rm -it -v "$PWD":/data -w /data pdal/pdal

Python 绑定(pip)

bash
pip install PDAL   # 依赖系统已安装 PDAL 库(提供 pdal-config)

验证安装

bash
pdal --version                  # 输出如 PDAL 2.10.2 (…)
pdal --help                     # 列出全部子命令(info/translate/pipeline/…)
pdal --drivers                  # 列出可用的 readers/filters/writers
pdal --options filters.smrf     # 查看某个 driver 的参数与默认值
pdal info --help                # 查看单个子命令的参数

核心 API/命令

pdal info — 查看点云信息

bash
pdal info input.las                     # 不带参数时默认等价 --stats(读取全部点统计)
pdal info input.las --summary           # 概要(点数、范围、坐标系)
pdal info input.las --metadata          # 元数据(含 LAS 头信息)
pdal info input.las --schema            # 维度 schema
pdal info input.las --all               # stats + schema + metadata
pdal info input.las -p 0-10             # 输出第 0-10 个点(0 起始)
pdal info input.las --query "636601.87, 849018.59, 425.10"   # 按到该点的距离排序输出

输出默认为 JSON,可直接用 jq 解析。

pdal translate — 转换与简单过滤

bash
# 基本语法:pdal translate [options] input output [filter...]
pdal translate input.las output.laz

# 重投影
pdal translate input.las output.las -f reprojection --filters.reprojection.out_srs="EPSG:4326"

# 多级过滤按顺序串联
pdal translate input.las output.las smrf expression --filters.expression.expression="Classification == 2"

# 指定 writer 参数(LAZ 压缩)
pdal translate input.las output.laz --writers.las.compression=true

pdal pipeline — 运行 JSON pipeline

bash
pdal pipeline pipeline.json
pdal pipeline --stdin < pipeline.json
pdal pipeline pipeline.json --validate       # 只校验并报告是否可流式处理
pdal pipeline pipeline.json --metadata meta.json
pdal pipeline pipeline.json --writers.las.filename=out.laz   # 命令行覆盖参数
pdal pipeline pipeline.json --stage.points.filename=data.laz # 按 tag 覆盖

Pipeline JSON 结构

json
[
  "input.las",
  { "type": "filters.crop", "bounds": "([0,100],[0,100])" },
  "output.laz"
]
  • 顶层为 stage 数组;旧式 {"pipeline": [...]} 对象写法仍兼容
  • 每个 stage 可含:type(reader/filter/writer 类型)、filename、tag(唯一标识)、inputs(上游 tag 数组)及专有参数
  • 字符串 stage 等价于只含 filename 的 stage,驱动按扩展名推断
  • stage 按列出顺序执行;未写 inputs 时沿用默认输入链;inputs 引用的 tag 必须先定义

常用 filters

filters.crop — 裁剪
json
{ "type": "filters.crop", "bounds": "([0,1000000],[0,1000000])" }
  • bounds 支持 PDAL 风格 ([xmin,xmax],[ymin,ymax])(3D 时加第三段)、GeoJSON BBOX、JSON 对象
  • polygon 接受 WKT 字符串(如 "POLYGON((0 0, 5000 10000, 10000 0, 0 0))")
  • point + distance 按半径裁剪;outside 取反,只保留区域外的点
filters.range — 按维度取值过滤
json
{ "type": "filters.range", "limits": "Z[0:100],Classification[2:2]" }
  • 范围语法:Z[10:](Z ≥ 10)、Classification[2:2](等于 2)、Blue[:255)(开区间)、Intensity![25:25](取反)
  • 同维度多段取并集,不同维度取交集
  • 2.5 起推荐新代码改用 filters.expression;filters.range 将在 3.0 弃用
filters.expression — 表达式过滤
json
{ "type": "filters.expression", "expression": "Classification == 2" }
filters.reprojection — 重投影
json
{ "type": "filters.reprojection", "in_srs": "EPSG:26916", "out_srs": "EPSG:4326" }
  • out_srs 必需;in_srs 仅在数据自身缺少坐标系时给出
  • 重投影会改变坐标精度,writer 侧用 scale_x/y/z 与 offset_x/y/z: "auto" 保持精度
filters.outlier — 去噪
json
{ "type": "filters.outlier", "method": "statistical", "mean_k": 12, "multiplier": 2.2 }
  • method 可选 statistical(mean_k 默认 8,multiplier 默认 2.0)或 radius(radius 默认 1.0,min_k 默认 2)
  • 命中点标记为 Classification=7(LAS 噪点),再用 filters.expression 删除
filters.smrf — 地面分类
json
{ "type": "filters.smrf", "cell": 1.0, "slope": 0.15, "threshold": 0.5, "window": 18.0, "scalar": 1.25 }
  • Simple Morphological Filter:地面点标 Classification=2(ground_class),非地面标 1(other_class)
  • 常用参数:cell(格网大小,默认 1.0)、window(最大窗口,默认 18.0)、slope(默认 0.15)、threshold(默认 0.5)、scalar(高程缩放,默认 1.25)
  • 之后用 filters.expression("Classification == 2")只保留地面点

常用 writers

writers.las
json
{ "type": "writers.las", "filename": "output.laz", "compression": "true", "minor_version": 4 }
  • compression 设为 true 输出 LAZ(LazPerf 压缩)
  • scale_x/y/z 与 offset_x/y/z 可设 "auto" 防止精度损失
  • a_srs 指定输出坐标系;forward 可继承源 LAS 头字段
writers.gdal — DEM 栅格化
json
{
  "type": "writers.gdal",
  "filename": "dem.tif",
  "resolution": 1.0,
  "output_type": "idw",
  "gdaldriver": "GTiff"
}
  • resolution 必需(格网边长);dimension 默认 Z
  • output_type 可选 min/max/mean/idw/count/stdev/all(默认 all,输出多波段)
  • gdalopts 透传 GDAL 驱动参数;override_srs 指定输出栅格坐标系

Python 绑定

python
import json
import pdal

stages = [
    "input.las",
    {"type": "filters.smrf"},
    {"type": "filters.expression", "expression": "Classification == 2"},
    {"type": "writers.gdal", "filename": "dem.tif", "resolution": 1.0, "output_type": "idw"}
]

pipeline = pdal.Pipeline(json.dumps(stages))
count = pipeline.execute()    # 返回处理的点数
arrays = pipeline.arrays      # NumPy 结构化数组列表
metadata = pipeline.metadata  # 元数据
log = pipeline.log            # 执行日志

points = arrays[0]
x = points["X"]               # 按维度名取列

典型工作流

工作流 1:批量格式转换(LAS → LAZ)

bash
for f in *.las; do
  pdal translate "$f" "${f%.las}.laz"
done

工作流 2:裁剪 + 重投影

pipeline 文件 clip_reproject.json:

json
[
  "input.las",
  { "type": "filters.crop", "bounds": "([500000,500500],[4000000,4000500])" },
  { "type": "filters.reprojection", "in_srs": "EPSG:32650", "out_srs": "EPSG:4326" },
  { "type": "writers.las", "filename": "output_4326.laz", "compression": "true",
    "scale_x": "auto", "scale_y": "auto", "scale_z": "auto" }
]
bash
pdal pipeline clip_reproject.json

工作流 3:地面分类与 DEM 生成(与 GDAL 配合)

json
[
  "input.las",
  { "type": "filters.outlier", "method": "statistical", "mean_k": 8, "multiplier": 2.0 },
  { "type": "filters.smrf", "cell": 1.0, "slope": 0.15, "threshold": 0.5, "window": 18.0 },
  { "type": "filters.expression", "expression": "Classification == 2" },
  { "type": "writers.gdal", "filename": "dem.tif", "resolution": 1.0, "output_type": "idw", "window_size": 3 }
]
bash
pdal pipeline ground_dem.json
gdalinfo dem.tif
gdal_translate -of COG dem.tif dem_cog.tif   # 后续处理交给 GDAL

工作流 4:Python 批处理去噪

python
import glob
import json
import pdal

for las_file in glob.glob("tiles/*.las"):
    stages = [
        las_file,
        {"type": "filters.outlier", "method": "statistical", "mean_k": 8, "multiplier": 2.0},
        {"type": "filters.expression", "expression": "Classification != 7"},
        las_file.replace(".las", "_denoised.laz"),
    ]
    count = pdal.Pipeline(json.dumps(stages)).execute()
    print(las_file, count)

最佳实践

  • 先探测再处理:pdal info --summary 检查点数、范围与坐标系,--metadata 查看 LAS 头信息
  • 复杂处理写成 pipeline JSON 文件:可复用、可版本化,用 pdal pipeline --validate 预校验
  • 处理顺序影响结果:去噪(outlier)→ 地面分类(smrf)→ 提取(expression)→ 输出(writer)
  • 优先流式处理:stream mode 是默认策略;outlier、smrf 等需要全局计算的 stage 会回退标准模式,内存受限时按块拆分数据
  • 重投影后用 writer 的 scale_*/offset_* = "auto",防止坐标精度截断
  • 输出统一用 LAZ(compression: "true")减小体积,GDAL/QGIS 可直接读取
  • 用 tag + inputs 构建分支与合并(filters.merge),tag 必须先定义
  • pdal ground 自 2.6.0 标记 DEPRECATED,2.7 从默认安装移除、2.8 完全移除;一律改用 filters.smrf 的 pipeline 写法
  • SMRF 参数需按数据调整:window 参考最大建筑物尺寸,slope/threshold 可参考 SMRF 论文的参数组合

常见问题

问题解决
pdal: command not found按环境准备安装(apt/conda/Docker);Windows 推荐 conda 或 OSGeo4W
pip install PDAL 报错找不到 pdal-config需先安装 PDAL 库(apt 的 libpdal-dev 或 conda 的 pdal),推荐直接用 conda 安装 python-pdal
pipeline 报解析失败用 pdal pipeline --validate 定位 JSON 语法错误;确认顶层是 stage 数组
filters.reprojection 报缺少 SRS设置 out_srs;数据无坐标系时补充 in_srs
处理大文件内存不足尽量使用支持流式的 stage;outlier/smrf 等全局 filter 按数据分块处理
writers.gdal 输出了多波段默认 output_type: "all",指定 mean 或 idw 等单值即可输出单波段
重投影后坐标精度变差在 writer 中设置 scale_x/y/z 与 offset_x/y/z: "auto"
地面分类效果不佳调整 smrf 的 window/slope/threshold/scalar,先检查数据坐标系与高程单位
报 Couldn't create <cls> stage of type '<type>'.stage 名拼错或该版本没有此 stage:先 pdal --drivers 确认存在,再核对 readers.*/filters.*/writers.* 前缀

AI 使用建议

  • 执行环境:命令在终端 / 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。
  • 先探测版本:pdal --version(应为 2.10.2)、pdal --drivers;pdal ground 自 2.6 起弃用,低版本缺少 filters.expression 等 stage,回答里要写明按哪个版本写。
  • 验证产物:pdal info --summary out.laz 核对 num_points、bounds、srs;DEM 用 gdalinfo -json dem.tif 核对波段数与范围;pipeline 先 pdal pipeline --validate 再实跑,不要只看退出码。
  • 注意执行模式:stream mode 不能跑 filters.outlier、filters.smrf 这类需要全局统计的 stage,大文件先按 tile 拆分;writers.gdal 默认 output_type: "all" 会输出多波段,单波段 DEM 要显式写 idw/mean。
  • Python 场景:pipeline.execute() 返回处理的点数而不是数组,数据在 pipeline.arrays(NumPy 结构化数组);排查失败看 pipeline.log,不要只看异常栈。
  • 安全与权限:pdal translate 与各 writer 会覆盖同名输出,先确认目标文件名;pdal pipeline --stdin 和 Docker 挂载以调用者/容器用户写盘,Linux 下注意属主;安装 PDAL 或下载大点云前先征得用户同意。

相关技能

参考资源

常见问题

Pdal AI 技能有什么作用?

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.

为什么在 TypingMind 中使用 Pdal?

因为您只需安装一次,就能搭配任何模型使用。Pdal 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Pdal?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/znlgis/opengis-skills/tree/main/gis/pdal。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Pdal?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Pdal 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Pdal 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Pdal AI 技能免费吗?

是的。znlgis 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇