python中osmnx库的ox.graph_from_bbox()函数给出了不完整的图

发布于 2025-01-19 15:50:25 字数 720 浏览 2 评论 0原文

我有一个代码,该代码提供了从源点到目标点的路由。 在以下代码中,Origin_lat和Origin_long是源坐标,dest_lat和dest_long是目标坐标,

G = ox.graph_from_bbox(origin_lat,dest_lat,origin_long,dest_long, network_type='drive')
origin_point = (origin_lat, origin_long) 
destination_point = (dest_lat, dest_long)
origin_node = ox.get_nearest_node(G, origin_point,method='euclidean')
destination_node = ox.get_nearest_node(G, destination_point,method='euclidean')
route = nx.shortest_path(G, origin_node, destination_node, weight='travel_time')

但对于某些坐标,我没有从源到目的地的完整路线。我已经连接了输出的屏幕截图,其中我已经在ScatterMapbox上绘制了路由 image 黑色路由未达到源和目的地,表示图本身不完整。任何人都可以帮助我。

I have a piece of code which provides the route from a source point to destination point.
In the below code, origin_lat and origin_long are the source coordinates and dest_lat and dest_long are the destination coordinates

G = ox.graph_from_bbox(origin_lat,dest_lat,origin_long,dest_long, network_type='drive')
origin_point = (origin_lat, origin_long) 
destination_point = (dest_lat, dest_long)
origin_node = ox.get_nearest_node(G, origin_point,method='euclidean')
destination_node = ox.get_nearest_node(G, destination_point,method='euclidean')
route = nx.shortest_path(G, origin_node, destination_node, weight='travel_time')

But for some coordinates, I am not getting a complete route from source to destination. I have attached the screenshot of the output where I have plotted the route on ScatterMapbox image
The black route is not reaching the source and destination, means the graph itself is incomplete. Can anyone help me out with this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文