Osmread是一个简单的库,用于以Python读取OpenStreetMap数据文件。它支持XML和PBF文件格式作为输入。它不是为快速处理大型行星垃圾场而设计的,但可用于简单处理较小的文件,如区域摘录。
如果您需要快速处理大文件,请查看 imposm.parser库。
https://pypi.org/project/osmread/
https://www.it1352.com/1823123.html
https://github.com/dezhin/osmread
用法示例
from osmread import parse_file, Way
highway_count = 0
for entity in parse_file('foo.osm.bz2'):
if isinstance(entity, Way) and 'highway' in entity.tags:
highway_count += 1
print("%d highways found" % highway_count)
所有的Node,Way和Relation实例有id,version,changeset, timestamp,uid和tags属性。节点坐标存储在lon和中 lat。方式节点存储在中nodes,关系成员位于中members。
关系成员是元组的阵列(role,class,id),其中class是 Node,Way或Relation。
无法从’pyproj’导入名称’CRS’以使用osmnx库
解决办法
https://stackoverflow.com/questions
https://gitter.im/pyproj4-pyproj/community