OSMnx的大图形\u from_place()请求导致超时错误

2024-06-10 02:43:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用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()(timeout=10180(默认),1000,…)函数中尝试了各种超时,但我不完全理解这里的超时意味着什么。我想我不明白的是请求中的超时和立交桥Turbo中的超时之间的关系


Tags: fromapihostporttimeoutplacede高速公路
1条回答
网友
1楼 · 发布于 2024-06-10 02:43:34

ox.config(timeout=10000)将完成你的工作ox.config()是一个非常方便的函数,它还可以用于许多其他自定义设置。我尝试了这个功能,但在我的情况下,基础设施不支持。否则,我的查询就完成了,3小时后我得到了结果。我建议您使用http://download.geofabrik.de/asia/china.html进行此类下载。请访问[1]:https://github.com/gboeing/osmnx/issues/151和[2]:https://github.com/gboeing/osmnx/issues/445

相关问题 更多 >