fe8f96e9981376e26984bfa4812916d14856dc05,osmnx/distance.py,,get_nearest_edge,#Any#Any#Any#Any#,168

Before Change


    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])

After Change


    // 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}")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: HyperGAN/HyperGAN
Commit Name: 25e57a1d525fffe215b6226f9206d1f51cbc5e58
Time: 2017-06-08
Author: martyn@255bits.com
File Name: hypergan/discriminators/autoencoder_discriminator.py
Class Name: AutoencoderDiscriminator
Method Name: build


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