OSMNX - 边的 "part" 被认为是最近的

OSMNX - what "part" of an edge is considered the nearest

我正在使用 OSMNX 中的 nearest_edges 函数。我不清楚在进行此计算时使用了边缘的哪个“部分”。它是边缘的任何一部分吗?是中点吗?

对于网络中的长边,它会产生很大的不同。

这取决于您如何对函数进行参数化。从 nearest_edges 函数 documentation:

Find the nearest edge to a point or to each of several points.

If X and Y are single coordinate values, this will return the nearest edge to that point. If X and Y are lists of coordinate values, this will return the nearest edge to each point.

If interpolate is None, search for the nearest edge to each point, one at a time, using an r-tree and minimizing the euclidean distances from the point to the possible matches. For accuracy, use a projected graph and points. This method is precise and also fastest if searching for few points relative to the graph’s size.

For a faster method if searching for many points relative to the graph’s size, use the interpolate argument to interpolate points along the edges and index them. If the graph is projected, this uses a k-d tree for euclidean nearest neighbor search, which requires that scipy is installed as an optional dependency. If graph is unprojected, this uses a ball tree for haversine nearest neighbor search, which requires that scikit-learn is installed as an optional dependency.

因此,如果您离开 interpolate=None(理想情况下使用投影图和投影点以确保准确性),该函数将根据点到您的点的最小距离找到离您的点最近的边边缘几何的任何部分。这在几何上是精确的,并且如果只在大图中搜索几个点是最快的。

或者,如果您传递一个 interpolate 参数值,该函数将沿边插入均匀间隔的点,然后根据点的最小距离找到离您的点最近的边到沿边几何的任何插值点。这在几何上有点不精确(这种不精确性随您的 interpolate 值而变化)但在搜索许多点时速度最快,尤其是在较小或中等大小的图形中。