fe8f96e9981376e26984bfa4812916d14856dc05,osmnx/distance.py,,get_nearest_edge,#Any#Any#Any#Any#,168
Before Change
Or a tuple of (u, v, key, geom, dist) if return_geom and return_dist are True.
// get u, v, key, geom from all the graph edges
gdf_edges = utils_graph.graph_to_gdfs(G, nodes=False, fill_edge_geometry=True)
edges = gdf_edges[["u", "v", "key", "geometry"]].values
// convert lat,lng (y,x) point to x,y for shapely distance operation
xy_point = Point(reversed(point))
// calculate euclidean distance from each edge"s geometry to this point
edge_distances = [(edge, xy_point.distance(edge[3])) for edge in edges]
// the nearest edge minimizes the distance to the point
(u, v, key, geom), dist = min(edge_distances, key=lambda x: x[1])
utils.log(f"Found nearest edge ({u, v, key}) to point {point}")
After Change
xy_point = Point(reversed(point))
// calculate euclidean distance from each edge"s geometry to this point
gs_edges = utils_graph .graph_to_gdfs(G, nodes=False)["geometry"]
uvk_geoms = zip(gs_edges.index, gs_edges.values )
distances = ((uvk, geom, xy_point.distance(geom)) for uvk, geom in uvk_geoms)
// the nearest edge minimizes the distance to the point
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances Project Name: gboeing/osmnx
Commit Name: fe8f96e9981376e26984bfa4812916d14856dc05
Time: 2020-11-18
Author: boeing@usc.edu
File Name: osmnx/distance.py
Class Name:
Method Name: get_nearest_edge
Project Name: gboeing/osmnx
Commit Name: b43ab325ce3e9b4f6b39af7a0f4b8338578bb89a
Time: 2021-03-16
Author: boeing@usc.edu
File Name: osmnx/distance.py
Class Name:
Method Name: get_nearest_edge
Project Name: gboeing/osmnx
Commit Name: c46a77985576103fc92ac95395f4d8410f56f029
Time: 2020-12-02
Author: boeing@usc.edu
File Name: osmnx/distance.py
Class Name:
Method Name: get_nearest_edge