Exemplo n.º 1
0
def test_download_graph__custom_node_tags(tag: str) -> None:
    """
    Make sure additional node tags have been fetched.
    """
    graph = graph_utils.download_map(["Nailsea, North Somerset, England"],
                                     node_tags=[tag])
    nodes, _ = osmnx.utils_graph.graph_to_gdfs(graph)
    assert tag in nodes.columns.tolist()
Exemplo n.º 2
0
def test_download_graph__add_grades() -> None:
    """
    Make sure grades are attached once an Google API key has been provided.
    """
    graph = graph_utils.download_map(["Nailsea, North Somerset, England"],
                                     api_key="some_random_api_key")
    _, edges = osmnx.utils_graph.graph_to_gdfs(graph)
    assert "grade" in edges.columns.tolist()
Exemplo n.º 3
0
def test_download_graph__add_elevation() -> None:
    """
    Make sure elevation is attached once an Google API key has been provided.
    """
    graph = graph_utils.download_map(["Nailsea, North Somerset, England"],
                                     api_key="some_random_api_key")
    nodes, _ = osmnx.utils_graph.graph_to_gdfs(graph)
    assert "elevation" in nodes.columns.tolist()
Exemplo n.º 4
0
def test_download_map() -> None:
    """
    Make sure we can download a map.
    """
    graph = graph_utils.download_map(["Nailsea, North Somerset, England"])
    assert isinstance(graph, networkx.DiGraph)

    # make sure some specific attributes/tags are available
    nodes, edges = osmnx.utils_graph.graph_to_gdfs(graph)
    assert not {
        "osmid",
        "highway",
        "name",
        "maxspeed",
        "length",
        "junction",
        "oneway",
        "bearing",
        "speed_kph",
        "travel_time",
    }.difference(edges.columns.tolist())
    assert not {"y", "x", "highway", "junction", "street_count"}.difference(
        nodes.columns.tolist())