- 'leisure:pitch' => array('label' => 'Pitch', 'frequency' => 762, 'icon' => ''),
- 'highway:unsurfaced' => array('label' => 'Unsurfaced', 'frequency' => 492, 'icon' => ''),
- 'historic:ruins' => array('label' => 'Ruins', 'frequency' => 483, 'icon' => 'tourist_ruin'),
- 'amenity:college' => array('label' => 'College', 'frequency' => 473, 'icon' => 'education_school'),
- 'historic:monument' => array('label' => 'Monument', 'frequency' => 470, 'icon' => 'tourist_monument'),
- 'railway:subway' => array('label' => 'Subway', 'frequency' => 385, 'icon' => ''),
- 'historic:memorial' => array('label' => 'Memorial', 'frequency' => 382, 'icon' => 'tourist_monument'),
- 'leisure:nature_reserve' => array('label' => 'Nature Reserve', 'frequency' => 342, 'icon' => ''),
- 'leisure:common' => array('label' => 'Common', 'frequency' => 322, 'icon' => ''),
- 'waterway:lock_gate' => array('label' => 'Lock Gate', 'frequency' => 321, 'icon' => ''),
- 'natural:fell' => array('label' => 'Fell', 'frequency' => 308, 'icon' => ''),
- 'amenity:nightclub' => array('label' => 'Nightclub', 'frequency' => 292, 'icon' => ''),
- 'highway:path' => array('label' => 'Path', 'frequency' => 287, 'icon' => ''),
- 'leisure:garden' => array('label' => 'Garden', 'frequency' => 285, 'icon' => ''),
- 'landuse:reservoir' => array('label' => 'Reservoir', 'frequency' => 276, 'icon' => ''),
- 'leisure:playground' => array('label' => 'Playground', 'frequency' => 264, 'icon' => ''),
- 'leisure:stadium' => array('label' => 'Stadium', 'frequency' => 212, 'icon' => ''),
- 'historic:mine' => array('label' => 'Mine', 'frequency' => 193, 'icon' => 'poi_mine'),
- 'natural:cliff' => array('label' => 'Cliff', 'frequency' => 193, 'icon' => ''),
- 'tourism:caravan_site' => array('label' => 'Caravan Site', 'frequency' => 183, 'icon' => 'accommodation_caravan_park'),
- 'amenity:bus_station' => array('label' => 'Bus Station', 'frequency' => 181, 'icon' => 'transport_bus_station'),
- 'amenity:kindergarten' => array('label' => 'Kindergarten', 'frequency' => 179, 'icon' => ''),
- 'highway:construction' => array('label' => 'Construction', 'frequency' => 176, 'icon' => ''),
- 'amenity:atm' => array('label' => 'Atm', 'frequency' => 172, 'icon' => 'money_atm2'),
- 'amenity:emergency_phone' => array('label' => 'Emergency Phone', 'frequency' => 164, 'icon' => ''),
- 'waterway:lock' => array('label' => 'Lock', 'frequency' => 146, 'icon' => ''),
- 'waterway:riverbank' => array('label' => 'Riverbank', 'frequency' => 143, 'icon' => ''),
- 'natural:coastline' => array('label' => 'Coastline', 'frequency' => 142, 'icon' => ''),
- 'tourism:viewpoint' => array('label' => 'Viewpoint', 'frequency' => 140, 'icon' => 'tourist_view_point'),
- 'tourism:hostel' => array('label' => 'Hostel', 'frequency' => 140, 'icon' => ''),
- 'tourism:bed_and_breakfast' => array('label' => 'Bed And Breakfast', 'frequency' => 140, 'icon' => 'accommodation_bed_and_breakfast'),
- 'railway:halt' => array('label' => 'Halt', 'frequency' => 135, 'icon' => ''),
- 'railway:platform' => array('label' => 'Platform', 'frequency' => 134, 'icon' => ''),
- 'railway:tram' => array('label' => 'Tram', 'frequency' => 130, 'icon' => 'transport_tram_stop'),
- 'amenity:courthouse' => array('label' => 'Courthouse', 'frequency' => 129, 'icon' => 'amenity_court'),
- 'amenity:recycling' => array('label' => 'Recycling', 'frequency' => 126, 'icon' => 'amenity_recycling'),
- 'amenity:dentist' => array('label' => 'Dentist', 'frequency' => 124, 'icon' => 'health_dentist'),
- 'natural:beach' => array('label' => 'Beach', 'frequency' => 121, 'icon' => 'tourist_beach'),
- 'place:moor' => array('label' => 'Moor', 'frequency' => 118, 'icon' => ''),
- 'amenity:grave_yard' => array('label' => 'Grave Yard', 'frequency' => 110, 'icon' => ''),
- 'waterway:drain' => array('label' => 'Drain', 'frequency' => 108, 'icon' => ''),
- 'landuse:grass' => array('label' => 'Grass', 'frequency' => 106, 'icon' => ''),
- 'landuse:village_green' => array('label' => 'Village Green', 'frequency' => 106, 'icon' => ''),
- 'natural:bay' => array('label' => 'Bay', 'frequency' => 102, 'icon' => ''),
- 'railway:tram_stop' => array('label' => 'Tram Stop', 'frequency' => 101, 'icon' => 'transport_tram_stop'),
- 'leisure:marina' => array('label' => 'Marina', 'frequency' => 98, 'icon' => ''),
- 'highway:stile' => array('label' => 'Stile', 'frequency' => 97, 'icon' => ''),
- 'natural:moor' => array('label' => 'Moor', 'frequency' => 95, 'icon' => ''),
- 'railway:light_rail' => array('label' => 'Light Rail', 'frequency' => 91, 'icon' => ''),
- 'railway:narrow_gauge' => array('label' => 'Narrow Gauge', 'frequency' => 90, 'icon' => ''),
- 'natural:land' => array('label' => 'Land', 'frequency' => 86, 'icon' => ''),
- 'amenity:village_hall' => array('label' => 'Village Hall', 'frequency' => 82, 'icon' => ''),
- 'waterway:dock' => array('label' => 'Dock', 'frequency' => 80, 'icon' => ''),
- 'amenity:veterinary' => array('label' => 'Veterinary', 'frequency' => 79, 'icon' => ''),
- 'landuse:brownfield' => array('label' => 'Brownfield', 'frequency' => 77, 'icon' => ''),
- 'leisure:track' => array('label' => 'Track', 'frequency' => 76, 'icon' => ''),
- 'railway:historic_station' => array('label' => 'Historic Station', 'frequency' => 74, 'icon' => ''),
- 'landuse:construction' => array('label' => 'Construction', 'frequency' => 72, 'icon' => ''),
- 'amenity:prison' => array('label' => 'Prison', 'frequency' => 71, 'icon' => 'amenity_prison'),
- 'landuse:quarry' => array('label' => 'Quarry', 'frequency' => 71, 'icon' => ''),
- 'amenity:telephone' => array('label' => 'Telephone', 'frequency' => 70, 'icon' => ''),
- 'highway:traffic_signals' => array('label' => 'Traffic Signals', 'frequency' => 66, 'icon' => ''),
- 'natural:heath' => array('label' => 'Heath', 'frequency' => 62, 'icon' => ''),
- 'historic:house' => array('label' => 'House', 'frequency' => 61, 'icon' => ''),
- 'amenity:social_club' => array('label' => 'Social Club', 'frequency' => 61, 'icon' => ''),
- 'landuse:military' => array('label' => 'Military', 'frequency' => 61, 'icon' => ''),
- 'amenity:health_centre' => array('label' => 'Health Centre', 'frequency' => 59, 'icon' => ''),
- 'historic:building' => array('label' => 'Building', 'frequency' => 58, 'icon' => ''),
- 'amenity:clinic' => array('label' => 'Clinic', 'frequency' => 57, 'icon' => ''),
- 'highway:services' => array('label' => 'Services', 'frequency' => 56, 'icon' => ''),
- 'amenity:ferry_terminal' => array('label' => 'Ferry Terminal', 'frequency' => 55, 'icon' => ''),
- 'natural:marsh' => array('label' => 'Marsh', 'frequency' => 55, 'icon' => ''),
- 'natural:hill' => array('label' => 'Hill', 'frequency' => 54, 'icon' => ''),
- 'highway:raceway' => array('label' => 'Raceway', 'frequency' => 53, 'icon' => ''),
- 'amenity:taxi' => array('label' => 'Taxi', 'frequency' => 47, 'icon' => ''),
- 'amenity:take_away' => array('label' => 'Take Away', 'frequency' => 45, 'icon' => ''),
- 'amenity:car_rental' => array('label' => 'Car Rental', 'frequency' => 44, 'icon' => ''),
- 'place:islet' => array('label' => 'Islet', 'frequency' => 44, 'icon' => ''),
- 'amenity:nursery' => array('label' => 'Nursery', 'frequency' => 44, 'icon' => ''),
- 'amenity:nursing_home' => array('label' => 'Nursing Home', 'frequency' => 43, 'icon' => ''),
- 'amenity:toilets' => array('label' => 'Toilets', 'frequency' => 38, 'icon' => ''),
- 'amenity:hall' => array('label' => 'Hall', 'frequency' => 38, 'icon' => ''),
- 'waterway:boatyard' => array('label' => 'Boatyard', 'frequency' => 36, 'icon' => ''),
- 'highway:mini_roundabout' => array('label' => 'Mini Roundabout', 'frequency' => 35, 'icon' => ''),
- 'historic:manor' => array('label' => 'Manor', 'frequency' => 35, 'icon' => ''),
- 'tourism:chalet' => array('label' => 'Chalet', 'frequency' => 34, 'icon' => ''),
- 'amenity:bicycle_parking' => array('label' => 'Bicycle Parking', 'frequency' => 34, 'icon' => ''),
- 'amenity:hotel' => array('label' => 'Hotel', 'frequency' => 34, 'icon' => ''),
- 'waterway:weir' => array('label' => 'Weir', 'frequency' => 33, 'icon' => ''),
- 'natural:wetland' => array('label' => 'Wetland', 'frequency' => 33, 'icon' => ''),
- 'natural:cave_entrance' => array('label' => 'Cave Entrance', 'frequency' => 32, 'icon' => ''),
- 'amenity:crematorium' => array('label' => 'Crematorium', 'frequency' => 31, 'icon' => ''),
- 'tourism:picnic_site' => array('label' => 'Picnic Site', 'frequency' => 31, 'icon' => ''),
- 'landuse:wood' => array('label' => 'Wood', 'frequency' => 30, 'icon' => ''),
- 'landuse:basin' => array('label' => 'Basin', 'frequency' => 30, 'icon' => ''),
- 'natural:tree' => array('label' => 'Tree', 'frequency' => 30, 'icon' => ''),
- 'leisure:slipway' => array('label' => 'Slipway', 'frequency' => 29, 'icon' => ''),
- 'landuse:meadow' => array('label' => 'Meadow', 'frequency' => 29, 'icon' => ''),
- 'landuse:piste' => array('label' => 'Piste', 'frequency' => 28, 'icon' => ''),
- 'amenity:care_home' => array('label' => 'Care Home', 'frequency' => 28, 'icon' => ''),
- 'amenity:club' => array('label' => 'Club', 'frequency' => 28, 'icon' => ''),
- 'amenity:medical_centre' => array('label' => 'Medical Centre', 'frequency' => 27, 'icon' => ''),
- 'historic:roman_road' => array('label' => 'Roman Road', 'frequency' => 27, 'icon' => ''),
- 'historic:fort' => array('label' => 'Fort', 'frequency' => 26, 'icon' => ''),
- 'railway:subway_entrance' => array('label' => 'Subway Entrance', 'frequency' => 26, 'icon' => ''),
- 'historic:yes' => array('label' => 'Historic', 'frequency' => 25, 'icon' => ''),
- 'highway:gate' => array('label' => 'Gate', 'frequency' => 25, 'icon' => ''),
- 'leisure:fishing' => array('label' => 'Fishing', 'frequency' => 24, 'icon' => ''),
- 'historic:museum' => array('label' => 'Museum', 'frequency' => 24, 'icon' => ''),
- 'amenity:car_wash' => array('label' => 'Car Wash', 'frequency' => 24, 'icon' => ''),
- 'railway:level_crossing' => array('label' => 'Level Crossing', 'frequency' => 23, 'icon' => ''),
- 'leisure:bird_hide' => array('label' => 'Bird Hide', 'frequency' => 23, 'icon' => ''),
- 'natural:headland' => array('label' => 'Headland', 'frequency' => 21, 'icon' => ''),
- 'tourism:apartments' => array('label' => 'Apartments', 'frequency' => 21, 'icon' => ''),
- 'amenity:shopping' => array('label' => 'Shopping', 'frequency' => 21, 'icon' => ''),
- 'natural:scrub' => array('label' => 'Scrub', 'frequency' => 20, 'icon' => ''),
- 'natural:fen' => array('label' => 'Fen', 'frequency' => 20, 'icon' => ''),
- 'building:yes' => array('label' => 'Building', 'frequency' => 200, 'icon' => ''),
- 'mountain_pass:yes' => array('label' => 'Mountain Pass', 'frequency' => 200, 'icon' => ''),
+/**
+ * Return a class importance value for the given place.
+ *
+ * @param array[] $aPlace Information about the place.
+ *
+ * @return int An importance value. The lower the value, the more
+ * important the class.
+ */
+function getImportance($aPlace)
+{
+ static $aWithImportance = null;
+
+ if ($aWithImportance === null) {
+ $aWithImportance = array_flip(array(
+ 'place:country',
+ 'place:state',
+ 'place:province',
+ 'place:county',
+ 'place:city',
+ 'place:region',
+ 'place:island',
+ 'place:town',
+ 'place:village',
+ 'place:hamlet',
+ 'place:suburb',
+ 'place:locality',
+ 'landuse:farm',
+ 'place:farm',
+ 'highway:motorway_junction',
+ 'highway:motorway',
+ 'highway:trunk',
+ 'highway:primary',
+ 'highway:secondary',
+ 'highway:tertiary',
+ 'highway:residential',
+ 'highway:unclassified',
+ 'highway:living_street',
+ 'highway:service',
+ 'highway:track',
+ 'highway:road',
+ 'highway:byway',
+ 'highway:bridleway',
+ 'highway:cycleway',
+ 'highway:pedestrian',
+ 'highway:footway',
+ 'highway:steps',
+ 'highway:motorway_link',
+ 'highway:trunk_link',
+ 'highway:primary_link',
+ 'landuse:industrial',
+ 'landuse:residential',
+ 'landuse:retail',
+ 'landuse:commercial',
+ 'place:airport',
+ 'aeroway:aerodrome',
+ 'railway:station',
+ 'amenity:place_of_worship',
+ 'amenity:pub',
+ 'amenity:bar',
+ 'amenity:university',
+ 'tourism:museum',
+ 'amenity:arts_centre',
+ 'tourism:zoo',
+ 'tourism:theme_park',
+ 'tourism:attraction',
+ 'leisure:golf_course',
+ 'historic:castle',
+ 'amenity:hospital',
+ 'amenity:school',
+ 'amenity:theatre',
+ 'amenity:public_building',
+ 'amenity:library',
+ 'amenity:townhall',
+ 'amenity:community_centre',
+ 'amenity:fire_station',
+ 'amenity:police',
+ 'amenity:bank',
+ 'amenity:post_office',
+ 'leisure:park',
+ 'amenity:park',
+ 'landuse:park',
+ 'landuse:recreation_ground',
+ 'tourism:hotel',
+ 'tourism:motel',
+ 'amenity:cinema',
+ 'tourism:artwork',
+ 'historic:archaeological_site',
+ 'amenity:doctors',
+ 'leisure:sports_centre',
+ 'leisure:swimming_pool',
+ 'shop:supermarket',
+ 'shop:convenience',
+ 'amenity:restaurant',
+ 'amenity:fast_food',
+ 'amenity:cafe',
+ 'tourism:guest_house',
+ 'amenity:pharmacy',
+ 'amenity:fuel',
+ 'natural:peak',
+ 'waterway:waterfall',
+ 'natural:wood',
+ 'natural:water',
+ 'landuse:forest',
+ 'landuse:cemetery',
+ 'landuse:allotments',
+ 'landuse:farmyard',
+ 'railway:rail',
+ 'waterway:canal',
+ 'waterway:river',
+ 'waterway:stream',
+ 'shop:bicycle',
+ 'shop:clothes',
+ 'shop:hairdresser',
+ 'shop:doityourself',
+ 'shop:estate_agent',
+ 'shop:car',
+ 'shop:garden_centre',
+ 'shop:car_repair',
+ 'shop:newsagent',
+ 'shop:bakery',
+ 'shop:furniture',
+ 'shop:butcher',
+ 'shop:apparel',
+ 'shop:electronics',
+ 'shop:department_store',
+ 'shop:books',
+ 'shop:yes',
+ 'shop:outdoor',
+ 'shop:mall',
+ 'shop:florist',
+ 'shop:charity',
+ 'shop:hardware',
+ 'shop:laundry',
+ 'shop:shoes',
+ 'shop:beverages',
+ 'shop:dry_cleaning',
+ 'shop:carpet',
+ 'shop:computer',
+ 'shop:alcohol',
+ 'shop:optician',
+ 'shop:chemist',
+ 'shop:gallery',
+ 'shop:mobile_phone',
+ 'shop:sports',
+ 'shop:jewelry',
+ 'shop:pet',
+ 'shop:beauty',
+ 'shop:stationery',
+ 'shop:shopping_centre',
+ 'shop:general',
+ 'shop:electrical',
+ 'shop:toys',
+ 'shop:jeweller',
+ 'shop:betting',
+ 'shop:household',
+ 'shop:travel_agency',
+ 'shop:hifi',
+ 'amenity:shop',
+ 'tourism:information',
+ 'place:house',
+ 'place:house_name',
+ 'place:house_number',
+ 'place:country_code',
+ 'leisure:pitch',
+ 'highway:unsurfaced',
+ 'historic:ruins',
+ 'amenity:college',
+ 'historic:monument',
+ 'railway:subway',
+ 'historic:memorial',
+ 'leisure:nature_reserve',
+ 'leisure:common',
+ 'waterway:lock_gate',
+ 'natural:fell',
+ 'amenity:nightclub',
+ 'highway:path',
+ 'leisure:garden',
+ 'landuse:reservoir',
+ 'leisure:playground',
+ 'leisure:stadium',
+ 'historic:mine',
+ 'natural:cliff',
+ 'tourism:caravan_site',
+ 'amenity:bus_station',
+ 'amenity:kindergarten',
+ 'highway:construction',
+ 'amenity:atm',
+ 'amenity:emergency_phone',
+ 'waterway:lock',
+ 'waterway:riverbank',
+ 'natural:coastline',
+ 'tourism:viewpoint',
+ 'tourism:hostel',
+ 'tourism:bed_and_breakfast',
+ 'railway:halt',
+ 'railway:platform',
+ 'railway:tram',
+ 'amenity:courthouse',
+ 'amenity:recycling',
+ 'amenity:dentist',
+ 'natural:beach',
+ 'place:moor',
+ 'amenity:grave_yard',
+ 'waterway:drain',
+ 'landuse:grass',
+ 'landuse:village_green',
+ 'natural:bay',
+ 'railway:tram_stop',
+ 'leisure:marina',
+ 'highway:stile',
+ 'natural:moor',
+ 'railway:light_rail',
+ 'railway:narrow_gauge',
+ 'natural:land',
+ 'amenity:village_hall',
+ 'waterway:dock',
+ 'amenity:veterinary',
+ 'landuse:brownfield',
+ 'leisure:track',
+ 'railway:historic_station',
+ 'landuse:construction',
+ 'amenity:prison',
+ 'landuse:quarry',
+ 'amenity:telephone',
+ 'highway:traffic_signals',
+ 'natural:heath',
+ 'historic:house',
+ 'amenity:social_club',
+ 'landuse:military',
+ 'amenity:health_centre',
+ 'historic:building',
+ 'amenity:clinic',
+ 'highway:services',
+ 'amenity:ferry_terminal',
+ 'natural:marsh',
+ 'natural:hill',
+ 'highway:raceway',
+ 'amenity:taxi',
+ 'amenity:take_away',
+ 'amenity:car_rental',
+ 'place:islet',
+ 'amenity:nursery',
+ 'amenity:nursing_home',
+ 'amenity:toilets',
+ 'amenity:hall',
+ 'waterway:boatyard',
+ 'highway:mini_roundabout',
+ 'historic:manor',
+ 'tourism:chalet',
+ 'amenity:bicycle_parking',
+ 'amenity:hotel',
+ 'waterway:weir',
+ 'natural:wetland',
+ 'natural:cave_entrance',
+ 'amenity:crematorium',
+ 'tourism:picnic_site',
+ 'landuse:wood',
+ 'landuse:basin',
+ 'natural:tree',
+ 'leisure:slipway',
+ 'landuse:meadow',
+ 'landuse:piste',
+ 'amenity:care_home',
+ 'amenity:club',
+ 'amenity:medical_centre',
+ 'historic:roman_road',
+ 'historic:fort',
+ 'railway:subway_entrance',
+ 'historic:yes',
+ 'highway:gate',
+ 'leisure:fishing',
+ 'historic:museum',
+ 'amenity:car_wash',
+ 'railway:level_crossing',
+ 'leisure:bird_hide',
+ 'natural:headland',
+ 'tourism:apartments',
+ 'amenity:shopping',
+ 'natural:scrub',
+ 'natural:fen',
+ 'building:yes',
+ 'mountain_pass:yes',
+ 'amenity:parking',
+ 'highway:bus_stop',
+ 'place:postcode',
+ 'amenity:post_box',
+ 'place:houses',
+ 'railway:preserved',
+ 'waterway:derelict_canal',
+ 'amenity:dead_pub',
+ 'railway:disused_station',
+ 'railway:abandoned',
+ 'railway:disused'
+ ));
+ }