python最短路径点

2024-04-20 03:02:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个点坐标系,还有两个点和终点坐标系。 我想知道最短路径附近点的索引

gdf_points = gpd.GeoDataFrame(geometry=gpd.points_from_xy([0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5], 
                                                          [0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4]))
gdf_start= gpd.GeoSeries(gpd.points_from_xy([2.5],[0.5]))
gdf_end= gpd.GeoSeries(gpd.points_from_xy([0.5],[3.5]))
ax=gdf_points.plot() 
gdf_start.plot(ax=ax)
gdf_end.plot(ax=ax)

enter image description here

enter image description here


Tags: from路径plotaxstartpointsend坐标系