【问题标题】:How to find lat and long by splitting shortest path into several distances如何通过将最短路径分成几个距离来找到纬度和经度
【发布时间】:2021-10-16 09:38:53
【问题描述】:

说,我使用 osmnx 最短路径找到了从 start_node 到 end_node 的最短路径/路线。下面是示例代码:

route = nx.shortest_path(g, start_node, end_node, weight='length')
shortest_dist = nx.shortest_path_length(g, start_node, end_node, weight='length')

原来距离是 934 m。这里是它在图中的样子:

如何获得最短路线每 100 m 的经纬度坐标。

【问题讨论】:

    标签: geolocation coordinates geospatial shortest-path osmnx


    【解决方案1】:

    您可以获取路线的几何图形,然后沿其插入点:https://osmnx.readthedocs.io/en/stable/osmnx.html#osmnx.utils_geo.interpolate_points

    【讨论】:

    • 谢谢 Geoff,我有点犹豫。据说dist的参数应该在geom的同一单位。而且我已经将我的路线(最短路径)转换为 LineString 几何。那么,我是否正确假设我的 geom 的单位长度在 WSG84 中。如果是这样,那么我如何将 100m 放入我的 geom 的单位长度中?
    • 如果您的几何图形是未投影的(即十进制度单位),那么您应该将其投影到基于米的投影,以米为单位。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-22
    • 2012-02-10
    • 1970-01-01
    • 2010-11-28
    • 2010-12-11
    • 1970-01-01
    相关资源
    最近更新 更多