remove maptiler layers

This commit is contained in:
vcoppe
2026-05-27 18:52:15 +02:00
parent fcfaf043c4
commit 0b7f30a7c4
15 changed files with 39 additions and 171 deletions
+12 -12
View File
@@ -6,22 +6,22 @@
"url": "https://tiles.gpx.studio/openmaptiles.json"
},
"hillshading": {
"type": "vector",
"tiles": ["http://localhost:8080/hillshading/{z}/{x}/{y}.mvt"],
"minzoom": 4,
"maxzoom": 12
"type": "vector",
"tiles": ["https://tiles.gpx.studio/hillshading/{z}/{x}/{y}.mvt"],
"minzoom": 4,
"maxzoom": 12
},
"contours_m": {
"type": "vector",
"tiles": ["http://localhost:8080/contours_m/{z}/{x}/{y}.mvt"],
"minzoom": 4,
"maxzoom": 12
"type": "vector",
"tiles": ["https://tiles.gpx.studio/contours_m/{z}/{x}/{y}.mvt"],
"minzoom": 11,
"maxzoom": 12
},
"contours_ft": {
"type": "vector",
"tiles": ["http://localhost:8080/contours_ft/{z}/{x}/{y}.mvt"],
"minzoom": 4,
"maxzoom": 12
"type": "vector",
"tiles": ["https://tiles.gpx.studio/contours_ft/{z}/{x}/{y}.mvt"],
"minzoom": 11,
"maxzoom": 12
}
},
"sprite": "https://tiles.openfreemap.org/sprites/ofm_f384/ofm",

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

+3 -18
View File
@@ -35,10 +35,6 @@ export const maptilerKeyPlaceHolder = 'MAPTILER_KEY';
export const basemaps: { [key: string]: string | StyleSpecification } = {
topo: topo as StyleSpecification,
satellite: satellite as StyleSpecification,
maptilerStreets: `https://api.maptiler.com/maps/streets-v4/style.json?key=${maptilerKeyPlaceHolder}`,
maptilerTopo: `https://api.maptiler.com/maps/topo-v4/style.json?key=${maptilerKeyPlaceHolder}`,
maptilerOutdoors: `https://api.maptiler.com/maps/outdoor-v4/style.json?key=${maptilerKeyPlaceHolder}`,
maptilerSatellite: `https://api.maptiler.com/maps/hybrid-v4/style.json?key=${maptilerKeyPlaceHolder}`,
esriSatellite: {
version: 8,
sources: {
@@ -805,10 +801,6 @@ export const basemapTree: LayerTreeType = {
world: {
topo: true,
satellite: true,
maptilerStreets: true,
maptilerTopo: true,
maptilerOutdoors: true,
maptilerSatellite: true,
esriSatellite: true,
openStreetMap: true,
openTopoMap: true,
@@ -1033,10 +1025,6 @@ export const defaultBasemapTree: LayerTreeType = {
world: {
topo: true,
satellite: true,
maptilerStreets: true,
maptilerTopo: true,
maptilerOutdoors: true,
maptilerSatellite: true,
esriSatellite: false,
openStreetMap: true,
openTopoMap: true,
@@ -1495,14 +1483,11 @@ export const overpassQueryData: Record<string, OverpassQueryData> = {
};
export const terrainSources: { [key: string]: RasterDEMSourceSpecification } = {
'maptiler-dem': {
type: 'raster-dem',
url: `https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json?key=${maptilerKeyPlaceHolder}`,
},
mapterhorn: {
type: 'raster-dem',
url: 'https://tiles.mapterhorn.com/tilejson.json',
url: 'https://tiles.gpx.studio/mapterhorn.json',
encoding: 'terrarium',
},
};
export const defaultTerrainSource = 'maptiler-dem';
export const defaultTerrainSource = 'mapterhorn';
+1 -7
View File
@@ -8,7 +8,7 @@
...others
}: {
iconOnly?: boolean;
company?: 'gpx.studio' | 'maptiler' | 'github' | 'crowdin' | 'facebook' | 'reddit';
company?: 'gpx.studio' | 'github' | 'crowdin' | 'facebook' | 'reddit';
[key: string]: any;
} = $props();
</script>
@@ -19,12 +19,6 @@
alt="Logo of gpx.studio."
{...others}
/>
{:else if company === 'maptiler'}
<img
src="{base}/maptiler-logo{mode.current === 'dark' ? '-dark' : ''}.svg"
alt="Logo of Maptiler."
{...others}
/>
{:else if company === 'github'}
<svg
role="img"
@@ -1,10 +1,10 @@
<script lang="ts">
import maptilerTopoMap from '$lib/assets/img/home/maptiler-topo.png?enhanced';
import topoMap from '$lib/assets/img/home/topo.png?enhanced';
import waymarkedMap from '$lib/assets/img/home/waymarked.png?enhanced';
</script>
<div class="relative h-80 aspect-square rounded-2xl shadow-xl overflow-clip">
<enhanced:img src={maptilerTopoMap} alt="MapTiler Topo map screenshot." class="absolute" />
<enhanced:img src={topoMap} alt="Topo map screenshot." class="absolute" />
<enhanced:img
src={waymarkedMap}
alt="Waymarked Trails map screenshot."
@@ -29,7 +29,7 @@ export const defaultEmbeddingOptions = {
key: '',
files: [],
ids: [],
basemap: 'maptilerStreets',
basemap: 'topo',
elevation: {
show: true,
height: 170,
@@ -125,9 +125,7 @@ export function convertOldEmbeddingOptions(options: URLSearchParams): any {
}
if (options.has('source')) {
let basemap = options.get('source')!;
if (basemap === 'satellite') {
newOptions.basemap = 'maptilerSatellite';
} else if (basemap === 'otm') {
if (basemap === 'otm') {
newOptions.basemap = 'openTopoMap';
} else if (basemap === 'ohm') {
newOptions.basemap = 'openHikingMap';
+3 -13
View File
@@ -96,11 +96,9 @@ export class StyleManager {
}
this.merge(style, basemapStyle);
if (this._maptilerKey !== '') {
const terrain = this.getCurrentTerrain();
style.sources[terrain.source] = terrainSources[terrain.source];
style.terrain = terrain.exaggeration > 0 ? terrain : undefined;
}
const terrain = this.getCurrentTerrain();
style.sources[terrain.source] = terrainSources[terrain.source];
style.terrain = terrain.exaggeration > 0 ? terrain : undefined;
style.layers.push(...anchorLayers);
@@ -172,7 +170,6 @@ export class StyleManager {
}
updateTerrain() {
if (this._maptilerKey === '') return;
const map_ = get(this._map);
if (!map_) return;
@@ -195,9 +192,6 @@ export class StyleManager {
): Promise<maplibregl.StyleSpecification> {
if (typeof styleInfo === 'string') {
let styleUrl = styleInfo as string;
if (styleUrl.includes(maptilerKeyPlaceHolder)) {
styleUrl = styleUrl.replace(maptilerKeyPlaceHolder, this._maptilerKey);
}
const response = await fetch(styleUrl, { cache: 'force-cache' });
if (!response.ok) {
throw new Error(`HTTP error fetching style "${styleInfo}": ${response.status}`);
@@ -260,10 +254,6 @@ export class StyleManager {
getCurrentTerrain() {
const terrain = get(terrainSource);
const source = terrainSources[terrain];
if (source.url && source.url.includes(maptilerKeyPlaceHolder)) {
source.url = source.url.replace(maptilerKeyPlaceHolder, this._maptilerKey);
}
const map_ = get(this._map);
return {
source: terrain,
+1 -1
View File
@@ -59,7 +59,7 @@ Only one basemap can be displayed at a time.
<DocsLayers />
<span class="text-sm text-center mt-2">
Hover over the map to show the <a href="https://hiking.waymarkedtrails.org" target="_blank">Waymarked Trails hiking</a> overlay on top of the <a href="https://www.maptiler.com/maps/outdoor-topo/" target="_blank">MapTiler Topo</a> basemap.
Hover over the map to show the <a href="https://hiking.waymarkedtrails.org" target="_blank">Waymarked Trails hiking</a> overlay on top of the topographic basemap.
</span>
</div>
@@ -18,7 +18,7 @@ This tool allows you to add elevation data to traces and [points of interest](..
<DocsNote>
Elevation data is provided by <a href="https://maptiler.com" target="_blank">MapTiler</a>.
You can learn more about its origin and accuracy in the <a href="https://docs.maptiler.com/guides/map-tiling-hosting/data-hosting/rgb-terrain-by-maptiler/" target="_blank">documentation</a>.
Elevation data is provided by <a href="https://mapterhorn.com" target="_blank">Mapterhorn</a>.
You can learn more about its origin and accuracy in the <a href="https://mapterhorn.com/attribution/" target="_blank">documentation</a>.
</DocsNote>
+2 -2
View File
@@ -210,7 +210,7 @@ type RoutingProfile =
| 'motorcycle'
| 'water'
| 'railway';
type TerrainSource = 'maptiler-dem' | 'mapterhorn';
type TerrainSource = 'mapterhorn';
type StreetViewSource = 'mapillary' | 'google';
export const settings = {
@@ -308,7 +308,7 @@ export const settings = {
terrainSource: new Setting<TerrainSource>(
'terrainSource',
defaultTerrainSource,
getValueValidator(['maptiler-dem', 'mapterhorn'], defaultTerrainSource)
getValueValidator(['mapterhorn'], defaultTerrainSource)
),
directionMarkers: new Setting('directionMarkers', false),
distanceMarkers: new Setting('distanceMarkers', false),
+8 -10
View File
@@ -7,7 +7,6 @@ import maplibregl from 'maplibre-gl';
import { pointToTile, pointToTileFraction } from '@mapbox/tilebelt';
import type { GPXStatisticsTree } from '$lib/logic/statistics-tree';
import { ListTrackSegmentItem } from '$lib/components/file-list/file-list';
import { PUBLIC_MAPTILER_KEY } from '$env/static/public';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
@@ -101,7 +100,7 @@ export function getClosestTrackSegments(
export function getElevation(
points: (TrackPoint | Waypoint | Coordinates)[],
ELEVATION_ZOOM: number = 13,
ELEVATION_ZOOM: number = 12,
tileSize = 512
): Promise<number[]> {
let coordinates = points.map((point) =>
@@ -122,10 +121,9 @@ export function getElevation(
};
let promises = uniqueTiles.map((tile) =>
fetch(
`https://api.maptiler.com/tiles/terrain-rgb-v2/${ELEVATION_ZOOM}/${tile[0]}/${tile[1]}.webp?key=${PUBLIC_MAPTILER_KEY}`,
{ cache: 'force-cache' }
)
fetch(`https://tiles.gpx.studio/mapterhorn/${ELEVATION_ZOOM}/${tile[0]}/${tile[1]}.webp`, {
cache: 'force-cache',
})
.then((response) => response.blob())
.then(
(blob) =>
@@ -180,10 +178,10 @@ export function getElevation(
_y + (_y + 1 == tileSize ? 0 : 1)
);
let ele00 = -10000 + (p00[0] * 256 * 256 + p00[1] * 256 + p00[2]) * 0.1;
let ele01 = -10000 + (p01[0] * 256 * 256 + p01[1] * 256 + p01[2]) * 0.1;
let ele10 = -10000 + (p10[0] * 256 * 256 + p10[1] * 256 + p10[2]) * 0.1;
let ele11 = -10000 + (p11[0] * 256 * 256 + p11[1] * 256 + p11[2]) * 0.1;
let ele00 = -32768 + p00[0] * 256 + p00[1] + p00[2] / 256;
let ele01 = -32768 + p01[0] * 256 + p01[1] + p01[2] / 256;
let ele10 = -32768 + p10[0] * 256 + p10[1] + p10[2] / 256;
let ele11 = -32768 + p11[0] * 256 + p11[1] + p11[2] / 256;
return (
ele00 * (1 - dx) * (1 - dy) +