Shapefile
Use this skill for practical Shapefile handling, debugging, and migration planning.
Workflow
- 1. Confirm whether the task is inspection, repair, conversion, schema explanation, or batch cleanup.
- Identify which companion files are present:
.shp, .shx, .dbf, .prj, and optionally .cpg. - Check CRS, encoding, geometry type, and field-name limits before suggesting edits or conversions.
- Prefer writing outputs to a new path; avoid in-place mutation unless the user explicitly asks.
- If the dataset is large or the workflow is repeated, prefer a deterministic CLI path through
qgis.
Core Rules
- - Treat a Shapefile as a multi-file dataset, not a single
.shp file. - Missing
.shx or .dbf usually means the dataset is incomplete. - Missing
.prj means CRS is unknown, not automatically WGS84. - DBF field names are short and legacy-oriented; watch for truncation and type loss.
- Text encoding may depend on
.cpg; without it, non-ASCII text can decode incorrectly. - Shapefile is poor for long field names, rich types, large text, and modern metadata needs.
Common Failure Checks
- - File opens but attributes are broken: verify
.dbf exists and encoding is correct. - Features draw in the wrong place: verify
.prj exists and the CRS was not guessed incorrectly. - Import succeeds but schema looks wrong: check field-name truncation and DBF type limitations.
- Multipart or invalid geometry surprises: inspect geometry type before conversion or editing.
- One file was copied alone: remind that the full sidecar set must travel together.
Preferred Outcomes
- - For interchange with legacy systems, preserve the Shapefile but document its CRS and encoding explicitly.
- For ongoing editing or richer schema, migrate to
GPKG. - For lightweight web interchange, convert to
GeoJSON only when the CRS and precision tradeoffs are acceptable. - For deterministic file conversion or batch fixes, hand off execution to
qgis.
Task Boundaries
- - Use this skill for Shapefile structure, limitations, troubleshooting, and migration guidance.
- For general CRS selection, use
project or wgs84. - For actual file-based conversion, reprojection, clipping, or repair commands, use
qgis. - For web map rendering or tiles, use
mapbox or cesium as appropriate.
OpenClaw + ClawHub Notes
- - Keep examples generic and portable.
- Do not hardcode private data paths, private datasets, or machine-specific environments.
- For clawhub.ai publication, keep the skill concise, reproducible, and semver-friendly; keep detailed patterns in references.
Reference Docs In This Skill
- - Read
{baseDir}/references/patterns.md when you need concrete Shapefile validation, packaging, or conversion guidance.
Shapefile
使用此技能进行实际的Shapefile处理、调试和迁移规划。
工作流程
- 1. 确认任务是检查、修复、转换、模式解释还是批量清理。
- 识别存在的配套文件:.shp、.shx、.dbf、.prj,以及可选的.cpg。
- 在建议编辑或转换前,检查CRS、编码、几何类型和字段名称限制。
- 优先将输出写入新路径;除非用户明确要求,否则避免原地修改。
- 如果数据集较大或工作流程重复,优先通过qgis使用确定性CLI路径。
核心规则
- - 将Shapefile视为多文件数据集,而非单个.shp文件。
- 缺少.shx或.dbf通常意味着数据集不完整。
- 缺少.prj意味着CRS未知,而非自动默认为WGS84。
- DBF字段名称简短且面向传统;注意截断和类型丢失。
- 文本编码可能依赖于.cpg;若无此文件,非ASCII文本可能解码错误。
- Shapefile不适用于长字段名称、丰富类型、大文本和现代元数据需求。
常见故障检查
- - 文件可打开但属性损坏:验证.dbf是否存在且编码正确。
- 要素绘制位置错误:验证.prj是否存在且CRS未被错误猜测。
- 导入成功但模式异常:检查字段名称截断和DBF类型限制。
- 多部分或无效几何体意外出现:在转换或编辑前检查几何类型。
- 单个文件被单独复制:提醒所有配套文件必须一起传输。
首选方案
- - 与遗留系统交换时,保留Shapefile但明确记录其CRS和编码。
- 进行持续编辑或更丰富模式时,迁移至GPKG。
- 进行轻量级网络交换时,仅在CRS和精度权衡可接受的情况下转换为GeoJSON。
- 进行确定性文件转换或批量修复时,将执行交给qgis。
任务边界
- - 使用此技能处理Shapefile结构、限制、故障排除和迁移指导。
- 对于一般CRS选择,使用project或wgs84。
- 对于实际基于文件的转换、重投影、裁剪或修复命令,使用qgis。
- 对于网络地图渲染或瓦片,酌情使用mapbox或cesium。
OpenClaw + ClawHub 说明
- - 保持示例通用且可移植。
- 不要硬编码私有数据路径、私有数据集或特定机器环境。
- 对于clawhub.ai发布,保持技能简洁、可复现且支持语义化版本;在参考资料中保留详细模式。
本技能中的参考文档
- - 当需要具体的Shapefile验证、打包或转换指导时,阅读{baseDir}/references/patterns.md。