1. 下载数据
从https://www.openstreetmap.org/下载数据(如'map.osm')
2.转换格式
安装gdal,我用的cuda
conda install -c conda-forge gdal
如果报错可能需要回到base(退出虚拟环境)再更新一下conda
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
标签:map,记录,OSM,conda,output,报错,osm From: https://www.cnblogs.com/xiaoaoran/p/17464345.html