detect enum of power

This commit is contained in:
Tykayn 2024-12-22 18:57:06 +01:00 committed by tykayn
parent d1efdbd256
commit a004d47392

View File

@ -1,6 +1,3 @@
const utils = {
/**
* fouiller dans les tags les valeurs explicites de puissance déclarée.
@ -33,6 +30,10 @@ const utils = {
let value = feature.properties.tags[tag]
if (value && tag.toLowerCase().indexOf('output') !== -1) {
value = '' + value
if (value.indexOf(';') !== -1) {
console.log('value output multiple', value)
let explode = value.split(';')
explode.forEach(elem => {
if (value.replace) {
value = value.replace(' ')
value = value.replace('kW', '')
@ -41,6 +42,17 @@ const utils = {
if (power > outputPower) {
outputPower = power
}
})
} else {
if (value.replace) {
value = value.replace(' ')
value = value.replace('kW', '')
}
let power = parseInt(value)
if (power > outputPower) {
outputPower = power
}
}
}
}
}
@ -52,26 +64,26 @@ const utils = {
* villes les plus peuplées de France
*/
cities: [
{ name: 'Paris', coords: [48.8566, 2.3522] },
{ name: 'Marseille', coords: [43.2965, 5.3698] },
{ name: 'Lyon', coords: [45.7640, 4.8357] },
{ name: 'Toulouse', coords: [43.6042, 1.4437] },
{ name: 'Nice', coords: [43.7101, 7.2620] },
{ name: 'Nantes', coords: [47.2184, -1.5536] },
{ name: 'Strasbourg', coords: [48.5831, 7.7521] },
{ name: 'Montpellier', coords: [43.6167, 3.8742] },
{ name: 'Bordeaux', coords: [44.8378, -0.5792] },
{ name: 'Lille', coords: [50.6293, 3.1466] },
{ name: 'Rennes', coords: [48.1120, -1.6823] },
{ name: 'Toulon', coords: [43.1230, 5.9291] },
{ name: 'Le Havre', coords: [49.4943, 0.1079] },
{ name: 'Saint-Etienne', coords: [45.4380, 4.3841] },
{ name: 'Grenoble', coords: [45.1667, 5.7295] },
{ name: 'Rouen', coords: [49.4431, 1.0820] },
{ name: 'Dijon', coords: [47.3221, 5.0446] },
{ name: 'Angers', coords: [47.4786, -0.5551] },
{ name: 'Nîmes', coords: [43.8366, 4.3623] },
{ name: 'Reims', coords: [49.2500, 4.0333] }
{name: 'Paris', coords: [48.8566, 2.3522]},
{name: 'Marseille', coords: [43.2965, 5.3698]},
{name: 'Lyon', coords: [45.7640, 4.8357]},
{name: 'Toulouse', coords: [43.6042, 1.4437]},
{name: 'Nice', coords: [43.7101, 7.2620]},
{name: 'Nantes', coords: [47.2184, -1.5536]},
{name: 'Strasbourg', coords: [48.5831, 7.7521]},
{name: 'Montpellier', coords: [43.6167, 3.8742]},
{name: 'Bordeaux', coords: [44.8378, -0.5792]},
{name: 'Lille', coords: [50.6293, 3.1466]},
{name: 'Rennes', coords: [48.1120, -1.6823]},
{name: 'Toulon', coords: [43.1230, 5.9291]},
{name: 'Le Havre', coords: [49.4943, 0.1079]},
{name: 'Saint-Etienne', coords: [45.4380, 4.3841]},
{name: 'Grenoble', coords: [45.1667, 5.7295]},
{name: 'Rouen', coords: [49.4431, 1.0820]},
{name: 'Dijon', coords: [47.3221, 5.0446]},
{name: 'Angers', coords: [47.4786, -0.5551]},
{name: 'Nîmes', coords: [43.8366, 4.3623]},
{name: 'Reims', coords: [49.2500, 4.0333]}
]
}
export default utils