【问题标题】:Correct OSMnx Custom Filter Syntax正确的 OSMnx 自定义过滤器语法
【发布时间】:2021-05-21 16:32:45
【问题描述】:

我刚刚更新到更新版本的 OSMnx (0.16),我的一个脚本不再工作。

  G = ox.graph_from_point(yx, 
                    dist = 5000,
                    dist_type = 'bbox', 
                    infrastructure = 'way["railway"]',
                    network_type = 'none',
                    custom_filter = '["service"!~"yard|siding"]["railway"~"%s"],
                    truncate_by_edge = True,
                    retain_all = True
                     )

这旨在拉动所有地铁,但不包括所有侧线。但是,infrastructure 参数在最新版本中不再可用。

显然,我需要将infrastructure 信息合并到自定义查询中,但是我不知道该怎么做。我不确定客户过滤器的正确语法应该是什么。

任何想法都会有很大帮助!

【问题讨论】:

    标签: openstreetmap osmnx overpass-api


    【解决方案1】:

    通读 OSMnx documentation 和用法 examples。他们解释了如何使用自定义过滤器。并通读 Overpass 查询语言 wiki,它非常详细地解释了语法本身。

    import osmnx as ox
    point = 40.750972, -73.992778
    G = ox.graph_from_point(point,
                            custom_filter = '["railway"~"subway"]["service"!~"yard|siding"]',
                            truncate_by_edge = True,
                            retain_all = True)
    len(G) #79
    

    【讨论】:

      猜你喜欢
      • 2018-11-18
      • 2021-06-19
      • 2014-02-13
      • 2015-03-28
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-31
      相关资源
      最近更新 更多