Install
openclaw skills install @ruiduobao/geoskill-llm-spatial-queryopenclaw skills install @ruiduobao/geoskill-llm-spatial-queryRuns attribute + spatial queries on a vector layer from a single natural-language sentence (e.g., "select parcels with area > 50, keep the top 3 by value"), and outputs the matched features as GeoJSON plus a structured query plan.
This skill is an offline NumPy-equivalent implementation of an LLM/NL2GeoSQL spatial Q&A system: it does not depend on large models, parses text into a query plan with regex rules (field/comparator/value, bbox spatial intent, ordering, and Top-N), and executes the plan with geopandas/shapely; the query plan is persisted as JSON and is fully auditable and unit-testable.
pip install numpy rasterio scipy scikit-learn geopandas shapely
python geoskill-llm-spatial-query.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-llm-spatial-query.py --bbox 116.0 39.0 117.0 40.0 --synthetic --query "top 3 areas larger than 50" --output-dir ./out
python geoskill-llm-spatial-query.py --input parcels.geojson --query "population under 3000" --output-dir ./out
python geoskill-llm-spatial-query.py --bbox 116.0 39.0 116.5 39.5 --synthetic --query "parcels in range" --output-dir ./out
| File | Format | Description |
|---|---|---|
query_result.geojson | GeoJSON | Set of matched features |
query_plan.json | JSON | Parsed structured query plan |
output-manifest.json | JSON | Run manifest (input/output/QA/exit code) |
Local vector files (GeoJSON/Shapefile), or a --synthetic regular parcel grid layer.
--synthetic mode requires no network at all.MIT
用一句自然语言(如"筛选面积大于 50 的地块,取值最高的前 3 个")对矢量图层做属性 + 空间查询,输出命中要素 GeoJSON 与结构化查询计划。
本 skill 是 LLM/NL2GeoSQL 空间问答系统的离线 numpy 等价实现:不依赖大模型,用正则规则把文本解析成查询计划(字段/比较符/数值、bbox 空间意图、排序与 Top-N),再用 geopandas/shapely 执行;查询计划落盘为 JSON,完全可审计、可单测。
pip install numpy rasterio scipy scikit-learn geopandas shapely
python geoskill-llm-spatial-query.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-llm-spatial-query.py --bbox 116.0 39.0 117.0 40.0 --synthetic --query "面积大于50的前3个" --output-dir ./out
python geoskill-llm-spatial-query.py --input parcels.geojson --query "人口小于3000" --output-dir ./out
python geoskill-llm-spatial-query.py --bbox 116.0 39.0 116.5 39.5 --synthetic --query "在范围内的地块" --output-dir ./out
| 文件 | 格式 | 说明 |
|---|---|---|
query_result.geojson | GeoJSON | 命中要素集合 |
query_plan.json | JSON | 解析出的结构化查询计划 |
output-manifest.json | JSON | 运行清单(输入/输出/QA/退出码) |
本地矢量文件(GeoJSON/Shapefile),或 --synthetic 规则地块网格图层。
--synthetic 模式完全无网络。MIT