Initial osm2streets QGIS workflow

This commit is contained in:
2026-07-21 17:03:27 +08:00
commit dc22543e9a
10 changed files with 846 additions and 0 deletions

10
docs/changelog.md Normal file
View File

@@ -0,0 +1,10 @@
# Changelog
## 2026-07-17
- Added configurable input/output paths through JSON config files.
- Added [config/default.json](/Users/que01/osm2streets-qgis-workflow/config/default.json) for `/Users/que01/Downloads/osm.xml`.
- Added [config/hanyang-block.json](/Users/que01/osm2streets-qgis-workflow/config/hanyang-block.json) for `/Users/que01/Desktop/汉阳区区块.osm`.
- Added [config/examples/template.json](/Users/que01/osm2streets-qgis-workflow/config/examples/template.json) for new areas.
- Updated OSM node coordinate parsing to support both single-quoted and double-quoted XML attributes.
- Verified QGIS outputs for both a smaller Overpass-style XML input and a larger JOSM-generated `.osm` input.

87
docs/input-cases.md Normal file
View File

@@ -0,0 +1,87 @@
# Input Cases
这个工具目前验证过两类 OSM XML 输入。
## Case 1: Overpass/OSM XML
配置:
- [config/default.json](/Users/que01/osm2streets-qgis-workflow/config/default.json)
输入:
- `/Users/que01/Downloads/osm.xml`
特点:
- XML 属性使用双引号,例如 `lat="30.x" lon="114.x"`
- 数据规模较小,适合调样式。
- 已生成路面、人行道、中心线、停止线、方向箭头。
最近一次验证规模:
- nodes: 1368
- ways: 100
- relations: 9
- road_surface: 133
- sidewalks: 102
- lane_arrows_webscale: 1565
## Case 2: JOSM OSM XML
配置:
- [config/hanyang-block.json](/Users/que01/osm2streets-qgis-workflow/config/hanyang-block.json)
输入:
- `/Users/que01/Desktop/汉阳区区块.osm`
特点:
- XML 属性使用单引号,例如 `lat='30.x' lon='114.x'`
- 文件头包含 `generator='JOSM'`
- 数据规模更大osm2streets 会输出较多拓扑裁切提示,例如 `trimmed into oblivion``layers don't match`
- 这些提示不一定阻止产物生成,但如果 QGIS 里出现明显断口,优先检查原始 OSM 路网连接、裁剪边界和 `layer` 标签。
最近一次验证规模:
- nodes: 6360
- ways: 696
- relations: 59
- road_surface: 1894
- sidewalks: 1379
- lane_arrows_webscale: 19390
## 建新配置的建议
从模板复制:
```bash
cp /Users/que01/osm2streets-qgis-workflow/config/examples/template.json \
/Users/que01/osm2streets-qgis-workflow/config/my-area.json
```
至少修改:
- `input`
- `outDir`
- `gpkg`
- `project`
- `preview`
运行:
```bash
cd /Users/que01/osm2streets-qgis-workflow
node scripts/build-osm2streets-qgis.js --config config/my-area.json
```
## 兼容性说明
脚本的 OSM bbox 解析已兼容:
- `lat="..." lon="..."`
- `lat='...' lon='...'`
osm2streets 本身仍要求输入是标准 OSM XML。若输入来自其它 GIS 格式,先转换成 OSM XML 或改造脚本入口。