Пример #1
0
def test_run_from_location_name_without_additional_nodes(
    default_output_pois_columns, default_output_network_columns
):
    location_name = "roanne"

    network_initialized = OsmGt.roads_from_location(location_name, "pedestrian")
    graph_computed = network_initialized.get_graph()
    network_gdf = network_initialized.get_gdf()

    shared_asserts(
        None,
        network_gdf,
        default_output_pois_columns,
        default_output_network_columns,
        graph_computed,
    )

    network_topology_gdfs = network_initialized.topology_checker()
    assert {
        "lines_unchanged",
        "lines_added",
        "lines_split",
        "nodes_added",
        "intersections_added",
    } == set(network_topology_gdfs.keys())
    for title, topology_gdf in network_topology_gdfs.items():
        if title in ["nodes_added", "lines_added"]:
            assert topology_gdf.shape[0] == 0
        else:
            assert topology_gdf.shape[0] > 0
        assert topology_gdf.shape[-1] == 5
Пример #2
0
def test_run_from_location_name_with_additional_nodes(
    default_output_pois_columns, default_output_network_columns
):
    location_name = "roanne"
    pois_initialized = OsmGt.pois_from_location(location_name)

    pois_study_area = pois_initialized.study_area
    assert pois_study_area.geom_type == "Polygon"

    pois_gdf = pois_initialized.get_gdf()
    network_initialized = OsmGt.roads_from_location(
        location_name, "pedestrian", pois_gdf
    )
    study_area = network_initialized.study_area
    assert study_area.geom_type == "Polygon"

    graph_computed = network_initialized.get_graph()
    network_gdf = network_initialized.get_gdf()

    shared_asserts(
        pois_gdf,
        network_gdf,
        default_output_pois_columns,
        default_output_network_columns,
        graph_computed,
    )

    network_topology_gdfs = network_initialized.topology_checker()
    assert {
        "lines_unchanged",
        "lines_added",
        "lines_split",
        "nodes_added",
        "intersections_added",
    } == set(network_topology_gdfs.keys())
    for topology_gdf in network_topology_gdfs.values():
        assert topology_gdf.shape[0] > 0
        assert topology_gdf.shape[1] == 5