Redesigning overlay definitions
This commit is contained in:
parent
fc09fdf358
commit
92fb5f7bac
41
helper.ts
41
helper.ts
|
@ -13,19 +13,25 @@ Object.keys(legacyOverlayDefinitions).forEach((key) => {
|
||||||
|
|
||||||
// One timer
|
// One timer
|
||||||
|
|
||||||
const categories = ['hiking', 'cycling', 'vanlife'];
|
let tags = {};
|
||||||
|
|
||||||
let overlays = {};
|
let overlays = {};
|
||||||
|
|
||||||
for (const category of categories) {
|
for (const tagName of Object.keys(legacyOverlayDefinitions)) {
|
||||||
console.log({ caller: 'onetimer / category', category });
|
for (const tagValue of Object.keys(legacyOverlayDefinitions[tagName])) {
|
||||||
overlays[category] = {};
|
tags[tagValue] = { name: tagName, value: tagValue };
|
||||||
for (const tag of Object.keys(legacyOverlayDefinitions)) {
|
for (const activity of Object.keys(
|
||||||
overlays[category][tag] = {};
|
legacyOverlayDefinitions[tagName][tagValue]
|
||||||
for (const tagValue of Object.keys(legacyOverlayDefinitions[tag] || {})) {
|
)) {
|
||||||
const def = legacyOverlayDefinitions[tag][tagValue];
|
if (!overlays[activity]) {
|
||||||
if (!!def[category]) {
|
overlays[activity] = {};
|
||||||
overlays[category][tag][tagValue] = def[category];
|
}
|
||||||
|
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({
|
console.log({
|
||||||
caller: 'onetimer / result',
|
caller: 'onetimer / result',
|
||||||
|
tags: JSON.stringify(tags),
|
||||||
overlays: JSON.stringify(overlays),
|
overlays: JSON.stringify(overlays),
|
||||||
});
|
});
|
||||||
|
|
||||||
// End of one timer
|
// End of one timer
|
||||||
|
|
||||||
console.log({
|
// console.log({
|
||||||
legacyOverlayDefinitions,
|
// legacyOverlayDefinitions,
|
||||||
filters,
|
// filters,
|
||||||
json: JSON.stringify(filters),
|
// json: JSON.stringify(filters),
|
||||||
overlays: JSON.stringify(overlays),
|
// overlays: JSON.stringify(overlays),
|
||||||
});
|
// });
|
||||||
|
|
|
@ -1,219 +1,267 @@
|
||||||
import { indexOf } from 'lodash';
|
import { indexOf } from 'lodash';
|
||||||
import { Feature } from 'ol';
|
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 = {
|
export const overlayDefinitions = {
|
||||||
hiking: {
|
hiking: {
|
||||||
amenity: {
|
drinking: ['bar', 'pub', 'cafe', 'drinking_water', 'water_point', 'water'],
|
||||||
bar: { drinking: true },
|
eating: [
|
||||||
fast_food: { eating: true },
|
'fast_food',
|
||||||
food_court: { eating: true },
|
'food_court',
|
||||||
pub: { eating: true, drinking: true },
|
'pub',
|
||||||
restaurant: { eating: true },
|
'restaurant',
|
||||||
cafe: { drinking: true },
|
'bakery',
|
||||||
atm: { money: true, dayToDay: true },
|
'butcher',
|
||||||
bank: { money: true, dayToDay: true },
|
'cheese',
|
||||||
doctors: { health: true },
|
'chocolate',
|
||||||
hospital: { health: true },
|
'convenience',
|
||||||
pharmacy: { health: true },
|
'dairy',
|
||||||
police: { security: true },
|
'farm',
|
||||||
fire_station: { security: true },
|
'greengrocer',
|
||||||
drinking_water: { drinking: true },
|
'health_food',
|
||||||
water_point: { drinking: true },
|
'pasta',
|
||||||
waste_basket: { dayToDay: true },
|
'pastry',
|
||||||
waste_disposal: { dayToDay: true },
|
'seafood',
|
||||||
vending_machine: { dayToDay: true },
|
'supermarket',
|
||||||
},
|
'wholesale',
|
||||||
shop: {
|
'outdoor',
|
||||||
bakery: { eating: true },
|
],
|
||||||
butcher: { eating: true },
|
money: ['atm', 'bank'],
|
||||||
cheese: { eating: true },
|
dayToDay: [
|
||||||
chocolate: { eating: true },
|
'atm',
|
||||||
convenience: { eating: true },
|
'bank',
|
||||||
dairy: { eating: true },
|
'waste_basket',
|
||||||
farm: { eating: true },
|
'waste_disposal',
|
||||||
greengrocer: { eating: true },
|
'vending_machine',
|
||||||
health_food: { eating: true },
|
'department_store',
|
||||||
pasta: { eating: true },
|
'general',
|
||||||
pastry: { eating: true },
|
'mall',
|
||||||
seafood: { eating: true },
|
'laundry',
|
||||||
water: { drinking: true },
|
],
|
||||||
department_store: { dayToDay: true },
|
health: ['doctors', 'hospital', 'pharmacy'],
|
||||||
general: { dayToDay: true },
|
security: ['police', 'fire_station'],
|
||||||
mall: { dayToDay: true },
|
sleeping: [
|
||||||
supermarket: { eating: true },
|
'hotel',
|
||||||
wholesale: { eating: true },
|
'alpine_hut',
|
||||||
outdoor: { eating: true },
|
'apartment',
|
||||||
laundry: { dayToDay: true },
|
'camp_site',
|
||||||
},
|
'chalet',
|
||||||
tourism: {
|
'guest_house',
|
||||||
hotel: { sleeping: true },
|
'hostel',
|
||||||
alpine_hut: { sleeping: true },
|
'motel',
|
||||||
apartment: { sleeping: true },
|
'wilderness_hut',
|
||||||
camp_site: { sleeping: true },
|
],
|
||||||
chalet: { sleeping: true },
|
naturalSites: [
|
||||||
guest_house: { sleeping: true },
|
'viewpoint',
|
||||||
hostel: { sleeping: true },
|
'waterfall',
|
||||||
motel: { sleeping: true },
|
'peak',
|
||||||
wilderness_hut: { sleeping: true },
|
'cave_entrance',
|
||||||
viewpoint: { naturalSites: true },
|
'volcano',
|
||||||
},
|
'arch',
|
||||||
waterway: { waterfall: { naturalSites: true } },
|
'arete',
|
||||||
natural: {
|
'fumarole',
|
||||||
peak: { naturalSites: true },
|
'rock',
|
||||||
cave_entrance: { naturalSites: true },
|
'saddle',
|
||||||
volcano: { naturalSites: true },
|
'sinkhole',
|
||||||
arch: { naturalSites: true },
|
'stone',
|
||||||
arete: { naturalSites: true },
|
'glacier',
|
||||||
fumarole: { naturalSites: true },
|
'spring',
|
||||||
rock: { naturalSites: true },
|
'hot_spring',
|
||||||
saddle: { naturalSites: true },
|
'geyser',
|
||||||
sinkhole: { naturalSites: true },
|
],
|
||||||
stone: { naturalSites: true },
|
|
||||||
glacier: { naturalSites: true },
|
|
||||||
spring: { naturalSites: true },
|
|
||||||
hot_spring: { naturalSites: true },
|
|
||||||
geyser: { naturalSites: true },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
cycling: {
|
cycling: {
|
||||||
amenity: {
|
drinking: ['bar', 'pub', 'cafe', 'drinking_water', 'water_point', 'water'],
|
||||||
bar: { drinking: true },
|
eating: [
|
||||||
fast_food: { eating: true },
|
'fast_food',
|
||||||
food_court: { eating: true },
|
'food_court',
|
||||||
pub: { eating: true, drinking: true },
|
'pub',
|
||||||
restaurant: { eating: true },
|
'restaurant',
|
||||||
cafe: { drinking: true },
|
'bakery',
|
||||||
atm: { money: true, dayToDay: true },
|
'butcher',
|
||||||
bank: { money: true, dayToDay: true },
|
'cheese',
|
||||||
doctors: { health: true },
|
'chocolate',
|
||||||
hospital: { health: true },
|
'convenience',
|
||||||
pharmacy: { health: true },
|
'dairy',
|
||||||
police: { security: true },
|
'farm',
|
||||||
fire_station: { security: true },
|
'greengrocer',
|
||||||
drinking_water: { drinking: true },
|
'health_food',
|
||||||
water_point: { drinking: true },
|
'pasta',
|
||||||
waste_basket: { dayToDay: true },
|
'pastry',
|
||||||
waste_disposal: { dayToDay: true },
|
'seafood',
|
||||||
vending_machine: { dayToDay: true },
|
'supermarket',
|
||||||
bicycle_parking: { parking: true },
|
'wholesale',
|
||||||
},
|
'outdoor',
|
||||||
shop: {
|
],
|
||||||
bakery: { eating: true },
|
money: ['atm', 'bank'],
|
||||||
butcher: { eating: true },
|
dayToDay: [
|
||||||
cheese: { eating: true },
|
'atm',
|
||||||
chocolate: { eating: true },
|
'bank',
|
||||||
convenience: { eating: true },
|
'waste_basket',
|
||||||
dairy: { eating: true },
|
'waste_disposal',
|
||||||
farm: { eating: true },
|
'vending_machine',
|
||||||
greengrocer: { eating: true },
|
'department_store',
|
||||||
health_food: { eating: true },
|
'general',
|
||||||
pasta: { eating: true },
|
'mall',
|
||||||
pastry: { eating: true },
|
'laundry',
|
||||||
seafood: { eating: true },
|
],
|
||||||
water: { drinking: true },
|
health: ['doctors', 'hospital', 'pharmacy'],
|
||||||
department_store: { dayToDay: true },
|
security: ['police', 'fire_station'],
|
||||||
general: { dayToDay: true },
|
parking: ['bicycle_parking'],
|
||||||
mall: { dayToDay: true },
|
sleeping: [
|
||||||
supermarket: { eating: true },
|
'hotel',
|
||||||
wholesale: { eating: true },
|
'alpine_hut',
|
||||||
outdoor: { eating: true },
|
'apartment',
|
||||||
laundry: { dayToDay: true },
|
'camp_site',
|
||||||
},
|
'chalet',
|
||||||
tourism: {
|
'guest_house',
|
||||||
hotel: { sleeping: true },
|
'hostel',
|
||||||
alpine_hut: { sleeping: true },
|
'motel',
|
||||||
apartment: { sleeping: true },
|
'wilderness_hut',
|
||||||
camp_site: { sleeping: true },
|
],
|
||||||
chalet: { sleeping: true },
|
naturalSites: [
|
||||||
guest_house: { sleeping: true },
|
'viewpoint',
|
||||||
hostel: { sleeping: true },
|
'waterfall',
|
||||||
motel: { sleeping: true },
|
'peak',
|
||||||
wilderness_hut: { sleeping: true },
|
'cave_entrance',
|
||||||
viewpoint: { naturalSites: true },
|
'volcano',
|
||||||
},
|
'arch',
|
||||||
waterway: { waterfall: { naturalSites: true } },
|
'arete',
|
||||||
natural: {
|
'fumarole',
|
||||||
peak: { naturalSites: true },
|
'rock',
|
||||||
cave_entrance: { naturalSites: true },
|
'saddle',
|
||||||
volcano: { naturalSites: true },
|
'sinkhole',
|
||||||
arch: { naturalSites: true },
|
'stone',
|
||||||
arete: { naturalSites: true },
|
'glacier',
|
||||||
fumarole: { naturalSites: true },
|
'spring',
|
||||||
rock: { naturalSites: true },
|
'hot_spring',
|
||||||
saddle: { naturalSites: true },
|
'geyser',
|
||||||
sinkhole: { naturalSites: true },
|
],
|
||||||
stone: { naturalSites: true },
|
|
||||||
glacier: { naturalSites: true },
|
|
||||||
spring: { naturalSites: true },
|
|
||||||
hot_spring: { naturalSites: true },
|
|
||||||
geyser: { naturalSites: true },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
vanlife: {
|
vanlife: {
|
||||||
amenity: {
|
drinking: ['bar', 'pub', 'cafe', 'drinking_water', 'water_point', 'water'],
|
||||||
bar: { drinking: true },
|
eating: [
|
||||||
fast_food: { eating: true },
|
'fast_food',
|
||||||
food_court: { eating: true },
|
'food_court',
|
||||||
pub: { eating: true, drinking: true },
|
'pub',
|
||||||
restaurant: { eating: true },
|
'restaurant',
|
||||||
cafe: { drinking: true },
|
'bakery',
|
||||||
atm: { money: true, dayToDay: true },
|
'butcher',
|
||||||
bank: { money: true, dayToDay: true },
|
'cheese',
|
||||||
doctors: { health: true },
|
'chocolate',
|
||||||
hospital: { health: true },
|
'convenience',
|
||||||
pharmacy: { health: true },
|
'dairy',
|
||||||
police: { security: true },
|
'farm',
|
||||||
fire_station: { security: true },
|
'greengrocer',
|
||||||
drinking_water: { drinking: true },
|
'health_food',
|
||||||
water_point: { drinking: true },
|
'pasta',
|
||||||
waste_basket: { dayToDay: true },
|
'pastry',
|
||||||
waste_disposal: { dayToDay: true },
|
'seafood',
|
||||||
vending_machine: { dayToDay: true },
|
'supermarket',
|
||||||
parking: { parking: true, sleeping: true },
|
'wholesale',
|
||||||
},
|
'outdoor',
|
||||||
shop: {
|
],
|
||||||
bakery: { eating: true },
|
money: ['atm', 'bank'],
|
||||||
butcher: { eating: true },
|
dayToDay: [
|
||||||
cheese: { eating: true },
|
'atm',
|
||||||
chocolate: { eating: true },
|
'bank',
|
||||||
convenience: { eating: true },
|
'waste_basket',
|
||||||
dairy: { eating: true },
|
'waste_disposal',
|
||||||
farm: { eating: true },
|
'vending_machine',
|
||||||
greengrocer: { eating: true },
|
'department_store',
|
||||||
health_food: { eating: true },
|
'general',
|
||||||
pasta: { eating: true },
|
'mall',
|
||||||
pastry: { eating: true },
|
'laundry',
|
||||||
seafood: { eating: true },
|
],
|
||||||
water: { drinking: true },
|
health: ['doctors', 'hospital', 'pharmacy'],
|
||||||
department_store: { dayToDay: true },
|
security: ['police', 'fire_station'],
|
||||||
general: { dayToDay: true },
|
parking: ['parking'],
|
||||||
mall: { dayToDay: true },
|
sleeping: ['parking', 'camp_site'],
|
||||||
supermarket: { eating: true },
|
naturalSites: [
|
||||||
wholesale: { eating: true },
|
'viewpoint',
|
||||||
outdoor: { eating: true },
|
'waterfall',
|
||||||
laundry: { dayToDay: true },
|
'peak',
|
||||||
},
|
'cave_entrance',
|
||||||
tourism: {
|
'volcano',
|
||||||
camp_site: { sleeping: true },
|
'arch',
|
||||||
viewpoint: { naturalSites: true },
|
'arete',
|
||||||
},
|
'fumarole',
|
||||||
waterway: { waterfall: { naturalSites: true } },
|
'rock',
|
||||||
natural: {
|
'saddle',
|
||||||
peak: { naturalSites: true },
|
'sinkhole',
|
||||||
cave_entrance: { naturalSites: true },
|
'stone',
|
||||||
volcano: { naturalSites: true },
|
'glacier',
|
||||||
arch: { naturalSites: true },
|
'spring',
|
||||||
arete: { naturalSites: true },
|
'hot_spring',
|
||||||
fumarole: { naturalSites: true },
|
'geyser',
|
||||||
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 },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue