melting-pot/js/main.js

1189 lines
40 KiB
JavaScript

//import * as geoDataPointsFromApi from './data.json';
const geoDataJsonMock = {
'version': 0.6,
'generator': 'Overpass API 0.7.57 93a4d346',
'osm3s': {
'timestamp_osm_base': '2021-12-05T21:05:09Z',
'copyright': 'The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.',
},
'elements': [{
'type': 'node',
'id': 598729945,
'lat': 48.6727029,
'lon': 2.0690276,
'tags': {'amenity': 'restaurant', 'cuisine': 'crepe', 'name': 'Le Chat Botté'},
}, {
'type': 'node',
'id': 963824814,
'lat': 48.6735834,
'lon': 2.1704756,
'tags': {
'addr:city': 'Saint-Jean-de-Beauregard',
'addr:housenumber': '5',
'addr:postcode': '91940',
'addr:street': 'Grande Rue',
'amenity': 'restaurant',
'cuisine': 'french',
'name': 'L\'Atelier Gourmand',
'phone': '+33 1 60 12 31 01',
'website': 'https://lateliergourmand-restaurant.fr/',
},
}, {
'type': 'node',
'id': 1821405244,
'lat': 48.5934956,
'lon': 2.1918785,
'tags': {'opening_hours:covid19': 'open', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 1821447330,
'lat': 48.592966,
'lon': 2.1911154,
'tags': {
'addr:housenumber': '47',
'addr:postcode': '91680',
'addr:street': 'Rue de la libération',
'amenity': 'restaurant',
'cuisine': 'french',
'name': 'Le Chatel',
},
}, {
'type': 'node',
'id': 1821452707,
'lat': 48.5928358,
'lon': 2.1879911,
'tags': {
'addr:housenumber': '52',
'addr:postcode': '91680',
'addr:street': 'Rue de la libération',
'amenity': 'fast_food',
'cuisine': 'pizza',
'name': 'Pizza Di Napoli',
},
}, {
'type': 'node',
'id': 1834699862,
'lat': 48.6454151,
'lon': 2.0763808,
'tags': {
'amenity': 'restaurant',
'cuisine': 'french',
'delivery:covid19': 'no',
'drive_through:covid19': 'yes',
'name': 'Le sabot Rouge',
'opening_hours:covid19': 'open',
'takeaway:covid19': 'yes',
'toilets': 'yes',
},
}, {
'type': 'node',
'id': 1834702870,
'lat': 48.6478571,
'lon': 2.0699221,
'tags': {'amenity': 'restaurant', 'cuisine': 'italian', 'name': 'Bella Storia'},
}, {
'type': 'node',
'id': 1834705019,
'lat': 48.6563093,
'lon': 2.0941853,
'tags': {
'addr:city': 'Limours',
'addr:postcode': '91470',
'addr:street': 'D988',
'amenity': 'restaurant',
'cuisine': 'french',
'name': 'Le Relais de la Bénerie',
'phone': '+33 1 64 91 17 60',
'website': 'http://www.benerie.com',
},
}, {
'type': 'node',
'id': 1834714300,
'lat': 48.6449685,
'lon': 2.0675456,
'tags': {'name': 'Boulangerie des Arcades', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 1834715278,
'lat': 48.6460212,
'lon': 2.0765257,
'tags': {'name': 'Boulangerie des Arcades', 'opening_hours:covid19': 'open', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 1834715299,
'lat': 48.645886,
'lon': 2.0762176,
'tags': {'access:covid19': 'yes', 'name': 'Maison Rault', 'opening_hours:covid19': 'open', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 2014435573,
'lat': 48.6215549,
'lon': 2.0020417,
'tags': {'name': 'Boulangerie des Six Moulins', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 2493756899,
'lat': 48.5855788,
'lon': 1.9880778,
'tags': {'name': 'Boulangerie Patault', 'opening_hours:covid19': 'open', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 2495079905,
'lat': 48.5866915,
'lon': 1.9889874,
'tags': {
'addr:housenumber': '15',
'addr:street': 'Rue Guy le Rouge',
'amenity': 'restaurant',
'cuisine': 'french',
'email': 'lescu-de-rohan@orange.fr',
'fax': '+33 1 30 41 47 52',
'name': 'L\'Escu de Rohan',
'phone': '+33130413133',
'website': 'https://www.lescuderohan.com/',
},
}, {
'type': 'node',
'id': 3139612455,
'lat': 48.6688887,
'lon': 2.1209381,
'tags': {
'addr:city': 'Gometz-la-Ville',
'addr:housenumber': '4',
'addr:postcode': '91400',
'addr:street': 'Rue des Trois Quartiers',
'amenity': 'restaurant',
'cuisine': 'asian',
'name': 'Merveilles d\'Asie',
'phone': '+33 1 60 12 90 90',
},
}, {
'type': 'node',
'id': 4129002789,
'lat': 48.6173936,
'lon': 2.0233807,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 4169682912,
'lat': 48.6733384,
'lon': 2.1403445,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 4169934697,
'lat': 48.6173132,
'lon': 2.0292241,
'tags': {
'addr:city': 'Bonnelles',
'addr:housenumber': '2',
'addr:postcode': '78830',
'addr:street': 'Rue de la Libération',
'amenity': 'cafe',
'name': 'Le Relais du Bonnellois',
},
}, {
'type': 'node',
'id': 4370782566,
'lat': 48.6486167,
'lon': 2.0468019,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 4860114316,
'lat': 48.6698524,
'lon': 2.1215873,
'tags': {
'addr:city': 'Gometz-la-Ville',
'addr:housenumber': '3',
'addr:postcode': '91400',
'addr:street': 'Rue des Trois Quartiers',
'name': 'Boulangerie Patisserie Le Moulin de Gometz',
'shop': 'bakery',
},
}, {
'type': 'node',
'id': 5236551305,
'lat': 48.6729103,
'lon': 2.0689965,
'tags': {'amenity': 'drinking_water', 'check_date': '2021-11-20'},
}, {
'type': 'node',
'id': 5236554259,
'lat': 48.6729858,
'lon': 2.0685247,
'tags': {'amenity': 'cafe', 'name': 'Au PointBar'},
}, {
'type': 'node',
'id': 5236558077,
'lat': 48.6724006,
'lon': 2.0678798,
'tags': {
'addr:city': 'Les Molières',
'addr:housenumber': '9',
'addr:postcode': '91470',
'addr:street': 'Grande Rue',
'name': 'La boulangerie des Molières',
'opening_hours': 'Tu-Sa 06:45-13:00,15:30-19:30; Su 06:45-13:00',
'opening_hours:covid19': 'open',
'phone': '+33 9 84 51 15 37',
'shop': 'bakery',
},
}, {
'type': 'node',
'id': 5409920641,
'lat': 48.6445544,
'lon': 2.0671571,
'tags': {
'addr:housenumber': '42',
'addr:street': 'Rue de Chartres',
'amenity': 'restaurant',
'name': 'Tabac des Sports',
'phone': '+33 6 62 38 18 75',
},
}, {
'type': 'node',
'id': 5428631674,
'lat': 48.6463866,
'lon': 2.0599982,
'tags': {
'addr:city': 'Pecqueuse',
'addr:housenumber': '19',
'addr:postcode': '91470',
'addr:street': 'Rue du 8 Mai 1945',
'amenity': 'restaurant',
'name': 'Entrepot\'es',
'phone': '+33164959740',
'website': 'https://fr-fr.facebook.com/pages/category/European-Restaurant/Entrepotes-706835119337210/',
},
}, {
'type': 'node',
'id': 5922556806,
'lat': 48.6178537,
'lon': 2.0280854,
'tags': {'name': 'Le Pain', 'shop': 'bakery'},
}, {
'type': 'node',
'id': 6126513555,
'lat': 48.6277177,
'lon': 2.1017932,
'tags': {
'access:covid19': 'yes',
'addr:city': 'Forges-les-Bains',
'addr:housenumber': '17',
'addr:postcode': '91470',
'addr:street': 'Rue du Docteur Babin',
'amenity': 'restaurant',
'capacity': '80',
'changing_table': 'yes',
'cuisine': 'french',
'delivery:covid19': 'no',
'diet:meat': 'yes',
'diet:vegetarian': 'limited',
'drive_through:covid19': 'yes',
'name': 'L\'Arôme',
'opening_hours': 'We-Sa 12:00-13:30,19:00-20:30; Su 12:00-13:30',
'opening_hours:covid19': 'open',
'outdoor_seating': 'yes',
'outdoor_seating:comfort': 'chair',
'payment:cash': 'yes',
'payment:credit_cards': 'yes',
'phone': '+33164908859',
'phone:FR': '+33 1 64 90 88 59',
'reservation': 'recommended',
'smoking': 'outside',
'takeaway:covid19': 'yes',
'toilets:wheelchair': 'yes',
'website': 'https://larome-restaurant.fr/',
},
}, {
'type': 'node',
'id': 6126980224,
'lat': 48.6239638,
'lon': 2.1236317,
'tags': {
'addr:city': 'Briis-sous-Forges',
'addr:housenumber': '13',
'addr:postcode': '91640',
'addr:street': 'Rue de l\'Armée Patton',
'name': 'La Briisoise',
'opening_hours': 'Mo 06:30-20:00; Tu 06:30-20:00; We off; Th 06:30-20:00; Fr 06:30-20:00; Sa 06:30-20:00; Su 06:30-13:30',
'opening_hours:covid19': 'Mo 06:30-20:00; Tu 06:30-20:00; We off; Th 06:30-20:00; Fr 06:30-20:00; Sa 06:30-20:00; Su 06:30-13:30',
'shop': 'bakery',
'telecom': '0164907030',
},
}, {
'type': 'node',
'id': 6126980227,
'lat': 48.6245805,
'lon': 2.1248841,
'tags': {
'addr:city': 'Briis-sous-Forges',
'addr:housenumber': '8',
'addr:postcode': '91640',
'addr:street': 'Rue de l\'Orme Maillard',
'name': 'Le Grenier de Briis',
'opening_hours:covid19': 'open',
'shop': 'bakery',
},
}, {
'type': 'node',
'id': 6126980229,
'lat': 48.6241473,
'lon': 2.1255589,
'tags': {
'addr:city': 'Briis-sous-Forges',
'addr:housenumber': '7',
'addr:postcode': '91640',
'addr:street': 'Rue Marcel Quinet',
'amenity': 'restaurant',
'capacity': '50',
'name': 'Salades et grillades',
'old:name': 'Le Marrakech',
'opening_hours:covid19': 'off',
'takeaway': 'yes',
'telecom': '01 69 92 71 19',
'wikidata': 'https://commons.wikimedia.org/wiki/File:Le_pilori_-_Caf%C3%A9_bar_restaurant.jpg',
},
}, {
'type': 'node',
'id': 6126980230,
'lat': 48.6241837,
'lon': 2.1227134,
'tags': {
'amenity': 'fast_food',
'cuisine': 'pizza',
'delivery': 'yes',
'delivery:covid19': 'yes',
'drive_through:covid19': 'yes',
'name': 'Béni saf pizza',
'opening_hours:covid19': 'open',
'takeaway': 'yes',
'takeaway:covid19': 'yes',
},
}, {
'type': 'node',
'id': 6127010186,
'lat': 48.6242461,
'lon': 2.1252949,
'tags': {
'addr:city': 'Briis-sous-Forges',
'addr:housenumber': '20',
'addr:postcode': '91640',
'addr:street': 'Rue Marcel Quinet',
'amenity': 'restaurant',
'cuisine': 'french;drinks',
'name': 'Le Pilo',
'opening_hours:covid19': 'off',
'wikimedia_commons': 'File:Le pilori - Café bar restaurant.jpg',
},
}, {
'type': 'node',
'id': 6127010194,
'lat': 48.6241078,
'lon': 2.1245417,
'tags': {
'amenity': 'vending_machine',
'opening_hours:covid19': 'off',
'vending': 'parcel_pickup;parcel_mail_in',
},
}, {
'type': 'node',
'id': 6132372198,
'lat': 48.6449824,
'lon': 2.0764392,
'tags': {'amenity': 'restaurant', 'cuisine': 'crêperie', 'name': 'Art Billing', 'opening_hours:covid19': 'off'},
}, {
'type': 'node',
'id': 6132372201,
'lat': 48.6449025,
'lon': 2.0667147,
'tags': {'amenity': 'fast_food', 'cuisine': 'pizza'},
}, {
'type': 'node',
'id': 6132386010,
'lat': 48.6285755,
'lon': 2.0989107,
'tags': {'amenity': 'vending_machine', 'vending': 'parcel_pickup;parcel_mail_in'},
}, {
'type': 'node',
'id': 6138973945,
'lat': 48.6289593,
'lon': 2.0949554,
'tags': {'amenity': 'vending_machine', 'vending': 'parcel_pickup'},
}, {
'type': 'node',
'id': 6138973946,
'lat': 48.6290118,
'lon': 2.0950782,
'tags': {'amenity': 'vending_machine', 'currency:EUR': 'yes', 'payment:cash': 'yes', 'vending': 'bread'},
}, {
'type': 'node',
'id': 6139945889,
'lat': 48.6318152,
'lon': 2.0817993,
'tags': {'amenity': 'restaurant', 'cuisine': 'french', 'name': 'Restaurant du Golf'},
}, {
'type': 'node',
'id': 6636948349,
'lat': 48.6677244,
'lon': 1.9880434,
'tags': {
'addr:city': 'Cernay',
'amenity': 'restaurant',
'capacity': '120',
'cuisine': 'regional',
'description': 'Menu « Paysan », unique et à volonté.',
'name': 'La Ferme du Bout des Prés',
'opening_hours': 'Fr-Su 12:15-15:00, 20:15-23:00',
'phone': '+33 1 34 85 29 04',
'reservation': 'required',
'smoking': 'outside',
'takeaway': 'no',
'website': 'https://www.lafermeduboutdespres.com/',
'wheelchair': 'limited',
},
}, {
'type': 'node',
'id': 6643094659,
'lat': 48.6161025,
'lon': 2.127331,
'tags': {'amenity': 'vending_machine', 'indoor': 'yes', 'vending': 'public_transport_tickets'},
}, {
'type': 'node',
'id': 6898145446,
'lat': 48.6362743,
'lon': 2.1472,
'tags': {
'brand': 'Paul',
'brand:wikidata': 'Q3370417',
'brand:wikipedia': 'en:Paul (bakery)',
'delivery': 'no',
'name': 'Paul',
'shop': 'bakery',
'takeaway': 'yes',
},
}, {
'type': 'node',
'id': 6898145447,
'lat': 48.636249,
'lon': 2.1471916,
'tags': {'amenity': 'vending_machine', 'vending': 'coffee'},
}, {
'type': 'node',
'id': 6898145448,
'lat': 48.6361594,
'lon': 2.147128,
'tags': {'amenity': 'vending_machine', 'vending': 'coffee'},
}, {
'type': 'node',
'id': 6898145451,
'lat': 48.6362434,
'lon': 2.1476538,
'tags': {
'amenity': 'fast_food',
'brand': 'Pizza Hut',
'brand:wikidata': 'Q191615',
'brand:wikipedia': 'en:Pizza Hut',
'cuisine': 'pizza',
'delivery': 'no',
'name': 'Pizza Hut Express',
'takeaway': 'yes',
},
}, {
'type': 'node',
'id': 6898145452,
'lat': 48.6361658,
'lon': 2.1474612,
'tags': {
'amenity': 'fast_food',
'brand': 'McDonald\'s',
'brand:wikidata': 'Q38076',
'brand:wikipedia': 'fr:McDonald\'s',
'cuisine': 'burger',
'delivery': 'no',
'name': 'McDonald\'s Originals',
'takeaway': 'yes',
},
}, {
'type': 'node',
'id': 6970264914,
'lat': 48.6222544,
'lon': 2.003323,
'tags': {'amenity': 'drinking_water', 'name': 'Eau potable'},
}, {
'type': 'node',
'id': 6979971441,
'lat': 48.6281676,
'lon': 2.0986492,
'tags': {'amenity': 'vending_machine', 'vending': 'condoms'},
}, {
'type': 'node',
'id': 7425453044,
'lat': 48.5760136,
'lon': 2.1918219,
'tags': {
'addr:city': 'Breuillet',
'addr:postcode': '91650',
'amenity': 'fast_food',
'contact:phone': '+33164584411',
'cuisine': 'pizza',
'name': 'Pizza Nana',
'opening_hours': 'Mo-Sa 11:00-14:30,18:00-23:00; Su 18:00-23:00',
},
}, {
'type': 'node',
'id': 7425453045,
'lat': 48.5759053,
'lon': 2.1919187,
'tags': {
'addr:city': 'Breuillet',
'addr:postcode': '91650',
'contact:phone': '+33164584714',
'name': 'Aux Délices de Port Sud',
'opening_hours': 'Tu-Sa 07:00-13:00,16:00-20:00; Su 07:00-13:30',
'shop': 'bakery',
},
}, {
'type': 'node',
'id': 7480164580,
'lat': 48.6285639,
'lon': 2.0989016,
'tags': {'shop': 'bakery'},
}, {
'type': 'node',
'id': 7480176885,
'lat': 48.6282958,
'lon': 2.0984886,
'tags': {
'access:covid19': 'yes',
'amenity': 'fast_food',
'cuisine': 'pizza',
'delivery:covid19': 'no',
'drive_through:covid19': 'yes',
'name': 'food truck pizza',
'opening_hours': 'Fr 16:00-21:00',
'opening_hours:covid19': 'open',
'takeaway': 'only',
'takeaway:covid19': 'yes',
'wheelchair': 'yes',
},
}, {
'type': 'node',
'id': 7548624634,
'lat': 48.6263676,
'lon': 2.122432,
'tags': {'drinking_water': 'no', 'man_made': 'water_tap'},
}, {
'type': 'node',
'id': 7578904473,
'lat': 48.5850758,
'lon': 1.9900026,
'tags': {'access': 'yes', 'amenity': 'drinking_water', 'bottle': 'yes', 'fee': 'no'},
}, {
'type': 'node',
'id': 7750169559,
'lat': 48.6297157,
'lon': 2.1262698,
'tags': {'amenity': 'drinking_water', 'bottle': 'yes', 'wheelchair': 'yes'},
}, {
'type': 'node',
'id': 7750169561,
'lat': 48.6297667,
'lon': 2.1267712,
'tags': {'amenity': 'drinking_water', 'bottle': 'yes', 'wheelchair': 'yes'},
}, {
'type': 'node',
'id': 7750169563,
'lat': 48.6298745,
'lon': 2.1276022,
'tags': {'amenity': 'drinking_water', 'bottle': 'yes', 'wheelchair': 'yes'},
}, {
'type': 'node',
'id': 7761047977,
'lat': 48.6454158,
'lon': 2.1602203,
'tags': {'access': 'yes', 'amenity': 'drinking_water', 'name': 'fontaine', 'wheelchair': 'limited'},
}, {
'type': 'node',
'id': 7813843559,
'lat': 48.5791244,
'lon': 1.9905708,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7875044828,
'lat': 48.6690652,
'lon': 2.1196581,
'tags': {'amenity': 'restaurant', 'cuisine': 'japanese', 'name': 'Sushi Supe'},
}, {
'type': 'node',
'id': 7875044829,
'lat': 48.6690409,
'lon': 2.1196633,
'tags': {'amenity': 'vending_machine', 'vending': 'public_transport_tickets'},
}, {
'type': 'node',
'id': 7875705449,
'lat': 48.6179683,
'lon': 2.1244384,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7875705450,
'lat': 48.6179759,
'lon': 2.1244076,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7875706137,
'lat': 48.6176121,
'lon': 2.124539,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7875809228,
'lat': 48.6160262,
'lon': 2.1273081,
'tags': {'amenity': 'vending_machine', 'indoor': 'yes', 'vending': 'public_transport_tickets'},
}, {
'type': 'node',
'id': 7899841160,
'lat': 48.6423812,
'lon': 2.0653069,
'tags': {'amenity': 'drinking_water', 'indoor': 'yes'},
}, {
'type': 'node',
'id': 7925614676,
'lat': 48.6296773,
'lon': 2.1263069,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7934044729,
'lat': 48.6201578,
'lon': 2.1464583,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7941352245,
'lat': 48.6402124,
'lon': 2.0854707,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 7941357794,
'lat': 48.6407519,
'lon': 2.0857058,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 8000578221,
'lat': 48.646007,
'lon': 2.0777091,
'tags': {'amenity': 'fast_food', 'cuisine': 'pizza', 'name': 'Wasa Pizza'},
}, {
'type': 'node',
'id': 8157368325,
'lat': 48.6453245,
'lon': 2.0761971,
'tags': {'amenity': 'vending_machine', 'vending': 'condoms'},
}, {
'type': 'node',
'id': 8425844186,
'lat': 48.647298,
'lon': 2.154703,
'tags': {'amenity': 'restaurant'},
}, {
'type': 'node',
'id': 8442577337,
'lat': 48.6123054,
'lon': 2.1677433,
'tags': {'addr:street': 'Allée des Marronniers', 'amenity': 'restaurant', 'name': 'la ferme de Bel air'},
}, {
'type': 'node',
'id': 8442577338,
'lat': 48.6120085,
'lon': 2.1673702,
'tags': {'shop': 'bakery'},
}, {
'type': 'node',
'id': 8457404527,
'lat': 48.6729562,
'lon': 2.0689663,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 8457404530,
'lat': 48.6733776,
'lon': 2.0694295,
'tags': {'amenity': 'vending_machine', 'vending': 'excrement_bags'},
}, {
'type': 'node',
'id': 8728349812,
'lat': 48.6452152,
'lon': 2.1525443,
'tags': {'amenity': 'drinking_water'},
}, {
'type': 'node',
'id': 8728370728,
'lat': 48.6450868,
'lon': 2.1528069,
'tags': {'amenity': 'fast_food', 'changing_table': 'no', 'cuisine': 'crepe;pancake', 'takeaway': 'only'},
}, {
'type': 'node',
'id': 9064436330,
'lat': 48.6360815,
'lon': 2.1469188,
'tags': {'amenity': 'vending_machine', 'bin': 'yes', 'fee': 'no', 'vending': 'excrement_bags'},
}, {
'type': 'node',
'id': 9178440450,
'lat': 48.6253553,
'lon': 2.1235391,
'tags': {'drinking_water': 'no', 'man_made': 'water_tap'},
}, {
'type': 'node',
'id': 9178440456,
'lat': 48.6236429,
'lon': 2.1255285,
'tags': {'description': 'Robinet décoratif', 'drinking_water': 'no', 'man_made': 'water_tap'},
}, {
'type': 'way',
'id': 190166457,
'bounds': {'minlat': 48.6480275, 'minlon': 2.1530003, 'maxlat': 48.648157, 'maxlon': 2.1532555},
'nodes': [2007756820, 2007756827, 2007756834, 2007756841, 2007756833, 2007756842, 2007756816, 2007756803, 8425897443, 2007756820],
'geometry': [{'lat': 48.6481171, 'lon': 2.1532555}, {'lat': 48.6481292, 'lon': 2.153199}, {
'lat': 48.6481407,
'lon': 2.1532116,
}, {'lat': 48.648157, 'lon': 2.1531323}, {'lat': 48.6481279, 'lon': 2.1530727}, {
'lat': 48.6481515,
'lon': 2.1530393,
}, {'lat': 48.6480829, 'lon': 2.1530003}, {'lat': 48.6480275, 'lon': 2.153202}, {
'lat': 48.6480572,
'lon': 2.1532197,
}, {'lat': 48.6481171, 'lon': 2.1532555}],
'tags': {
'amenity': 'restaurant',
'building': 'yes',
'cuisine': 'french',
'name': 'à la bonne franquette',
'source': 'cadastre-dgi-fr source : Direction Générale des Impôts - Cadastre. Mise à jour : 2012',
'url': 'https://www.bonnefranquette.fr/',
},
}, {
'type': 'way',
'id': 342902206,
'bounds': {'minlat': 48.628958, 'minlon': 2.094892, 'maxlat': 48.629058, 'maxlon': 2.09504},
'nodes': [3498574009, 3498574024, 3498574071, 3498574052, 3498573919, 3498573910, 3498573868, 3498574009],
'geometry': [{'lat': 48.629031, 'lon': 2.09504}, {'lat': 48.629036, 'lon': 2.095019}, {
'lat': 48.629058,
'lon': 2.094937,
}, {'lat': 48.629045, 'lon': 2.094929}, {'lat': 48.628985, 'lon': 2.094892}, {
'lat': 48.62898,
'lon': 2.094909,
}, {'lat': 48.628958, 'lon': 2.094999}, {'lat': 48.629031, 'lon': 2.09504}],
'tags': {
'amenity': 'bar',
'building': 'yes',
'name': 'Bar du Château',
'source': 'cadastre-dgi-fr source : Direction Générale des Finances Publiques - Cadastre. Mise à jour : 2015',
},
}, {
'type': 'way',
'id': 361165635,
'bounds': {'minlat': 48.6354381, 'minlon': 2.1483085, 'maxlat': 48.6356885, 'maxlon': 2.1489224},
'nodes': [3656808136, 3656808139, 3656808137, 4690767211, 3656808138, 3656808140, 3656808141, 2007753948, 2007753943, 2007753930, 2007753926, 3656808136],
'geometry': [{'lat': 48.6354381, 'lon': 2.1483333}, {'lat': 48.6354548, 'lon': 2.1484958}, {
'lat': 48.6354399,
'lon': 2.1484993,
}, {'lat': 48.6354456, 'lon': 2.1485542}, {'lat': 48.6354498, 'lon': 2.1485955}, {
'lat': 48.6354645,
'lon': 2.148592,
}, {'lat': 48.6354984, 'lon': 2.1489224}, {'lat': 48.6356885, 'lon': 2.1488778}, {
'lat': 48.6356362,
'lon': 2.1483674,
}, {'lat': 48.635552, 'lon': 2.1483872}, {'lat': 48.6355439, 'lon': 2.1483085}, {
'lat': 48.6354381,
'lon': 2.1483333,
}],
'tags': {'amenity': 'restaurant', 'building': 'yes', 'cuisine': 'french'},
}, {
'type': 'way',
'id': 362695143,
'bounds': {'minlat': 48.6697744, 'minlon': 2.1206926, 'maxlat': 48.6700774, 'maxlon': 2.1211026},
'nodes': [3669626255, 3669626247, 3669626295, 3669626435, 3669616908, 3669616893, 3669626260, 3669626266, 3669626220, 3669626201, 3669626176, 3669626170, 3669626191, 3669626198, 3669626218, 3669626228, 3669626235, 3669626224, 3669626237, 3669626242, 3669626255],
'geometry': [{'lat': 48.6699284, 'lon': 2.1210016}, {'lat': 48.6699144, 'lon': 2.1210256}, {
'lat': 48.6699734,
'lon': 2.1211026,
}, {'lat': 48.6700774, 'lon': 2.1209196}, {'lat': 48.6700184, 'lon': 2.1208396}, {
'lat': 48.6700004,
'lon': 2.1208696,
}, {'lat': 48.6699324, 'lon': 2.1207786}, {'lat': 48.6699374, 'lon': 2.1207696}, {
'lat': 48.6698794,
'lon': 2.1206926,
}, {'lat': 48.6698484, 'lon': 2.1207466}, {'lat': 48.6697874, 'lon': 2.1208556}, {
'lat': 48.6697744,
'lon': 2.1208786,
}, {'lat': 48.6698324, 'lon': 2.1209536}, {'lat': 48.6698434, 'lon': 2.1209326}, {
'lat': 48.6698734,
'lon': 2.1209716,
}, {'lat': 48.6698864, 'lon': 2.1209466}, {'lat': 48.6698954, 'lon': 2.1209576}, {
'lat': 48.6698844,
'lon': 2.1209756,
}, {'lat': 48.6698964, 'lon': 2.1209916}, {'lat': 48.6699074, 'lon': 2.1209746}, {
'lat': 48.6699284,
'lon': 2.1210016,
}],
'tags': {
'addr:city': 'Gometz-la-Ville',
'addr:street': 'Rue des Trois Quartiers',
'amenity': 'restaurant',
'building': 'yes',
'name': 'Relais des Trois Quartiers',
'source': 'cadastre-dgi-fr source : Direction Générale des Finances Publiques - Cadastre - SDIS91. Mise à jour : 2016',
},
}, {
'type': 'way',
'id': 602189903,
'bounds': {'minlat': 48.6693147, 'minlon': 2.1209129, 'maxlat': 48.6693875, 'maxlon': 2.1209967},
'nodes': [5720798174, 5720798175, 5720798176, 5720798177, 5720798174],
'geometry': [{'lat': 48.6693875, 'lon': 2.1209311}, {'lat': 48.6693227, 'lon': 2.1209129}, {
'lat': 48.6693147,
'lon': 2.1209785,
}, {'lat': 48.6693795, 'lon': 2.1209967}, {'lat': 48.6693875, 'lon': 2.1209311}],
'tags': {
'addr:city': 'Gometz-la-Ville',
'addr:postcode': '91400',
'addr:street': 'Rue des Trois Quartiers',
'amenity': 'fast_food',
'brand': 'Le Kiosque à Pizzas',
'brand:wikidata': 'Q3223839',
'brand:wikipedia': 'fr:Le Kiosque à Pizzas',
'building': 'yes',
'cuisine': 'pizza',
'name': 'Le Kiosque à Pizzas',
'outdoor_seating': 'no',
'takeaway': 'only',
},
}],
};
const overrideQuery = true;
const initialZoom = 14;
const osmMention = '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
// serveurs de tuiles: https://wiki.openstreetmap.org/wiki/Tile_servers
// https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png
// https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png
const tileServer = "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"
var map = L.map('map').setView([48.6410, 2.1307], initialZoom);
L.tileLayer(tileServer, {
maxZoom: 19,
attribution: osmMention,
}).addTo(map);
// if (overrideQuery) {
// $('#overpass-api-controls').hide();
// }
function buildOverpassApiUrl(map, overpassQuery) {
var baseUrl = 'https://overpass-api.de/api/interpreter';
var bounds = map.getBounds().getSouth() + ',' + map.getBounds().getWest() + ',' + map.getBounds().getNorth() + ',' + map.getBounds().getEast();
var resultUrl, query = '';
if (overrideQuery) {
query = `?data=[out:json][timeout:15];(
node[shop=bakery](${bounds});
node[amenity=bar](${bounds});
node[amenity=cafe](${bounds});
node[amenity=fast_food](${bounds});
node[amenity=restaurant](${bounds});
node[amenity=pub](${bounds});
node[amenity=vending_machine](${bounds});
node[amenity=drinking_water](${bounds});
node[man_made=water_tap](${bounds});
node[man_made=drinking_fountain](${bounds});
way[amenity=microwave](${bounds});
way[amenity=pub](${bounds});
way[amenity=bar](${bounds});
way[amenity=cafe](${bounds});
way[shop=bakery](${bounds});
way[amenity=fast_food](${bounds});
way[amenity=vending_machine](${bounds});
way[amenity=restaurant](${bounds});
);out body geom;`;
} else {
var nodeQuery = 'node[' + overpassQuery + '](' + bounds + ');';
var wayQuery = 'way[' + overpassQuery + '](' + bounds + ');';
var relationQuery = 'relation[' + overpassQuery + '](' + bounds + ');';
query = '?data=[out:json][timeout:15];(' + nodeQuery + wayQuery + relationQuery + ');out body geom;';
}
resultUrl = baseUrl + query;
console.log("query url", resultUrl)
return resultUrl;
}
const UseLocalJson = false;
const loadQueryPoints = () => {
if (UseLocalJson) {
displayPointsFromApi(geoDataJsonMock);
} else {
loadOverpassQuery();
}
};
function loadedSuccess() {
document.querySelector('#success_load').classList.add('visible')
setTimeout(function () {
document.querySelector('#success_load').classList.remove('visible')
}, 1000)
$('#spinning_icon').fadeOut();
}
function displayPointsFromApi(points) {
var resultAsGeojson = osmtogeojson(points);
var resultLayer = L.geoJson(resultAsGeojson, {
style: function (feature) {
return {color: '#ff0000'};
},
filter: function (feature, layer) {
var isPolygon = (feature.geometry) && (feature.geometry.type !== undefined) && (feature.geometry.type === 'Polygon');
if (isPolygon) {
feature.geometry.type = 'Point';
var polygonCenter = L.latLngBounds(feature.geometry.coordinates[0]).getCenter();
feature.geometry.coordinates = [polygonCenter.lat, polygonCenter.lng];
}
return true;
},
onEachFeature: function (feature, layer) {
var popupContent = '';
popupContent = popupContent + '<dt>@id</dt><dd>' + feature.properties.type + '/' + feature.properties.id + '</dd>';
var keys = Object.keys(feature.properties.tags);
keys.forEach(function (key) {
popupContent = popupContent + '<dt>' + key + '</dt><dd>' + feature.properties.tags[key] + '</dd>';
});
popupContent = popupContent + '</dl>';
layer.bindPopup(popupContent);
let iconSiZePx = 20;
if (feature.properties.tags['amenity'] && feature.properties.tags['amenity'] === 'restaurant' ||
feature.properties.tags['amenity'] === 'fast_food'
) {
iconSiZePx = 40;
}
let icon, cuisine, rest_name = '';
if (feature.properties.tags['name'] !== undefined) {
rest_name = feature.properties.tags['name'];
} else {
rest_name = 'nom ? ';
}
if (typeof feature.properties.tags['cuisine'] !== typeof undefined && feature.properties.tags['cuisine'].length) {
cuisine = ` - cuisine: ${feature.properties.tags['cuisine'] | ''}`;
}
let html = '<a href="https://www.openstreetmap.org/' + feature.id + '"> ' + rest_name + ' ' + cuisine + '</a>' +
'<a class="edit-button" href="https://www.openstreetmap.org/edit?editor=id&node=' + feature.properties.id + '">' +
'✏️</a>';
var label = L.marker(layer._latlng, {
icon: L.divIcon({
iconUrl: 'https://www.cipherbliss.com/ou-manger/img/' + getIconFromTags(feature.properties.tags),
className: 'label ' + makeCssClassFromTags(feature.properties.tags),
// html : html,
iconSize: ['auto', 'auto'],
}),
}).addTo(map);
var myIcon = L.icon({
iconUrl: 'https://www.cipherbliss.com/ou-manger/img/' + getIconFromTags(feature.properties.tags),
iconSize: [iconSiZePx, iconSiZePx],
iconAnchor: [iconSiZePx / 2, iconSiZePx / 2],
popupAnchor: [iconSiZePx / 2, iconSiZePx / 2],
className: makeCssClassFromTags(feature.properties.tags),
});
let regular_marker = L.marker(layer._latlng, {title: rest_name, icon: myIcon}).addTo(map);
regular_marker.bindPopup(html);
regular_marker.on({
mouseover: function () {
this.openPopup();
},
mouseout: function () {
setTimeout(() => this.closePopup(), 3000);
},
click: function () {
this.openPopup();
},
});
// regular_marker.fire('mouseover');
},
});
}
function makeCssClassFromTags(tags) {
let tagKeys = Object.keys(tags);
if (!tags) {
return '';
}
let listOfClasses = [];
tagKeys.forEach((element) => {
listOfClasses.push('tag-' + element + '_' + tags[element].replace(':', '--'));
});
getIsOpenFromOpeningHours(tags)
if (tags['opening_hours']) {
listOfClasses.push('tag-has-opening-hours')
} else {
listOfClasses.push('tag-no-opening-hours')
}
return listOfClasses.join(' ');
}
/**
* trouver si un magasin est actuellement ouvert, ou si les infos de opening_hours sont absentes
* exemple: Mo 06:30-20:00; Tu 06:30-20:00; We off; Th 06:30-20:00;
* Fr 06:30-20:00; Sa 06:30-20:00; Su 06:30-13:30
* @param tags
* @returns {string}
*/
function getIsOpenFromOpeningHours(tags) {
let isOpen = 'has-no-opening-hours';
let currentDay = new Date();
let daysArray = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
let todayInLetters = daysArray[currentDay.getDay()];
let todayInHour = daysArray[currentDay.getHours()];
if (tags['opening_hours']) {
let opening_hours = tags['opening_hours'].trim();
// trouver les sections séparées par des points virgule
let sections = opening_hours.split(' ')
// séparer les sections d'ouverture par un espace entre la plage de jour et les heures
sections.map(part => {
// prendre en compte les périodes de plusieurs jours Mo-Sa
// prise en compte d'un seul jour à la fois
if (part.indexOf(todayInLetters)) {
// voir si le jour actuel est inclus dans la section
// voir si les horaires de ce jour sont dans le futur
// dans ce cas le restaurant est ouvert, YES!
isOpen = 'is-open-this-day'
let splitDay = part.split('-')
if (splitDay.length) {
let start = splitDay[0]
let end = splitDay[1]
if (start.substring(0, 2) < todayInHour) {
//sera ouvert aujourd'hui
} else {
//était ouvert aujourd'hui
}
}
}
})
}
console.log(tags['opening_hours'], isOpen)
return isOpen;
}
function getIconFromTags(tags) {
let iconFileName = 'icon_restaurant.png';
if (tags['man_made']) {
iconFileName = 'fountain.png';
} else if (tags['shop']) {
iconFileName = 'croissant.png';
} else if (tags['amenity']) {
if (tags['amenity'] === 'restaurant') {
if (tags['cuisine'] === 'pizza') {
iconFileName = 'pizza.png';
}
if (tags['cuisine'] === 'italian') {
iconFileName = 'pizza.png';
}
if (tags['cuisine'] === 'japanese') {
iconFileName = 'asian_food.png';
}
if (tags['cuisine'] === 'crepe') {
iconFileName = 'crepe.png';
}
if (tags['cuisine'] === 'crepes') {
iconFileName = 'crepe.png';
}
if (tags['cuisine'] === 'sushi') {
iconFileName = 'asian_food.png';
}
if (tags['cuisine'] === 'asian') {
iconFileName = 'asian_food.png';
}
if (tags['cuisine'] === 'chinese') {
iconFileName = 'asian_food.png';
}
} else if (tags['amenity'] === 'vending_machine') {
iconFileName = 'vending_machine.png';
} else if (tags['amenity'] === 'drinking_water') {
iconFileName = 'fountain.png';
} else if (tags['amenity'] === 'pub') {
iconFileName = 'beer.png';
} else if (tags['amenity'] === 'fast_food') {
iconFileName = 'burger.png';
if (tags['cuisine'] === 'pizza') {
iconFileName = 'pizza.png';
}
}
}
return iconFileName;
}
$('#query-button').click(function () {
loadOverpassQuery();
});
let isLoading = false;
function removeOlderPoints() {
// L.clearLayers()
}
function loadOverpassQuery() {
// ne pas charger si on recherche déjà
if (!isLoading) {
isLoading = true;
$('#spinning_icon').fadeIn();
var queryTextfieldValue = $('#query-textfield').val();
var overpassApiUrl = buildOverpassApiUrl(map, queryTextfieldValue);
$.get(overpassApiUrl, function (geoDataPointsFromApi) {
removeOlderPoints()
displayPointsFromApi(geoDataPointsFromApi);
loadedSuccess();
isLoading = false;
}); // end of the getting from overpass API
}
}
console.log('loadQueryPoints', loadQueryPoints);
loadQueryPoints();
$('#spinning_icon').hide();