对 OSMnx 的大 graph_from_place() 请求导致超时错误
Large graph_from_place() request for OSMnx leading to timeout error
我正在尝试使用 OSMnx 为中国提取高速公路(高速公路|主干道|主干道)。
G = ox.graph_from_place('China', network_type = 'drive', infrastructure='way["highway"~"motorway|trunk|primary"]')
我遇到超时错误:
ConnectTimeout: HTTPConnectionPool(host='overpass-api.de', port=80): Max retries exceeded with url: /api/interpreter (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x000001D695D92A20>, 'Connection to overpass-api.de timed out. (connect timeout=10)')) HTTPConnectionPool(host='overpass-api.de', port=80): Max retries exceeded with url: /api/interpreter (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x000001D695D92A20>, 'Connection to overpass-api.de timed out. (connect timeout=10)'))
这是一个很大的请求,所以它会超时我并不感到惊讶,但我想知道我的请求是否太大或者是否有实际提取它的方法。
我在 ox.graph_from_place()(超时 = 10,180(默认),1000,...)函数中尝试了各种超时,但我不完全理解这里的超时意味着什么。我想我不明白的是请求中的超时和Overpass Turbo中的超时之间的关系。
ox.config(timeout=10000)
会做你的工作。 ox.config()
是一个非常方便的功能,它也可以用于许多其他自定义设置。我试过这个功能,但基础设施不支持我的情况。否则,我的查询已完成并在 3 小时后得到结果。我会推荐你使用 http://download.geofabrik.de/asia/china.html for such downloads. Please visit [1]: https://github.com/gboeing/osmnx/issues/151, and [2]: https://github.com/gboeing/osmnx/issues/445
我正在尝试使用 OSMnx 为中国提取高速公路(高速公路|主干道|主干道)。
G = ox.graph_from_place('China', network_type = 'drive', infrastructure='way["highway"~"motorway|trunk|primary"]')
我遇到超时错误:
ConnectTimeout: HTTPConnectionPool(host='overpass-api.de', port=80): Max retries exceeded with url: /api/interpreter (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x000001D695D92A20>, 'Connection to overpass-api.de timed out. (connect timeout=10)')) HTTPConnectionPool(host='overpass-api.de', port=80): Max retries exceeded with url: /api/interpreter (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x000001D695D92A20>, 'Connection to overpass-api.de timed out. (connect timeout=10)'))
这是一个很大的请求,所以它会超时我并不感到惊讶,但我想知道我的请求是否太大或者是否有实际提取它的方法。
我在 ox.graph_from_place()(超时 = 10,180(默认),1000,...)函数中尝试了各种超时,但我不完全理解这里的超时意味着什么。我想我不明白的是请求中的超时和Overpass Turbo中的超时之间的关系。
ox.config(timeout=10000)
会做你的工作。 ox.config()
是一个非常方便的功能,它也可以用于许多其他自定义设置。我试过这个功能,但基础设施不支持我的情况。否则,我的查询已完成并在 3 小时后得到结果。我会推荐你使用 http://download.geofabrik.de/asia/china.html for such downloads. Please visit [1]: https://github.com/gboeing/osmnx/issues/151, and [2]: https://github.com/gboeing/osmnx/issues/445