@@ -806,6 +806,8 @@
}
if (map_token && geojsonData && geojsonData.features.length > 0) {
+ console.log('geojsonData.features', geojsonData.features)
+
map = new maplibregl.Map({
container: 'map',
style: `https://api.maptiler.com/maps/streets/style.json?key=${map_token}`,
@@ -885,6 +887,22 @@
map.on('click', 'unclustered-point', function (e) {
const coordinates = e.features[0].geometry.coordinates.slice();
const properties = e.features[0].properties;
+ let missing_tags = [];
+
+ const tags_for_completion = ['name', 'wheelchair', 'siret', 'opening_hours'];
+ tags_for_completion.forEach(function (tag) {
+ if (!properties[tag]) {
+ missing_tags.push(tag);
+ }
+ })
+
+ if (!properties['phone'] && properties['contact:phone']) {
+ missing_tags.push('contact:phone');
+ }
+ if (!properties['website'] && properties['contact:website']) {
+ missing_tags.push('contact:website');
+ }
+ properties.missing_tags = missing_tags;
let popupContent = `
${properties.name || 'Sans nom'}`;
if (properties.address) popupContent += `${properties.address}
`;
@@ -892,9 +910,10 @@
if (properties.note) popupContent += `
Note: ${properties.note}`;
popupContent += `
Complétion : ${properties.completion !== null ? properties.completion + '%' : '–'}`;
const missingTags = Array.isArray(properties.missing_tags) ? properties.missing_tags : [];
- if (missingTags.length > 0) {
- popupContent += `
Manque : ${missingTags.map(t => `${t}
`).join(', ')}
`;
- }
+ console.log('e.features[0]', e.features[0], missingTags, 'tags', properties)
+ // if (missingTags.length > 0) {
+ // popupContent += `
Manque : ${missingTags.map(t => `${t}
`).join(', ')}
`;
+ // }
popupContent += `
Voir sur OSM`;
while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {