b43ab325ce3e9b4f6b39af7a0f4b8338578bb89a,osmnx/distance.py,,get_nearest_edge,#Any#Any#Any#Any#,314

Before Change


        Or a tuple of (u, v, key, geom, dist) if return_geom and return_dist are True.
    
    // 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
    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
    (u, v, key), geom, dist = min(distances, key=lambda x: x[2])
    utils.log(f"Found nearest edge ({u, v, key}) to point {point}")

After Change


        Or a tuple of (u, v, key, dist) if return_dist is True.
        Or a tuple of (u, v, key, geom, dist) if return_geom and return_dist are True.
    
    ne, dist = nearest_edges(G, X=[point[1]], Y=[point[0]], return_dist=True)
    u, v, key = ne[0]
    geom = utils_graph.graph_to_gdfs(G, nodes=False).loc[(u, v, key), "geometry"]
    if return_dist and return_geom:
        return u, v, key, geom, dist[0]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


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: matplotlib/matplotlib
Commit Name: c71244ca37022167536cd9bd6c6f8104da92cf52
Time: 2019-09-30
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/_cm_listed.py
Class Name:
Method Name:


Project Name: bokeh/bokeh
Commit Name: 849729af279adeb657bd3d864df84aa038b79c3d
Time: 2015-12-22
Author: bryanv@continuum.io
File Name: examples/plotting/file/periodic.py
Class Name:
Method Name: