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

标签 python openstreetmap osmnx

我正在使用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 参数值,该函数将沿边缘插入均匀间隔的点,然后根据点的最小值找到距离您的点最近的边缘到沿边缘几何形状的任何插值点的距离。这在几何上稍微不精确(这种不精确性随您的插值值而变化),但在搜索许多点时速度最快,特别是在较小或中等大小的图中。

关于python - OSMNX - 边缘的 "part"被认为是最近的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69673649/

相关文章:

python - 如何将我的 Python2.6 站点包移动到 Python2.7?

python - 查找其键与子字符串匹配的字典项

python - OSMnx - 示例文件的问题

openstreetmap - 使用 OSMNX : how to retrieve the Hannover subway network? 打开街道 map

python - Osmnx:如何检索作为高速公路一部分的公交车站信息节点的信息?

python - 根据重复值将 Dataframe 拆分为多个 csv 文件

python - Plotly:如何在带有刻面的图形表达图形中隐藏轴标题?

javascript - 如何通过管道将文件传输到 eager.io

python - 使用 python 3 使用 PyQt4 QWebView 查看 map

android osmdroid 将本地语言更改为英语