Esempio n. 1
0
    ),
    4: OsmNode(
        id=4,
        coord=GeoCoordinate(lng=-2.0, lat=-2.0),
        ways=[],
        metadata={"hd_edges": "[]"},
    ),
    5: OsmNode(
        id=5,
        coord=GeoCoordinate(lng=-2.0, lat=-1.0),
        ways=[],
        metadata={"hd_edges": "[]"},
    ),
}
base_ways = {
    1: Way(id=1, nodes=[1, 2], tags={"highway": "primary"}),
    2: Way(id=2, nodes=[1, 5, 4, 3, 2], tags={"highway": "primary"}),
}
base_relations = {}

base_data = Mock(nodes=base_nodes, ways=base_ways, relations=base_relations)

fake_mask = Mask(
    nodes={1, 2, 3, 4, 5},
    edges={(1, 2), (2, 1), (2, 3), (3, 2), (3, 4), (4, 5), (5, 1)},
    relations={(1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 1), (3, 2, 1), (5, 1, 2)},
    hd_mapping={},
)

expected_ways = {
    1: Way(id=1, nodes=[1, 2], tags={"highway": "primary"}),
        id=4,
        coord=GeoCoordinate(lng=0.0, lat=1.0),
        ways=[],
        metadata={"hd_edges": "[]"},
    ),
    5:
    OsmNode(
        id=5,
        coord=GeoCoordinate(lng=0.0, lat=-1.0),
        ways=[],
        metadata={"hd_edges": "[]"},
    ),
}
base_ways = {
    1: Way(id=1, nodes=[1, 2, 3], tags={
        "highway": "primary",
        "oneway": "yes"
    }),
    2: Way(id=2, nodes=[4, 2, 5], tags={
        "highway": "primary",
        "oneway": "yes"
    }),
}
base_relations = {}

base_data = Mock(nodes=base_nodes, ways=base_ways, relations=base_relations)

fake_mask = Mask(
    nodes={1, 2, 3, 4, 5},
    edges={(1, 2), (2, 3), (4, 2), (2, 5)},
    relations={(1, 2, 3), (4, 2, 5), (4, 2, 1)},
    hd_mapping={},
Esempio n. 3
0
    ),
    4:
    OsmNode(
        id=4,
        coord=GeoCoordinate(lng=2.0, lat=0.0),
        ways=[2],
        metadata={
            "version": 1,
            "hd_edges": "[]"
        },
    ),
}

base_ways = {
    1: Way(id=1, nodes=[1, 2], tags={
        "version": 1,
        "highway": "primary"
    }),
    2: Way(id=2, nodes=[3, 4], tags={
        "version": 1,
        "highway": "primary"
    }),
}

base_relations = {
    (2, 3, 4):
    Relation(
        1,
        from_way=1,
        from_node=2,
        via=ViaNode(3),
        to_way=2,
Esempio n. 4
0
        },
    ),
    8:
    OsmNode(
        id=8,
        coord=GeoCoordinate(lng=0, lat=-3),
        metadata={
            "version": 1,
            "hd_edges": "[]"
        },
    ),
}

base_ways = {
    1: Way(id=1, nodes=[1, 2, 3], tags={
        "version": 1,
        "highway": "primary"
    }),
    2: Way(id=2, nodes=[3, 4, 5], tags={
        "version": 1,
        "highway": "primary"
    }),
    3: Way(id=3, nodes=[7, 6, 5], tags={
        "version": 1,
        "highway": "primary"
    }),
    4: Way(id=4, nodes=[7, 8], tags={
        "version": 1,
        "highway": "primary"
    }),
}
        coord=GeoCoordinate(lng=0.0, lat=1.0),
        ways=[4],
        metadata={
            "version": 1,
            "hd_edges": "[]"
        },
    ),
}

base_ways = {
    1:
    Way(
        id=1,
        nodes=[1, 2, 3],
        tags={
            "version": 1,
            "highway": "primary",
            "oneway": "yes"
        },
    ),
    2:
    Way(id=2,
        nodes=[4, 1],
        tags={
            "version": 1,
            "highway": "primary",
            "oneway": "yes"
        }),
    3:
    Way(id=3,
        nodes=[3, 5],
    OsmNode(
        id=2,
        coord=GeoCoordinate(lng=0.0, lat=0.0),
        ways=[],
        metadata={"hd_edges": "[]"},
    ),
    3:
    OsmNode(
        id=3,
        coord=GeoCoordinate(lng=1.0, lat=0.0),
        ways=[],
        metadata={"hd_edges": "[]"},
    ),
}

base_ways = {1: Way(id=1, nodes=[1, 2, 3], tags={"highway": "primary"})}

base_relations = {}

base_data = Mock(nodes=base_nodes, ways=base_ways, relations=base_relations)

fake_mask = Mask(nodes={1, 2, 3},
                 edges={(1, 2), (2, 3)},
                 relations={(1, 2, 3)},
                 hd_mapping={})

expected_nodes = {
    1:
    OsmNode(
        id=1,
        coord=GeoCoordinate(lng=-1.0, lat=0.0),
    OsmNode(1,
            coord=GeoCoordinate(lng=-1.0, lat=0.0),
            ways=[],
            metadata={"hd_edges": "[]"}),
    2:
    OsmNode(2,
            coord=GeoCoordinate(lng=0.0, lat=0.0),
            ways=[],
            metadata={"hd_edges": "[]"}),
    3:
    OsmNode(3,
            coord=GeoCoordinate(lng=1.0, lat=0.0),
            ways=[],
            metadata={"hd_edges": "[]"}),
}
base_ways = {1: Way(id=1, nodes=[1, 2, 3, 4, 5], tags={"highway": "primary"})}
base_relations = {}

base_data = Mock(nodes=base_nodes, ways=base_ways, relations=base_relations)

fake_mask = Mask(
    nodes={1, 2, 3},
    edges={(1, 2), (2, 1), (2, 3), (3, 2)},
    relations={(1, 2, 3), (3, 2, 1)},
    hd_mapping={},
)

expected_nodes = {
    1:
    OsmNode(
        id=1,