mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-06-20 01:34:43 +02:00
up stats of watched tags in osm extract
This commit is contained in:
parent
41b543cece
commit
872d14e17c
4 changed files with 31 additions and 8 deletions
|
@ -118,10 +118,10 @@
|
||||||
<label for="filter_max_output">
|
<label for="filter_max_output">
|
||||||
Afficher les stations avec une puissance supérieure à:
|
Afficher les stations avec une puissance supérieure à:
|
||||||
</label>
|
</label>
|
||||||
<input type="range" min="1" max="400" value="3" class="slider" id="filter_max_output_slider">
|
<input type="range" min="1" max="500" value="1" class="slider" id="filter_max_output_slider">
|
||||||
|
|
||||||
<span id="filter_max_output_display">
|
<span id="filter_max_output_display">
|
||||||
3 kW
|
1 kW
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ const lcm_config = {
|
||||||
transport: 'https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png'
|
transport: 'https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png'
|
||||||
},
|
},
|
||||||
tags_to_display_in_popup: [
|
tags_to_display_in_popup: [
|
||||||
|
'charge',
|
||||||
'description',
|
'description',
|
||||||
'name',
|
'name',
|
||||||
'access',
|
'access',
|
||||||
|
@ -56,7 +57,11 @@ const lcm_config = {
|
||||||
'socket:type2_combo',
|
'socket:type2_combo',
|
||||||
'socket:type2_combo:output',
|
'socket:type2_combo:output',
|
||||||
'socket:chademo',
|
'socket:chademo',
|
||||||
'operator', 'ref:EU:EVSE',
|
'operator',
|
||||||
|
'opening_hours',
|
||||||
|
'maxstay',
|
||||||
|
'maxheight',
|
||||||
|
'ref:EU:EVSE',
|
||||||
'network',
|
'network',
|
||||||
'opening_hours',
|
'opening_hours',
|
||||||
'contact',
|
'contact',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
|
import lcm_config from './js/lcm_config.js';
|
||||||
|
|
||||||
let stats = {};
|
let stats = {};
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ async function compterFeaturesInOpenDataEtalab() {
|
||||||
let count_nb_pdc_ok = 0;
|
let count_nb_pdc_ok = 0;
|
||||||
let unique_id_station_itinerance = []
|
let unique_id_station_itinerance = []
|
||||||
let count_id_station_itinerance_duplicate = 0;
|
let count_id_station_itinerance_duplicate = 0;
|
||||||
|
|
||||||
|
|
||||||
geojson.features.forEach(feature => {
|
geojson.features.forEach(feature => {
|
||||||
if (feature.properties.id_station_itinerance) {
|
if (feature.properties.id_station_itinerance) {
|
||||||
if (!unique_id_station_itinerance.includes(feature.properties.id_station_itinerance)) {
|
if (!unique_id_station_itinerance.includes(feature.properties.id_station_itinerance)) {
|
||||||
|
@ -64,6 +66,7 @@ async function compterFeaturesInOpenDataEtalab() {
|
||||||
}
|
}
|
||||||
count_capacity += nbre_pdc;
|
count_capacity += nbre_pdc;
|
||||||
}
|
}
|
||||||
|
;
|
||||||
});
|
});
|
||||||
// Créer l'objet de statistiques
|
// Créer l'objet de statistiques
|
||||||
stats = {
|
stats = {
|
||||||
|
@ -74,7 +77,7 @@ async function compterFeaturesInOpenDataEtalab() {
|
||||||
count_nb_pdc_okOpenData: count_nb_pdc_ok,
|
count_nb_pdc_okOpenData: count_nb_pdc_ok,
|
||||||
count_id_station_itinerance_duplicate: count_id_station_itinerance_duplicate,
|
count_id_station_itinerance_duplicate: count_id_station_itinerance_duplicate,
|
||||||
count_unique_id_station_itinerance: unique_id_station_itinerance.length,
|
count_unique_id_station_itinerance: unique_id_station_itinerance.length,
|
||||||
dateGeneration: new Date().toISOString()
|
dateGeneration: new Date().toISOString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,20 +159,36 @@ function compterFeaturesInOpenStreetMapFromFile() {
|
||||||
const nombreFeaturesInOSM = data.elements.length;
|
const nombreFeaturesInOSM = data.elements.length;
|
||||||
|
|
||||||
let countPointsDeChargeOSM = 0;
|
let countPointsDeChargeOSM = 0;
|
||||||
|
|
||||||
|
// Initialiser le compteur pour chaque tag
|
||||||
|
let tagsCountOSM = {};
|
||||||
|
lcm_config.tags_to_display_in_popup.forEach(tag => {
|
||||||
|
tagsCountOSM[tag] = 0;
|
||||||
|
});
|
||||||
|
|
||||||
data.elements.forEach(element => {
|
data.elements.forEach(element => {
|
||||||
if (element.type === 'node' && element.tags.capacity) {
|
if (element.type === 'node' && element.tags && element.tags.capacity) {
|
||||||
let capa = parseInt(element.tags.capacity)
|
let capa = parseInt(element.tags.capacity)
|
||||||
if (isNaN(capa)) {
|
if (isNaN(capa)) {
|
||||||
capa = 1;
|
capa = 1;
|
||||||
}
|
}
|
||||||
countPointsDeChargeOSM += capa;
|
countPointsDeChargeOSM += capa;
|
||||||
}
|
}
|
||||||
|
// Compter les tags présents
|
||||||
|
if (element.tags) {
|
||||||
|
lcm_config.tags_to_display_in_popup.forEach(tag => {
|
||||||
|
if (element.tags[tag] !== undefined && element.tags[tag] !== null && element.tags[tag] !== "") {
|
||||||
|
tagsCountOSM[tag]++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stats = {
|
stats = {
|
||||||
...stats,
|
...stats,
|
||||||
countStationsOSM: nombreFeaturesInOSM,
|
countStationsOSM: nombreFeaturesInOSM,
|
||||||
countPointsDeChargeOSM: countPointsDeChargeOSM
|
countPointsDeChargeOSM: countPointsDeChargeOSM,
|
||||||
|
tagsCountOSM
|
||||||
};
|
};
|
||||||
} catch (erreur) {
|
} catch (erreur) {
|
||||||
console.error('Erreur lors du traitement du fichier OSM:', erreur.message);
|
console.error('Erreur lors du traitement du fichier OSM:', erreur.message);
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
bash: /home/cipherbliss/Téléchargements/WebStorm-232.10335.13/bin/bin/webstorm.sh: Aucun fichier ou dossier de ce nom
|
|
Loading…
Add table
Add a link
Reference in a new issue