一般来说,我是OSMnx和Overpass查询的新手。我试图了解使用非街道基础设施类型时编写自定义查询的正确方法。
具体来说,我试图了解为什么此查询有效
import osmnx as ox
my_custom_filter = '["railway"~"disused"]'
G = ox.graph_from_point((51.5073509,-0.1277583),
distance = 10000,
distance_type = 'bbox',
infrastructure = 'way["railway]',
network_type = 'none',
custom_filter = my_custom_filter
)
但这引发了错误的请求错误:
import osmnx as ox
my_custom_filter = '["railway"~"disused"]'
G = ox.graph_from_point((51.5073509,-0.1277583),
distance = 10000,
distance_type = 'bbox',
infrastructure = 'way["railway~"rail"]',
network_type = 'none',
custom_filter = my_custom_filter
)
注意,不同之处仅在于我在后一个查询中将rail指定为rail类型。
请参阅此处的OSM铁路指南。
如果任何人都可以将我的资源指向任何可以帮助我进一步了解如何构造自定义过滤器的资源,尤其是具有多个过滤器的自定义过滤器,那也将是极好的。例如,添加其他客户过滤器的正确语法是什么。
您只是"
在争论中遗漏了一个。这有效:
import osmnx as ox
ox.config(log_console=True, use_cache=True)
point = (51.5073509,-0.1277583)
dist = 10000
dt = 'bbox'
cf = '["railway"~"disused"]'
G = ox.graph_from_point(point, dist=dist, dist_type=dt, custom_filter=cf)
但这会产生EmptyOverpassResponse
错误,因为在该搜索区域中没有与您的查询匹配的内容。但是,如果将其更改为例如,则会得到一个图形:
cf = '["railway"!~"disused"]'
G = ox.graph_from_point(point, dist=dist, dist_type=dt, custom_filter=cf)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句