【问题标题】:OSMnx - tags missing in graph edgesOSMnx - 图边中缺少标签
【发布时间】:2020-05-07 12:14:46
【问题描述】:

我正在尝试检测城市中可以骑自行车的所有街道。为此,我想包含包含标签"bicycle":"yes" 的人行道,但我无法在使用 OSMnx 下载的数据中找到它。

例如,id为45031879的边缘作为直接从openstreetmap网站下载的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 下载附加标签?

谢谢

【问题讨论】:

    标签: osmnx


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-21
      • 2014-07-30
      • 2013-12-24
      • 1970-01-01
      • 1970-01-01
      • 2020-06-12
      相关资源
      最近更新 更多