56000b4ac3808e10ee064125978347375fecba8a,osmnx/folium.py,,plot_route_folium,#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,152

Before Change



    // create gdf of the route edges
    gdf_edges = utils_graph.graph_to_gdfs(G.subgraph(route), nodes=False, fill_edge_geometry=True)
    route_nodes = list(zip(route[:-1], route[1:]))
    index = [
        gdf_edges[(gdf_edges["u"] == u) & (gdf_edges["v"] == v)].index[0] for u, v in route_nodes
    ]
    gdf_route_edges = gdf_edges.loc[index]

    // get route centroid
    x, y = gdf_route_edges.unary_union.centroid.xy
    route_centroid = (y[0], x[0])

    // create the folium web map if one wasn"t passed-in
    if route_map is None:
        route_map = folium.Map(location=route_centroid, zoom_start=zoom, tiles=tiles)

    // add each route edge to the map
    for _, row in gdf_route_edges.iterrows():
        pl = _make_folium_polyline(
            edge=row,
            edge_color=route_color,
            edge_width=route_width,
            edge_opacity=route_opacity,
            popup_attribute=popup_attribute,
            **kwargs,
        )
        pl.add_to(route_map)

    // if fit_bounds is True, fit the map to the bounds of the route by passing
    // list of lat-lng points as [southwest, northeast]
    if fit_bounds and isinstance(route_map, folium.Map):
        tb = gdf_route_edges.total_bounds
        bounds = [(tb[1], tb[0]), (tb[3], tb[2])]
        route_map.fit_bounds(bounds)

    return route_map

After Change



    // create gdf of the route edges in order
    node_pairs = zip(route[:-1], route[1:])
    uvk = ((u, v, min(G[u][v], key=G[u][v].get("length"))) for u, v in node_pairs)
    gdf_edges = utils_graph.graph_to_gdfs(G.subgraph(route), nodes=False).loc[uvk]

    // get route centroid
    x, y = gdf_edges.unary_union.centroid.xy
    route_centroid = (y[0], x[0])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: gboeing/osmnx
Commit Name: 56000b4ac3808e10ee064125978347375fecba8a
Time: 2020-11-18
Author: boeing@usc.edu
File Name: osmnx/folium.py
Class Name:
Method Name: plot_route_folium


Project Name: ContextLab/hypertools
Commit Name: 3c8f5966e66f2222d2cfa3770d2ac923d254b61a
Time: 2016-12-20
Author: andrew.heusser@gmail.com
File Name: python/hypertools/_shared/helpers.py
Class Name:
Method Name: vals2colors


Project Name: ContextLab/hypertools
Commit Name: 50f590603a1dd562453926edaab69267633b8455
Time: 2016-12-20
Author: andrew.heusser@gmail.com
File Name: python/hypertools/_shared/helpers.py
Class Name:
Method Name: vals2colors


Project Name: gboeing/osmnx
Commit Name: f727d48d75e9c313855108bd7b759d1404c70ea1
Time: 2020-12-02
Author: boeing@usc.edu
File Name: osmnx/folium.py
Class Name:
Method Name: plot_route_folium