fix unknown latlng when no output guessed

This commit is contained in:
Tykayn 2024-12-23 00:26:13 +01:00 committed by tykayn
parent 8089d5c6a3
commit 18a18e58af
2 changed files with 30 additions and 17 deletions

View File

@ -9,8 +9,8 @@ import utils from './utils.js'
import colorUtils from './color-utils.js'
console.log('config', config)
let geojsondata
let geojsondata;
let lastLatLng;
// serveurs de tuiles: https://wiki.openstreetmap.org/wiki/Tile_servers
// https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png
@ -115,9 +115,12 @@ var baseLayers = {
}
let all_stations_markers = L.layerGroup().addTo(map) // layer group pour tous les marqueurs
let stations_much_speed_wow = L.layerGroup().addTo(map) // layer group des stations rapides
// let stations_much_speed_wow = L.layerGroup().addTo(map) // layer group des stations rapides
let overlays = {stations_bof: all_stations_markers, stations_much_speed_wow} // Si vous avez des calques superposables, ajoutez-les ici
let overlays = {
stations_bof: all_stations_markers
// , stations_much_speed_wow
} // Si vous avez des calques superposables, ajoutez-les ici
const layerControl = L.control.layers(baseLayers, overlays, {collapsed: true}).addTo(map)
tileGrey.addTo(map)
@ -186,7 +189,7 @@ function createJOSMEditLink(feature) {
function supprimerMarqueurs() {
all_stations_markers.clearLayers()
stations_much_speed_wow.clearLayers()
// stations_much_speed_wow.clearLayers()
map.eachLayer((layer) => {
if (layer instanceof L.Marker) {
@ -433,7 +436,17 @@ function eachFeature(feature, layer) {
} else if (zoom <= 18) {
ratio_circle = 0.25
}
console.log('ratio_circle', ratio_circle)
// console.log('ratio_circle', ratio_circle, feature.properties)
if (!layer._latlng) {
console.error('pas de latlng du layer', layer)
if (lastLatLng) {
layer._latlng = lastLatLng
}
} else {
console.log('layer._latlng', layer._latlng)
lastLatLng = layer._latlng
}
if (!outPowerGuessed) {
radius = radius * ratio_circle
} else {
@ -466,22 +479,21 @@ function eachFeature(feature, layer) {
// montrer les détails quand on est proche
// afficher moins de couleur, montrer le centre plus précis
if (zoom > 15) {
opacity = 0.25
let circle_center = L.circle(layer._latlng, {
color: 'black',
fillColor: color,
fillOpacity: 1,
radius: 0.1
})
if (!outPowerGuessed) {
circle_center.bindTooltip("?", {
permanent: true,
className: "my-label",
offset: [0, 0]
});
}
circle_center.addTo(all_stations_markers);
}).addTo(all_stations_markers);
// if (!outPowerGuessed) {
//
// circle_center.bindTooltip("?", {
// permanent: true,
// className: "my-label",
// offset: [0, 0]
// });
// }
// circle_center.addTo(all_stations_markers);
}

View File

@ -56,6 +56,7 @@ const utils = {
}
}
}
console.log('outputPower', outputPower)
feature.properties.outputPower = outputPower
return outputPower
},