78 lines
2.3 KiB
JavaScript
78 lines
2.3 KiB
JavaScript
|
|
|
|
|
|
const utils = {
|
|
/**
|
|
* fouiller dans les tags les valeurs explicites de puissance déclarée.
|
|
* Deviner aussi les puissances non déclarées:
|
|
* - type 2 présent, max 43kW
|
|
* - type Chademo présent, max 63kW
|
|
* https://forum.openstreetmap.fr/t/bornes-de-recharges-et-puissance-chargeurs-quel-est-votre-avis/27828
|
|
*
|
|
* @param feature
|
|
* @returns {number}
|
|
*/
|
|
guessOutputPowerFromFeature: (feature) => {
|
|
let outputPower = 0
|
|
let power = 0
|
|
if (feature.properties && feature.properties.tags) {
|
|
|
|
let found_type_2 = false
|
|
let found_type_chademo = false
|
|
// deviner les puissances max selon les capacités de prises
|
|
for (var tag in feature.properties.tags) {
|
|
if (tag.indexOf('type2') !== -1) {
|
|
|
|
found_type_2 = true
|
|
power = 43
|
|
}
|
|
if (tag.indexOf('chademo') !== -1) {
|
|
found_type_chademo = true
|
|
power = 63
|
|
}
|
|
let value = feature.properties.tags[tag]
|
|
if (value && tag.toLowerCase().indexOf('output') !== -1) {
|
|
value = '' + value
|
|
if (value.replace) {
|
|
value = value.replace(' ')
|
|
value = value.replace('kW', '')
|
|
}
|
|
let power = parseInt(value)
|
|
if (power > outputPower) {
|
|
outputPower = power
|
|
}
|
|
}
|
|
}
|
|
}
|
|
feature.properties.outputPower = outputPower
|
|
return outputPower
|
|
},
|
|
|
|
/**
|
|
* 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] }
|
|
]
|
|
}
|
|
export default utils
|