remove heatmap-related stuff

This commit is contained in:
vcoppe
2024-08-11 11:57:01 +02:00
parent 6fafb38b6d
commit bee1bd9c6a
5 changed files with 3 additions and 235 deletions

View File

@@ -410,62 +410,6 @@ export const overlays: { [key: string]: AnySourceData; } = {
maxzoom: 18,
attribution: '&copy; <a href="https://www.waymarkedtrails.org" target="_blank">Waymarked Trails</a>'
},
stravaHeatmapRun: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapTrailRun: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapHike: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapRide: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapGravel: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapMTB: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapWater: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
stravaHeatmapWinter: {
type: 'raster',
tiles: [],
tileSize: 1024,
maxzoom: 15,
attribution: '&copy; <a href="https://www.strava.com" target="_blank">Strava</a>'
},
};
export const defaultOpacities: { [key: string]: number; } = {
@@ -538,16 +482,6 @@ export const overlayTree: LayerTreeType = {
cyclOSM: {
cyclOSMlite: true,
},
/*strava: {
stravaHeatmapRun: true,
stravaHeatmapTrailRun: true,
stravaHeatmapHike: true,
stravaHeatmapRide: true,
stravaHeatmapGravel: true,
stravaHeatmapMTB: true,
stravaHeatmapWater: true,
stravaHeatmapWinter: true,
},*/
waymarked_trails: {
waymarkedTrailsHiking: true,
waymarkedTrailsCycling: true,
@@ -630,16 +564,6 @@ export const defaultOverlays = {
cyclOSM: {
cyclOSMlite: false,
},
/*strava: {
stravaHeatmapRun: false,
stravaHeatmapTrailRun: false,
stravaHeatmapHike: false,
stravaHeatmapRide: false,
stravaHeatmapGravel: false,
stravaHeatmapMTB: false,
stravaHeatmapWater: false,
stravaHeatmapWinter: false,
},*/
waymarked_trails: {
waymarkedTrailsHiking: false,
waymarkedTrailsCycling: false,
@@ -774,16 +698,6 @@ export const defaultOverlayTree: LayerTreeType = {
cyclOSM: {
cyclOSMlite: false,
},
/*strava: {
stravaHeatmapRun: true,
stravaHeatmapTrailRun: true,
stravaHeatmapHike: true,
stravaHeatmapRide: true,
stravaHeatmapGravel: true,
stravaHeatmapMTB: true,
stravaHeatmapWater: true,
stravaHeatmapWinter: true,
},*/
waymarked_trails: {
waymarkedTrailsHiking: true,
waymarkedTrailsCycling: true,
@@ -1122,16 +1036,4 @@ export const overpassQueryData: Record<string, OverpassQueryData> = {
amenity: "ferry_terminal"
}
}
};
export const stravaHeatmapServers = ['https://heatmap-external-a.strava.com/tiles-auth', 'https://heatmap-external-b.strava.com/tiles-auth', 'https://heatmap-external-c.strava.com/tiles-auth'];
export const stravaHeatmapActivityIds: { [key: string]: string } = {
stravaHeatmapRun: 'sport_Run',
stravaHeatmapTrailRun: 'sport_TrailRun',
stravaHeatmapHike: 'sport_Hike',
stravaHeatmapRide: 'sport_Ride',
stravaHeatmapGravel: 'sport_GravelRide',
stravaHeatmapMTB: 'sport_MountainBikeRide',
stravaHeatmapWater: 'water',
stravaHeatmapWinter: 'winter',
}
};

View File

@@ -14,16 +14,14 @@
import { settings } from '$lib/db';
import { _ } from 'svelte-i18n';
import { writable, get } from 'svelte/store';
import { map, setStravaHeatmapURLs } from '$lib/stores';
import { browser } from '$app/environment';
import { writable } from 'svelte/store';
import { map } from '$lib/stores';
import CustomLayers from './CustomLayers.svelte';
const {
selectedBasemapTree,
selectedOverlayTree,
selectedOverpassTree,
stravaHeatmapColor,
currentOverlays,
customLayers,
opacities
@@ -51,63 +49,6 @@
$: if ($selectedOverlay) {
setOpacityFromSelection();
}
const heatmapColors = [
{ value: '', label: '' },
{ value: 'blue', label: $_('layers.color.blue') },
{ value: 'bluered', label: $_('layers.color.bluered') },
{ value: 'gray', label: $_('layers.color.gray') },
{ value: 'hot', label: $_('layers.color.hot') },
{ value: 'orange', label: $_('layers.color.orange') },
{ value: 'purple', label: $_('layers.color.purple') }
];
let selectedHeatmapColor = writable(heatmapColors[0]);
$: if ($selectedHeatmapColor !== heatmapColors[0]) {
stravaHeatmapColor.set($selectedHeatmapColor.value);
// remove and add the heatmap layers
let m = get(map);
if (m) {
let currentStravaLayers = [];
if (overlayTree.overlays.world.strava) {
for (let layer of Object.keys(overlayTree.overlays.world.strava)) {
if (m.getLayer(layer)) {
m.removeLayer(layer);
currentStravaLayers.push(layer);
}
if (m.getSource(layer)) {
m.removeSource(layer);
}
}
}
if (currentStravaLayers.length > 0) {
currentOverlays.update(($currentOverlays) => {
for (let layer of currentStravaLayers) {
$currentOverlays.overlays.world.strava[layer] = false;
}
return $currentOverlays;
});
currentOverlays.update(($currentOverlays) => {
for (let layer of currentStravaLayers) {
$currentOverlays.overlays.world.strava[layer] = true;
}
return $currentOverlays;
});
}
}
}
$: if ($stravaHeatmapColor && browser) {
setStravaHeatmapURLs();
if ($stravaHeatmapColor !== get(selectedHeatmapColor).value) {
let toSelect = heatmapColors.find(({ value }) => value === $stravaHeatmapColor);
if (toSelect) {
selectedHeatmapColor.set(toSelect);
}
}
}
</script>
<Sheet.Root bind:open>
@@ -209,26 +150,6 @@
</ScrollArea>
</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="heatmap-color" class="hidden">
<Accordion.Trigger>{$_('layers.heatmap')}</Accordion.Trigger>
<Accordion.Content class="overflow-visible">
<div class="flex flex-row items-center justify-between gap-6">
<Label>
{$_('menu.style.color')}
</Label>
<Select.Root bind:selected={$selectedHeatmapColor}>
<Select.Trigger class="h-8 mr-1">
<Select.Value />
</Select.Trigger>
<Select.Content>
{#each heatmapColors as { value, label }}
<Select.Item {value}>{label}</Select.Item>
{/each}
</Select.Content>
</Select.Root>
</div>
</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
</ScrollArea>
</Sheet.Header>

View File

@@ -105,7 +105,6 @@ export const settings = {
customOverlayOrder: dexieSettingStore<string[]>('customOverlayOrder', []),
directionMarkers: dexieSettingStore('directionMarkers', false),
distanceMarkers: dexieSettingStore('distanceMarkers', false),
stravaHeatmapColor: dexieSettingStore('stravaHeatmapColor', 'bluered'),
streetViewSource: dexieSettingStore('streetViewSource', 'mapillary'),
fileOrder: dexieSettingStore<string[]>('fileOrder', []),
defaultOpacity: dexieSettingStore('defaultOpacity', 0.7),

View File

@@ -393,47 +393,3 @@ export enum ExportState {
ALL
}
export const exportState = writable<ExportState>(ExportState.NONE);
let stravaCookies: any = null;
function refreshStravaCookies() {
/*
TODO
if (stravaCookies === null) {
return fetch('https://s.gpx.studio')
.then(response => {
if (response.ok) {
return response.json();
} else {
throw new Error('Failed to fetch Strava cookies');
}
})
.then(data => {
stravaCookies = data;
console.log('Strava cookies:', stravaCookies);
});
} else {
return Promise.resolve();
}
*/
return Promise.resolve();
}
export function setStravaHeatmapURLs() {
/*refreshStravaCookies().then(() => {
overlays.stravaHeatmapRun.tiles = [];
overlays.stravaHeatmapTrailRun.tiles = [];
overlays.stravaHeatmapHike.tiles = [];
overlays.stravaHeatmapRide.tiles = [];
overlays.stravaHeatmapGravel.tiles = [];
overlays.stravaHeatmapMTB.tiles = [];
overlays.stravaHeatmapWater.tiles = [];
overlays.stravaHeatmapWinter.tiles = [];
for (let activity of Object.keys(overlayTree.overlays.world.strava)) {
overlays[activity].tiles = [];
for (let server of stravaHeatmapServers) {
overlays[activity].tiles.push(`${server}/${stravaHeatmapActivityIds[activity]}/${get(settings.stravaHeatmapColor)}/{z}/{x}/{y}@2x.png`); //?Signature=${stravaCookies['CloudFront-Signature']}&Key-Pair-Id=${stravaCookies['CloudFront-Key-Pair-Id']}&Policy=${stravaCookies['CloudFront-Policy']}`);
}
}
});*/
}

View File

@@ -228,7 +228,6 @@
"update": "Update layer"
},
"opacity": "Overlay opacity",
"heatmap": "Strava Heatmap",
"label": {
"basemaps": "Basemaps",
"overlays": "Overlays",
@@ -281,15 +280,6 @@
"ignFrCadastre": "IGN Cadastre",
"ignSlope": "IGN Slope",
"ignSkiTouring": "IGN Ski Touring",
"strava": "Strava",
"stravaHeatmapRun": "Running",
"stravaHeatmapTrailRun": "Trail Running",
"stravaHeatmapHike": "Hiking",
"stravaHeatmapRide": "Cycling",
"stravaHeatmapGravel": "Gravel Cycling",
"stravaHeatmapMTB": "MTB",
"stravaHeatmapWater": "Water",
"stravaHeatmapWinter": "Winter",
"waymarked_trails": "Waymarked Trails",
"waymarkedTrailsHiking": "Hiking",
"waymarkedTrailsCycling": "Cycling",