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/并读取文件

 

posted @   拎壶冲AR  阅读(146)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示