OSM踩坑记录
1. 下载数据
从https://www.openstreetmap.org/下载数据(如'map.osm')
2.转换格式
安装gdal,我用的cuda
conda install -c conda-forge gdal
如果报错可能需要回到base(退出虚拟环境)再更新一下conda
1 | conda update --all |
然后转换数据,从osm到geojson
ogr2ogr -f GeoJSON map.geo.json map.osm
这个可能报错情况:
1. 缺少osmconf.ini配置文件
Warning 1: Cannot find osmconf.ini configuration file ERROR 1: Could not parse configuration file for OSM import
下载好放在转换文件('map.osm')同目录下即可
2. Layer XXX不存在
Warning 1: Input datasource uses random layer reading, but output datasource does not support random layer writing 0ERROR 1: Layer 'lines' does not already exist in the output dataset, and cannot be created by the output driver.
命令中添加对应的层
ogr2ogr -f GeoJSON map.geo.json map.osm lines
3. 查看geojson文件(可视化)
打开网站:http://geojson.io/并读取文件
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下