lister les cuisines dans un set

This commit is contained in:
Tykayn 2024-02-26 17:27:39 +01:00 committed by tykayn
parent 104e4fa9d3
commit 00c1154a1f
3 changed files with 481 additions and 314 deletions

127
cuisines.md Normal file
View File

@ -0,0 +1,127 @@
# Sortes de cuisines fréquentes
- afghan
- african
- american
- antilles
- arab
- argentinian
- asian
- asian_fusion
- bagel
- barbecue
- basque
- bistro
- brasilian
- brasserie
- brazilian
- brunch
- bubble_tea
- burge
- burger
- cafe
- cafeteria
- cake
- cambodian
- cameroonian
- caribbean
- chicken
- chinese
- coffee_shop
- colombian
- corean
- couscous
- creole
- crepe
- cuisine_nissarde
- djiboutian
- donut
- ethiopian
- falafel
- fish
- fish_and_chips
- french
- fried_chicken
- friture
- fusion
- gabonese
- georgian
- greek
- grill
- hawaiian
- hot_dog
- ice_cream
- indian
- international
- italian
- italian_pizza
- japanese
- japonais
- juice
- kebab
- korean
- kque
- kurdish
- lao
- laotian
- latin_american
- lebanese
- maghreb
- maghrébine
- malaysian
- mauritian
- meat
- mediterranean
- Mésopotamie_et_Anatolie
- mexican
- mexico
- middle_eastern
- moroccan
- nepalese
- noodle
- organic
- oriental
- paella
- pakistani
- pancake
- pasta
- pâtes
- persian
- peruvian
- pizza
- poke
- polish
- portugese
- portuguese
- ramen
- regional
- romanian
- Roumaine
- russian
- salad
- sandwich
- Savoie
- savory_pancakes
- seafood
- seasonal
- Sénégal
- serbian
- sichuan
- spanish
- steak_house
- street_food
- sushi
- syrian
- taiwan
- taiwanese
- tapas
- thai
- thaï
- tibetan
- tunisian
- turkish
- vegan
- vietnam
- vietnamese
- wrap
- 火鍋

BIN
img/miss_hour.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,5 +1,8 @@
//import * as geoDataPointsFromApi from './data.json';
// liste des cuisines uniques
let cuisineSet = ['pizza', 'italian', 'japanese', 'thai', 'thaï', 'lebanese','portugese']
// Filtre pour afficher seulement les cafés
// Appliquer/retirer le filtre quand on clique sur le bouton
export function toggleFilter(objectAmenity) {
@ -134,6 +137,9 @@ function loadedSuccess() {
}
let counterFeatures = 0;
let counterFeaturesHourMissing = 0;
let counterFeaturesCuisineMissing = 0;
function displayPointsFromApi(points) {
var resultAsGeojson = osmtogeojson(points);
@ -151,6 +157,7 @@ function displayPointsFromApi(points) {
return true;
},
onEachFeature: function (feature, layer) {
counterFeatures++
var popupContent = '';
popupContent = popupContent + '<dt>@id</dt><dd>' + feature.properties.type + '/' + feature.properties.id + '</dd>';
var keys = Object.keys(feature.properties.tags);
@ -189,6 +196,7 @@ function displayPointsFromApi(points) {
if (!cuisine) {
cuisine = ' ';
counterFeaturesCuisineMissing++
}
let isOpen = false;
let opening, hours = '';
@ -248,6 +256,7 @@ function displayPointsFromApi(points) {
});
let regular_marker = L.marker(layer._latlng, {title: rest_name, icon: myIcon}).addTo(map);
regular_marker.bindPopup(html);
@ -263,9 +272,40 @@ function displayPointsFromApi(points) {
this.openPopup();
},
});
// regular_marker.fire('mouseover');
/**
* ajout d'icone pour chaque restaurant où il manque l'horaire
*/
if (!feature.properties.tags.opening_hours) {
counterFeaturesHourMissing++
var missingHour = L.icon({
iconUrl: '/img/miss_hour.png',
iconSize: [iconSiZePx/3, iconSiZePx/3],
iconAnchor: [iconSiZePx / 2, iconSiZePx / 2],
className: makeCssClassFromTags(feature.properties.tags),
});
L.marker(
{
lat: layer._latlng.lat + 0.00002,
lng: layer._latlng.lng + 0.00001
},
{
title: "horaire manquante",
icon: missingHour
}
).addTo(map);
}
},
});
console.log('counterFeatures', counterFeatures)
console.log('counterFeatures hour missing', counterFeaturesHourMissing)
console.log('counterFeatures cuisine missing', counterFeaturesCuisineMissing)
}
function makeCssClassFromTags(tags) {
@ -365,8 +405,6 @@ function isLocationOpenNow(openingHours) {
return false;
}
function getIconFromTags(tags) {
let iconFileName = 'icon_restaurant.png';
@ -376,6 +414,10 @@ function getIconFromTags(tags) {
let firstCuisine = tags['cuisine'].split(';')[0];
if (!firstCuisine) {
firstCuisine = tags['cuisine']
}
if(cuisineSet.indexOf(firstCuisine) === -1) {
cuisineSet.push(firstCuisine)
}
if (tags['man_made']) {
@ -422,14 +464,11 @@ function getIconFromTags(tags) {
iconFileName = 'vending_machine.png';
} else if (tags['amenity'] === 'drinking_water') {
iconFileName = 'fountain.png';
}
else if (tags['amenity'] === 'pub') {
} else if (tags['amenity'] === 'pub') {
iconFileName = 'beer.jpg';
}
else if (tags['amenity'] === 'bar') {
} else if (tags['amenity'] === 'bar') {
iconFileName = 'beer.jpg';
}
else if (tags['amenity'] === 'fast_food') {
} else if (tags['amenity'] === 'fast_food') {
iconFileName = 'burger.png';
if (firstCuisine === 'pizza') {
iconFileName = 'pizza.png';
@ -460,6 +499,7 @@ function loadOverpassQuery() {
removeOlderPoints()
displayPointsFromApi(geoDataPointsFromApi);
console.log('cuisineSet', new Set(cuisineSet))
loadedSuccess();
isLoading = false;
}); // end of the getting from overpass API