OSMnx-图形边缘中缺少标签

时间:2020-01-21 12:20:40

标签: osmnx

我试图检测出城市中所有可以骑自行车的街道。为此,我想包括带有标签"bicycle":"yes"的行人通道,但是在用OSMnx下载的数据中找不到它。

例如,直接从openstreetmap网站下载的ID为 45031879 的XML边缘如下所示:

<way id="45031879" visible="true" version="4" changeset="64616340" timestamp="2018-11-18T10:34:12Z" user="livmilan" uid="712033">
  <nd ref="571102337"/>
  ...
  <nd ref="1587102704"/>
  <tag k="bicycle" v="yes"/>    <=====
  <tag k="highway" v="footway"/>
</way>

但是在使用OSMnx通过命令graph = ox.graph_from_place(place, network_type='all'))下载时的边缘看起来像这样:

{'osmid': 45031879, 'highway': 'footway', 'oneway': False, 'length': 22.818, 'geometry': <shapely.geometry.linestring.LineString object at 0x00000170F3F112C8>}

自行车信息似乎丢失了。是否可以通过osmnx下载其他标签?

谢谢

1 个答案:

答案 0 :(得分:1)

Configureuseful_tags_way设置可添加其他OSM方式标签以保留为图形边缘属性:

import osmnx as ox
ox.config(log_console=True, use_cache=True,
          useful_tags_way = ox.settings.useful_tags_way + ['bicycle'])

place = 'Berkeley, CA, USA'
G = ox.graph_from_place(place, network_type='bike')
edges = ox.graph_to_gdfs(G, nodes=False)
'bicycle' in edges.columns #True