Kar*_*dda 3 python geospatial openstreetmap driving-distance
我想获得python中两点之间的行驶距离。我不被允许使用 Google Maps API。是否有任何开源 API 可以帮助计算两点之间的行驶距离?如果是的话,一个小例子是 Python 将是惊人的。提前致谢。
小智 12
来自 python 包 OSMNX 的示例:
示例文档-> 路由
import networkx as nx
import osmnx as ox
# get the nearest network node to each point
orig_node = ox.get_nearest_node(G, (37.828903, -122.245846))
dest_node = ox.get_nearest_node(G, (37.812303, -122.215006))
# how long is our route in meters?
nx.shortest_path_length(G, orig_node, dest_node, weight='length')
Run Code Online (Sandbox Code Playgroud)
关于如何安装的文档:https : //osmnx.readthedocs.io/en/stable/#installation
请注意以下摘录:
'如果您是 pip 安装 OSMnx,请先安装 geopandas 和 rtree。使用 conda-forge 来安装这些依赖项是最简单的。'
| 归档时间: |
|
| 查看次数: |
5827 次 |
| 最近记录: |