def test_de_bs_ring_order(self):
        import dsl

        z, x, y = (16, 34583, 21151)

        self.generate_fixtures(
            dsl.is_in('DE', z, x, y),
            # https://www.openstreetmap.org/way/4329503
            dsl.way(4329503, dsl.tile_diagonal(z, x, y), {
                'toll:N3': 'yes', 'maxspeed': '60', 'lanes': '2',
                'name': 'Krohnstieg', 'surface': 'asphalt', 'lit': 'yes',
                'source': 'openstreetmap.org', 'oneway': 'yes', 'foot': 'no',
                'bicycle': 'no', 'ref': 'Ring 3;B 433', 'highway': 'trunk',
            }),
            dsl.relation(1, {
                'source': 'openstreetmap.org', 'route': 'road',
                'type': 'route', 'name': 'Ring 3',
            }, ways=[4329503]),
            dsl.relation(3, {
                'name': 'B433', 'type': 'route', 'route': 'road',
                'source': 'openstreetmap.org', 'ref': 'B 433',
            }, ways=[4329503]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4329503,
                'shield_text': 'B433', 'network': 'DE:BS',
                'all_shield_texts': ['B433', 'Ring 3'],
                'all_networks': ['DE:BS', 'DE:Hamburg:Ring'],
            })
    def test_de_bs(self):
        import dsl

        z, x, y = (16, 34605, 21611)

        self.generate_fixtures(
            dsl.is_in('DE', z, x, y),
            # https://www.openstreetmap.org/way/5136775
            dsl.way(5136775, dsl.tile_diagonal(z, x, y), {
                'source:maxspeed': 'DE:rural', 'source': 'openstreetmap.org',
                'maxspeed': '100', 'ref': 'B 6', 'highway': 'secondary',
            }),
            dsl.relation(1, {
                'name': 'B 6 Salzgitter - Hildesheim', 'ref': 'B 6',
                'route': 'road', 'source': 'openstreetmap.org',
                'operator': 'Bundesrepublik Deutschland', 'type': 'route',
            }, ways=[5136775]),
            dsl.relation(2, {
                'name': 'B 6 Hildesheim - Salzgitter', 'ref': 'B 6',
                'route': 'road', 'source': 'openstreetmap.org',
                'operator': 'Bundesrepublik Deutschland', 'type': 'route',
            }, ways=[5136775]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 5136775,
                'shield_text': 'B6', 'network': 'DE:BS',
                'all_shield_texts': ['B6'],
                'all_networks': ['DE:BS'],
            })
    def test_c_road(self):
        import dsl

        z, x, y = (16, 59435, 40315)

        self.generate_fixtures(
            dsl.way(1, dsl.tile_box(z, x, y), {
                'kind': 'admin_area', 'iso_code': 'AU',
                'source': 'openstreetmap.org',
            }),
            # https://www.openstreetmap.org/way/7787334
            dsl.way(7787334, dsl.tile_diagonal(z, x, y), {
                'name': 'Churchill - Traralgon Road', 'surface': 'paved',
                'source': 'openstreetmap.org', 'oneway': 'yes',
                'ref': 'C475;C476', 'highway': 'secondary',
            }),
            dsl.relation(1, {
                'name': 'Mattingley Hill Road', 'ref': 'C475', 'route': 'road',
                'addr:state': 'VIC', 'source': 'openstreetmap.org',
                'type': 'route', 'addr:country': 'AU',
            }, ways=[7787334]),
            dsl.relation(2, {
                'ref': 'C476', 'route': 'road', 'addr:state': 'VIC',
                'source': 'openstreetmap.org', 'type': 'route',
                'addr:country': 'AU',
            }, ways=[7787334]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 7787334, 'shield_text': 'C475', 'network': 'AU:C-road',
                'all_shield_texts': ['C475', 'C476'],
                'all_networks': ['AU:C-road', 'AU:C-road'],
            })
    def test_s_road_in_both_relations(self):
        import dsl

        z, x, y = (16, 60644, 38056)

        self.generate_fixtures(
            dsl.way(1, dsl.tile_box(z, x, y), {
                'kind': 'admin_area', 'iso_code': 'AU',
                'source': 'openstreetmap.org'
            }),
            # https://www.openstreetmap.org/way/240922938
            dsl.way(240922938, dsl.tile_diagonal(z, x, y), {
                'source:name': 'survey', 'maxspeed': '60', 'lanes': '2',
                'name': 'Beaudesert Beenleigh Road',
                'source:maxspeed': 'sign', 'surface': 'asphalt',
                'source': 'openstreetmap.org', 'source:ref': 'survey',
                'ref': '92;T8', 'highway': 'primary', 'network': 'S',
            }),
            dsl.relation(1, {
                'network': 'S', 'ref': '92', 'route': 'road',
                'addr:state': 'QLD', 'source': 'openstreetmap.org',
                'type': 'route', 'addr:country': 'AU',
            }, ways=[240922938]),
            dsl.relation(2, {
                'type': 'route', 'route': 'road', 'ref': '8', 'network': 'T',
                'source': 'openstreetmap.org'
            }, ways=[240922938]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 240922938, 'shield_text': '92', 'network': 'AU:S-route',
                'all_networks': ['AU:S-route', 'AU:T-drive'],
                'all_shield_texts': ['92', '8'],
            })
    def test_cn_x102(self):
        import dsl

        z, x, y = (16, 51492, 28421)

        self.generate_fixtures(
            dsl.is_in('CN', z, x, y),
            # https://www.openstreetmap.org/way/50677938
            dsl.way(50677938, dsl.tile_diagonal(z, x, y), {
                'source': 'openstreetmap.org', 'ref': 'X102;S214',
                'highway': 'primary',
            }),
            dsl.relation(1, {
                'type': 'route', 'route': 'road', 'ref': 'S214',
                'name': 'S214', 'source': 'openstreetmap.org',
            }, ways=[50677938]),
            dsl.relation(2, {
                'type': 'route', 'route': 'road', 'ref': 'X102',
                'name': 'X102', 'source': 'openstreetmap.org',
            }, ways=[50677938]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 50677938,
                'shield_text': 'S214', 'network': 'CN:expressway:regional',
                'all_shield_texts': ['S214', 'X102'],
                'all_networks': [
                    'CN:expressway:regional',
                    'CN:JX',
                ],
            })
    def test_101_zaregional(self):
        import dsl

        z, x, y = (16, 36189, 39319)

        self.generate_fixtures(
            dsl.is_in('ZA', z, x, y),
            # https://www.openstreetmap.org/way/56160610
            dsl.way(56160610, dsl.tile_diagonal(z, x, y), {
                'highway': u'secondary',
                'maxspeed': u'80',
                'ref': u'R304;R101',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'direction': u'south',
                'name': u'R101 (southbound)',
                'network': u'za:regional',
                'ref': u'R101',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[56160610]),
            dsl.relation(2, {
                'direction': u'north',
                'name': u'R101 (northbound)',
                'network': u'za:regional',
                'ref': u'R101',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[56160610]),
            dsl.relation(3, {
                'direction': u'south',
                'name': u'R304 (southbound)',
                'network': u'za:regional',
                'ref': u'R304',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[56160610]),
            dsl.relation(4, {
                'direction': u'north',
                'name': u'R304 (northbound)',
                'network': u'za:regional',
                'ref': u'R304',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[56160610]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 56160610,
                'network': u'ZA:regional',
                'shield_text': u'101',
                'all_networks': ['ZA:regional', 'ZA:regional'],
                'all_shield_texts': ['101', '304'],
            })
Beispiel #7
0
    def test_o31_tr(self):
        import dsl

        z, x, y = (16, 37725, 25197)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4392510
            dsl.way(
                4392510, dsl.tile_diagonal(z, x, y), {
                    'highway': u'motorway',
                    'int_ref': u'E 87',
                    'lanes': u'3',
                    'maxspeed': u'120',
                    'oneway': u'yes',
                    'ref': u'O-31',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                    'toll': u'yes',
                }),
            dsl.relation(1, {
                'name:bg': u'Европейски път Е 87, Турция',
                'name:de': u'Europastraße 87, Türkei',
                'name:en': u'European Route 87, Turkey',
                'network': u'e-road',
                'ref': u'E 87',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4392510]),
            dsl.relation(2, {
                'e-road': u'A_link',
                'from': u'E 87',
                'network': u'e-road',
                'route': u'road',
                'source': u'openstreetmap.org',
                'to': u'E 96',
                'type': u'route',
            },
                         ways=[4392510]),
            dsl.relation(3, {
                'description': u'İzmir - Aydın otoyolu',
                'network': u'TR-roads',
                'ref': u'O-31',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4392510]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4392510,
                'network': u'TR:motorway',
                'shield_text': u'O31',
                'all_networks': ['TR:motorway', 'e-road'],
                'all_shield_texts': ['O31', 'E87'],
            })
    def test_pb(self):
        import dsl

        z, x, y = (16, 25886, 34039)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/31514019
            dsl.way(31514019, dsl.tile_diagonal(z, x, y), {
                'horse': 'yes', 'maxspeed': '80', 'bicycle': 'yes',
                'oneway': 'no', 'surface': 'asphalt', 'cycleway': 'no',
                'access': 'yes', 'source': 'openstreetmap.org',
                'IBGE:CD_ADMINIS': 'estadual', 'foot': 'yes', 'lanes': '2',
                'sidewalk': 'none', 'ref': 'PB-366', 'highway': 'secondary',
            }),
            dsl.relation(1, {
                'source': 'openstreetmap.org', 'route': 'road',
                'ref': 'PB-366', 'network': 'BR:PB', 'type': 'route',
            }, ways=[31514019]),
            dsl.relation(2, {
                'type': 'route', 'route': 'road', 'ref': 'BR-426',
                'network': 'BR', 'source': 'openstreetmap.org',
            }, ways=[31514019]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 31514019,
                'shield_text': '426', 'network': 'BR',
                'all_networks': ['BR', 'BR:PB'],
                'all_shield_texts': ['426', '366'],
            })
    def test_b_road_with_spaces(self):
        import dsl

        z, x, y = (16, 60720, 38212)

        self.generate_fixtures(
            dsl.way(
                1, dsl.tile_box(z, x, y), {
                    'kind': 'admin_area',
                    'iso_code': 'AU',
                    'source': 'openstreetmap.org',
                }),
            # https://www.openstreetmap.org/way/131293316
            dsl.way(
                131293316, dsl.tile_diagonal(z, x, y), {
                    'source:name': 'NSW LPI Base Map',
                    'name': 'Myocum Road',
                    'source:name:date': '2016-02',
                    'surface': 'asphalt',
                    'source:date': '2016-07',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'ref': 'B62;T 28;T 30',
                    'highway': 'primary',
                }),
            dsl.relation(1, {
                'ref': 'B62',
                'route': 'road',
                'addr:state': 'NSW',
                'source': 'openstreetmap.org',
                'type': 'route',
                'addr:country': 'AU',
            },
                         ways=[131293316]),
            dsl.relation(2, {
                'type': 'route',
                'route': 'road',
                'ref': '30',
                'network': 'T',
                'source': 'openstreetmap.org',
            },
                         ways=[131293316]),
            dsl.relation(3, {
                'type': 'route',
                'route': 'road',
                'ref': '28',
                'network': 'T',
                'source': 'openstreetmap.org',
            },
                         ways=[131293316]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 131293316,
                'shield_text': '62',
                'network': 'AU:B-road',
                'all_networks': ['AU:B-road', 'AU:T-drive', 'AU:T-drive'],
                'all_shield_texts': ['62', '28', '30'],
            })
    def test_br_RSC(self):
        import dsl

        z, x, y = (16, 23450, 38314)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/25979338
            dsl.way(25979338, dsl.tile_diagonal(z, x, y), {
                'name': 'Rota do Sol', 'surface': 'paved',
                'source': 'openstreetmap.org', 'oneway': 'no',
                'ref': 'RSC-453', 'highway': 'primary',
            }),
            dsl.relation(1, {
                'network': 'BR', 'ref': 'BR-453', 'route': 'road',
                'wikipedia': 'pt:BR-453', 'source': 'openstreetmap.org',
                'wikidata': 'Q2877442', 'type': 'route',
            }, ways=[25979338]),
            dsl.relation(2, {
                'old_ref': 'RST-453', 'name': 'Rota do Sol', 'route': 'road',
                'source:official_name': 'LO 11432/2000', 'type': 'route',
                'official_name': 'Rota do Sol Euclides Triches',
                'source': 'openstreetmap.org', 'ref': 'RSC-453',
                'network': 'BR:RS',
            }, ways=[25979338]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 25979338,
                'shield_text': '453', 'network': 'BR',
                'all_shield_texts': ['453', '453'],
                'all_networks': ['BR', 'BR:RS']
            })
Beispiel #11
0
    def test_de_bab(self):
        import dsl

        z, x, y = (16, 34029, 22225)

        self.generate_fixtures(
            dsl.is_in('DE', z, x, y),
            # https://www.openstreetmap.org/way/52480330
            dsl.way(
                52480330, dsl.tile_diagonal(z, x, y), {
                    'maxspeed': '130',
                    'lanes': '2',
                    'incline': '6%',
                    'source:maxspeed': 'DE:motorway',
                    'lit': 'no',
                    'source': 'openstreetmap.org',
                    'zone:traffic': 'DE:rural',
                    'int_ref': 'E 44',
                    'oneway': 'yes',
                    'ref': 'A 1',
                    'highway': 'motorway',
                }),
            dsl.relation(1, {
                'network': 'e-road',
                'type': 'route',
                'route': 'road',
                'name:fr': u'Route europ\xe9enne E 44',
                'source': 'openstreetmap.org',
                'e-road:class': 'A-intermediate',
                'wikidata': 'Q705125',
                'ref': 'E 44',
                'description:fr': 'E 44 Le Havre - Giessen',
                'name': 'E 44 Le Havre - Giessen',
            },
                         ways=[52480330]),
            dsl.relation(2, {
                'name': 'Bundesautobahn 1',
                'type': 'route',
                'route': 'road',
                'wikipedia': 'de:Bundesautobahn 1',
                'source': 'openstreetmap.org',
                'short_name:de': 'BAB 1',
                'wikidata': 'Q9006',
                'operator': 'Bundesrepublik Deutschland',
                'ref': 'A 1',
                'TMC:cid_58:tabcd_1:Class': 'Road',
                'network': 'BAB',
            },
                         ways=[52480330]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 52480330,
                'shield_text': 'A1',
                'network': 'DE:BAB',
                'all_shield_texts': ['A1', 'E44'],
                'all_networks': ['DE:BAB', 'e-road'],
            })
Beispiel #12
0
    def test_de_bab_operator_via(self):
        import dsl

        z, x, y = (16, 34234, 22595)

        self.generate_fixtures(
            dsl.is_in('DE', z, x, y),
            # https://www.openstreetmap.org/way/207881430
            dsl.way(
                207881430, dsl.tile_diagonal(z, x, y), {
                    'source:lit': 'http://www.autobahn-bilder.de',
                    'maxspeed': 'none',
                    'lanes': '3',
                    'operator:type': 'private',
                    'source:maxspeed': 'DE:motorway',
                    'surface': 'asphalt',
                    'lit': 'no',
                    'source': 'openstreetmap.org',
                    'zone:traffic': 'DE:motorway',
                    'int_ref': 'E 35;E 52',
                    'oneway': 'yes',
                    'operator': u'Via Solutions S\xfcdwest',
                    'shoulder:right': 'yes',
                    'ref': 'A 5',
                    'highway': 'motorway',
                }),
            dsl.relation(1, {
                'network': 'e-road',
                'ref': 'E 52',
                'route': 'road',
                'source': 'openstreetmap.org',
                'type': 'route',
                'section': 'west-west',
            },
                         ways=[207881430]),
            dsl.relation(2, {
                'from': 'Amsterdam',
                'network': 'e-road',
                'source': 'openstreetmap.org',
                'type': 'route',
                'route': 'road',
                'wikipedia': 'en:European route E35',
                'to': 'Roma',
                'wikidata': 'Q313416',
                'ref': 'E 35',
                'section': 'Germany (south-north)',
            },
                         ways=[207881430]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 207881430,
                'shield_text': 'A5',
                'network': 'DE:BAB',
                'all_shield_texts': ['A5', 'E35', 'E52'],
                'all_networks': ['DE:BAB', 'e-road', 'e-road'],
            })
    def test_orr_innh_hyderabad(self):
        import dsl

        z, x, y = (16, 47010, 29526)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/520309418
            dsl.way(
                520309418, dsl.tile_diagonal(z, x, y), {
                    'bicycle': u'no',
                    'foot': u'no',
                    'highway': u'motorway',
                    'horse': u'no',
                    'lanes': u'4',
                    'maxspeed': u'120',
                    'motor_vehicle': u'designated',
                    'motorcycle': u'no',
                    'name': u'Outer Ring Road',
                    'official_name': u'Nehru Outer Ring Road',
                    'oneway': u'yes',
                    'ref': u'ORR',
                    'smoothness': u'excellent',
                    'source': u'openstreetmap.org',
                    'start_date': u'2011-08-14',
                    'surface': u'asphalt',
                }),
            dsl.relation(1, {
                'name': u'Nehru Outer Ring Road',
                'note': u'see other relation',
                'operator': u'HMDA',
                'ref': u'ORR',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q7112004',
            },
                         ways=[520309418]),
            dsl.relation(2, {
                'highway': u'motorway',
                'name': u'Outer Ring Road',
                'official_name': u'Nehru Outer Ring Road',
                'operator': u'HMDA',
                'ref': u'ORR',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q7112004',
                'wikipedia': u'en:Outer Ring Road, Hyderabad',
            },
                         ways=[520309418]),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 520309418,
            'network': u'IN:NH',
            'shield_text': u'ORR',
        })
Beispiel #14
0
    def test_d550_tr(self):
        import dsl

        z, x, y = (16, 37647, 24651)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4354149
            dsl.way(
                4354149, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'int_ref': u'E 87;E 90',
                    'name': u'E-87',
                    'oneway': u'yes',
                    'ref': u'D550',
                    'source': u'openstreetmap.org',
                }),
            dsl.relation(1, {
                'name:bg': u'Европейски път Е 87, Турция',
                'name:de': u'Europastraße 87, Türkei',
                'name:en': u'European Route 87, Turkey',
                'network': u'e-road',
                'ref': u'E 87',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4354149]),
            dsl.relation(2, {
                'network': u'TR-roads',
                'ref': u'D 550',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4354149]),
            dsl.relation(3, {
                'name': u'European Road 90',
                'name:de': u'Europastraße 90',
                'name:en': u'European Road 90',
                'network': u'e-road',
                'note': u'Turkey',
                'ref': u'E 90',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4354149]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4354149,
                'network': 'TR:highway',
                'shield_text': 'D550',
                'all_networks': ['TR:highway', 'e-road', 'e-road'],
                'all_shield_texts': ['D550', 'E87', 'E90'],
            })
Beispiel #15
0
    def test_cn_expressway(self):
        import dsl

        z, x, y = (16, 54413, 26599)

        self.generate_fixtures(
            dsl.is_in('CN', z, x, y),
            # https://www.openstreetmap.org/way/127553001
            dsl.way(
                127553001, dsl.tile_diagonal(z, x, y), {
                    'name:en': 'Huning Expressway',
                    'lanes': '4',
                    'name': u'\u6caa\u5b81\u9ad8\u901f',
                    'surface': 'asphalt',
                    'source': 'openstreetmap.org',
                    'maxspeed': '120',
                    'int_ref': 'AH5',
                    'oneway': 'yes',
                    'ref': 'G42',
                    'highway': 'motorway',
                }),
            dsl.relation(1, {
                'name:en': 'G42 Hurong Expressway',
                'network': 'CN-expressways',
                'type': 'route',
                'route': 'road',
                'source': 'openstreetmap.org',
                'ref': 'G42',
                'name': u'\u6caa\u84c9\u9ad8\u901f',
            },
                         ways=[127553001]),
            dsl.relation(2, {
                'from': 'Shanghai',
                'int_name': 'Asian Highway AH5',
                'name:id': 'AH5',
                'int_ref': 'AH5',
                'name': 'Asian Highway AH5',
                'network': 'AsianHighway',
                'ref': 'AH5',
                'route': 'road',
                'source': 'openstreetmap.org',
                'to': 'Istanbul',
                'type': 'route',
                'wikidata': 'Q4651742',
                'wikipedia': 'en:AH5',
            },
                         ways=[127553001]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 127553001,
                'shield_text': 'G42',
                'network': 'CN:expressway',
                'all_shield_texts': ['G42', 'AH5'],
                'all_networks': ['CN:expressway', 'AsianHighway'],
            })
Beispiel #16
0
    def test_a2_ro(self):
        import dsl

        z, x, y = (16, 37541, 23726)

        self.generate_fixtures(
            dsl.is_in('RO', z, x, y),
            # https://www.openstreetmap.org/way/15241569
            dsl.way(
                15241569, dsl.tile_diagonal(z, x, y), {
                    'access': u'yes',
                    'highway': u'motorway',
                    'int_ref': u'E 81',
                    'lanes': u'2',
                    'maxspeed': u'100',
                    'name': u'Autostrada Soarelui',
                    'oneway': u'yes',
                    'ref': u'A2',
                    'smoothness': u'good',
                    'source': u'openstreetmap.org',
                    'start_date': u'2004',
                    'surface': u'asphalt',
                }),
            dsl.relation(1, {
                'description:fr': u'E 81 Moukatchevo - Constanţa',
                'e-road:class': u'A-intermediate',
                'name:fr': u'Route européenne E 81',
                'network': u'e-road',
                'ref': u'E 81',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q987350',
            },
                         ways=[15241569]),
            dsl.relation(2, {
                'name': u'Autostrada A2',
                'network': u'A',
                'ref': u'A2',
                'route': u'road',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
                'type': u'route',
                'wikidata': u'Q429447',
                'wikipedia': u'en:A2 motorway (Romania)',
            },
                         ways=[15241569]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 15241569,
                'network': u'RO:motorway',
                'shield_text': u'A2',
                'all_networks': ['RO:motorway', 'e-road'],
                'all_shield_texts': ['A2', 'E81'],
            })
Beispiel #17
0
    def test_no_oslo_ring(self):
        # there's a different sign for the Store Ringvei (Oslo Ring-road). also
        # looks like in Norway they actually sign the E-roads.
        #
        # https://en.wikipedia.org/wiki/Ring_3_(Oslo)
        # https://en.wikipedia.org/wiki/Norwegian_national_road

        import dsl

        z, x, y = (16, 34736, 19062)

        self.generate_fixtures(
            dsl.is_in('NO', z, x, y),
            # https://www.openstreetmap.org/way/71218142
            dsl.way(
                71218142, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'int_ref': u'E 06',
                    'lanes': u'2',
                    'maxspeed': u'70',
                    'maxspeed:conditional': u'60 @ (Nov 01 - Apr 8)',
                    'name': u'Adolf Hedins vei',
                    'oneway': u'yes',
                    'ref': u'E 6;Ring 3',
                    'source': u'openstreetmap.org',
                }),
            dsl.relation(1, {
                'nat_ref': u'E 6',
                'network': u'e-road',
                'ref': u'E 06',
                'route': u'road',
                'section': u'Norway (south-south)',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q921422',
                'wikipedia': u'de:Europastraße 6',
            },
                         ways=[71218142]),
            dsl.relation(2, {
                'name': u'Store ringvei',
                'ref': u'Ring 3',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[71218142]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 71218142,
                'network': u'NO:oslo:ring',
                'shield_text': 'Ring 3',
                'all_networks': ['NO:oslo:ring', 'e-road'],
                'all_shield_texts': ['Ring 3', 'E 6'],
            })
    def test_o31_tr(self):
        import dsl

        z, x, y = (16, 37725, 25197)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4392510
            dsl.way(4392510, dsl.tile_diagonal(z, x, y), {
                'highway': u'motorway',
                'int_ref': u'E 87',
                'lanes': u'3',
                'maxspeed': u'120',
                'oneway': u'yes',
                'ref': u'O-31',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
                'toll': u'yes',
            }),
            dsl.relation(1, {
                'name:bg': u'Европейски път Е 87, Турция',
                'name:de': u'Europastraße 87, Türkei',
                'name:en': u'European Route 87, Turkey',
                'network': u'e-road',
                'ref': u'E 87',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4392510]),
            dsl.relation(2, {
                'e-road': u'A_link',
                'from': u'E 87',
                'network': u'e-road',
                'route': u'road',
                'source': u'openstreetmap.org',
                'to': u'E 96',
                'type': u'route',
            }, ways=[4392510]),
            dsl.relation(3, {
                'description': u'İzmir - Aydın otoyolu',
                'network': u'TR-roads',
                'ref': u'O-31',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4392510]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4392510,
                'network': u'TR:motorway',
                'shield_text': u'O31',
                'all_networks': ['TR:motorway', 'e-road'],
                'all_shield_texts': ['O31', 'E87'],
            })
Beispiel #19
0
    def test_eo7_eo82(self):
        import dsl

        z, x, y = (16, 36785, 25495)

        self.generate_fixtures(
            dsl.is_in('GR', z, x, y),
            # https://www.openstreetmap.org/way/25114417
            dsl.way(
                25114417, dsl.tile_diagonal(z, x, y), {
                    'date': u'20110715',
                    'highway': u'primary',
                    'int_name': u'Megalopoli - Kalamata',
                    'lanes': u'2',
                    'maxspeed': u'70',
                    'name': u'Μεγαλόπολη - Καλαμάτα',
                    'name:fr': u'Mégalopolis - Kalamata',
                    'ref': u'ΕΟ7;ΕΟ82',
                    'source': u'openstreetmap.org',
                    'source:ref': u'ΦΕΚ B 1932/26.9.2007',
                    'surface': u'asphalt',
                }),
            dsl.relation(1, {
                'name': u'Εθνική Οδός 7 (Κόρινθος - Καλαμάτα)',
                'name:en': u'National Highway 7 (Corinth - Kalamata)',
                'name:fr': u'Route Nationale 7 (Corinthe - Kalamata)',
                'network': u'GR:national',
                'ref': u'ΕΟ7',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q487890',
            },
                         ways=[25114417]),
            dsl.relation(2, {
                'int_name': u'Ethniki Odos 82 (Sparti - Kalamata - Pylos)',
                'name': u'Εθνική Οδός 82 (Σπάρτη - Καλαμάτα - Πύλος)',
                'name:en': u'National Highway 82 (Sparta - Kalamata - Pylos)',
                'name:fr': u'Route Nationale 82 (Sparte - Kalamata - Pylos)',
                'network': u'GR:national',
                'ref': u'ΕΟ82',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[25114417]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 25114417,
                'network': u'GR:national',
                'shield_text': u'7',
                'all_networks': ['GR:national', 'GR:national'],
                'all_shield_texts': ['7', '82'],
            })
    def test_orr_innh_hyderabad(self):
        import dsl

        z, x, y = (16, 47010, 29526)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/520309418
            dsl.way(520309418, dsl.tile_diagonal(z, x, y), {
                'bicycle': u'no',
                'foot': u'no',
                'highway': u'motorway',
                'horse': u'no',
                'lanes': u'4',
                'maxspeed': u'120',
                'motor_vehicle': u'designated',
                'motorcycle': u'no',
                'name': u'Outer Ring Road',
                'official_name': u'Nehru Outer Ring Road',
                'oneway': u'yes',
                'ref': u'ORR',
                'smoothness': u'excellent',
                'source': u'openstreetmap.org',
                'start_date': u'2011-08-14',
                'surface': u'asphalt',
            }),
            dsl.relation(1, {
                'name': u'Nehru Outer Ring Road',
                'note': u'see other relation',
                'operator': u'HMDA',
                'ref': u'ORR',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q7112004',
            }, ways=[520309418]),
            dsl.relation(2, {
                'highway': u'motorway',
                'name': u'Outer Ring Road',
                'official_name': u'Nehru Outer Ring Road',
                'operator': u'HMDA',
                'ref': u'ORR',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q7112004',
                'wikipedia': u'en:Outer Ring Road, Hyderabad',
            }, ways=[520309418]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 520309418,
                'network': u'IN:NH',
                'shield_text': u'ORR',
            })
Beispiel #21
0
    def test_yellowhead(self):
        import dsl

        z, x, y = (16, 11190, 21389)

        self.generate_fixtures(
            dsl.is_in('CA', z, x, y),
            # https://www.openstreetmap.org/way/51442002
            dsl.way(
                51442002, dsl.tile_diagonal(z, x, y), {
                    'name': 'Yellowhead Highway',
                    'nat_name': 'Trans-Canada Highway',
                    'source': 'openstreetmap.org',
                    'attribution': u'GeoBase\xae',
                    'ref': '16',
                    'highway': 'trunk',
                }),
            dsl.relation(1, {
                'name': 'Yellowhead Highway (BC)',
                'type': 'route',
                'route': 'road',
                'wikipedia': 'en:British Columbia Highway 16',
                'source': 'openstreetmap.org',
                'wikidata': 'Q129818',
                'ref': '16',
                'network': 'CA:yellowhead'
            },
                         ways=[51442002]),
            # NOTE: this relation doesn't really exist. i only added it to test
            # the sorting!
            dsl.relation(2, {
                'name': 'Fake highway',
                'type': 'route',
                'route': 'road',
                'source': 'openstreetmap.org',
                'ref': '0',
                'network': 'CA:BC:something',
            },
                         ways=[51442002]),
        )

        # transcanada should sort before yellowhead, and yellowhead before
        # state networks.
        self.assert_has_feature(
            z, x, y, 'roads', {
                'id':
                51442002,
                'shield_text':
                '16',
                'network':
                'CA:transcanada',
                'all_networks':
                ['CA:transcanada', 'CA:yellowhead', 'CA:BC:something'],
                'all_shield_texts': ['16', '16', '0'],
            })
    def test_s_road_in_both_relations(self):
        import dsl

        z, x, y = (16, 60644, 38056)

        self.generate_fixtures(
            dsl.way(
                1, dsl.tile_box(z, x, y), {
                    'kind': 'admin_area',
                    'iso_code': 'AU',
                    'source': 'openstreetmap.org'
                }),
            # https://www.openstreetmap.org/way/240922938
            dsl.way(
                240922938, dsl.tile_diagonal(z, x, y), {
                    'source:name': 'survey',
                    'maxspeed': '60',
                    'lanes': '2',
                    'name': 'Beaudesert Beenleigh Road',
                    'source:maxspeed': 'sign',
                    'surface': 'asphalt',
                    'source': 'openstreetmap.org',
                    'source:ref': 'survey',
                    'ref': '92;T8',
                    'highway': 'primary',
                    'network': 'S',
                }),
            dsl.relation(1, {
                'network': 'S',
                'ref': '92',
                'route': 'road',
                'addr:state': 'QLD',
                'source': 'openstreetmap.org',
                'type': 'route',
                'addr:country': 'AU',
            },
                         ways=[240922938]),
            dsl.relation(2, {
                'type': 'route',
                'route': 'road',
                'ref': '8',
                'network': 'T',
                'source': 'openstreetmap.org'
            },
                         ways=[240922938]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 240922938,
                'shield_text': '92',
                'network': 'AU:S-route',
                'all_networks': ['AU:S-route', 'AU:T-drive'],
                'all_shield_texts': ['92', '8'],
            })
    def test_d550_tr(self):
        import dsl

        z, x, y = (16, 37647, 24651)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4354149
            dsl.way(4354149, dsl.tile_diagonal(z, x, y), {
                'highway': u'trunk',
                'int_ref': u'E 87;E 90',
                'name': u'E-87',
                'oneway': u'yes',
                'ref': u'D550',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'name:bg': u'Европейски път Е 87, Турция',
                'name:de': u'Europastraße 87, Türkei',
                'name:en': u'European Route 87, Turkey',
                'network': u'e-road',
                'ref': u'E 87',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4354149]),
            dsl.relation(2, {
                'network': u'TR-roads',
                'ref': u'D 550',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4354149]),
            dsl.relation(3, {
                'name': u'European Road 90',
                'name:de': u'Europastraße 90',
                'name:en': u'European Road 90',
                'network': u'e-road',
                'note': u'Turkey',
                'ref': u'E 90',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4354149]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4354149,
                'network': 'TR:highway',
                'shield_text': 'D550',
                'all_networks': ['TR:highway', 'e-road', 'e-road'],
                'all_shield_texts': ['D550', 'E87', 'E90'],
            })
Beispiel #24
0
    def test_cn_g4w2(self):
        import dsl

        z, x, y = (16, 53263, 28168)

        self.generate_fixtures(
            dsl.is_in('CN', z, x, y),
            # https://www.openstreetmap.org/way/49242320
            dsl.way(
                49242320, dsl.tile_diagonal(z, x, y), {
                    'lanes': '2',
                    'name': 'Qinglian Expressway',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'ref': 'G4W2;G107',
                    'highway': 'motorway',
                }),
            dsl.relation(
                1, {
                    'name:en': 'China National Highway 107',
                    'network': 'CN-roads',
                    'ref': 'G107',
                    'route': 'road',
                    'name': u'107\u56fd\u9053',
                    'source': 'openstreetmap.org',
                    'type': 'route',
                    'name:zh': u'107\u56fd\u9053',
                    'highway': 'trunk',
                    'description':
                    'G107 runs from Beijing to Shenzhen via Wuhan',
                },
                ways=[49242320]),
            dsl.relation(2, {
                'name:en': 'Xuchang-Guangzhou Expressway',
                'name': u'\u8bb8\u5e7f\u9ad8\u901f',
                'name:zh': u'\u8bb8\u5e7f\u9ad8\u901f',
                'route': 'road',
                'wikipedia': u'zh:\u8bb8\u5e7f\u9ad8\u901f\u516c\u8def',
                'source': 'openstreetmap.org',
                'type': 'route',
                'ref': 'G4W2',
                'network': 'CN-expressways',
            },
                         ways=[49242320]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 49242320,
                'shield_text': 'G4W2',
                'network': 'CN:expressway',
                'all_shield_texts': ['G4W2', 'G107'],
                'all_networks': ['CN:expressway', 'CN:expressway'],
            })
    def test_a2_ro(self):
        import dsl

        z, x, y = (16, 37541, 23726)

        self.generate_fixtures(
            dsl.is_in('RO', z, x, y),
            # https://www.openstreetmap.org/way/15241569
            dsl.way(15241569, dsl.tile_diagonal(z, x, y), {
                'access': u'yes',
                'highway': u'motorway',
                'int_ref': u'E 81',
                'lanes': u'2',
                'maxspeed': u'100',
                'name': u'Autostrada Soarelui',
                'oneway': u'yes',
                'ref': u'A2',
                'smoothness': u'good',
                'source': u'openstreetmap.org',
                'start_date': u'2004',
                'surface': u'asphalt',
            }),
            dsl.relation(1, {
                'description:fr': u'E 81 Moukatchevo - Constanţa',
                'e-road:class': u'A-intermediate',
                'name:fr': u'Route européenne E 81',
                'network': u'e-road',
                'ref': u'E 81',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q987350',
            }, ways=[15241569]),
            dsl.relation(2, {
                'name': u'Autostrada A2',
                'network': u'A',
                'ref': u'A2',
                'route': u'road',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
                'type': u'route',
                'wikidata': u'Q429447',
                'wikipedia': u'en:A2 motorway (Romania)',
            }, ways=[15241569]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 15241569,
                'network': u'RO:motorway',
                'shield_text': u'A2',
                'all_networks': ['RO:motorway', 'e-road'],
                'all_shield_texts': ['A2', 'E81'],
            })
    def test_trans_amazonian(self):
        import dsl

        z, x, y = (16, 26409, 34070)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/258644490
            dsl.way(
                258644490, dsl.tile_diagonal(z, x, y), {
                    'maxspeed': '110',
                    'lanes': '2',
                    'surface': 'asphalt',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'ref': 'BR-101;BR-230',
                    'highway': 'motorway',
                }),
            dsl.relation(1, {
                'source:name': 'Lei 10.292/01',
                'name': u'Rodovia Governador M\xe1rio Covas',
                'type': 'route',
                'route': 'road',
                'wikipedia': 'pt:BR-101',
                'note': u'BR-101 Regi\xe3o Nordeste',
                'source': 'openstreetmap.org',
                'wikidata': 'Q2877408',
                'ref': 'BR-101',
                'network': 'BR',
            },
                         ways=[258644490]),
            dsl.relation(2, {
                'name:en': 'Trans-Amazonian highway',
                'name': u'Rodovia Transamaz\xf4nica',
                'type': 'route',
                'route': 'road',
                'wikipedia': 'pt:BR-230',
                'source': 'openstreetmap.org',
                'name:fr': 'Transamazonienne',
                'wikidata': 'Q1569903',
                'ref': 'BR-230',
                'network': 'BR',
            },
                         ways=[258644490]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 258644490,
                'shield_text': '230',
                'network': 'BR:Trans-Amazonian',
                'all_networks': ['BR:Trans-Amazonian', 'BR'],
                'all_shield_texts': ['230', '101'],
            })
    def test_no_oslo_ring(self):
        # there's a different sign for the Store Ringvei (Oslo Ring-road). also
        # looks like in Norway they actually sign the E-roads.
        #
        # https://en.wikipedia.org/wiki/Ring_3_(Oslo)
        # https://en.wikipedia.org/wiki/Norwegian_national_road

        import dsl

        z, x, y = (16, 34736, 19062)

        self.generate_fixtures(
            dsl.is_in('NO', z, x, y),
            # https://www.openstreetmap.org/way/71218142
            dsl.way(71218142, dsl.tile_diagonal(z, x, y), {
                'highway': u'trunk',
                'int_ref': u'E 06',
                'lanes': u'2',
                'maxspeed': u'70',
                'maxspeed:conditional': u'60 @ (Nov 01 - Apr 8)',
                'name': u'Adolf Hedins vei',
                'oneway': u'yes',
                'ref': u'E 6;Ring 3',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'nat_ref': u'E 6',
                'network': u'e-road',
                'ref': u'E 06',
                'route': u'road',
                'section': u'Norway (south-south)',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q921422',
                'wikipedia': u'de:Europastraße 6',
            }, ways=[71218142]),
            dsl.relation(2, {
                'name': u'Store ringvei',
                'ref': u'Ring 3',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[71218142]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 71218142,
                'network': u'NO:oslo:ring',
                'shield_text': 'Ring 3',
                'all_networks': ['NO:oslo:ring', 'e-road'],
                'all_shield_texts': ['Ring 3', 'E 6'],
            })
Beispiel #28
0
    def test_de_bs_double(self):
        import dsl

        z, x, y = (16, 35115, 21991)

        self.generate_fixtures(
            dsl.is_in('DE', z, x, y),
            # https://www.openstreetmap.org/way/3237220
            dsl.way(
                3237220, dsl.tile_diagonal(z, x, y), {
                    'maxspeed': '50',
                    'lanes': '2',
                    'name': u'Neefestra\xdfe',
                    'turn:lanes': 'through|through;right',
                    'surface': 'asphalt',
                    'source': 'openstreetmap.org',
                    'hazmat': 'designated',
                    'oneway': 'yes',
                    'bicycle': 'no',
                    'ref': 'B 173;B 169',
                    'highway': 'primary',
                }),
            dsl.relation(1, {
                'checked': '2014/01/06 Streckenkundler',
                'name': 'B 169 (Sachsen)',
                'type': 'route',
                'route': 'road',
                'source': 'openstreetmap.org',
                'operator': 'Bundesrepublik Deutschland',
                'ref': 'B 169',
            },
                         ways=[3237220]),
            dsl.relation(2, {
                'name': 'B 173',
                'ref': 'B 173',
                'route': 'road',
                'wikipedia': u'de:Bundesstra\xdfe 173',
                'source': 'openstreetmap.org',
                'wikidata': 'Q52784',
                'operator': 'Bundesrepublik Deutschland',
                'type': 'route',
            },
                         ways=[3237220]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 3237220,
                'shield_text': 'B169',
                'network': 'DE:BS',
                'all_networks': ['DE:BS', 'DE:BS'],
                'all_shield_texts': ['B169', 'B173'],
            })
    def test_m5_rumroad(self):
        import dsl

        z, x, y = (16, 41943, 21204)

        self.generate_fixtures(
            dsl.is_in('RU', z, x, y),
            # https://www.openstreetmap.org/way/14395684
            dsl.way(
                14395684, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'int_ref': u'E 30;AH6',
                    'lit': u'no',
                    'oneway': u'yes',
                    'ref': u'М-5',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                }),
            dsl.relation(1, {
                'name': u'E 30 Russia middle (east)',
                'name:ru': u'Европейский маршрут E 30',
                'network': u'e-road',
                'ref': u'E 30',
                'route': u'road',
                'section': u'Russia middle (east)',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q160249',
                'wikipedia': u'en:European route E30',
            },
                         ways=[14395684]),
            dsl.relation(2, {
                'distance': u'1879 km',
                'name': u'«Урал»',
                'network': u'ru:national',
                'ref': u'М-5',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q1848985',
                'wikipedia': u'ru:Урал (автодорога)',
            },
                         ways=[14395684]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 14395684,
                'network': u'RU:national',
                'shield_text': u'М5',
                'all_networks': ['RU:national', 'e-road'],
                'all_shield_texts': [u'М5', 'E30'],
            })
    def test_e_road(self):
        import dsl

        z, x, y = (16, 33186, 22554)

        self.generate_fixtures(
            dsl.is_in('FR', z, x, y),
            # https://www.openstreetmap.org/way/16108247
            dsl.way(
                16108247, dsl.tile_diagonal(z, x, y), {
                    'horse': 'no',
                    'hazmat': 'no',
                    'bicycle': 'no',
                    'name': u'Boulevard Périphérique Intérieur',
                    'toll': 'no',
                    'surface': 'asphalt',
                    'lit': 'yes',
                    'source': 'openstreetmap.org',
                    'maxspeed': '70',
                    'int_ref': 'E 05',
                    'oneway': 'yes',
                    'foot': 'no',
                    'lanes': '3',
                    'sidewalk': 'no',
                    'smoothness': 'excellent',
                    'highway': 'trunk',
                }),
            dsl.relation(1, {
                'type': 'route',
                'route': 'road',
                'bicycle': 'no',
                'name': u'Boulevard Périphérique de Paris',
                'source': 'openstreetmap.org',
            },
                         ways=[16108247]),
            dsl.relation(2, {
                'network': 'e-road',
                'ref': 'E 05',
                'route': 'road',
                'wikipedia': u'fr:Route européenne 5',
                'source': 'openstreetmap.org',
                'wikidata': 'Q693493',
                'type': 'route',
                'section': 'France (north-south)',
            },
                         ways=[16108247]),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 16108247,
            'shield_text': 'E5',
            'network': 'e-road',
        })
Beispiel #31
0
    def test_ve5_ptexpress(self):
        import dsl

        z, x, y = (16, 29700, 26472)

        self.generate_fixtures(
            dsl.is_in('PT', z, x, y),
            # https://www.openstreetmap.org/way/24992736
            dsl.way(
                24992736, dsl.tile_diagonal(z, x, y), {
                    'alt_name': u'ER 102',
                    'highway': u'primary',
                    'lanes': u'3',
                    'lanes:backward': u'1',
                    'lanes:forward': u'2',
                    'layer': u'-1',
                    'name': u'Túnel das Eiras',
                    'ref': u'VE 5',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                    'tunnel': u'yes',
                    'turn:lanes:backward': u'through',
                    'turn:lanes:forward': u'through|through',
                }),
            dsl.relation(1, {
                'description': u'Caniço – Camacha',
                'name': u'Estrada Regional 102',
                'ref': u'ER 102',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[24992736]),
            dsl.relation(2, {
                'alt_name': u'ER 102',
                'name': u'Via Expresso 5',
                'ref': u'VE 5',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[24992736]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 24992736,
                'network': u'PT:express',
                'shield_text': u'VE5',
                'all_networks': ['PT:express', 'PT:regional'],
                'all_shield_texts': ['VE5', 'R102'],
            })
    def test_c_road(self):
        import dsl

        z, x, y = (16, 59435, 40315)

        self.generate_fixtures(
            dsl.way(
                1, dsl.tile_box(z, x, y), {
                    'kind': 'admin_area',
                    'iso_code': 'AU',
                    'source': 'openstreetmap.org',
                }),
            # https://www.openstreetmap.org/way/7787334
            dsl.way(
                7787334, dsl.tile_diagonal(z, x, y), {
                    'name': 'Churchill - Traralgon Road',
                    'surface': 'paved',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'ref': 'C475;C476',
                    'highway': 'secondary',
                }),
            dsl.relation(1, {
                'name': 'Mattingley Hill Road',
                'ref': 'C475',
                'route': 'road',
                'addr:state': 'VIC',
                'source': 'openstreetmap.org',
                'type': 'route',
                'addr:country': 'AU',
            },
                         ways=[7787334]),
            dsl.relation(2, {
                'ref': 'C476',
                'route': 'road',
                'addr:state': 'VIC',
                'source': 'openstreetmap.org',
                'type': 'route',
                'addr:country': 'AU',
            },
                         ways=[7787334]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 7787334,
                'shield_text': '475',
                'network': 'AU:C-road',
                'all_shield_texts': ['475', '476'],
                'all_networks': ['AU:C-road', 'AU:C-road'],
            })
    def test_pb(self):
        import dsl

        z, x, y = (16, 25886, 34039)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/31514019
            dsl.way(
                31514019, dsl.tile_diagonal(z, x, y), {
                    'horse': 'yes',
                    'maxspeed': '80',
                    'bicycle': 'yes',
                    'oneway': 'no',
                    'surface': 'asphalt',
                    'cycleway': 'no',
                    'access': 'yes',
                    'source': 'openstreetmap.org',
                    'IBGE:CD_ADMINIS': 'estadual',
                    'foot': 'yes',
                    'lanes': '2',
                    'sidewalk': 'none',
                    'ref': 'PB-366',
                    'highway': 'secondary',
                }),
            dsl.relation(1, {
                'source': 'openstreetmap.org',
                'route': 'road',
                'ref': 'PB-366',
                'network': 'BR:PB',
                'type': 'route',
            },
                         ways=[31514019]),
            dsl.relation(2, {
                'type': 'route',
                'route': 'road',
                'ref': 'BR-426',
                'network': 'BR',
                'source': 'openstreetmap.org',
            },
                         ways=[31514019]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 31514019,
                'shield_text': '426',
                'network': 'BR',
                'all_networks': ['BR', 'BR:PB'],
                'all_shield_texts': ['426', '366'],
            })
Beispiel #34
0
    def test_multiple_shields(self):
        import dsl

        z, x, y = 16, 18022, 25522

        # I-77, I-81, US-11 & US-52 all in one road West Virginia.
        self.generate_fixtures(
            dsl.way(1, dsl.tile_box(z, x, y), {
                'kind': 'admin_area', 'iso_code': 'US',
                'source': 'openstreetmap.org'
            }),
            # http://www.openstreetmap.org/way/51388984
            dsl.way(51388984, dsl.tile_diagonal(z, x, y), {
                'horse': 'no', 'maxspeed': '70 mph', 'bicycle': 'no',
                'source': 'openstreetmap.org', 'hgv': 'designated',
                'surface': 'asphalt', 'oneway': 'yes', 'foot': 'no',
                'lanes': '3', 'sidewalk': 'none',
                'ref': 'I 77;I 81;US 11;US 52', 'highway': 'motorway'
            }),
            dsl.relation(1, {
                'name': 'US 11 (VA)', 'type': 'route', 'route': 'road',
                'wikipedia': 'en:U.S. Route 11', 'is_in:state': 'VA',
                'source': 'openstreetmap.org', 'wikidata': 'Q407534',
                'ref': '11', 'network': 'US:US'
            }, ways=[51388984]),
            dsl.relation(2, {
                'name': 'I 77 (VA) (North)', 'type': 'route', 'route': 'road',
                'wikipedia': 'en:Interstate 77 in Virginia',
                'is_in:state': 'VA', 'source': 'openstreetmap.org',
                'wikidata': 'Q2447354', 'ref': '77', 'network': 'US:I'
            }, ways=[51388984]),
            dsl.relation(3, {
                'direction': 'south', 'name': 'I 81 (VA southbound)',
                'type': 'route', 'route': 'road',
                'wikipedia': 'en:Interstate 81 in Virginia',
                'is_in:state': 'VA', 'source': 'openstreetmap.org',
                'wikidata': 'Q2447647', 'ref': '81', 'network': 'US:I'
            }, ways=[51388984]),
            dsl.relation(4, {
                'name': 'US 52 (VA)', 'type': 'route', 'route': 'road',
                'wikipedia': 'en:U.S. Route 52', 'is_in:state': 'VA',
                'source': 'openstreetmap.org', 'ref': '52', 'network': 'US:US'
            }, ways=[51388984]),
        )

        self.assert_has_feature(
            16, 18022, 25522, 'roads',
            {'kind': 'highway', 'network': 'US:I', 'id': 51388984,
             'shield_text': '77',
             'all_networks': ['US:I', 'US:I', 'US:US', 'US:US'],
             'all_shield_texts': ['77', '81', '11', '52']})
    def test_161_innh(self):
        import dsl

        z, x, y = (16, 46811, 29105)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/22865906
            dsl.way(
                22865906, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'ref': u'NH161;SH204',
                    'source': u'openstreetmap.org',
                }),
            dsl.relation(1, {
                'network': u'IN:NH:MH',
                'note': u'NH161 in MH',
                'ref': u'NH161',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[22865906]),
            dsl.relation(2, {
                'name': u'National Highway 161',
                'network': u'IN:NH',
                'ref': u'NH161',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[22865906]),
            dsl.relation(3, {
                'name': u'SH204',
                'ref': u'SH204',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[22865906]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 22865906,
                'network': 'IN:NH',
                'shield_text': '161',
                'all_networks': ['IN:NH', 'IN:SH'],
                'all_shield_texts': ['161', '204'],
            })
    def test_m5_rumroad(self):
        import dsl

        z, x, y = (16, 41943, 21204)

        self.generate_fixtures(
            dsl.is_in('RU', z, x, y),
            # https://www.openstreetmap.org/way/14395684
            dsl.way(14395684, dsl.tile_diagonal(z, x, y), {
                'highway': u'trunk',
                'int_ref': u'E 30;AH6',
                'lit': u'no',
                'oneway': u'yes',
                'ref': u'М-5',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
            }),
            dsl.relation(1, {
                'name': u'E 30 Russia middle (east)',
                'name:ru': u'Европейский маршрут E 30',
                'network': u'e-road',
                'ref': u'E 30',
                'route': u'road',
                'section': u'Russia middle (east)',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q160249',
                'wikipedia': u'en:European route E30',
            }, ways=[14395684]),
            dsl.relation(2, {
                'distance': u'1879 km',
                'name': u'«Урал»',
                'network': u'ru:national',
                'ref': u'М-5',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q1848985',
                'wikipedia': u'ru:Урал (автодорога)',
            }, ways=[14395684]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 14395684,
                'network': u'RU:national',
                'shield_text': u'М5',
                'all_networks': ['RU:national', 'e-road'],
                'all_shield_texts': [u'М5', 'E30'],
            })
    def test_1_chmotorway(self):
        import dsl

        z, x, y = (16, 34086, 23060)

        self.generate_fixtures(
            dsl.is_in('CH', z, x, y),
            # https://www.openstreetmap.org/way/40653024
            dsl.way(
                40653024, dsl.tile_diagonal(z, x, y), {
                    'highway': u'motorway',
                    'int_ref': u'E 25',
                    'lanes': u'2',
                    'lit': u'no',
                    'maxspeed': u'120',
                    'oneway': u'yes',
                    'ref': u'A1',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                    'toll': u'yes',
                }),
            dsl.relation(1, {
                'name': u'A1',
                'network': u'motorway',
                'ref': u'A1',
                'route': u'road',
                'source': u'openstreetmap.org',
                'toll': u'yes',
                'type': u'route',
                'wikidata': u'Q675903',
                'wikipedia': u'de:Autobahn 1 (Schweiz)',
            },
                         ways=[40653024]),
            dsl.relation(2, {
                'network': u'e-road',
                'ref': u'E 25',
                'route': u'road',
                'section': u'Switzerland middle',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikipedia': u'en:European route E25',
            },
                         ways=[40653024]),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 40653024,
            'network': u'CH:motorway',
            'shield_text': u'1',
        })
    def test_547e_innh(self):
        import dsl

        z, x, y = (16, 47127, 28829)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/28465477
            dsl.way(
                28465477, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'ref': u'NH547E',
                    'ref:old': u'SH265',
                    'source': u'openstreetmap.org',
                }),
            dsl.relation(1, {
                'network': u'IN:NH:MH',
                'note': u'NH547E in MH',
                'ref': u'NH547E',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[28465477]),
            dsl.relation(2, {
                'network': u'IN:NH',
                'ref': u'NH547E',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[28465477]),
            dsl.relation(3, {
                'name': u'SH265',
                'ref': u'SH265',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[28465477]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 28465477,
                'network': 'IN:NH',
                'shield_text': '547E',
                'all_networks': ['IN:NH', 'IN:SH'],
                'all_shield_texts': ['547E', '265'],
            })
Beispiel #39
0
    def test_vr1_ptrapid(self):
        import dsl

        z, x, y = (16, 29710, 26466)

        self.generate_fixtures(
            dsl.is_in('PT', z, x, y),
            # https://www.openstreetmap.org/way/19854039
            dsl.way(
                19854039, dsl.tile_diagonal(z, x, y), {
                    'alt_name': u'Via Rápida 1',
                    'bicycle': u'no',
                    'foot': u'no',
                    'highway': u'trunk',
                    'maxspeed': u'80',
                    'motor_vehicle': u'designated',
                    'oneway': u'yes',
                    'ref': u'VR 1',
                    'source': u'openstreetmap.org',
                    'surface': u'paved',
                }),
            dsl.relation(1, {
                'description': u'Litoral da ilha da Madeira',
                'name': u'Estrada Regional 101',
                'ref': u'ER 101',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[19854039]),
            dsl.relation(2, {
                'alt_name': u'Via Rápida',
                'name': u'Via Rápida 1',
                'operator': u'Via Litoral',
                'ref': u'VR 1',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[19854039]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 19854039,
                'network': u'PT:rapid',
                'shield_text': u'VR1',
                'all_networks': ['PT:rapid', 'PT:regional'],
                'all_shield_texts': ['VR1', 'R101'],
            })
Beispiel #40
0
    def test_d550_07_tr(self):
        import dsl

        z, x, y = (16, 37691, 24911)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4391958
            dsl.way(
                4391958, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'int_ref': u'E 87',
                    'lanes': u'2',
                    'name': u'İzmir Çanakkale Yolu',
                    'oneway': u'yes',
                    'ref': u'D550-07',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                }),
            dsl.relation(1, {
                'name:bg': u'Европейски път Е 87, Турция',
                'name:de': u'Europastraße 87, Türkei',
                'name:en': u'European Route 87, Turkey',
                'network': u'e-road',
                'ref': u'E 87',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4391958]),
            dsl.relation(2, {
                'network': u'TR-roads',
                'ref': u'D 550',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4391958]),
        )

        # we drop the "-07" suffix. it seems to be some kind of section number.
        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4391958,
                'network': u'TR:highway',
                'shield_text': u'D550',
                'all_networks': ['TR:highway', 'e-road'],
                'all_shield_texts': ['D550', 'E87'],
            })
Beispiel #41
0
    def test_o4_tr(self):
        import dsl

        z, x, y = (16, 38700, 24768)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4316183
            dsl.way(
                4316183, dsl.tile_diagonal(z, x, y), {
                    'highway': u'motorway',
                    'int_ref': u'E 89',
                    'lanes': u'3',
                    'name': u'Anadolu Otoyolu',
                    'oneway': u'yes',
                    'ref': u'O-4',
                    'source': u'openstreetmap.org',
                }),
            dsl.relation(1, {
                'description:fr': u'E 89 Gerede - Ankara',
                'e-road:class': u'A-intermediate',
                'name:fr': u'Route européenne E 89',
                'network': u'e-road',
                'ref': u'E 89',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikidata': u'Q2419632',
            },
                         ways=[4316183]),
            dsl.relation(2, {
                'description': u'İstanbul - Ankara Otoyolu',
                'network': u'TR-road',
                'ref': u'O-4',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4316183]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4316183,
                'network': u'TR:motorway',
                'shield_text': u'O4',
                'all_networks': ['TR:motorway', 'e-road'],
                'all_shield_texts': ['O4', 'E89'],
            })
    def test_br_RSC(self):
        import dsl

        z, x, y = (16, 23450, 38314)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/25979338
            dsl.way(
                25979338, dsl.tile_diagonal(z, x, y), {
                    'name': 'Rota do Sol',
                    'surface': 'paved',
                    'source': 'openstreetmap.org',
                    'oneway': 'no',
                    'ref': 'RSC-453',
                    'highway': 'primary',
                }),
            dsl.relation(1, {
                'network': 'BR',
                'ref': 'BR-453',
                'route': 'road',
                'wikipedia': 'pt:BR-453',
                'source': 'openstreetmap.org',
                'wikidata': 'Q2877442',
                'type': 'route',
            },
                         ways=[25979338]),
            dsl.relation(2, {
                'old_ref': 'RST-453',
                'name': 'Rota do Sol',
                'route': 'road',
                'source:official_name': 'LO 11432/2000',
                'type': 'route',
                'official_name': 'Rota do Sol Euclides Triches',
                'source': 'openstreetmap.org',
                'ref': 'RSC-453',
                'network': 'BR:RS',
            },
                         ways=[25979338]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 25979338,
                'shield_text': '453',
                'network': 'BR',
                'all_shield_texts': ['453', '453'],
                'all_networks': ['BR', 'BR:RS']
            })
    def test_ve5_ptexpress(self):
        import dsl

        z, x, y = (16, 29700, 26472)

        self.generate_fixtures(
            dsl.is_in('PT', z, x, y),
            # https://www.openstreetmap.org/way/24992736
            dsl.way(24992736, dsl.tile_diagonal(z, x, y), {
                'alt_name': u'ER 102',
                'highway': u'primary',
                'lanes': u'3',
                'lanes:backward': u'1',
                'lanes:forward': u'2',
                'layer': u'-1',
                'name': u'Túnel das Eiras',
                'ref': u'VE 5',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
                'tunnel': u'yes',
                'turn:lanes:backward': u'through',
                'turn:lanes:forward': u'through|through',
            }),
            dsl.relation(1, {
                'description': u'Caniço – Camacha',
                'name': u'Estrada Regional 102',
                'ref': u'ER 102',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[24992736]),
            dsl.relation(2, {
                'alt_name': u'ER 102',
                'name': u'Via Expresso 5',
                'ref': u'VE 5',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[24992736]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 24992736,
                'network': u'PT:express',
                'shield_text': u'VE5',
                'all_networks': ['PT:express', 'PT:regional'],
                'all_shield_texts': ['VE5', 'R102'],
            })
    def test_1_chmotorway(self):
        import dsl

        z, x, y = (16, 34086, 23060)

        self.generate_fixtures(
            dsl.is_in('CH', z, x, y),
            # https://www.openstreetmap.org/way/40653024
            dsl.way(40653024, dsl.tile_diagonal(z, x, y), {
                'highway': u'motorway',
                'int_ref': u'E 25',
                'lanes': u'2',
                'lit': u'no',
                'maxspeed': u'120',
                'oneway': u'yes',
                'ref': u'A1',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
                'toll': u'yes',
            }),
            dsl.relation(1, {
                'name': u'A1',
                'network': u'motorway',
                'ref': u'A1',
                'route': u'road',
                'source': u'openstreetmap.org',
                'toll': u'yes',
                'type': u'route',
                'wikidata': u'Q675903',
                'wikipedia': u'de:Autobahn 1 (Schweiz)',
            }, ways=[40653024]),
            dsl.relation(2, {
                'network': u'e-road',
                'ref': u'E 25',
                'route': u'road',
                'section': u'Switzerland middle',
                'source': u'openstreetmap.org',
                'type': u'route',
                'wikipedia': u'en:European route E25',
            }, ways=[40653024]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 40653024,
                'network': u'CH:motorway',
                'shield_text': u'1',
            })
Beispiel #45
0
    def test_de_bs_ring_order(self):
        import dsl

        z, x, y = (16, 34583, 21151)

        self.generate_fixtures(
            dsl.is_in('DE', z, x, y),
            # https://www.openstreetmap.org/way/4329503
            dsl.way(
                4329503, dsl.tile_diagonal(z, x, y), {
                    'toll:N3': 'yes',
                    'maxspeed': '60',
                    'lanes': '2',
                    'name': 'Krohnstieg',
                    'surface': 'asphalt',
                    'lit': 'yes',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'foot': 'no',
                    'bicycle': 'no',
                    'ref': 'Ring 3;B 433',
                    'highway': 'trunk',
                }),
            dsl.relation(1, {
                'source': 'openstreetmap.org',
                'route': 'road',
                'type': 'route',
                'name': 'Ring 3',
            },
                         ways=[4329503]),
            dsl.relation(3, {
                'name': 'B433',
                'type': 'route',
                'route': 'road',
                'source': 'openstreetmap.org',
                'ref': 'B 433',
            },
                         ways=[4329503]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4329503,
                'shield_text': 'B433',
                'network': 'DE:BS',
                'all_shield_texts': ['B433', 'Ring 3'],
                'all_networks': ['DE:BS', 'DE:Hamburg:Ring'],
            })
    def test_br_PRC(self):
        import dsl

        z, x, y = (16, 23383, 37517)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/31611447
            dsl.way(31611447, dsl.tile_diagonal(z, x, y), {
                'maxspeed': '110', 'surface': 'paved',
                'source': 'openstreetmap.org', 'IBGE:CD_ADMINIS': 'federal',
                'nat_ref': 'BR-466', 'ref': 'PRC-466', 'highway': 'primary',
            }),
            dsl.relation(1, {
                'type': 'route', 'route': 'road', 'ref': 'BR-466',
                'network': 'BR', 'source': 'openstreetmap.org',
            }, ways=[31611447]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 31611447,
                'shield_text': '466', 'network': 'BR',
                'all_shield_texts': ['466', '466'],
                'all_networks': ['BR', 'BR:PR']
            })
    def test_br_ERS(self):
        import dsl

        z, x, y = (16, 23101, 38967)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/20906150
            dsl.way(20906150, dsl.tile_diagonal(z, x, y), {
                'old_ref': 'RS-602', 'maxspeed': '80', 'surface': 'asphalt',
                'source': 'openstreetmap.org', 'ref': 'ERS-602',
                'highway': 'secondary',
            }),
            dsl.relation(1, {
                'network': 'BR:RS', 'ref': 'ERS-602', 'route': 'road',
                'surface': 'asphalt', 'source': 'openstreetmap.org',
                'type': 'route',
            }, ways=[20906150]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 20906150,
                'shield_text': '602', 'network': 'BR:RS',
                'all_networks': ['BR:RS'],
                'all_shield_texts': ['602'],
            })
    def test_br_MGC(self):
        import dsl

        z, x, y = (16, 24603, 36244)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/31574746
            dsl.way(31574746, dsl.tile_diagonal(z, x, y), {
                'network': 'BR', 'IBGE:CD_ADMINIS': 'estadual',
                'surface': 'paved', 'source': 'openstreetmap.org',
                'incorrect:name': 'MGC-259', 'oneway': 'no',
                'ref': 'MGC-259;BR-259', 'highway': 'primary',
            }),
            dsl.relation(1, {
                'type': 'route', 'route': 'road', 'ref': 'BR-259',
                'network': 'BR', 'source': 'openstreetmap.org',
            }, ways=[31574746]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 31574746,
                'all_shield_texts': ['259', '259'],
                'all_networks': ['BR', 'BR:MG'],
            })
    def test_se(self):
        import dsl

        z, x, y = (16, 26010, 34601)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/31529719
            dsl.way(31529719, dsl.tile_diagonal(z, x, y), {
                'source': 'openstreetmap.org', 'ref': 'SE-200',
                'surface': 'asphalt', 'highway': 'primary',
                'IBGE:CD_ADMINIS': 'estadual',
            }),
            dsl.relation(1, {
                'type': 'route', 'route': 'road', 'ref': 'SE-200',
                'network': 'SE', 'source': 'openstreetmap.org',
            }, ways=[31529719]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 31529719,
                'shield_text': '200', 'network': 'BR:SE',
                'all_shield_texts': ['200'],
                'all_networks': ['BR:SE'],
            })
    def test_kr_expressway_no_name_en_no_ncat(self):
        # same as the test above, but without the "ncat" to test that it
        # backfills from the name.
        import dsl

        z, x, y = (16, 56165, 25760)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/43543281
            dsl.way(43543281, dsl.tile_diagonal(z, x, y), {
                'lanes': '2', 'name': u'중부내륙고속도로지선', 'review': 'no',
                'source': 'openstreetmap.org', 'highway': 'motorway',
                'oneway': 'yes', 'ref': '451',
            }),
            dsl.relation(1, {
                'type': 'route', 'route': 'road', 'ref': '451',
                'source': 'openstreetmap.org',
            }, ways=[43543281]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 43543281,
                'shield_text': '451',
                'network': 'KR:expressway',
            })
    def test_kr_jungbunaeryukgosokdoro(self):
        import dsl

        z, x, y = (16, 56156, 25839)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/562319872
            dsl.way(562319872, dsl.tile_diagonal(z, x, y), {
                'name:en': 'Jungbunaeryuk Expressway', 'lanes': '2',
                'name': u'중부내륙고속도로', 'name:ko': u'중부내륙고속도로',
                'review': 'no', 'name:ko_rm': 'Jungbunaeryukgosokdoro',
                'source': 'openstreetmap.org', 'ncat': u'고속도로',
                'oneway': 'yes', 'ref': '45', 'toll': 'yes',
                'highway': 'motorway',
            }),
            dsl.relation(1, {
                'name:en': 'Jungbunaeryuk Expressway',
                'name': u'중부내륙고속도로', 'name:ko': u'중부내륙고속도로',
                'ref': '45', 'route': 'road', 'source': 'openstreetmap.org',
                'type': 'route',
            }, ways=[562319872]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 562319872,
                'shield_text': '45',
                'network': 'KR:expressway',
            })
    def test_viroads(self):
        # despite the network tag, this is actually in Vietnam (ISO code VN,
        # not VI).
        import dsl

        z, x, y = (16, 51909, 28995)

        self.generate_fixtures(
            dsl.is_in('VN', z, x, y),
            # https://www.openstreetmap.org/way/48844918
            dsl.way(48844918, dsl.tile_diagonal(z, x, y), {
                'highway': u'secondary',
                'ref': u'217',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'network': u'VI-roads',
                'ref': u'217',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[48844918]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 48844918,
                'shield_text': '217',
                'network': u'VN:road',
            })
    def test_vntl(self):
        import dsl

        z, x, y = (16, 52078, 29058)

        self.generate_fixtures(
            dsl.is_in('VN', z, x, y),
            # https://www.openstreetmap.org/way/161484320
            dsl.way(161484320, dsl.tile_diagonal(z, x, y), {
                'alt_name': u'Đường Cà Mau',
                'highway': u'secondary',
                'name': u'Tỉnh lộ 481',
                'ref': u'481',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'alt_name': u'Đường Cà Mau',
                'highway': u'secondary',
                'name': u'Tỉnh lộ 481',
                'network': u'VN-TL',
                'ref': u'481',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[161484320]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 161484320,
                'shield_text': u'TL481',
                'network': u'VN:provincial',
            })
    def test_20_chnational(self):
        import dsl

        z, x, y = (16, 34009, 23025)

        self.generate_fixtures(
            dsl.is_in('CH', z, x, y),
            # https://www.openstreetmap.org/way/24521024
            dsl.way(24521024, dsl.tile_diagonal(z, x, y), {
                'highway': u'primary',
                'lit': u'yes',
                'name': u'Boulevard de la Liberté',
                'ref': u'20',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'name': u'Hauptstrasse 20',
                'name:fr': u'Route Principale 20',
                'network': u'ch:national',
                'note': u'(F)–Le Locle–La Chaux-de-Fonds–Neuchâtel',
                'ref': u'20',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[24521024]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 24521024,
                'network': u'CH:national',
                'shield_text': u'20',
            })
    def test_asianhighway(self):
        import dsl

        z, x, y = (16, 55875, 25370)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/547188348
            dsl.way(547188348, dsl.tile_diagonal(z, x, y), {
                'name:en': 'Tongil-ro', 'name': u'통일로', 'review': 'no',
                'source': 'openstreetmap.org', 'highway': 'primary',
            }),
            dsl.relation(1, {
                'alt_name': u'아주공로 1호선', 'int_ref': 'AH1', 'layer': '1',
                'section': 'Korea', 'int_name': 'Asian Highway AH1',
                'network': 'AH', 'name': u'아시안 하이웨이 1호선',
                'name:en': 'Asian Highway AH1', 'ref': 'AH1', 'route': 'road',
                'source': 'openstreetmap.org', 'state': 'connection',
                'type': 'route', 'wikidata': 'Q494205', 'wikipedia': 'en:AH1',
            }, ways=[547188348]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 547188348,
                'shield_text': '1',
                'network': 'AsianHighway',
            })
    def test_54_inmdr(self):
        import dsl

        z, x, y = (16, 46579, 26841)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/11760010
            dsl.way(11760010, dsl.tile_diagonal(z, x, y), {
                'highway': u'secondary',
                'name': u'Rahon Road',
                'ref': u'MDR54',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'network': u'IN:SH:PB',
                'ref': u'MDR54',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[11760010]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 11760010,
                'network': u'IN:MDR',
                'shield_text': u'54',
            })
    def test_kr_expressway_rel_no_net(self):
        import dsl

        z, x, y = (16, 55975, 25658)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/90611594
            dsl.way(90611594, dsl.tile_diagonal(z, x, y), {
                'name:en': u'Tongyeong–Daejeon Expressway', 'lanes': '2',
                'name': u'통영대전고속도로', 'name:ko': u'통영대전고속도로',
                'name:ko_rm': 'Tongyeong-daejeon-gosokdoro',
                'source': 'openstreetmap.org', 'maxspeed': '100',
                'oneway': 'yes', 'ref': '35', 'highway': 'motorway',
            }),
            dsl.relation(1, {
                'layer': '1', 'name:en': u'Tongyeong–Daejeon Expressway',
                'name': u'통영대전고속도로', 'name:ko': u'통영대전고속도로',
                'type': 'route', 'route': 'road',
                'source': 'openstreetmap.org', 'ref': '35',
            }, ways=[90611594]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 90611594,
                'shield_text': '35',
                'network': 'KR:expressway',
            })
    def test_fr_d_road_relation(self):
        import dsl

        z, x, y = (16, 33716, 23296)

        self.generate_fixtures(
            dsl.is_in('FR', z, x, y),
            # https://www.openstreetmap.org/way/137943124
            dsl.way(
                137943124, dsl.tile_diagonal(z, x, y), {
                    'source': 'openstreetmap.org',
                    'ref': 'D 17',
                    'highway': 'secondary',
                }),
            dsl.relation(1, {
                'name': 'D17(FR:01)',
                'ref': 'D 17',
                'route': 'road',
                'source': 'openstreetmap.org',
                'type': 'route',
                'network': 'FR:01:D-road',
            },
                         ways=[137943124]),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 137943124,
            'shield_text': 'D17',
            'network': 'FR:D-road',
        })
    def test_kr_expressway(self):
        import dsl

        z, x, y = (16, 55904, 25415)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/59242897
            dsl.way(59242897, dsl.tile_diagonal(z, x, y), {
                'name:en': 'Seoul Ring Expressway', 'lanes': '4',
                'name': u'서울외곽순환고속도로',
                'name:ko': u'서울외곽순환고속도로',
                'name:ko_rm': 'Seouloegwaksunhwangosokdoro',
                'source': 'openstreetmap.org', 'oneway': 'yes', 'ref': '100',
                'highway': 'motorway',
            }),
            dsl.relation(1, {
                'name:en': 'Seoul Ring Expressway(KEC), bound for '
                'Pangyo(Ilsan)',
                'name': u'서울외곽순환고속도로(도로공사) 판교(일산)방향',
                'name:ko': u'서울외곽순환고속도로(도로공사) 판교(일산)방향',
                'route': 'road', 'source': 'openstreetmap.org',
                'operator': 'Korea Expressway Corporation', 'type': 'route',
                'road': 'kr:expressway', 'network': 'KR:expressway',
            }, ways=[59242897]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 59242897,
                'shield_text': '100',
                'network': 'KR:expressway',
            })