add keys to display

This commit is contained in:
Tykayn 2024-10-18 00:47:01 +02:00 committed by tykayn
parent 499d79f18d
commit 0d9d327c5a

View File

@ -3,10 +3,13 @@
const overrideQuery = true const overrideQuery = true
const initialZoom = 14 const initialZoom = 14
const osmMention = '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors' const osmMention = '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
let unknown_color = '#676767' // color for unknown power output of the station
// serveurs de tuiles: https://wiki.openstreetmap.org/wiki/Tile_servers // serveurs de tuiles: https://wiki.openstreetmap.org/wiki/Tile_servers
// https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png // https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png
// https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png // https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png
// https://tile.openstreetmap.org/{z}/{x}/{y}.png
// 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png'
const tileServer = 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png' const tileServer = 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png'
// Créer la carte centrée sur Rouen // Créer la carte centrée sur Rouen
@ -46,16 +49,33 @@ function buildOverpassApiUrl (map, overpassQuery) {
return resultUrl return resultUrl
} }
const tags_to_display_in_popup = ['capacity', 'socket:type_2', const tags_to_display_in_popup = [
'socket:type2:output', 'name',
'capacity',
'date_start',
'charging_station:output', 'charging_station:output',
'socket:type_2',
'socket:type2:output',
'socket:typee', 'socket:typee',
'socket:typee:output',
'socket:type2_combo', 'socket:type2_combo',
'socket:type2_combo:output',
'socket:chademo', 'socket:chademo',
'operator', 'ref:EU:EVSE', 'operator', 'ref:EU:EVSE',
'network', 'network',
'opening_hours',
'contact', 'contact',
'phone'] 'phone',
'contact:phone',
'website',
'contact:website',
'ref',
'fee',
'payment',
'payment:contactless',
'authentication:app',
'authentication:debit_card',
]
function supprimerMarqueurs (map) { function supprimerMarqueurs (map) {
map.eachLayer((layer) => { map.eachLayer((layer) => {
@ -74,6 +94,7 @@ const colors = [
'#08c1c7', '#08c1c7',
'#0081f0', '#0081f0',
] ]
function getColor (feature) { function getColor (feature) {
var outputPower = 0 var outputPower = 0
if (feature.properties && feature.properties.tags) { if (feature.properties && feature.properties.tags) {
@ -96,7 +117,8 @@ function getColor (feature) {
} }
if (!outputPower) { if (!outputPower) {
console.log('pas de outputPower', outputPower) console.log('pas de outputPower', outputPower)
return 'white'
return unknown_color
} }
feature.properties.tags.has_output_of_irve_specified = outputPower feature.properties.tags.has_output_of_irve_specified = outputPower
var index = Math.min(Math.floor(outputPower / 10), colors.length - 1) var index = Math.min(Math.floor(outputPower / 10), colors.length - 1)
@ -160,11 +182,11 @@ function displayPointsFromApi (points) {
}).addTo(map) }).addTo(map)
let color = getColor(feature) let color = getColor(feature)
let radius = 20; let radius = 50
if (color == '#0081f0') { if (color == '#0081f0') {
radius = 200; radius = 200
} else if (color == '#08c1c7') { } else if (color == '#08c1c7') {
radius = 100; radius = 100
} }
let circle = L.circle(layer._latlng, { let circle = L.circle(layer._latlng, {
color: color, color: color,