Beispiel #1
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_fr_rnil_road(self):
        import dsl

        z, x, y = (16, 33218, 22520)

        self.generate_fixtures(
            dsl.is_in('FR', z, x, y),
            # https://www.openstreetmap.org/way/10292212
            dsl.way(
                10292212, dsl.tile_diagonal(z, x, y), {
                    'source': 'openstreetmap.org',
                    'old_ref': 'N 2bis;N 2',
                    'ref': 'RNIL 2',
                    'highway': 'primary',
                    'oneway': 'yes',
                }),
            dsl.relation(1, {
                'name': 'RNIL2(FR:93)',
                'ref': 'RNIL 2',
                'route': 'road',
                'source': 'openstreetmap.org',
                'type': 'route',
                'network': 'FR:93:RNIL-road',
            },
                         ways=[10292212]),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 10292212,
            'shield_text': 'N2',
            'network': 'FR:N-road',
        })
    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_br_SP_many(self):
        import dsl

        z, x, y = (16, 24051, 36887)

        self.generate_fixtures(
            dsl.is_in('BR', z, x, y),
            # https://www.openstreetmap.org/way/258575188
            dsl.way(258575188, dsl.tile_diagonal(z, x, y), {
                'lanes': '1', 'name': 'Rodovia Municipal Domingos Innocentini',
                'wikipedia': 'pt:Rodovia Municipal Domingos Innocentini',
                'surface': 'asphalt', 'source': 'openstreetmap.org',
                'oneway': 'yes', 'ref': 'SPA-149/215;SCA-040',
                'highway': 'primary',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 258575188,
                'shield_text': '149',
                'network': 'BR:SP',
                'all_networks': ['BR:SP', 'BR:SP', 'BR:SP:SCA'],
                'all_shield_texts': ['149', '215', '040'],
            })
    def test_ct01_vnexpressway(self):
        import dsl

        z, x, y = (16, 52150, 30818)

        self.generate_fixtures(
            dsl.is_in('VN', z, x, y),
            # https://www.openstreetmap.org/way/129963821
            dsl.way(129963821, dsl.tile_diagonal(z, x, y), {
                'bridge': u'yes',
                'highway': u'motorway',
                'lanes': u'2',
                'layer': u'1',
                'maxspeed': u'100',
                'name': u'TP Hồ Chí Minh - Trung Lương',
                'oneway': u'yes',
                'ref': u'CT01',
                'source': u'openstreetmap.org',
                'toll': u'yes',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 129963821,
                'network': u'VN:expressway',
                'shield_text': u'CT01',
            })
    def test_dj200b_ro(self):
        import dsl

        z, x, y = (16, 37519, 23715)

        self.generate_fixtures(
            dsl.is_in('RO', z, x, y),
            # https://www.openstreetmap.org/way/3118247
            dsl.way(3118247, dsl.tile_diagonal(z, x, y), {
                'highway': u'primary',
                'is_in:city': u'București',
                'lanes': u'2',
                'maxspeed': u'50',
                'name': u'Bulevardul Iancu de Hunedoara',
                'oneway': u'yes',
                'ref': u'DJ200B',
                'smoothness': u'excellent',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 3118247,
                'network': u'RO:county',
                'shield_text': u'200B',
            })
Beispiel #7
0
    def test_no(self):
        import dsl

        z, x, y = (16, 34749, 19016)

        self.generate_fixtures(
            dsl.is_in('NO', z, x, y),
            # https://www.openstreetmap.org/way/116419571
            dsl.way(
                116419571, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'lanes': u'2',
                    'lit': u'yes',
                    'maxspeed': u'60',
                    'name': u'Hadelandsveien',
                    'ref': u'4',
                    'source': u'openstreetmap.org',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 116419571,
            'shield_text': '4',
            'network': 'NO',
        })
Beispiel #8
0
    def test_54_myfederal(self):
        import dsl

        z, x, y = (16, 51239, 32174)

        self.generate_fixtures(
            dsl.is_in('MY', z, x, y),
            # https://www.openstreetmap.org/way/258246542
            dsl.way(
                258246542, dsl.tile_diagonal(z, x, y), {
                    'bicycle': u'yes',
                    'foot': u'yes',
                    'highway': u'trunk',
                    'lanes': u'2',
                    'maxspeed': u'90',
                    'motor_vehicle': u'yes',
                    'name': u'Jalan Kepong - Kuala Selangor',
                    'oneway': u'yes',
                    'ref': u'FT54',
                    'source': u'openstreetmap.org',
                    'surface': u'paved',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 258246542,
            'network': u'MY:federal',
            'shield_text': u'54',
        })
    def test_a30_gbaroadgreen(self):
        import dsl

        z, x, y = (16, 32694, 21802)

        self.generate_fixtures(
            dsl.is_in('GB', z, x, y),
            # https://www.openstreetmap.org/way/298766837
            dsl.way(
                298766837, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'lanes': u'2',
                    'lit': u'yes',
                    'maxspeed': u'30 mph',
                    'name': u'Great South West Road',
                    'oneway': u'yes',
                    'operator': u'Transport for London',
                    'ref': u'A30',
                    'sidewalk': u'separate',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 298766837,
                'network': u'GB:A-road-green',
                'shield_text': u'A30',
            })
Beispiel #10
0
    def test_ca(self):
        import dsl

        z, x, y = (16, 13515, 21656)

        self.generate_fixtures(
            dsl.is_in('CA', z, x, y),
            # https://www.openstreetmap.org/way/284925161
            dsl.way(
                284925161, dsl.tile_diagonal(z, x, y), {
                    'highway': u'primary',
                    'lanes': u'2',
                    'maxspeed': u'100',
                    'name': u'Veterans Memorial Highway',
                    'ref': u'2',
                    'source': u'openstreetmap.org',
                    'surface': u'paved',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 284925161,
            'shield_text': '2',
            'network': 'CA',
        })
    def test_a3_gbaroad(self):
        import dsl

        z, x, y = (16, 32685, 21846)

        self.generate_fixtures(
            dsl.is_in('GB', z, x, y),
            # https://www.openstreetmap.org/way/152213939
            dsl.way(
                152213939, dsl.tile_diagonal(z, x, y), {
                    'bicycle': u'no',
                    'highway': u'trunk',
                    'highways_england:area': u'3',
                    'lanes': u'2',
                    'lit': u'yes',
                    'maxspeed': u'70 mph',
                    'maxspeed:type': u'UK:nsl_dual',
                    'name': u'Portsmouth Road',
                    'oneway': u'yes',
                    'operator': u'Highways England',
                    'ref': u'A3',
                    'source': u'openstreetmap.org',
                    'source:name': u'OS_OpenData_Locator',
                    'source:ref': u'OS_OpenData_Locator',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 152213939,
            'network': u'GB:A-road-green',
            'shield_text': u'A3',
        })
    def test_mx_yuc(self):
        import dsl

        z, x, y = (16, 16692, 28851)

        self.generate_fixtures(
            dsl.is_in("MX", z, x, y),
            # https://www.openstreetmap.org/way/131913202
            dsl.way(
                131913202,
                dsl.tile_diagonal(z, x, y),
                {
                    "source:name": "INEGI",
                    "maxspeed": "80",
                    "name": u"Carretera Sucil\xe1 - Calotmul",
                    "source:maxspeed": "INEGI",
                    "surface": "asphalt",
                    "source": "openstreetmap.org",
                    "oneway": "no",
                    "ref": "YUC 33",
                    "highway": "secondary",
                },
            ),
        )

        self.assert_has_feature(
            z, x, y, "roads", {
                "id": 131913202,
                "shield_text": "33",
                "network": "MX:YUC",
            }
        )
    def test_mx_ver(self):
        import dsl

        z, x, y = (16, 15047, 28999)

        self.generate_fixtures(
            dsl.is_in("MX", z, x, y),
            # https://www.openstreetmap.org/way/323155576
            dsl.way(
                323155576,
                dsl.tile_diagonal(z, x, y),
                {
                    "maxspeed": "70",
                    "lanes": "2",
                    "name": "Ramal a Coyutla",
                    "source": "openstreetmap.org",
                    "surface": "asphalt",
                    "width": "6",
                    "ref": "VER 127",
                    "smoothness": "intermediate",
                    "highway": "secondary",
                },
            ),
        )

        self.assert_has_feature(
            z, x, y, "roads", {
                "id": 323155576,
                "shield_text": "127",
                "network": "MX:VER",
            }
        )
    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_d230_d650_tr(self):
        import dsl

        z, x, y = (16, 38239, 24918)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4378290
            dsl.way(4378290, dsl.tile_diagonal(z, x, y), {
                'highway': u'trunk',
                'oneway': u'yes',
                'ref': u'D230;D650',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'network': u'TR-roads',
                'ref': u'D 230',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4378290]),
        )

        # note that D650, despite being numerically greater than D230, comes
        # first. this is because some highways are apparently "major" highways
        # although this doesn't make a difference to their shield.
        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4378290,
                'network': 'TR:highway',
                'shield_text': 'D650',
                'all_networks': ['TR:highway', 'TR:highway'],
                'all_shield_texts': ['D650', 'D230'],
            })
Beispiel #16
0
    def test_sa33_my_(self):
        import dsl

        z, x, y = (16, 53870, 31872)

        self.generate_fixtures(
            dsl.is_in('MY', z, x, y),
            # https://www.openstreetmap.org/way/32770972
            dsl.way(
                32770972, dsl.tile_diagonal(z, x, y), {
                    'access': u'yes',
                    'bicycle': u'yes',
                    'cycleway': u'no',
                    'fixme': u'yes',
                    'foot': u'yes',
                    'highway': u'secondary',
                    'horse': u'no',
                    'lanes': u'2',
                    'lit': u'no',
                    'motor_vehicle': u'yes',
                    'name': u'Jalan Paal-Kuala Tomani',
                    'oneway': u'no',
                    'ref': u'SA33',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 32770972,
            'network': u'MY:SBH',
            'shield_text': u'SA33',
        })
    def test_d260_tr(self):
        import dsl

        z, x, y = (16, 38509, 24944)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4636868
            dsl.way(4636868, dsl.tile_diagonal(z, x, y), {
                'highway': u'trunk',
                'level': u'-1',
                'oneway': u'yes',
                'ref': u'D-260',
                'source': u'openstreetmap.org',
            }),
            dsl.relation(1, {
                'network': u'TR-roads',
                'ref': u'D 260',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            }, ways=[4636868]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 4636868,
                'network': u'TR:highway',
                'shield_text': u'D260',
            })
    def test_orr_innh_chennai(self):
        import dsl

        z, x, y = (16, 47346, 30371)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/26807719
            dsl.way(26807719, dsl.tile_diagonal(z, x, y), {
                'highway': u'motorway',
                'lanes': u'3',
                'layer': u'1',
                'maxspeed': u'100',
                'motorroad': u'yes',
                'name': u'Outer Ring Road',
                'oneway': u'yes',
                'ref': u'ORR',
                'source': u'openstreetmap.org',
                'source:lanes': u'DigitalGlobeStandard',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 26807719,
                'network': u'IN:NH',
                'shield_text': u'ORR',
            })
    def test_d965_d060_tr(self):
        import dsl

        z, x, y = (16, 40623, 24630)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/47053015
            dsl.way(47053015, dsl.tile_diagonal(z, x, y), {
                'highway': u'primary',
                'int_ref': u'E 691',
                'name': u'Kars-Ardahan yolu',
                'ref': u'D 965 / D 060',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
            }),
            # this is in some relations, but this test is about parsing the ref
            # that has all those spaces and slashes in it.
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 47053015,
                'network': u'TR:highway',
                'shield_text': u'D060',
                'all_networks': ['TR:highway', 'TR:highway'],
                'all_shield_texts': ['D060', 'D965'],
            })
    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_wales(self):
        # wales is a country within the UK, but mapped as place=state.
        # should get a fallback from the states_provinces spreadsheet.
        import dsl

        z, x, y = (10, 501, 336)

        self.generate_fixtures(
            dsl.is_in('GB', z, x, y),
            # https://www.openstreetmap.org/node/2642288017
            dsl.point(
                2642288017, (-3.73893, 52.2928116), {
                    'is_in': u'United Kingdom, Europe',
                    'name': u'Wales',
                    'note': u'geographical centre of Wales',
                    'place': u'state',
                    'source': u'openstreetmap.org',
                }),
        )

        self.assert_has_feature(z, x, y, 'places', {
            'id': 2642288017,
            'min_zoom': 10,
            'max_zoom': 11,
        })
    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_united_kingdom(self):
        # in the absence of data joined from NE, we should fall back to a
        # default based on the country that the label point is in.
        import dsl
        from tilequeue.tile import deg2num

        lon, lat = (-3.2765753, 54.7023545)
        z = 5
        x, y = deg2num(lat, lon, z)

        self.generate_fixtures(
            dsl.is_in('GB', z, x, y),
            # https://www.openstreetmap.org/node/838090640
            dsl.point(
                838090640,
                (lon, lat),
                {
                    'name': u'United Kingdom',
                    'place': u'country',
                    'population': u'61792000',
                    'source': u'openstreetmap.org',
                    'wikidata': u'Q145',
                    'wikipedia': u'de:United Kingdom',  # LOL, de:
                }),
        )

        self.assert_has_feature(z, x, y, 'places', {
            'id': 838090640,
            'min_zoom': 1.7,
            'max_zoom': 6.7,
        })
    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_ne_min_zoom_should_override_default(self):
        import dsl
        from tilequeue.tile import deg2num

        lon, lat = (-3.2765753, 54.7023545)
        z = 5
        x, y = deg2num(lat, lon, z)

        self.generate_fixtures(
            dsl.is_in('GB', z, x, y),
            # https://www.openstreetmap.org/node/838090640
            dsl.point(
                838090640,
                (lon, lat),
                {
                    'name': u'United Kingdom',
                    'place': u'country',
                    'population': u'61792000',
                    'source': u'openstreetmap.org',
                    'wikidata': u'Q145',
                    'wikipedia': u'de:United Kingdom',  # LOL, de:
                    # NE joins should override defaults from location
                    '__ne_min_zoom': 0,
                    '__ne_max_zoom': 16,
                }),
        )

        self.assert_has_feature(z, x, y, 'places', {
            'id': 838090640,
            'min_zoom': 0,
            'max_zoom': 16,
        })
    def test_mx_son(self):
        import dsl

        z, x, y = (16, 12740, 27561)

        self.generate_fixtures(
            dsl.is_in("MX", z, x, y),
            # https://www.openstreetmap.org/way/29943430
            dsl.way(
                29943430,
                dsl.tile_diagonal(z, x, y),
                {
                    "maxspeed": "60",
                    "lanes": "4",
                    "name": u"Boulevard Rodolfo El\xedas Calles",
                    "surface": "paved",
                    "source": "openstreetmap.org",
                    "oneway": "no",
                    "ref": "SON 132",
                    "highway": "secondary",
                },
            ),
        )

        self.assert_has_feature(
            z, x, y, "roads", {
                "id": 29943430,
                "shield_text": "132",
                "network": "MX:SON",
            }
        )
    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_fr_m_road(self):
        import dsl

        z, x, y = (16, 34078, 23914)

        self.generate_fixtures(
            dsl.is_in('FR', z, x, y),
            # https://www.openstreetmap.org/way/4117272
            dsl.way(
                4117272, dsl.tile_diagonal(z, x, y), {
                    'maxspeed': '70',
                    'bicycle': 'no',
                    'name': 'Promenade Edouard Corniglion-Molinier',
                    'surface': 'asphalt',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'ref': 'M 6098',
                    'highway': 'primary',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 4117272,
            'shield_text': 'M6098',
            'network': 'FR:M-road',
        })
    def test_orr_innh_chennai(self):
        import dsl

        z, x, y = (16, 47346, 30371)

        self.generate_fixtures(
            dsl.is_in('IN', z, x, y),
            # https://www.openstreetmap.org/way/26807719
            dsl.way(
                26807719, dsl.tile_diagonal(z, x, y), {
                    'highway': u'motorway',
                    'lanes': u'3',
                    'layer': u'1',
                    'maxspeed': u'100',
                    'motorroad': u'yes',
                    'name': u'Outer Ring Road',
                    'oneway': u'yes',
                    'ref': u'ORR',
                    'source': u'openstreetmap.org',
                    'source:lanes': u'DigitalGlobeStandard',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 26807719,
            'network': u'IN:NH',
            'shield_text': u'ORR',
        })
    def test_fr_route_nationale(self):
        import dsl

        z, x, y = (16, 33512, 22698)

        self.generate_fixtures(
            dsl.is_in('FR', z, x, y),
            # https://www.openstreetmap.org/way/28470567
            dsl.way(
                28470567, dsl.tile_diagonal(z, x, y), {
                    'maxspeed': '50',
                    'lanes': '2',
                    'name': 'Avenue du 1er Mai',
                    'lit': 'yes',
                    'source': 'openstreetmap.org',
                    'oneway': 'yes',
                    'ref': 'RN 19',
                    'highway': 'primary',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 28470567,
            'shield_text': 'N19',
            'network': 'FR:N-road',
        })
    def test_add_country_code_to_road(self):
        import dsl

        # randomly chosen tile with the M4 motorway west of London, GB
        z, x, y = (16, 32680, 21796)

        # although we model these both as "ways", this is really just a way to
        # get geometry into the pipeline. in real usage, the admin_area comes
        # from a static shapefile.
        self.generate_fixtures(
            dsl.is_in('GB', z, x, y),
            dsl.way(2, dsl.tile_diagonal(z, x, y), {
                'highway': 'motorway',
                'ref': 'M4',
                'source': 'openstreetmap.org'
            }),
        )

        # should have deleted this layer before output.
        with self.layers_in_tile(z, x, y) as layers:
            self.assertNotIn('admin_areas', layers)

        # the country_code will have been used internally to generate a
        # "country_code" property, but (as per #1534) it should be stripped out
        # before the tile is output.
        self.assert_has_feature(z, x, y, 'roads', {
            'id': 2,
            'country_code': type(None),
            'network': 'GB:M-road'
        })
Beispiel #32
0
    def test_j137_my_jhr(self):
        import dsl

        z, x, y = (16, 51464, 32364)

        self.generate_fixtures(
            dsl.is_in('MY', z, x, y),
            # https://www.openstreetmap.org/way/5037585
            dsl.way(
                5037585, dsl.tile_diagonal(z, x, y), {
                    'highway': u'primary',
                    'is_in': u'Panchor, Muar, Johor, Malaysia',
                    'is_in:country': u'Malaysia',
                    'is_in:state': u'Johor',
                    'name': u'Jalan Panchor',
                    'ref': u'J137',
                    'source': u'openstreetmap.org',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 5037585,
            'network': u'MY:JHR',
            'shield_text': u'J137',
        })
    def test_kr_national(self):
        import dsl

        z, x, y = (16, 55864, 25396)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/71503022
            dsl.way(71503022, dsl.tile_diagonal(z, x, y), {
                'name:en': 'Nambusunhwan-ro', 'name': u'남부순환로',
                'name:ko': u'남부순환로', 'source': 'openstreetmap.org',
                'oneway': 'yes', 'ref': '92', 'highway': 'primary',
                'name:ja': u'南部循環路',
            }),
            dsl.relation(1, {
                'type': 'route', 'route': 'road', 'ref': '92',
                'network': 'KR:national', 'source': 'openstreetmap.org',
            }, ways=[71503022]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 71503022,
                'shield_text': '92',
                'network': 'KR:national',
            })
Beispiel #34
0
    def test_mbsa15_mysgrmunicipal(self):
        import dsl

        z, x, y = (16, 51252, 32209)

        self.generate_fixtures(
            dsl.is_in('MY', z, x, y),
            # https://www.openstreetmap.org/way/24701880
            dsl.way(
                24701880, dsl.tile_diagonal(z, x, y), {
                    'highway': u'primary',
                    'is_in': u'Shah Alam, Selangor, Malaysia',
                    'lanes': u'2',
                    'oneway': u'yes',
                    'ref': u'MBSA 15',
                    'source': u'openstreetmap.org',
                }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 24701880,
                'network': u'MY:SGR:municipal',
                'shield_text': u'BSA15',
            })
    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_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_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_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_no_relation(self):
        import dsl

        z, x, y = (16, 55886, 25381)

        self.generate_fixtures(
            dsl.is_in('KR', z, x, y),
            # https://www.openstreetmap.org/way/37399710
            dsl.way(37399710, dsl.tile_diagonal(z, x, y), {
                'tunnel:name:ko_rm': 'Namsan il ho teoneol', 'tunnel': 'yes',
                'layer': '-2', 'name:en': 'Samil-daero', 'name': u'삼일대로',
                'tunnel:name:ko': u'남산1호터널', 'name:ko': u'삼일대로',
                'review': 'no', 'name:ko_rm': 'Samil-daero',
                'tunnel:name:en': 'Namsan 1 Ho Tunnel',
                'source': 'openstreetmap.org', 'ncat': u'광역시도로',
                'oneway': 'yes', 'tunnel:name': u'남산1호터널', 'ref': 'AH1',
                'toll': 'yes', 'highway': 'primary', 'name:ja': u'三一大路',
            }),
        )

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

        z, x, y = (16, 52176, 28882)

        self.generate_fixtures(
            dsl.is_in('VN', z, x, y),
            # https://www.openstreetmap.org/way/160413329
            dsl.way(160413329, dsl.tile_diagonal(z, x, y), {
                'bicycle': u'yes',
                'cycleway': u'no',
                'foot': u'yes',
                'highway': u'secondary',
                'maxspeed': u'40',
                'name': u'Đường 208',
                'oneway': u'no',
                'ref': u'ĐT 388',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 160413329,
                'network': u'VN:provincial',
                'shield_text': u'ĐT388',
            })
    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_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_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_dc86_ro(self):
        import dsl

        z, x, y = (16, 37979, 23748)

        self.generate_fixtures(
            dsl.is_in('RO', z, x, y),
            # https://www.openstreetmap.org/way/12109479
            dsl.way(12109479, dsl.tile_diagonal(z, x, y), {
                'bicycle': u'yes',
                'highway': u'primary',
                'is_in:city': u'Năvodari',
                'lanes': u'2',
                'maxspeed': u'70',
                'oneway': u'no',
                'ref': u'DC86',
                'source': u'openstreetmap.org',
                'surface': u'asphalt',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 12109479,
                'network': u'RO:local',
                'shield_text': u'86',
            })
    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',
            })
    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_road_shield_text(self):
        # if the road has no name, but does have a shield, then we want to give
        # it a collision_rank.
        import dsl

        z, x, y = (16, 0, 0)

        self.generate_fixtures(
            dsl.is_in('US', z, x, y),
            dsl.way(1, dsl.tile_diagonal(z, x, y), {
                'highway': 'motorway',
                'source': 'openstreetmap.org',
            }),
            dsl.relation(1, {
                'network': 'US-I',
                'ref': '101',
                'type': 'route',
                'route': 'road',
            },
                         ways=[1]),
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'kind': 'highway',
                'name': type(None),
                'shield_text': '101',
                'collision_rank': int,
            })
    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'],
            })
Beispiel #49
0
    def test_d260_tr(self):
        import dsl

        z, x, y = (16, 38509, 24944)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/4636868
            dsl.way(
                4636868, dsl.tile_diagonal(z, x, y), {
                    'highway': u'trunk',
                    'level': u'-1',
                    'oneway': u'yes',
                    'ref': u'D-260',
                    'source': u'openstreetmap.org',
                }),
            dsl.relation(1, {
                'network': u'TR-roads',
                'ref': u'D 260',
                'route': u'road',
                'source': u'openstreetmap.org',
                'type': u'route',
            },
                         ways=[4636868]),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 4636868,
            'network': u'TR:highway',
            'shield_text': u'D260',
        })
    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']
            })
Beispiel #51
0
    def test_d965_d060_tr(self):
        import dsl

        z, x, y = (16, 40623, 24630)

        self.generate_fixtures(
            dsl.is_in('TR', z, x, y),
            # https://www.openstreetmap.org/way/47053015
            dsl.way(
                47053015, dsl.tile_diagonal(z, x, y), {
                    'highway': u'primary',
                    'int_ref': u'E 691',
                    'name': u'Kars-Ardahan yolu',
                    'ref': u'D 965 / D 060',
                    'source': u'openstreetmap.org',
                    'surface': u'asphalt',
                }),
            # this is in some relations, but this test is about parsing the ref
            # that has all those spaces and slashes in it.
        )

        self.assert_has_feature(
            z, x, y, 'roads', {
                'id': 47053015,
                'network': u'TR:highway',
                'shield_text': u'D060',
                'all_networks': ['TR:highway', 'TR:highway'],
                'all_shield_texts': ['D060', 'D965'],
            })
    def test_jp_national(self):
        import dsl

        z, x, y = (16, 57463, 26016)

        self.generate_fixtures(
            dsl.is_in('JP', z, x, y),
            # https://www.openstreetmap.org/way/242802845
            dsl.way(
                242802845, dsl.tile_diagonal(z, x, y), {
                    'name:en': 'National Route 163',
                    'name': u'\u56fd\u9053163\u53f7',
                    'oneway:bicycle': 'yes',
                    'source': 'openstreetmap.org',
                    'maxspeed': '50',
                    'oneway': 'yes',
                    'ref': '163',
                    'highway': 'trunk',
                    'name:ja': u'\u56fd\u9053163\u53f7',
                }),
        )

        self.assert_has_feature(z, x, y, 'roads', {
            'id': 242802845,
            'shield_text': '163',
            'network': 'JP:national',
        })
    def test_mx_slp(self):
        import dsl

        z, x, y = (16, 14396, 28636)

        self.generate_fixtures(
            dsl.is_in("MX", z, x, y),
            # https://www.openstreetmap.org/way/28926839
            dsl.way(
                28926839,
                dsl.tile_diagonal(z, x, y),
                {
                    "lanes": "3",
                    "name": "Antonio Rocha Cordero",
                    "surface": "asphalt",
                    "source": "openstreetmap.org",
                    "oneway": "yes",
                    "ref": "SLP 32",
                    "highway": "primary",
                },
            ),
        )

        self.assert_has_feature(
            z, x, y, "roads", {
                "id": 28926839,
                "shield_text": "32",
                "network": "MX:SLP",
            }
        )