def test_rehabilitation(self):
        import dsl

        z, x, y = (16, 10577, 25429)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/351588744
            dsl.way(351588744, dsl.box_area(z, x, y, 1593), {
                'addr:housenumber': '480',
                'addr:street': 'North 1st Street',
                'amenity': 'healthcare',
                'building': 'yes',
                'building:levels': '2',
                'healthcare': 'rehabilitation',
                'healthcare:speciality': 'brain_injury',
                'name': 'Services for Brain Injury',
                'source': 'openstreetmap.org',
                'website': 'http://legalaidsociety.org/',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 351588744,
                'kind': 'rehabilitation',
            })
    def test_bicycle_shop_large_way(self):
        import dsl

        z, x, y = (15, 5242, 12665)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/260354461
            dsl.way(260354461, dsl.box_area(z, x, y, 723), {
                'addr:city': 'San Francisco',
                'addr:housenumber': '1090',
                'addr:postcode': '94103',
                'addr:state': 'CA',
                'addr:street': 'Folsom Street',
                'building': 'yes',
                'height': '7',
                'name': 'SF Bike Connection',
                'shop': 'bicycle',
                'source': 'openstreetmap.org',
                'website': 'http://bikeconnection.net/',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 260354461,
                'kind': 'bicycle',
                # should be in z15 tile, so min_zoom between 15 and 16
                'min_zoom': lambda z: 15 <= z < 16,
            })
    def test_substation_15_way(self):
        import dsl

        z, x, y = (15, 9653, 12314)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/108298302
            dsl.way(108298302, dsl.box_area(z, x, y, 51769), {
                'frequency': '60',
                'location': 'outdoor',
                'name': 'Rainey Substation',
                'operator': 'Consolidated Edison',
                'power': 'substation',
                'source': 'openstreetmap.org',
                'substation': 'transmission',
                'voltage': '345000;138000',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 108298302,
                'kind': 'substation',
                'min_zoom': 15,
            })
    def test_tier1_national_park(self):
        import dsl

        z, x, y = (12, 655, 1582)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/82207054
            dsl.way(82207054, dsl.box_area(z, x, y, 421901), {
                'admin_level': '1',
                'boundary': 'national_park',
                'leisure': 'park',
                'name': 'Fort Mason',
                'operator': 'U.S. National Park Service',
                'source': 'openstreetmap.org',
                'website': 'http://www.nps.gov/goga/index.htm',
                'wikidata': 'Q948933',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 82207054,
                'kind': 'national_park',
                'min_zoom': 12,
                'tier': 1,
            })
    def test_golf_course_13_way(self):
        import dsl

        z, x, y = (13, 1308, 3167)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/16753068
            dsl.way(16753068, dsl.box_area(z, x, y, 1120479), {
                'addr:city': 'San Francisco',
                'addr:housenumber': '99',
                'addr:postcode': '94132',
                'addr:state': 'CA',
                'addr:street': 'Harding Road',
                'golf:course': '27_hole',
                'golf:par': '72 + 30',
                'leisure': 'golf_course',
                'name': 'TPC Harding Park',
                'phone': '415-664-4690',
                'source': 'openstreetmap.org',
                'website': 'http://www.tpc.com/tpc-harding-park-golf',
                'wikidata': 'Q3512308',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 16753068,
                'kind': 'golf_course',
                'min_zoom': 13,
            })
    def test_tier4_hospital(self):
        import dsl

        z, x, y = (12, 703, 1638)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/571388052
            dsl.way(571388052, dsl.box_area(z, x, y, 264897), {
                'addr:city': 'Long Beach',
                'addr:housenumber': '2801',
                'addr:postcode': '90806',
                'addr:street': 'Atlantic Avenue',
                'amenity': 'hospital',
                'emergency': 'yes',
                'healthcare': 'hospital',
                'name': 'Long Beach Memorial Hospital',
                'opening_hours': '24/7',
                'operator': 'MemorialCare',
                'phone': '+1 562 933 2000',
                'source': 'openstreetmap.org',
                'wikidata': 'Q6672309',
                'wikipedia': 'en:Long Beach Memorial Medical Center',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 571388052,
                'kind': 'hospital',
                'min_zoom': 12,
                'tier': 4,
            })
    def test_podiatrist(self):
        import dsl

        z, x, y = (16, 12431, 26269)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/563753551
            dsl.way(563753551, dsl.box_area(z, x, y, 564), {
                'addr:city': 'Fountain Hills',
                'addr:housenumber': '11046',
                'addr:postcode': '85268',
                'addr:state': 'AZ',
                'addr:street': 'North Saguaro Boulevard',
                'addr:unit': '2',
                'building': 'commercial',
                'healthcare': 'podiatrist',
                'name': 'Advanced Podiatry',
                'phone': '(480) 837-2240',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 563753551,
                'kind': 'podiatrist',
            })
    def test_ruffle_bar(self):
        # sounds like candy...
        import dsl

        z, x, y = (16, 19322, 24667)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/110163359
            dsl.way(110163359, dsl.box_area(z, x, y, 900561), {
                'boundary': 'national_park',
                'ele': '4',
                'gnis:county_id': '047',
                'gnis:created': '01/23/1980',
                'gnis:feature_id': '963071',
                'gnis:state_id': '36',
                'name': 'Ruffle Bar',
                'natural': 'wetland',
                'place': 'island',
                'source': 'openstreetmap.org',
                'wetland': 'saltmarsh',
                'wikidata': 'Q15273739',
                'wikipedia': 'en:Ruffle Bar',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 110163359,
                'kind': 'wetland',
                'kind_detail': 'saltmarsh',
            })
    def test_charles_m_russell_wildlife_refuge(self):
        import dsl

        z, x, y = (9, 103, 178)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/6059779
            dsl.way(6059779, dsl.box_area(z, x, y, 8589619557), {
                'boundary': 'protected_area',
                'leisure': 'nature_reserve',
                'name': 'Charles M. Russell National Wildlife Refuge',
                'operator': 'US Fish and Wildlife Service',
                'ownership': 'national',
                'protect_class': '4',
                'protection_title': 'National Wildlife Refuge',
                'source': 'openstreetmap.org',
                'type': 'boundary',
                'wikidata': 'Q5080495',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 6059779,
                'kind': 'nature_reserve',
                'min_zoom': 9,
            })
    def test_henry_coe_state_park(self):
        import dsl

        z, x, y = (11, 333, 795)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/318202
            dsl.way(318202, dsl.box_area(z, x, y, 560913461), {
                'attribution': 'CASIL CSP_Opbdys072008',
                'boundary': 'national_park',
                'csp:globalid': '{4BE5C08F-9239-4491-9400-5B776F304A18}',
                'csp:unitcode': '432',
                'leisure': 'nature_reserve',
                'name': 'Henry W. Coe State Park',
                'park:type': 'state_park',
                'protect_class': '5',
                'short_name': 'Coe Park',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wikidata': 'Q5729631',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 318202,
                'kind': 'park',
            })
    def test_prison_rikers_island(self):
        import dsl

        z, x, y = (13, 2414, 3077)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/3955540
            dsl.way(3955540, dsl.box_area(z, x, y, 2919251), {
                'amenity': 'prison',
                'ele': '8',
                'gnis:county_id': '005',
                'gnis:created': '01/23/1980',
                'gnis:edited': '10/27/2005',
                'gnis:feature_id': '962524',
                'gnis:state_id': '36',
                'name': 'Rikers Island',
                'place': 'island',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wikidata': 'Q120119',
                'wikipedia': 'en:Rikers Island',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 3955540,
                'kind': 'prison',
                'min_zoom': 13,
            })
    def test_okanogan_wenatchee_national_forest(self):
        import dsl

        z, x, y = (8, 42, 89)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/1447414
            dsl.way(1447414, dsl.box_area(z, x, y, 38300253290), {
                'boundary': 'national_park',
                'boundary:type': 'protected_area',
                'name': 'Okanogan-Wenatchee National Forest',
                'operator': 'United States Forest Service',
                'ownership': 'national',
                'protect_class': '6',
                'protected': 'perpetuity',
                'protection_title': 'National Forest',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'website': 'http://www.fs.usda.gov/okawen/',
                'wikidata': 'Q3079103',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 1447414,
                'kind': 'forest',
                'min_zoom': 7,
            })
    def test_arapahoe_national_forest(self):
        import dsl

        z, x, y = (8, 52, 97)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/396026
            dsl.way(396026, dsl.box_area(z, x, y, 3218601885), {
                'attribution': 'US Forest Service',
                'boundary': 'national_park',
                'boundary:type': 'protected_area',
                'name': 'Arapaho National Forest',
                'operator': 'United States Forest Service',
                'ownership': 'national',
                'protect_class': '6',
                'protected': 'perpetuity',
                'protection_title': 'National Forest',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 396026,
                'kind': 'forest',
                'min_zoom': 7,
            })
    def test_waterton_lakes_national_park(self):
        import dsl

        z, x, y = (8, 46, 87)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/6395476
            dsl.way(6395476, dsl.box_area(z, x, y, 1194507152), {
                'boundary': 'national_park',
                'leisure': 'nature_reserve',
                'name': 'Waterton Lakes National Park',
                'operator': 'Parks Canada',
                'protect_class': '2',
                'protection_title': 'National Park',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wikidata': 'Q902778',
                'wikipedia': 'en:Waterton Lakes National Park',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 6395476,
                'kind': 'national_park',
                'min_zoom': 6,
            })
    def test_blm_public_lands(self):
        import dsl

        z, x, y = (9, 107, 183)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/2517672
            dsl.way(2517672, dsl.box_area(z, x, y, 1172619201), {
                'boundary': 'protected_area',
                'name': 'BLM',
                'operator': 'US Bureau of Land Management',
                'ownership': 'national',
                'protect_class': '27',
                'protection_title': 'Public Access Land',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 2517672,
                'kind': 'protected_area',
                'min_zoom': 9,
            })
    def test_blood_bank(self):
        import dsl

        z, x, y = (16, 13332, 26538)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/123526145
            dsl.way(123526145, dsl.box_area(z, x, y, 601), {
                'addr:housenumber': '1200',
                'addr:postcode': '88011',
                'addr:street': 'Commerce Drive',
                'building': 'yes',
                'healthcare': 'blood_bank',
                'name': 'United Blood Services',
                'phone': '+1-575-527-1322',
                'source': 'openstreetmap.org',
                'website': 'http://unitedbloodservices.org/',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 123526145,
                'kind': 'blood_bank',
            })
    def test_north_pennines_aonb(self):
        import dsl

        z, x, y = (9, 252, 162)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/6576894
            dsl.way(6576894, dsl.box_area(z, x, y, 5946792285), {
                'boundary': 'national_park',
                'designation': 'area_of_outstanding_natural_beauty',
                'name': 'North Pennines AONB',
                'note': 'not a true national park',
                'source': 'openstreetmap.org',
                'type': 'boundary',
                'wikidata': 'Q1332452',
            }),
        )

        # this is a large AONB - but not technically a national park, as the
        # helpful note in the OSM data points out.
        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 6576894,
                'kind': 'park',
            })
    def test_theatre_large_way(self):
        import dsl

        z, x, y = (15, 9650, 12314)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/266170808
            dsl.way(266170808, dsl.box_area(z, x, y, 7492), {
                'amenity': 'theatre',
                'building': 'yes',
                'building:colour': '#CAC3A9',
                'building:part': 'yes',
                'height': '30',
                'name': 'Radio City Music Hall',
                'nycdoitt:bin': '1083862',
                'opening_hours': '09:30-17:00',
                'roof:colour': '#956C66',
                'roof:material': 'concrete',
                'roof:shape': 'flat',
                'source': 'openstreetmap.org',
                'tourism': 'yes',
                'website': 'http://www.radiocity.com/',
                'wikidata': 'Q753437',
                'wikipedia': 'en:Radio City Music Hall',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 266170808,
                'kind': 'theatre',
                'min_zoom': lambda z: 15 <= z < 16,
            })
    def test_big_egg_marsh(self):
        import dsl

        z, x, y = (16, 19327, 24668)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/50977027
            dsl.way(50977027, dsl.box_area(z, x, y, 254547), {
                'addr:state': 'NY',
                'boundary': 'national_park',
                'ele': '0',
                'gnis:county_name': 'Queens',
                'gnis:created': '01/23/1980',
                'gnis:feature_id': '943878',
                'gnis:feature_type': 'Swamp',
                'name': 'Big Egg Marsh',
                'natural': 'wetland',
                'place': 'island',
                'source': 'openstreetmap.org',
                'wetland': 'saltmarsh',
                'wikidata': 'Q34642571',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 50977027,
                'kind': 'wetland',
                'kind_detail': 'saltmarsh',
            })
    def test_buck_island_reef(self):
        # NOTE: this is also tagged as a national monument... so should it be
        # treated as a "strict nature reserve" and held back a few zooms or
        # promoted as a national monument??? for the moment, i've taken the
        # view that it should be held back.
        import dsl

        z, x, y = (9, 164, 230)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/8973739
            dsl.way(8973739, dsl.box_area(z, x, y, 88094771), {
                'boundary': 'protected_area',
                'leisure': 'nature_reserve',
                'name': 'Buck Island Reef National Monument',
                'operator': 'National Park Service',
                'protect_class': '1a',
                'protected_area': 'nature_reserve_strict',
                'protection_title': 'National Monument',
                'seamark:name': 'Buck Island Reef NM',
                'seamark:type': 'protected_area',
                'source': 'openstreetmap.org',
                'type': 'boundary',
                'website': 'https://www.nps.gov/buis',
                'wikidata': 'Q999352',
                'wikipedia': 'en:Buck Island Reef National Monument',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 8973739,
                'kind': 'nature_reserve',
                'min_zoom': 9,
            })
    def test_bicycle_shop_small_way(self):
        import dsl

        z, x, y = (16, 10476, 25332)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/264534357
            dsl.way(264534357, dsl.box_area(z, x, y, 362), {
                'addr:city': 'San Francisco',
                'addr:housenumber': '858',
                'addr:postcode': '94117',
                'addr:street': 'Stanyan Street',
                'building': 'yes',
                'height': '5',
                'name': 'American Cyclery Too',
                'operator': 'American Cyclery',
                'service:bicycle:pump': 'yes',
                'service:bicycle:repair': 'yes',
                'service:bicycle:retail': 'yes',
                'service:bicycle:second_hand': 'yes',
                'shop': 'bicycle',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 264534357,
                'kind': 'bicycle',
                # min_zoom between 16 and 17, less than the node at z17
                'min_zoom': lambda z: 16 <= z < 17,
            })
    def test_lake_roosevelt_national_rec_area(self):
        import dsl

        z, x, y = (9, 87, 177)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/5908558
            dsl.way(5908558, dsl.box_area(z, x, y, 914801107), {
                'boundary': 'national_park',
                'boundary:type': 'protected_area',
                'leisure': 'nature_reserve',
                'name': 'Lake Roosevelt National Recreation Area',
                'operator': 'National Park Service',
                'ownership': 'national',
                'protect_class': '5',
                'protection_title': 'National Recreation Area',
                'source': 'openstreetmap.org',
                'type': 'boundary',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 5908558,
                'kind': 'nature_reserve',
                'min_zoom': 9,
            })
    def test_lake_district_national_park(self):
        import dsl

        z, x, y = (9, 251, 163)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/287917
            dsl.way(287917, dsl.box_area(z, x, y, 6990909071), {
                'area': 'yes',
                'boundary': 'national_park',
                'designation': 'national_park',
                'name': 'Lake District National Park',
                'name:cy': 'Parc Cenedlaethol Ardal y Llynnoedd',
                'name:en': 'Lake District National Park',
                'ref:gss': 'E26000003',
                'source': 'openstreetmap.org',
                'source:ref:gss': 'ONS_OpenData',
                'type': 'boundary',
                'wikidata': 'Q211778',
            }),
        )

        # this is a national park, and should be tagged as such.
        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 287917,
                'kind': 'national_park',
            })
    def test_glacier_national_park(self):
        import dsl

        z, x, y = (6, 11, 22)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/1242641
            dsl.way(1242641, dsl.box_area(z, x, y, 9350484254), {
                'boundary': 'national_park',
                'boundary:type': 'protected_area',
                'leisure': 'nature_reserve',
                'name': 'Glacier National Park',
                'operator': 'United States National Park Service',
                'ownership': 'national',
                'protect_id': '2',
                'protected': 'perpetuity',
                'protection_title': 'National Park',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wikidata': 'Q373567',
                'wikipedia': 'en:Glacier National Park (U.S.)',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 1242641,
                'kind': 'national_park',
                'min_zoom': 6,
            })
    def test_landmark_ghirardelli_square(self):
        import dsl

        z, x, y = (12, 655, 1582)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/27104863
            dsl.way(27104863, dsl.box_area(z, x, y, 18245), {
                'area': 'yes',
                'historic': 'landmark',
                'landuse': 'retail',
                'name': 'Ghirardelli Square',
                'name:ko': u'\uae30\ub77c\ub378\ub9ac \uc2a4\ud018\uc5b4',
                'opening_hours': '11:00-21:00',
                'source': 'openstreetmap.org',
                'tourism': 'attraction',
                'wikidata': 'Q5556730',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 27104863,
                'kind': 'landmark',
                'min_zoom': 12,
            })
    def test_holy_cross(self):
        import dsl

        z, x, y = (13, 1309, 3169)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/24513384
            dsl.way(24513384, dsl.box_area(z, x, y, 1312871), {
                'ALAND': '1323862',
                'AREAID': '110413857999',
                'AWATER': '0',
                'COUNTYFP': '081',
                'landuse': 'cemetery',
                'MTFCC': 'K2582',
                'name': 'Holy Cross Cemetery',
                'source': 'openstreetmap.org',
                'STATEFP': '06',
                'Tiger:MTFCC': 'K2582',
                'wikidata': 'Q8509540',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 24513384,
                'kind': 'cemetery',
                'min_zoom': 13,
            })
    def test_substation_16_way(self):
        import dsl

        z, x, y = (16, 11223, 26160)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/394710539
            dsl.way(394710539, dsl.box_area(z, x, y, 39876), {
                'frequency': '60',
                'location': 'outdoor',
                'name': 'RECEIVING STATION H',
                'operator': 'LOS ANGELES DEPARTMENT OF WATER AND POWER',
                'power': 'substation',
                'ref': 'H',
                'source': 'openstreetmap.org',
                'substation': 'transmission',
                'voltage': '138000',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 394710539,
                'kind': 'substation',
                'min_zoom': 16,
            })
    def test_willits_cemetery(self):
        # despite the name, it has been tagged as a graveyard. the two terms
        # appear to be near-synonyms anyway (apparently a cemetery is
        # independent of any single church, and a graveyard isn't - but i had
        # to look that up, it wasn't obvious to me).
        import dsl

        z, x, y = (14, 2577, 6237)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/368713224
            dsl.way(368713224, dsl.box_area(z, x, y, 74278), {
                'amenity': 'grave_yard',
                'ele': '467',
                'gnis:county_id': '045',
                'gnis:created': '01/19/1981',
                'gnis:feature_id': '237866',
                'gnis:state_id': '06',
                'name': 'Willits Cemetery',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 368713224,
                'kind': 'grave_yard',
                'min_zoom': 14,
            })
    def test_over_land(self):
        # same test as before, but this time without the tags which indicate
        # it's water. over land, we should retain the landuse polygon.
        import dsl

        z, x, y = (16, 32272, 21795)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/3303804
            dsl.way(3303804, dsl.box_area(z, x, y, 1045925), {
                'access:tide': 'yes',
                'landuse': 'harbour',
                'name': 'Royal Portbury Dock',
                'seamark:harbour:category': 'roro',
                'seamark:type': 'harbour',
                'source': 'openstreetmap.org',
                'wikidata': 'Q7374733',
            }),
        )

        # harbour landuse label should come through
        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 3303804,
                'kind': 'harbour',
                'name': 'Royal Portbury Dock',
                'label_placement': True,
            })

        # landuse area should come through over land.
        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 3303804,
                'label_placement': type(None),
            })
    def test_yellow_bar_hassock(self):
        import dsl

        z, x, y = (16, 19325, 24665)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/50976996
            dsl.way(50976996, dsl.box_area(z, x, y, 930605), {
                'boundary': 'national_park',
                'ele': '0',
                'gnis:county_id': '047',
                'gnis:created': '01/23/1980',
                'gnis:feature_id': '971817',
                'gnis:state_id': '36',
                'name': 'Yellow Bar Hassock',
                'natural': 'wetland',
                'place': 'island',
                'source': 'openstreetmap.org',
                'wetland': 'saltmarsh',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 50976996,
                'kind': 'wetland',
                'kind_detail': 'saltmarsh',
            })
示例#31
0
    def test_solo_way(self):
        import dsl

        z, x, y = (16, 32744, 21517)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/164058691
            dsl.way(164058691, dsl.box_area(z, x, y, 1793476), {
                'closed:aeroway': 'aerodrome',
                'military': 'airfield',
                'name': 'RAF Upwood',
                'source': 'openstreetmap.org',
                'wikidata': 'Q7275648',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 164058691,
                'kind': 'airfield',
            })
    def test_forest(self):
        import dsl

        z, x, y = (9, 123, 180)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/1430156
            dsl.way(1430156, dsl.box_area(z, x, y, 2068410835), {
                'landuse': 'forest',
                'name': 'Savanna State Forest',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 1430156,
                'kind': 'forest',
                'min_zoom': 9,
            })
示例#33
0
    def test_parking_medium(self):
        import dsl

        z, x, y = (16, 10471, 25341)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/162093420
            dsl.way(162093420, dsl.box_area(z, x, y, 6111), {
                'access': 'destination',
                'amenity': 'parking',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 162093420,
                'kind': 'parking',
                'min_zoom': 16,
                'capacity': int,
            })
示例#34
0
    def test_large_rest_area_way(self):
        import dsl

        z, x, y = (11, 590, 754)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/319789716
            dsl.way(
                319789716, dsl.box_area(z, x, y, 130087), {
                    'area': u'yes',
                    'highway': u'rest_area',
                    'name': u'Preble',
                    'source': u'openstreetmap.org',
                    'toilets': u'yes',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 319789716,
            'kind': u'rest_area',
            'min_zoom': 11,
        })
示例#35
0
    def test_bare_rock(self):
        import dsl

        z, x, y = (16, 19300, 24626)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/385443481
            dsl.way(
                385443481, dsl.box_area(z, x, y, 3411), {
                    'alt_name': 'Rat Rock',
                    'name': 'Umpire Rock',
                    'natural': 'bare_rock',
                    'source': 'openstreetmap.org',
                    'wikidata': 'Q7295400',
                    'wikipedia': 'en:Rat Rock',
                }), )

        self.assert_has_feature(z, x, y, 'landuse', {
            'id': 385443481,
            'kind': 'bare_rock',
        })
示例#36
0
    def test_substation_17_way(self):
        import dsl

        z, x, y = (17, 20966, 50660)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/35115839
            dsl.way(
                35115839, dsl.box_area(z, x, y, 4869), {
                    'building': 'yes',
                    'height': '36 m',
                    'name': 'Pacific Gas & Electric Mission Substation',
                    'power': 'substation',
                    'source': 'openstreetmap.org',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 35115839,
            'kind': 'substation',
            'min_zoom': 17,
        })
示例#37
0
    def test_tier3_university(self):
        import dsl

        z, x, y = (12, 657, 1581)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/109193723
            dsl.way(
                109193723, dsl.box_area(z, x, y, 289389), {
                    'amenity': 'university',
                    'name': 'University of California, Berkeley - '
                    'Clark Kerr Campus',
                    'source': 'openstreetmap.org',
                }), )

        self.assert_has_feature(z, x, y, 'landuse', {
            'id': 109193723,
            'kind': 'university',
            'min_zoom': 12,
            'tier': 3,
        })
示例#38
0
    def test_cumberland_island_national_seashore(self):
        import dsl

        z, x, y = (9, 140, 209)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/4269033
            dsl.way(
                4269033, dsl.box_area(z, x, y, 202731274), {
                    'boundary': 'protected_area',
                    'name': 'Cumberland Island National Seashore',
                    'protect_class': '1',
                    'protection_title': 'National Seashore',
                    'source': 'openstreetmap.org',
                    'type': 'multipolygon',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 4269033,
            'kind': 'protected_area',
            'min_zoom': 9,
        })
示例#39
0
    def test_glen_canyon(self):
        import dsl

        z, x, y = (13, 1309, 3167)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/35800082
            dsl.way(35800082, dsl.box_area(z, x, y, 415604), {
                'gnis:feature_id': '224213',
                'leisure': 'park',
                'name': 'Glen Canyon Park',
                'source': 'openstreetmap.org',
                'wikidata': 'Q5567631',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 35800082,
                'kind': 'park',
                'min_zoom': 13,
            })
示例#40
0
    def test_bernal_heights(self):
        import dsl

        z, x, y = (13, 1310, 3167)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/16752188
            dsl.way(16752188, dsl.box_area(z, x, y, 209667), {
                'alt_name': 'Bernal Hill Park',
                'leisure': 'park',
                'name': 'Bernal Heights Park',
                'note': 'Off-leash dog park with no fence.',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 16752188,
                'kind': 'park',
                'min_zoom': 13,
            })
示例#41
0
    def test_little_lake_creek_wilderness(self):
        import dsl

        z, x, y = (10, 239, 420)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/209936201
            dsl.way(
                209936201, dsl.box_area(z, x, y, 21727129), {
                    'boundary': 'protected_area',
                    'landuse': 'conservation',
                    'name': 'Little Lake Creek Wilderness',
                    'protect_class': '1b',
                    'source': 'openstreetmap.org',
                    'wikidata': 'Q27973601',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 209936201,
            'kind': 'protected_area',
            'min_zoom': 10,
        })
示例#42
0
    def test_museum_petit_palais(self):
        import dsl

        z, x, y = (12, 2074, 1408)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/2778854
            dsl.way(2778854, dsl.box_area(z, x, y, 20111), {
                'addr:city': 'Paris',
                'addr:postcode': '75008',
                'addr:street': 'Avenue Winston Churchill',
                'architect': 'Charles Girault',
                'building': 'yes',
                'heritage': '3',
                'heritage:operator': 'mhs',
                'internet_access': 'wlan',
                'internet_access:fee': 'no',
                'internet_access:operator': 'Mairie de Paris',
                'name': 'Petit Palais',
                'opening_hours': 'Tu-Su 10:00-18:00',
                'phone': '+33 153 434 000',
                'ref:mhs': 'PA00088878',
                'source': 'openstreetmap.org',
                'source:internet_access': 'Paris Open Data',
                'start_date': '1900',
                'tourism': 'museum',
                'type': 'multipolygon',
                'website': 'http://www.petitpalais.paris.fr/',
                'wikidata': 'Q820892',
                'wikipedia': 'fr:Petit Palais',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 2778854,
                'kind': 'museum',
                'min_zoom': 12,
            })
    def test_landuse_saltmarsh(self):
        import dsl

        z, x, y = (16, 19323, 24662)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/50977043
            dsl.way(
                50977043, dsl.box_area(z, x, y, 122442), {
                    'boundary': 'national_park',
                    'landuse': 'meadow',
                    'natural': 'wetland',
                    'place': 'island',
                    'source': 'openstreetmap.org',
                    'wetland': 'saltmarsh',
                }), )

        self.assert_has_feature(z, x, y, 'landuse', {
            'id': 50977043,
            'kind': 'wetland',
            'kind_detail': 'saltmarsh',
        })
示例#44
0
    def test_low_emission_zone_way(self):
        import dsl

        z, x, y = (13, 4212, 2702)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/373249337
            dsl.way(
                373249337, dsl.box_area(z, x, y, 8608219), {
                    'boundary': 'low_emission_zone',
                    'name': 'Milieuzone Utrecht',
                    'source': 'openstreetmap.org',
                    'website':
                    'http://www.utrecht.nl/verkeersbeleid/milieuzone/',
                }), )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 373249337,
                'min_zoom': lambda z: 12 <= z < 13,
                'kind': 'low_emission_zone',
            })
示例#45
0
    def test_tpe(self):
        # TPE doesn't have "aerodrome" or "aerodrome:type" tags, so we look at
        # the join to Wikidata for the passenger numbers.
        import dsl

        z, x, y = (13, 6854, 3506)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/321502590
            dsl.way(
                321502590, dsl.box_area(z, x, y, 13507964), {
                    'aeroway': 'aerodrome',
                    'barrier': 'wall',
                    'ele': '33',
                    'iata': 'TPE',
                    'icao': 'RCTP',
                    'IFR': 'yes',
                    'name':
                    u'\u81fa\u7063\u6843\u5712\u570b\u969b\u6a5f\u5834',
                    'name:af': 'Taiwan Taoyuan Internasionale Lughawe',
                    'name:de': 'Flughafen Taiwan Taoyuan',
                    'name:en': 'Taiwan Taoyuan International Airport',
                    'name:es':
                    u'Aeropuerto Internacional de Taiw\xe1n Taoyuan',
                    'name:fr': u'A\xe9roport international Taiwan-Taoyuan',
                    'source': 'openstreetmap.org',
                    'variation': '4 W 2014 0.04 W',
                    'website': 'https://www.taoyuan-airport.com/',
                    'wikidata': 'Q44856',
                    'wikipedia:en': 'Taiwan_Taoyuan_International_Airport',
                    'passenger_count': '46535180',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 321502590,
            'kind': 'aerodrome',
            'kind_detail': 'international',
        })
    def test_natural_wood(self):
        import dsl

        z, x, y = (14, 11782, 7469)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/5617154
            dsl.way(5617154, dsl.box_area(z, x, y, 9186148530), {
                'name': 'Nallamala Forest',
                'natural': 'wood',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wikidata': 'Q1579454',
                'wikipedia': 'en:Nallamala Hills',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 5617154,
                'kind': 'natural_wood',
                'min_zoom': 9,
            })
    def test_natural_wood_usfs_2(self):
        # previously, being operator=USFS had meant a zoom bump, but no longer.
        import dsl

        z, x, y = (14, 2734, 6245)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/7352119
            dsl.way(7352119, dsl.box_area(z, x, y, 19525176), {
                'access': 'yes',
                'natural': 'wood',
                'operator': 'United States Forest Service',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 7352119,
                'kind': 'natural_wood',
                'min_zoom': 9,
            })
示例#48
0
    def test_adirondack(self):
        import dsl

        z, x, y = (8, 75, 93)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/1695394
            dsl.way(1695394, dsl.box_area(z, x, y, 45506933692), {
                'boundary': 'national_park',
                'name': 'Adirondack Park',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wikidata': 'Q357550',
                'wikipedia': 'en:Adirondack Park',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 1695394,
                'kind': 'park',
                'min_zoom': 8,
            })
示例#49
0
    def test_parking_huge_1(self):
        import dsl

        z, x, y = (15, 5234, 12670)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/32928608
            dsl.way(32928608, dsl.box_area(z, x, y, 16489), {
                'amenity': 'parking',
                'source': 'openstreetmap.org',
                'tiger:cfcc': 'A41',
                'tiger:county': 'San Francisco, CA',
                'tiger:reviewed': 'no',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 32928608,
                'kind': 'parking',
                'min_zoom': 15,
                'capacity': int,
            })
示例#50
0
    def test_mount_sutro_open_space(self):
        import dsl

        z, x, y = (13, 1309, 3166)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/3307684
            dsl.way(3307684, dsl.box_area(z, x, y, 675691), {
                'landuse': 'forest',
                'leisure': 'park',
                'name': 'Mount Sutro Open Space Reserve',
                'source': 'openstreetmap.org',
                'type': 'multipolygon',
                'wood': 'Eucalyptus',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 3307684,
                'kind': 'park',
                'min_zoom': 13,
            })
示例#51
0
    def test_mex(self):
        # although MEX doesn't have an "aerodrome:type" of international, and
        # no "aerodrome" tag, there's still an "international_flights" tag we
        # can use to determine this.
        import dsl

        z, x, y = (13, 1841, 3645)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/99909133
            dsl.way(
                99909133, dsl.box_area(z, x, y, 8005638), {
                    'aerodrome:type': 'public',
                    'aeroway': 'aerodrome',
                    'barrier': 'fence',
                    'ele': '2238',
                    'fence_type': 'wire',
                    'iata': 'MEX',
                    'icao': 'MMMX',
                    'international_flights': 'yes',
                    'is_in': 'Mexico City,D.F.,Mexico',
                    'name':
                    u'Aeropuerto Internacional de la Ciudad de M\xe9xico',
                    'name:en': 'Mexico City International Airport',
                    'operator':
                    u'Grupo Aeroportuario de la Ciudad de M\xe9xico',
                    'passengers': '33000000',
                    'source': 'openstreetmap.org',
                    'wikidata': 'Q860559',
                    'wikipedia': 'en:Mexico City International Airport',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 99909133,
            'kind': 'aerodrome',
            'kind_detail': 'international',
        })
示例#52
0
    def test_parking_mega(self):
        import dsl

        z, x, y = (14, 2950, 6428)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/73540518
            dsl.way(73540518, dsl.box_area(z, x, y, 55615), {
                'amenity': 'parking',
                'source': 'openstreetmap.org',
                'building':	'yes',
                'fee': 'yes',
                'name': 'MGM Grand Self Parking',
                'parking': 'multi-storey',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 73540518,
                'kind': 'parking_garage',
                'min_zoom': 14,
                'capacity': int,
            })
示例#53
0
    def test_parking_huge_2(self):
        import dsl

        z, x, y = (15, 5900, 12855)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/52175579
            dsl.way(52175579, dsl.box_area(z, x, y, 31611), {
                'amenity': 'parking',
                'source': 'openstreetmap.org',
                'building':	'yes',
                'fee': 'yes',
                'name': 'Aria and Vdara Self Parking',
                'parking': 'multi-storey',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 52175579,
                'kind': 'parking_garage',
                'min_zoom': 15,
                'capacity': int,
            })
示例#54
0
    def test_blm_public_lands(self):
        import dsl

        z, x, y = (9, 107, 183)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/2517672
            dsl.way(
                2517672, dsl.box_area(z, x, y, 1172619201), {
                    'boundary': 'protected_area',
                    'name': 'BLM',
                    'operator': 'US Bureau of Land Management',
                    'ownership': 'national',
                    'protect_class': '27',
                    'protection_title': 'Public Access Land',
                    'source': 'openstreetmap.org',
                    'type': 'multipolygon',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 2517672,
            'kind': 'protected_area',
            'min_zoom': 9,
        })
示例#55
0
    def test_blithedale_summit_landuse(self):
        import dsl

        z, x, y = (13, 1307, 3162)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/297452972
            dsl.way(297452972, dsl.box_area(z, x, y, 4142889), {
                'boundary': 'national_park',
                'boundary:type': 'protected_area',
                'leisure': 'common',
                'name': 'Blithedale Summit Open Space Preserve',
                'operator': 'Marin County Parks',
                'protect_class': '5',
                'protection_title': 'Open Space Preserve',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 297452972,
                'kind': 'common',
            })
示例#56
0
    def test_combo_poly(self):
        # combo tagging with polygon
        import dsl

        z, x, y = (16, 32692, 21778)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/166164837
            dsl.way(166164837, dsl.box_area(z, x, y, 4991683), {
                'aerodrome': 'military',
                'aeroway': 'aerodrome',
                'iata': 'NHT',
                'icao': 'EGWU',
                'landuse': 'military',
                'military': 'airfield',
                'name': 'RAF Northolt',
                'operator': 'Royal Air Force',
                'ref': 'NHT',
                'source': 'openstreetmap.org',
                'wikidata': 'Q106119',
                'wikipedia': 'en:RAF Northolt',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 166164837,
                'kind': 'airfield',
            })

        # check landuse too
        self.assert_has_feature(
            z, x, y, 'landuse', {
                'id': 166164837,
                'kind': 'airfield',
            })
示例#57
0
    def test_substation_15_way(self):
        import dsl

        z, x, y = (15, 9653, 12314)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/108298302
            dsl.way(
                108298302, dsl.box_area(z, x, y, 51769), {
                    'frequency': '60',
                    'location': 'outdoor',
                    'name': 'Rainey Substation',
                    'operator': 'Consolidated Edison',
                    'power': 'substation',
                    'source': 'openstreetmap.org',
                    'substation': 'transmission',
                    'voltage': '345000;138000',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 108298302,
            'kind': 'substation',
            'min_zoom': 15,
        })
    def test_no_label_boundary(self):
        # test that the boundary of the lake doesn't contribute a label
        # to the tile, and that we strip names from the boundaries.
        import dsl

        z, x, y = (4, 3, 4)
        area = 30000000000

        self.generate_fixtures(
            dsl.way(
                1, dsl.box_area(z, x, y, area, include_boundary=True), {
                    'featurecla': u'Lake',
                    'label': u'Lake',
                    'min_label': 3.7,
                    'min_zoom': 2.0,
                    'name': u'Lake',
                    'ne_id': u'1',
                    'scalerank': 2,
                    'source': u'naturalearthdata.com',
                    'wdid_score': 4,
                    'wikidataid': u'Q999999999',
                }), )

        # we shouldn't get a label placement point
        self.assert_no_matching_feature(z, x, y, 'water', {
            'kind': 'lake',
            'label_placement': True,
        })

        # but we should get a lake polygon, but that lake polygon shouldn't
        # have names or name translations on it.
        self.assert_has_feature(z, x, y, 'water', {
            'kind': 'lake',
            'name': type(None),
            'name:fr': type(None),
        })
示例#59
0
    def test_north_pennines_aonb(self):
        import dsl

        z, x, y = (9, 252, 162)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/6576894
            dsl.way(
                6576894, dsl.box_area(z, x, y, 5946792285), {
                    'boundary': 'national_park',
                    'designation': 'area_of_outstanding_natural_beauty',
                    'name': 'North Pennines AONB',
                    'note': 'not a true national park',
                    'source': 'openstreetmap.org',
                    'type': 'boundary',
                    'wikidata': 'Q1332452',
                }), )

        # this is a large AONB - but not technically a national park, as the
        # helpful note in the OSM data points out.
        self.assert_has_feature(z, x, y, 'pois', {
            'id': 6576894,
            'kind': 'park',
        })
示例#60
0
    def test_large_university(self):
        import dsl

        z, x, y = (10, 165, 399)

        self.generate_fixtures(
            # https://www.openstreetmap.org/relation/309918
            dsl.way(
                309918, dsl.box_area(z, x, y, 14614122), {
                    'amenity': 'university',
                    'name': 'California State University Monterey Bay',
                    'source': 'openstreetmap.org',
                    'type': 'multipolygon',
                    'website': 'https://csumb.edu/',
                    'wikidata': 'Q624686',
                    'wikipedia':
                    'en:California State University, Monterey Bay',
                }), )

        self.assert_has_feature(z, x, y, 'pois', {
            'id': 309918,
            'kind': 'university',
            'min_zoom': 10,
        })