Fix map not loading due to invalid tile layer name

This commit is contained in:
Eugene Burmakin 2024-09-16 20:52:51 +02:00
parent caa77be67f
commit 548d0b0e7a
6 changed files with 13 additions and 13 deletions

View file

@ -1 +1 @@
0.14.0 0.14.1

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.14.1] — 2024-09-16
### Fixed
- Fixed a bug where the map was not loading due to invalid tile layer name
## [0.14.0] — 2024-09-15 ## [0.14.0] — 2024-09-15
### Added ### Added

File diff suppressed because one or more lines are too long

View file

@ -12,10 +12,8 @@ export default class extends Controller {
toggleChildren() { toggleChildren() {
if (this.parentTarget.checked) { if (this.parentTarget.checked) {
this.childTargets.map(x => x.checked = true) this.childTargets.map(x => x.checked = true)
console.log('toggleChildrenChecked')
} else { } else {
this.childTargets.map(x => x.checked = false) this.childTargets.map(x => x.checked = false)
console.log('toggleChildrenUNChecked')
} }
} }

View file

@ -137,7 +137,7 @@ export default class extends Controller {
baseMaps() { baseMaps() {
let selectedLayerName = this.userSettings.preferred_map_layer || "OpenStreetMap"; let selectedLayerName = this.userSettings.preferred_map_layer || "OpenStreetMap";
console.log(selectedLayerName);
return { return {
OpenStreetMap: osmMapLayer(this.map, selectedLayerName), OpenStreetMap: osmMapLayer(this.map, selectedLayerName),
"OpenStreetMap.HOT": osmHotMapLayer(this.map, selectedLayerName), "OpenStreetMap.HOT": osmHotMapLayer(this.map, selectedLayerName),
@ -250,9 +250,6 @@ export default class extends Controller {
return response.json(); return response.json();
}) })
.then(data => { .then(data => {
console.log('Point deleted:', data);
// Remove the marker from the map
this.removeMarker(id); this.removeMarker(id);
}) })
.catch(error => { .catch(error => {
@ -348,7 +345,7 @@ export default class extends Controller {
<b>Duration:</b> ${timeOnRoute}<br> <b>Duration:</b> ${timeOnRoute}<br>
<b>Total Distance:</b> ${formatDistance(totalDistance, this.distanceUnit)}<br> <b>Total Distance:</b> ${formatDistance(totalDistance, this.distanceUnit)}<br>
`; `;
console.log(this.distanceUnit);
if (isDebugMode) { if (isDebugMode) {
const prevPoint = polylineCoordinates[0]; const prevPoint = polylineCoordinates[0];
const nextPoint = polylineCoordinates[polylineCoordinates.length - 1]; const nextPoint = polylineCoordinates[polylineCoordinates.length - 1];
@ -578,7 +575,6 @@ console.log(this.distanceUnit);
return response.json(); return response.json();
}) })
.then(data => { .then(data => {
console.log('Area deleted:', data);
this.areasLayer.removeLayer(layer); // Remove the layer from the areas layer group this.areasLayer.removeLayer(layer); // Remove the layer from the areas layer group
}) })
.catch(error => { .catch(error => {
@ -638,7 +634,6 @@ console.log(this.distanceUnit);
addSettingsButton() { addSettingsButton() {
if (this.settingsButtonAdded) return; if (this.settingsButtonAdded) return;
console.log('Adding settings button');
// Define the custom control // Define the custom control
const SettingsControl = L.Control.extend({ const SettingsControl = L.Control.extend({
onAdd: (map) => { onAdd: (map) => {

View file

@ -1,7 +1,7 @@
// Yeah I know it should be DRY but this is me doing a KISS at 21:00 on a Sunday night // Yeah I know it should be DRY but this is me doing a KISS at 21:00 on a Sunday night
export function osmMapLayer(map, selectedLayerName) { export function osmMapLayer(map, selectedLayerName) {
let layerName = 'osm'; let layerName = 'OpenStreetMap';
let layer = L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", { let layer = L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 19, maxZoom: 19,
@ -16,7 +16,7 @@ export function osmMapLayer(map, selectedLayerName) {
} }
export function osmHotMapLayer(map, selectedLayerName) { export function osmHotMapLayer(map, selectedLayerName) {
let layerName = 'osmHot'; let layerName = "OpenStreetMap.HOT";
let layer = L.tileLayer("https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", { let layer = L.tileLayer("https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", {
maxZoom: 19, maxZoom: 19,
attribution: "© OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France", attribution: "© OpenStreetMap contributors, Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France",