Python 沿最近边获取最近节点

Python 沿最近边获取最近节点,python,osmnx,Python,Osmnx,我在这篇文章中遵循gboeing的回复并使用osmnx Docker图像,但我得到了错误AttributeError:module'osmnx'没有属性'great\u circle\u vec' Docker似乎有最新的0.16 osmnx版本,当前文档没有提到此函数已被弃用或私有。建议的代码已经有一年半的历史了,所以可能有些东西已经改变了。有没有人有一个最新的解决方案来沿着最近的边获取最近的节点?使用osmnx.distance.great\u circle\u vec(args) 如果有人

我在这篇文章中遵循gboeing的回复并使用osmnx Docker图像,但我得到了错误
AttributeError:module'osmnx'没有属性'great\u circle\u vec'


Docker似乎有最新的0.16 osmnx版本,当前文档没有提到此函数已被弃用或私有。建议的代码已经有一年半的历史了,所以可能有些东西已经改变了。有没有人有一个最新的解决方案来沿着最近的边获取最近的节点?

使用
osmnx.distance.great\u circle\u vec(args)

如果有人感兴趣,我可以根据最初的github问题编写一些代码,以获取最近边缘上最近的lat/lng。它看起来像这样:

def nearest_point_on_edge(G, lat, lng, edge):
    ''' Return nearest point to lat/lng on edge 
    '''
    orig_point = Point(lng, lat)
    a_point = Point(G.nodes[edge[0]]['x'], G.nodes[edge[0]]['y'])
    b_point = Point(G.nodes[edge[1]]['x'], G.nodes[edge[1]]['y'])
    a_latlng = (G.nodes[edge[0]]['y'], G.nodes[edge[0]]['x'])
    b_latlng = (G.nodes[edge[1]]['y'], G.nodes[edge[1]]['x'])
    dist_ab = LineString([a_point, b_point]).project(orig_point)
    projected_orig_point = list(LineString([a_point, b_point]).interpolate(dist_ab).coords)
    nearest_latlng = (projected_orig_point[0][1], projected_orig_point[0][0])
    return nearest_latlng

谢谢你指出这一点。事后看来,这应该是显而易见的。但我确实有一个问题,关于你对最初问题的回答,那就是在最近的边上找到最近的点。我看到您的内置解决方案可以找到最近边的最近节点。osmnx中有没有内置的方法来获取最近边上最近点的坐标?没有,不是内置的。谢谢。我可以用原始帖子中的部分代码来实现这一点。我会把它贴在这里,以防万一有人感兴趣。