]> git.openstreetmap.org Git - nominatim-ui.git/blob - src/components/MapIcon.svelte
v3.2.9
[nominatim-ui.git] / src / components / MapIcon.svelte
1 <script>
2
3   export let aPlace;
4
5   $: sIcon = getIcon(aPlace.category, aPlace.type);
6   $: title = 'icon for ' + aPlace.category + ' ' + aPlace.type;
7   $: url = Nominatim_Config.Images_Base_Url + sIcon + '.p.20.png';
8
9   function getIcon(category, type) {
10     // equivalent to PHP Nominatim::ClassTypes::getIcon
11     // covers 83 of 214 available icon filenames, e.g. transport_roundabout_anticlockwise
12     // transport_rental_bicycle or place_of_worship_christian would need more data from
13     // the place.
14     var aIcons = {
15       'boundary:administrative': 'poi_boundary_administrative',
16       'place:city': 'poi_place_city',
17       'place:town': 'poi_place_town',
18       'place:village': 'poi_place_village',
19       'place:hamlet': 'poi_place_village',
20       'place:suburb': 'poi_place_village',
21       'place:locality': 'poi_place_village',
22       'place:airport': 'transport_airport2',
23       'aeroway:aerodrome': 'transport_airport2',
24       'railway:station': 'transport_train_station2',
25       'amenity:place_of_worship': 'place_of_worship_unknown3',
26       'amenity:pub': 'food_pub',
27       'amenity:bar': 'food_bar',
28       'amenity:university': 'education_university',
29       'tourism:museum': 'tourist_museum',
30       'amenity:arts_centre': 'tourist_art_gallery2',
31       'tourism:zoo': 'tourist_zoo',
32       'tourism:theme_park': 'poi_point_of_interest',
33       'tourism:attraction': 'poi_point_of_interest',
34       'leisure:golf_course': 'sport_golf',
35       'historic:castle': 'tourist_castle',
36       'amenity:hospital': 'health_hospital',
37       'amenity:school': 'education_school',
38       'amenity:theatre': 'tourist_theatre',
39       'amenity:library': 'amenity_library',
40       'amenity:fire_station': 'amenity_firestation3',
41       'amenity:police': 'amenity_police2',
42       'amenity:bank': 'money_bank2',
43       'amenity:post_office': 'amenity_post_office',
44       'tourism:hotel': 'accommodation_hotel2',
45       'amenity:cinema': 'tourist_cinema',
46       'tourism:artwork': 'tourist_art_gallery2',
47       'historic:archaeological_site': 'tourist_archaeological2',
48       'amenity:doctors': 'health_doctors',
49       'leisure:sports_centre': 'sport_leisure_centre',
50       'leisure:swimming_pool': 'sport_swimming_outdoor',
51       'shop:supermarket': 'shopping_supermarket',
52       'shop:convenience': 'shopping_convenience',
53       'amenity:restaurant': 'food_restaurant',
54       'amenity:fast_food': 'food_fastfood',
55       'amenity:cafe': 'food_cafe',
56       'tourism:guest_house': 'accommodation_bed_and_breakfast',
57       'amenity:pharmacy': 'health_pharmacy_dispensing',
58       'amenity:fuel': 'transport_fuel',
59       'natural:peak': 'poi_peak',
60       'natural:wood': 'landuse_coniferous_and_deciduous',
61       'shop:bicycle': 'shopping_bicycle',
62       'shop:clothes': 'shopping_clothes',
63       'shop:hairdresser': 'shopping_hairdresser',
64       'shop:doityourself': 'shopping_diy',
65       'shop:estate_agent': 'shopping_estateagent2',
66       'shop:car': 'shopping_car',
67       'shop:garden_centre': 'shopping_garden_centre',
68       'shop:car_repair': 'shopping_car_repair',
69       'shop:bakery': 'shopping_bakery',
70       'shop:butcher': 'shopping_butcher',
71       'shop:apparel': 'shopping_clothes',
72       'shop:laundry': 'shopping_laundrette',
73       'shop:beverages': 'shopping_alcohol',
74       'shop:alcohol': 'shopping_alcohol',
75       'shop:optician': 'health_opticians',
76       'shop:chemist': 'health_pharmacy',
77       'shop:gallery': 'tourist_art_gallery2',
78       'shop:jewelry': 'shopping_jewelry',
79       'tourism:information': 'amenity_information',
80       'historic:ruins': 'tourist_ruin',
81       'amenity:college': 'education_school',
82       'historic:monument': 'tourist_monument',
83       'historic:memorial': 'tourist_monument',
84       'historic:mine': 'poi_mine',
85       'tourism:caravan_site': 'accommodation_caravan_park',
86       'amenity:bus_station': 'transport_bus_station',
87       'amenity:atm': 'money_atm2',
88       'tourism:viewpoint': 'tourist_view_point',
89       'tourism:guesthouse': 'accommodation_bed_and_breakfast',
90       'railway:tram': 'transport_tram_stop',
91       'amenity:courthouse': 'amenity_court',
92       'amenity:recycling': 'amenity_recycling',
93       'amenity:dentist': 'health_dentist',
94       'natural:beach': 'tourist_beach',
95       'railway:tram_stop': 'transport_tram_stop',
96       'amenity:prison': 'amenity_prison',
97       'highway:bus_stop': 'transport_bus_stop2'
98     };
99
100     return aIcons[category + ':' + type];
101   }
102
103 </script>
104
105 {#if sIcon}
106   <img class="mapicon" src={url} alt={title} />
107 {/if}
108
109 <style>
110   .mapicon {
111     margin: 10px 0;
112   }
113 </style>