diff --git a/helper.ts b/helper.ts index 813af77..b1125e6 100644 --- a/helper.ts +++ b/helper.ts @@ -13,19 +13,25 @@ Object.keys(legacyOverlayDefinitions).forEach((key) => { // One timer -const categories = ['hiking', 'cycling', 'vanlife']; - +let tags = {}; let overlays = {}; -for (const category of categories) { - console.log({ caller: 'onetimer / category', category }); - overlays[category] = {}; - for (const tag of Object.keys(legacyOverlayDefinitions)) { - overlays[category][tag] = {}; - for (const tagValue of Object.keys(legacyOverlayDefinitions[tag] || {})) { - const def = legacyOverlayDefinitions[tag][tagValue]; - if (!!def[category]) { - overlays[category][tag][tagValue] = def[category]; +for (const tagName of Object.keys(legacyOverlayDefinitions)) { + for (const tagValue of Object.keys(legacyOverlayDefinitions[tagName])) { + tags[tagValue] = { name: tagName, value: tagValue }; + for (const activity of Object.keys( + legacyOverlayDefinitions[tagName][tagValue] + )) { + if (!overlays[activity]) { + overlays[activity] = {}; + } + for (const category of Object.keys( + legacyOverlayDefinitions[tagName][tagValue][activity] + )) { + if (!overlays[activity][category]) { + overlays[activity][category] = []; + } + overlays[activity][category].push(tagValue); } } } @@ -33,14 +39,15 @@ for (const category of categories) { console.log({ caller: 'onetimer / result', + tags: JSON.stringify(tags), overlays: JSON.stringify(overlays), }); // End of one timer -console.log({ - legacyOverlayDefinitions, - filters, - json: JSON.stringify(filters), - overlays: JSON.stringify(overlays), -}); +// console.log({ +// legacyOverlayDefinitions, +// filters, +// json: JSON.stringify(filters), +// overlays: JSON.stringify(overlays), +// }); diff --git a/src/components/overlays/overlay-definitions.ts b/src/components/overlays/overlay-definitions.ts index bdb86e9..26828f6 100644 --- a/src/components/overlays/overlay-definitions.ts +++ b/src/components/overlays/overlay-definitions.ts @@ -1,219 +1,267 @@ import { indexOf } from 'lodash'; import { Feature } from 'ol'; +export const osmTags = { + bar: { name: 'amenity', value: 'bar' }, + fast_food: { name: 'amenity', value: 'fast_food' }, + food_court: { name: 'amenity', value: 'food_court' }, + pub: { name: 'amenity', value: 'pub' }, + restaurant: { name: 'amenity', value: 'restaurant' }, + cafe: { name: 'amenity', value: 'cafe' }, + atm: { name: 'amenity', value: 'atm' }, + bank: { name: 'amenity', value: 'bank' }, + doctors: { name: 'amenity', value: 'doctors' }, + hospital: { name: 'amenity', value: 'hospital' }, + pharmacy: { name: 'amenity', value: 'pharmacy' }, + police: { name: 'amenity', value: 'police' }, + fire_station: { name: 'amenity', value: 'fire_station' }, + drinking_water: { name: 'amenity', value: 'drinking_water' }, + water_point: { name: 'amenity', value: 'water_point' }, + waste_basket: { name: 'amenity', value: 'waste_basket' }, + waste_disposal: { name: 'amenity', value: 'waste_disposal' }, + vending_machine: { name: 'amenity', value: 'vending_machine' }, + bicycle_parking: { name: 'amenity', value: 'bicycle_parking' }, + parking: { name: 'amenity', value: 'parking' }, + bakery: { name: 'shop', value: 'bakery' }, + butcher: { name: 'shop', value: 'butcher' }, + cheese: { name: 'shop', value: 'cheese' }, + chocolate: { name: 'shop', value: 'chocolate' }, + convenience: { name: 'shop', value: 'convenience' }, + dairy: { name: 'shop', value: 'dairy' }, + farm: { name: 'shop', value: 'farm' }, + greengrocer: { name: 'shop', value: 'greengrocer' }, + health_food: { name: 'shop', value: 'health_food' }, + pasta: { name: 'shop', value: 'pasta' }, + pastry: { name: 'shop', value: 'pastry' }, + seafood: { name: 'shop', value: 'seafood' }, + water: { name: 'shop', value: 'water' }, + department_store: { name: 'shop', value: 'department_store' }, + general: { name: 'shop', value: 'general' }, + mall: { name: 'shop', value: 'mall' }, + supermarket: { name: 'shop', value: 'supermarket' }, + wholesale: { name: 'shop', value: 'wholesale' }, + outdoor: { name: 'shop', value: 'outdoor' }, + laundry: { name: 'shop', value: 'laundry' }, + hotel: { name: 'tourism', value: 'hotel' }, + alpine_hut: { name: 'tourism', value: 'alpine_hut' }, + apartment: { name: 'tourism', value: 'apartment' }, + camp_site: { name: 'tourism', value: 'camp_site' }, + chalet: { name: 'tourism', value: 'chalet' }, + guest_house: { name: 'tourism', value: 'guest_house' }, + hostel: { name: 'tourism', value: 'hostel' }, + motel: { name: 'tourism', value: 'motel' }, + wilderness_hut: { name: 'tourism', value: 'wilderness_hut' }, + viewpoint: { name: 'tourism', value: 'viewpoint' }, + waterfall: { name: 'waterway', value: 'waterfall' }, + peak: { name: 'natural', value: 'peak' }, + cave_entrance: { name: 'natural', value: 'cave_entrance' }, + volcano: { name: 'natural', value: 'volcano' }, + arch: { name: 'natural', value: 'arch' }, + arete: { name: 'natural', value: 'arete' }, + fumarole: { name: 'natural', value: 'fumarole' }, + rock: { name: 'natural', value: 'rock' }, + saddle: { name: 'natural', value: 'saddle' }, + sinkhole: { name: 'natural', value: 'sinkhole' }, + stone: { name: 'natural', value: 'stone' }, + glacier: { name: 'natural', value: 'glacier' }, + spring: { name: 'natural', value: 'spring' }, + hot_spring: { name: 'natural', value: 'hot_spring' }, + geyser: { name: 'natural', value: 'geyser' }, +}; + export const overlayDefinitions = { hiking: { - amenity: { - bar: { drinking: true }, - fast_food: { eating: true }, - food_court: { eating: true }, - pub: { eating: true, drinking: true }, - restaurant: { eating: true }, - cafe: { drinking: true }, - atm: { money: true, dayToDay: true }, - bank: { money: true, dayToDay: true }, - doctors: { health: true }, - hospital: { health: true }, - pharmacy: { health: true }, - police: { security: true }, - fire_station: { security: true }, - drinking_water: { drinking: true }, - water_point: { drinking: true }, - waste_basket: { dayToDay: true }, - waste_disposal: { dayToDay: true }, - vending_machine: { dayToDay: true }, - }, - shop: { - bakery: { eating: true }, - butcher: { eating: true }, - cheese: { eating: true }, - chocolate: { eating: true }, - convenience: { eating: true }, - dairy: { eating: true }, - farm: { eating: true }, - greengrocer: { eating: true }, - health_food: { eating: true }, - pasta: { eating: true }, - pastry: { eating: true }, - seafood: { eating: true }, - water: { drinking: true }, - department_store: { dayToDay: true }, - general: { dayToDay: true }, - mall: { dayToDay: true }, - supermarket: { eating: true }, - wholesale: { eating: true }, - outdoor: { eating: true }, - laundry: { dayToDay: true }, - }, - tourism: { - hotel: { sleeping: true }, - alpine_hut: { sleeping: true }, - apartment: { sleeping: true }, - camp_site: { sleeping: true }, - chalet: { sleeping: true }, - guest_house: { sleeping: true }, - hostel: { sleeping: true }, - motel: { sleeping: true }, - wilderness_hut: { sleeping: true }, - viewpoint: { naturalSites: true }, - }, - waterway: { waterfall: { naturalSites: true } }, - natural: { - peak: { naturalSites: true }, - cave_entrance: { naturalSites: true }, - volcano: { naturalSites: true }, - arch: { naturalSites: true }, - arete: { naturalSites: true }, - fumarole: { naturalSites: true }, - rock: { naturalSites: true }, - saddle: { naturalSites: true }, - sinkhole: { naturalSites: true }, - stone: { naturalSites: true }, - glacier: { naturalSites: true }, - spring: { naturalSites: true }, - hot_spring: { naturalSites: true }, - geyser: { naturalSites: true }, - }, + drinking: ['bar', 'pub', 'cafe', 'drinking_water', 'water_point', 'water'], + eating: [ + 'fast_food', + 'food_court', + 'pub', + 'restaurant', + 'bakery', + 'butcher', + 'cheese', + 'chocolate', + 'convenience', + 'dairy', + 'farm', + 'greengrocer', + 'health_food', + 'pasta', + 'pastry', + 'seafood', + 'supermarket', + 'wholesale', + 'outdoor', + ], + money: ['atm', 'bank'], + dayToDay: [ + 'atm', + 'bank', + 'waste_basket', + 'waste_disposal', + 'vending_machine', + 'department_store', + 'general', + 'mall', + 'laundry', + ], + health: ['doctors', 'hospital', 'pharmacy'], + security: ['police', 'fire_station'], + sleeping: [ + 'hotel', + 'alpine_hut', + 'apartment', + 'camp_site', + 'chalet', + 'guest_house', + 'hostel', + 'motel', + 'wilderness_hut', + ], + naturalSites: [ + 'viewpoint', + 'waterfall', + 'peak', + 'cave_entrance', + 'volcano', + 'arch', + 'arete', + 'fumarole', + 'rock', + 'saddle', + 'sinkhole', + 'stone', + 'glacier', + 'spring', + 'hot_spring', + 'geyser', + ], }, cycling: { - amenity: { - bar: { drinking: true }, - fast_food: { eating: true }, - food_court: { eating: true }, - pub: { eating: true, drinking: true }, - restaurant: { eating: true }, - cafe: { drinking: true }, - atm: { money: true, dayToDay: true }, - bank: { money: true, dayToDay: true }, - doctors: { health: true }, - hospital: { health: true }, - pharmacy: { health: true }, - police: { security: true }, - fire_station: { security: true }, - drinking_water: { drinking: true }, - water_point: { drinking: true }, - waste_basket: { dayToDay: true }, - waste_disposal: { dayToDay: true }, - vending_machine: { dayToDay: true }, - bicycle_parking: { parking: true }, - }, - shop: { - bakery: { eating: true }, - butcher: { eating: true }, - cheese: { eating: true }, - chocolate: { eating: true }, - convenience: { eating: true }, - dairy: { eating: true }, - farm: { eating: true }, - greengrocer: { eating: true }, - health_food: { eating: true }, - pasta: { eating: true }, - pastry: { eating: true }, - seafood: { eating: true }, - water: { drinking: true }, - department_store: { dayToDay: true }, - general: { dayToDay: true }, - mall: { dayToDay: true }, - supermarket: { eating: true }, - wholesale: { eating: true }, - outdoor: { eating: true }, - laundry: { dayToDay: true }, - }, - tourism: { - hotel: { sleeping: true }, - alpine_hut: { sleeping: true }, - apartment: { sleeping: true }, - camp_site: { sleeping: true }, - chalet: { sleeping: true }, - guest_house: { sleeping: true }, - hostel: { sleeping: true }, - motel: { sleeping: true }, - wilderness_hut: { sleeping: true }, - viewpoint: { naturalSites: true }, - }, - waterway: { waterfall: { naturalSites: true } }, - natural: { - peak: { naturalSites: true }, - cave_entrance: { naturalSites: true }, - volcano: { naturalSites: true }, - arch: { naturalSites: true }, - arete: { naturalSites: true }, - fumarole: { naturalSites: true }, - rock: { naturalSites: true }, - saddle: { naturalSites: true }, - sinkhole: { naturalSites: true }, - stone: { naturalSites: true }, - glacier: { naturalSites: true }, - spring: { naturalSites: true }, - hot_spring: { naturalSites: true }, - geyser: { naturalSites: true }, - }, + drinking: ['bar', 'pub', 'cafe', 'drinking_water', 'water_point', 'water'], + eating: [ + 'fast_food', + 'food_court', + 'pub', + 'restaurant', + 'bakery', + 'butcher', + 'cheese', + 'chocolate', + 'convenience', + 'dairy', + 'farm', + 'greengrocer', + 'health_food', + 'pasta', + 'pastry', + 'seafood', + 'supermarket', + 'wholesale', + 'outdoor', + ], + money: ['atm', 'bank'], + dayToDay: [ + 'atm', + 'bank', + 'waste_basket', + 'waste_disposal', + 'vending_machine', + 'department_store', + 'general', + 'mall', + 'laundry', + ], + health: ['doctors', 'hospital', 'pharmacy'], + security: ['police', 'fire_station'], + parking: ['bicycle_parking'], + sleeping: [ + 'hotel', + 'alpine_hut', + 'apartment', + 'camp_site', + 'chalet', + 'guest_house', + 'hostel', + 'motel', + 'wilderness_hut', + ], + naturalSites: [ + 'viewpoint', + 'waterfall', + 'peak', + 'cave_entrance', + 'volcano', + 'arch', + 'arete', + 'fumarole', + 'rock', + 'saddle', + 'sinkhole', + 'stone', + 'glacier', + 'spring', + 'hot_spring', + 'geyser', + ], }, vanlife: { - amenity: { - bar: { drinking: true }, - fast_food: { eating: true }, - food_court: { eating: true }, - pub: { eating: true, drinking: true }, - restaurant: { eating: true }, - cafe: { drinking: true }, - atm: { money: true, dayToDay: true }, - bank: { money: true, dayToDay: true }, - doctors: { health: true }, - hospital: { health: true }, - pharmacy: { health: true }, - police: { security: true }, - fire_station: { security: true }, - drinking_water: { drinking: true }, - water_point: { drinking: true }, - waste_basket: { dayToDay: true }, - waste_disposal: { dayToDay: true }, - vending_machine: { dayToDay: true }, - parking: { parking: true, sleeping: true }, - }, - shop: { - bakery: { eating: true }, - butcher: { eating: true }, - cheese: { eating: true }, - chocolate: { eating: true }, - convenience: { eating: true }, - dairy: { eating: true }, - farm: { eating: true }, - greengrocer: { eating: true }, - health_food: { eating: true }, - pasta: { eating: true }, - pastry: { eating: true }, - seafood: { eating: true }, - water: { drinking: true }, - department_store: { dayToDay: true }, - general: { dayToDay: true }, - mall: { dayToDay: true }, - supermarket: { eating: true }, - wholesale: { eating: true }, - outdoor: { eating: true }, - laundry: { dayToDay: true }, - }, - tourism: { - camp_site: { sleeping: true }, - viewpoint: { naturalSites: true }, - }, - waterway: { waterfall: { naturalSites: true } }, - natural: { - peak: { naturalSites: true }, - cave_entrance: { naturalSites: true }, - volcano: { naturalSites: true }, - arch: { naturalSites: true }, - arete: { naturalSites: true }, - fumarole: { naturalSites: true }, - rock: { naturalSites: true }, - saddle: { naturalSites: true }, - sinkhole: { naturalSites: true }, - stone: { naturalSites: true }, - glacier: { naturalSites: true }, - spring: { naturalSites: true }, - hot_spring: { naturalSites: true }, - geyser: { naturalSites: true }, - }, + drinking: ['bar', 'pub', 'cafe', 'drinking_water', 'water_point', 'water'], + eating: [ + 'fast_food', + 'food_court', + 'pub', + 'restaurant', + 'bakery', + 'butcher', + 'cheese', + 'chocolate', + 'convenience', + 'dairy', + 'farm', + 'greengrocer', + 'health_food', + 'pasta', + 'pastry', + 'seafood', + 'supermarket', + 'wholesale', + 'outdoor', + ], + money: ['atm', 'bank'], + dayToDay: [ + 'atm', + 'bank', + 'waste_basket', + 'waste_disposal', + 'vending_machine', + 'department_store', + 'general', + 'mall', + 'laundry', + ], + health: ['doctors', 'hospital', 'pharmacy'], + security: ['police', 'fire_station'], + parking: ['parking'], + sleeping: ['parking', 'camp_site'], + naturalSites: [ + 'viewpoint', + 'waterfall', + 'peak', + 'cave_entrance', + 'volcano', + 'arch', + 'arete', + 'fumarole', + 'rock', + 'saddle', + 'sinkhole', + 'stone', + 'glacier', + 'spring', + 'hot_spring', + 'geyser', + ], }, };