diff --git a/web/assets/app.js b/web/assets/app.js index 3f72877..45f5f36 100644 --- a/web/assets/app.js +++ b/web/assets/app.js @@ -1,9 +1,11 @@ /* Site script, served at /assets/app.js (deferred). Vanilla JS, no build step. - 1. Preferences: theme and length order (saved in localStorage; applied early by prefs.js) + 1. Preferences: theme, length order and base map (saved in localStorage; applied + early by prefs.js) 2. Maps: .mapfig[data-map] figures. Data is fetched from data-src (same origin); lines are drawn on a plain graticule first, then on an OpenFreeMap base map - when MapLibre and WebGL are available. + when MapLibre and WebGL are available. A trail page's map (data-outdoor) is + an outdoor map, with relief and contours, and a switch to the plain one. 3. Trail finder (home page): search, filters, sort, URL query state, map/list highlight 4. Copy-credit buttons @@ -50,6 +52,16 @@ document.dispatchEvent(new Event('olt:units')); } + /* The base map of the trail maps: 'outdoor' (the default) or 'plain'. */ + function basemapChoice() { return root.dataset.basemap === 'plain' ? 'plain' : 'outdoor'; } + + function setBasemap(value) { + if (value === 'plain') root.dataset.basemap = 'plain'; + else delete root.dataset.basemap; + writePref('lh-basemap', value === 'plain' ? 'plain' : null); + document.dispatchEvent(new Event('olt:basemap')); + } + function syncRadios(selector, value) { document.querySelectorAll(selector).forEach(function (input) { input.checked = input.value === value; }); } @@ -89,6 +101,137 @@ var STYLE_URL = 'https://tiles.openfreemap.org/styles/positron'; + /* The outdoor base map of a trail page: the style named by the figure's + data-outdoor (web/assets/map/outdoor.json), with relief from its olt-dem + elevation source and contour lines made in the browser by maplibre-contour + (window.mlcontour, loaded after MapLibre on trail pages only). Each layer + carries its own dark-theme paint (metadata "olt:dark") and its layout for + a reader who puts km and m first (metadata "olt:km"); the contour steps for + each unit are in the style's metadata "olt:contours". Relief and contours + are extras: they stay hidden until the map is ready, so a slow or blocked + elevation host never holds the map up, and their errors never fail it. */ + var ELEVATION = { 'olt-dem': true, 'olt-contours': true }; + var outdoorStyles = {}; + var demSource; + + function fetchOutdoor(url) { + if (!outdoorStyles[url]) { + outdoorStyles[url] = fetch(url, { credentials: 'same-origin' }) + .then(function (r) { + if (!r.ok) throw new Error(r.status); + return r.json(); + }) + .catch(function () { return null; }); + } + return outdoorStyles[url]; + } + + /* One elevation tile source for the page, shared by the relief and the + contours; null when the add-on is missing (relief only, then). */ + function contourSource(dem) { + if (demSource !== undefined) return demSource; + demSource = null; + if (window.mlcontour && window.mlcontour.DemSource) { + try { + demSource = new window.mlcontour.DemSource({ + url: dem.tiles[0], encoding: dem.encoding, maxzoom: dem.maxzoom, worker: true, timeoutMs: 10000 + }); + demSource.setupMaplibre(window.maplibregl); + } catch (e) { demSource = null; } + } + return demSource; + } + + function contourUrl(base) { + var opts = base.metadata['olt:contours'][milesFirst() ? 'ft' : 'm']; + return demSource.contourProtocolUrl({ multiplier: opts.multiplier, thresholds: opts.thresholds }); + } + + function assign(target, values) { + Object.keys(values).forEach(function (k) { target[k] = values[k]; }); + return target; + } + + /* The style to hand MapLibre: the file in the reader's theme and units, its + elevation tiles fetched through the add-on when it is here. */ + function outdoorStyle(base, hideElevation) { + var style = JSON.parse(JSON.stringify(base)); + var dark = isDark(); + var km = !milesFirst(); + var dem = style.sources['olt-dem']; + var contours = dem ? contourSource(dem) : null; + if (contours) { + dem.tiles = [contours.sharedDemProtocolUrl]; + style.sources['olt-contours'].tiles = [contourUrl(base)]; + } else { + delete style.sources['olt-contours']; + style.layers = style.layers.filter(function (layer) { return layer.source !== 'olt-contours'; }); + } + style.layers.forEach(function (layer) { + var meta = layer.metadata || {}; + if (dark && meta['olt:dark']) layer.paint = assign(layer.paint || {}, meta['olt:dark']); + if (km && meta['olt:km']) layer.layout = assign(layer.layout || {}, meta['olt:km']); + if (hideElevation && ELEVATION[layer.source]) layer.layout = assign(layer.layout || {}, { visibility: 'none' }); + }); + return style; + } + + /* A theme or units change on a live outdoor map: the same metadata, set + layer by layer (MapLibre skips a value that is already set). */ + function restyleOutdoor(map, base) { + var dark = isDark(); + var km = !milesFirst(); + base.layers.forEach(function (layer) { + if (!map.getLayer(layer.id)) return; + var night = (layer.metadata || {})['olt:dark'] || {}; + var metric = (layer.metadata || {})['olt:km'] || {}; + Object.keys(night).forEach(function (prop) { + map.setPaintProperty(layer.id, prop, dark ? night[prop] : (layer.paint || {})[prop]); + }); + Object.keys(metric).forEach(function (prop) { + map.setLayoutProperty(layer.id, prop, km ? metric[prop] : (layer.layout || {})[prop]); + }); + }); + } + + function showElevation(map) { + map.getStyle().layers.forEach(function (layer) { + if (ELEVATION[layer.source]) map.setLayoutProperty(layer.id, 'visibility', 'visible'); + }); + } + + /* The Outdoor / Plain switch: a MapLibre control of two toggle buttons, top + left, clear of the zoom buttons, the scale bar and the credits. */ + function basemapControl() { + var box; + function sync() { + var choice = basemapChoice(); + box.querySelectorAll('button').forEach(function (b) { + b.setAttribute('aria-pressed', b.dataset.basemap === choice ? 'true' : 'false'); + }); + } + return { + sync: sync, + onAdd: function () { + box = document.createElement('div'); + box.className = 'maplibregl-ctrl maplibregl-ctrl-group basemap-switch'; + box.setAttribute('role', 'group'); + box.setAttribute('aria-label', 'Base map'); + [['outdoor', 'Outdoor'], ['plain', 'Plain']].forEach(function (pair) { + var b = document.createElement('button'); + b.type = 'button'; + b.dataset.basemap = pair[0]; + b.textContent = pair[1]; + b.addEventListener('click', function () { if (basemapChoice() !== pair[0]) setBasemap(pair[0]); }); + box.appendChild(b); + }); + sync(); + return box; + }, + onRemove: function () { if (box.parentNode) box.parentNode.removeChild(box); } + }; + } + function linesOf(feature) { var g = feature.geometry || {}; if (g.type === 'LineString') return [g.coordinates]; @@ -311,7 +454,9 @@ } if (kind === 'sketch') { var col = routeMain ? '--route' : '--trail'; + /* A pale band under the dots lifts them off relief and contours. */ return [ + { id: 'olt-sketch-halo', color: '--casing', width: [5, 6, 12, 9], opacity: 0.6, filter: IS_SKETCH }, { id: 'olt-sketch', color: col, width: [5, 3, 12, 5], dash: [0, 2], cap: 'round', filter: IS_SKETCH }, { id: 'olt-sketch-points', type: 'circle', stroke: col, strokeWidth: 2.5, radius: [5, 5, 12, 8], filter: IS_SKETCH } ]; @@ -329,9 +474,10 @@ return token(def.stroke || '--trail'); } - /* Trail lines go under the base map's labels, as on a printed map. */ + /* Trail lines go under the base map's labels, as on a printed map (and over + the contour labels, which sit with their lines below the water). */ function addLineLayers(map, fc, defs) { - var firstLabel = map.getStyle().layers.filter(function (l) { return l.type === 'symbol'; })[0]; + var firstLabel = map.getStyle().layers.filter(function (l) { return l.type === 'symbol' && !ELEVATION[l.source]; })[0]; map.addSource('olt', { type: 'geojson', data: fc }); defs.forEach(function (def) { var layer; @@ -357,6 +503,7 @@ } }; if (def.dash) layer.paint['line-dasharray'] = def.dash; + if (def.opacity) layer.paint['line-opacity'] = def.opacity; } if (def.filter) layer.filter = def.filter; map.addLayer(layer, firstLabel && firstLabel.id); @@ -376,6 +523,9 @@ var routeMain = fig.dataset.route === 'yes'; var defs = layerDefs(kind, routeMain); var onlyIds = (fig.dataset.ids || '').trim().split(/\s+/).filter(Boolean); + /* A trail page's map: fetch its outdoor style now, beside the track data. */ + var outdoorUrl = kind === 'overview' ? '' : (fig.dataset.outdoor || ''); + if (outdoorUrl) fetchOutdoor(outdoorUrl); var entry = { kind: kind, map: null, fc: null, defs: defs, fallback: fallback, visibleIds: onlyIds.length ? onlyIds : null, ready: false, mapStarted: false, fullBounds: null, boundsById: null }; @@ -450,10 +600,22 @@ if (!window.maplibregl) { dataReady.then(function (fc) { if (fc) fail('the map library did not load'); }); return; } if (!webglAvailable()) { dataReady.then(function (fc) { if (fc) fail('WebGL is off in this browser'); }); return; } if (!entry.ready && entry.fc) status.textContent = 'Loading the base map…'; + var timer = setTimeout(function () { fail('tiles did not load'); }, 15000); + if (outdoorUrl) fetchOutdoor(outdoorUrl).then(function (base) { createMap(base, timer); }); + else createMap(null, timer); + } + /* base: the outdoor style of a trail map, or null for a map with the plain + style only (the overview maps, or when the style file did not load). */ + function createMap(base, timer) { + var current = base && basemapChoice() === 'outdoor' ? 'outdoor' : 'plain'; + var contourMiles = milesFirst(); /* the units the contour tiles are made in */ + var settled = false; /* the current style is loaded and dressed */ + var styleGen = 0; + var switcher = null; var options = { container: host.querySelector('.map__canvas'), - style: STYLE_URL, + style: current === 'outdoor' ? outdoorStyle(base, true) : STYLE_URL, attributionControl: { compact: true }, cooperativeGestures: true, dragRotate: false, @@ -472,6 +634,7 @@ map.addControl(scale, 'bottom-left'); document.addEventListener('olt:units', function () { scale.setUnit(milesFirst() ? 'imperial' : 'metric'); + if (settled && current === 'outdoor') restyle(); }); /* A narrow frame has no room for the open attribution beside the scale @@ -486,38 +649,89 @@ map.on('resize', collapseAttribution); var originals = {}; - var timer = setTimeout(function () { fail('tiles did not load'); }, 15000); - map.on('error', function () { if (!map.isStyleLoaded()) fail('the map style did not load'); }); + map.on('error', function (e) { + if (e && e.sourceId && ELEVATION[e.sourceId]) return; /* no relief or contours here: the map stands */ + if (!map.isStyleLoaded()) fail('the map style did not load'); + }); + + /* The outdoor style in the reader's theme and units; contour tiles are + remade only when the units change. */ + function restyle() { + restyleOutdoor(map, base); + var source = map.getSource('olt-contours'); + if (source && demSource && contourMiles !== milesFirst()) { + contourMiles = milesFirst(); + source.setTiles([contourUrl(base)]); + } + } + + /* A freshly loaded base map: the theme, then the trail on top. */ + function dress() { + if (current === 'plain') { + originals = {}; + tintBasemap(map, originals); + } else { + restyle(); + } + addLineLayers(map, entry.fc, defs); + } var styleReady = new Promise(function (resolve) { map.on('load', resolve); }); Promise.all([dataReady, styleReady]).then(function (results) { var fc = results[0]; if (!fc) return; clearTimeout(timer); - tintBasemap(map, originals); - addLineLayers(map, fc, defs); + dress(); if (!bbox) { bbox = bboxOf(fc); entry.fullBounds = bbox.slice(); map.fitBounds([[bbox[0], bbox[1]], [bbox[2], bbox[3]]], { padding: 32, animate: false }); } entry.ready = true; + settled = true; host.dataset.state = 'ready'; status.textContent = ''; collapseAttribution(); if (entry.visibleIds) setVisible(entry, entry.visibleIds); if (kind === 'overview') wireOverview(map, defs); + if (current === 'outdoor') showElevation(map); + if (base) { + switcher = basemapControl(); + map.addControl(switcher, 'top-left'); + } mapCorners(); }); + /* Outdoor <-> Plain. setStyle drops every added layer, so the trail is + drawn again on the new style, with the theme, the units and the + visible-ids filter; the camera stays where the reader left it. */ + function applyBasemap() { + if (switcher) switcher.sync(); + var want = base && basemapChoice() === 'outdoor' ? 'outdoor' : 'plain'; + if (!entry.ready || want === current) return; + current = want; + settled = false; + var gen = ++styleGen; + if (want === 'outdoor') contourMiles = milesFirst(); + map.setStyle(want === 'outdoor' ? outdoorStyle(base, false) : STYLE_URL, { diff: false }); + map.once('style.load', function () { + if (gen !== styleGen) return; /* a later switch replaced this style */ + dress(); + if (entry.visibleIds) setVisible(entry, entry.visibleIds); + settled = true; + }); + } + if (base) document.addEventListener('olt:basemap', applyBasemap); + function mapCorners() { var b = map.getBounds(); corners({ w: b.getWest(), e: b.getEast(), n: b.getNorth(), s: b.getSouth() }); } map.on('moveend', function () { if (entry.ready) mapCorners(); }); document.addEventListener('olt:theme', function () { - if (!entry.ready) return; - tintBasemap(map, originals); + if (!entry.ready || !settled) return; /* a style still loading is dressed in the new theme */ + if (current === 'outdoor') restyle(); + else tintBasemap(map, originals); defs.forEach(function (def) { if (def.type === 'circle') { map.setPaintProperty(def.id, 'circle-color', token('--casing')); diff --git a/web/assets/map/LICENSE.txt b/web/assets/map/LICENSE.txt new file mode 100644 index 0000000..8f0ff45 --- /dev/null +++ b/web/assets/map/LICENSE.txt @@ -0,0 +1,73 @@ +outdoor.json, the outdoor map style of the trail pages, is derived from the +Liberty style of OpenFreeMap (https://github.com/hyperknot/openfreemap-styles), +read 2026-11-15. Liberty is a fork of OSM Liberty +(https://github.com/maputnik/osm-liberty), which is a fork of OSM Bright +(https://github.com/openmaptiles/osm-bright-gl-style), derived from Mapbox Open +Styles. The notices of each follow. + +The map design (look and feel) of OpenMapTiles styles is under the Creative +Commons Attribution 4.0 licence (https://creativecommons.org/licenses/by/4.0/). +It is credited in the corner of every map as "© OpenMapTiles", linked to +https://www.openmaptiles.org/, beside "© OpenStreetMap" for the map data. + +The elevation, relief and contour parts (the olt-dem and olt-contours sources +and the hillshade and contour layers) and the colours are this site's own. + +------------------------------------------------------------------------------- +OpenFreeMap styles: MIT License + +Copyright (c) 2023 Zsolt Ero + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +------------------------------------------------------------------------------- +OSM Liberty and OSM Bright: BSD 3-Clause License (code) + +Copyright (c) 2024, MapTiler.com & OpenMapTiles contributors. +Copyright (c) 2014, Mapbox. +All rights reserved. + +Modifications by MapTiler.com & OpenMapTiles contributors, by the OSM Liberty +contributors and by OpenFreeMap. Derived from "Mapbox Open Styles" +https://github.com/mapbox/mapbox-gl-styles + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/web/assets/map/outdoor.json b/web/assets/map/outdoor.json new file mode 100644 index 0000000..4103961 --- /dev/null +++ b/web/assets/map/outdoor.json @@ -0,0 +1,256 @@ +{ + "version": 8, + "name": "Long Hikes outdoor", + "metadata": { + "olt:about": "The outdoor base map of the trail pages, read by /assets/app.js. Derived from OpenFreeMap Liberty (MIT), itself a fork of OSM Liberty and OSM Bright (BSD-3-Clause code, CC BY 4.0 design); see LICENSE.txt beside this file. Light colours are in each layer's paint; olt:dark holds the same layer's dark-theme paint, and olt:km its layout when the reader puts km and m first.", + "olt:contours": { + "ft": {"multiplier": 3.28084, "thresholds": {"11": [500, 2500], "12": [200, 1000], "13": [100, 500], "14": [100, 500], "15": [40, 200]}}, + "m": {"multiplier": 1, "thresholds": {"11": [200, 1000], "12": [100, 500], "13": [50, 250], "14": [20, 100], "15": [10, 50]}} + } + }, + "sources": { + "openmaptiles": {"type": "vector", "url": "https://tiles.openfreemap.org/planet"}, + "olt-dem": { + "type": "raster-dem", + "tiles": ["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"], + "encoding": "terrarium", + "tileSize": 512, + "maxzoom": 12, + "bounds": [-180, 14, -50, 85], + "attribution": "Relief: Terrain Tiles, USGS and others (full credit below the map)" + }, + "olt-contours": {"type": "vector", "tiles": ["contours://{z}/{x}/{y}"], "minzoom": 11, "maxzoom": 15, "bounds": [-180, 14, -50, 85]} + }, + "sprite": "https://tiles.openfreemap.org/sprites/ofm_f384/ofm", + "glyphs": "https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf", + "layers": [ + {"id": "background", "type": "background", + "paint": {"background-color": "#f2efe6"}, + "metadata": {"olt:dark": {"background-color": "#1d241f"}}}, + + {"id": "landcover-ice", "type": "fill", "source": "openmaptiles", "source-layer": "landcover", + "filter": ["==", ["get", "class"], "ice"], + "paint": {"fill-color": "#f6fafc", "fill-outline-color": "#bcd6e6"}, + "metadata": {"olt:dark": {"fill-color": "#2a3338", "fill-outline-color": "#3b4d58"}}}, + {"id": "landcover-rock", "type": "fill", "source": "openmaptiles", "source-layer": "landcover", + "filter": ["==", ["get", "class"], "rock"], + "paint": {"fill-color": "#e3ded4", "fill-antialias": false}, + "metadata": {"olt:dark": {"fill-color": "#2a2b27"}}}, + {"id": "landcover-sand", "type": "fill", "source": "openmaptiles", "source-layer": "landcover", + "filter": ["==", ["get", "class"], "sand"], + "paint": {"fill-color": "#eee3c3", "fill-antialias": false}, + "metadata": {"olt:dark": {"fill-color": "#2d2a20"}}}, + {"id": "landcover-grass", "type": "fill", "source": "openmaptiles", "source-layer": "landcover", + "filter": ["==", ["get", "class"], "grass"], + "paint": {"fill-color": "#e2e8cc", "fill-opacity": 0.8, "fill-antialias": false}, + "metadata": {"olt:dark": {"fill-color": "#202a21"}}}, + {"id": "landcover-wetland", "type": "fill", "source": "openmaptiles", "source-layer": "landcover", + "filter": ["==", ["get", "class"], "wetland"], + "paint": {"fill-color": "#d6e5dc", "fill-antialias": false}, + "metadata": {"olt:dark": {"fill-color": "#1c2b27"}}}, + {"id": "landcover-wood", "type": "fill", "source": "openmaptiles", "source-layer": "landcover", + "filter": ["==", ["get", "class"], "wood"], + "paint": {"fill-color": "#c6dbb0", "fill-antialias": false, + "fill-opacity": ["interpolate", ["linear"], ["zoom"], 3, 0.5, 8, 0.8, 12, 0.9]}, + "metadata": {"olt:dark": {"fill-color": "#22352a"}}}, + {"id": "landuse-built", "type": "fill", "source": "openmaptiles", "source-layer": "landuse", + "filter": ["match", ["get", "class"], ["residential", "suburb", "neighbourhood", "commercial", "industrial", "retail"], true, false], + "paint": {"fill-color": "#e3ddd1", "fill-antialias": false, + "fill-opacity": ["interpolate", ["linear"], ["zoom"], 5, 0.9, 14, 0.6]}, + "metadata": {"olt:dark": {"fill-color": "#272b27"}}}, + {"id": "park-fill", "type": "fill", "source": "openmaptiles", "source-layer": "park", + "filter": ["match", ["geometry-type"], ["Polygon", "MultiPolygon"], true, false], + "paint": {"fill-color": "#4f8a46", "fill-antialias": false, + "fill-opacity": ["interpolate", ["linear"], ["zoom"], 4, 0.1, 10, 0.04]}, + "metadata": {"olt:dark": {"fill-color": "#8fd08a"}}}, + + {"id": "hillshade", "type": "hillshade", "source": "olt-dem", + "paint": {"hillshade-shadow-color": "#4f535c", "hillshade-highlight-color": "#fffdf4", + "hillshade-accent-color": "#5c5a53", "hillshade-illumination-direction": 315, + "hillshade-exaggeration": ["interpolate", ["linear"], ["zoom"], 3, 0.9, 6, 0.7, 9, 0.5, 12, 0.4, 15, 0.3]}, + "metadata": {"olt:dark": {"hillshade-shadow-color": "#000000", "hillshade-highlight-color": "#5d6b60", + "hillshade-accent-color": "#0b0f0d"}}}, + {"id": "contour-minor", "type": "line", "source": "olt-contours", "source-layer": "contours", + "filter": ["==", ["get", "level"], 0], + "paint": {"line-color": "rgba(135, 96, 58, 0.32)", "line-width": ["interpolate", ["linear"], ["zoom"], 11, 0.5, 15, 0.8]}, + "metadata": {"olt:dark": {"line-color": "rgba(214, 186, 146, 0.24)"}}}, + {"id": "contour-major", "type": "line", "source": "olt-contours", "source-layer": "contours", + "filter": [">", ["get", "level"], 0], + "paint": {"line-color": "rgba(135, 96, 58, 0.55)", "line-width": ["interpolate", ["linear"], ["zoom"], 11, 0.8, 15, 1.3]}, + "metadata": {"olt:dark": {"line-color": "rgba(214, 186, 146, 0.42)"}}}, + {"id": "contour-label", "type": "symbol", "source": "olt-contours", "source-layer": "contours", + "filter": [">", ["get", "level"], 0], + "layout": {"symbol-placement": "line", "symbol-spacing": 420, "text-max-angle": 25, + "text-field": ["concat", ["number-format", ["get", "ele"], {"locale": "en-US"}], " ft"], + "text-font": ["Noto Sans Regular"], "text-size": 10, "text-padding": 4}, + "paint": {"text-color": "#86643f", "text-halo-color": "rgba(242, 239, 230, 0.9)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#b89d77", "text-halo-color": "rgba(26, 33, 28, 0.9)"}, + "olt:km": {"text-field": ["concat", ["number-format", ["get", "ele"], {"locale": "en-US"}], " m"]}}}, + + {"id": "water", "type": "fill", "source": "openmaptiles", "source-layer": "water", + "filter": ["!=", ["get", "brunnel"], "tunnel"], + "paint": {"fill-color": "#a6cbe2"}, + "metadata": {"olt:dark": {"fill-color": "#13293a"}}}, + {"id": "waterway-river", "type": "line", "source": "openmaptiles", "source-layer": "waterway", + "filter": ["all", ["==", ["get", "class"], "river"], ["!=", ["get", "brunnel"], "tunnel"]], + "layout": {"line-cap": "round"}, + "paint": {"line-color": "#78acd3", "line-width": ["interpolate", ["exponential", 1.3], ["zoom"], 8, 0.6, 12, 1.5, 16, 4]}, + "metadata": {"olt:dark": {"line-color": "#2c5877"}}}, + {"id": "waterway-stream", "type": "line", "source": "openmaptiles", "source-layer": "waterway", "minzoom": 11, + "filter": ["all", ["!=", ["get", "class"], "river"], ["!=", ["get", "brunnel"], "tunnel"]], + "layout": {"line-cap": "round"}, + "paint": {"line-color": "#78acd3", "line-width": ["interpolate", ["linear"], ["zoom"], 11, 0.4, 16, 1.5], + "line-opacity": ["case", ["==", ["get", "intermittent"], 1], 0.55, 1]}, + "metadata": {"olt:dark": {"line-color": "#2c5877"}}}, + {"id": "park-outline", "type": "line", "source": "openmaptiles", "source-layer": "park", "minzoom": 7, + "filter": ["match", ["geometry-type"], ["Polygon", "MultiPolygon"], true, false], + "paint": {"line-color": "#6f9a5c", "line-opacity": 0.7, "line-dasharray": [3, 2], + "line-width": ["interpolate", ["linear"], ["zoom"], 7, 0.6, 12, 1.2]}, + "metadata": {"olt:dark": {"line-color": "#5e8a55"}}}, + {"id": "building", "type": "fill", "source": "openmaptiles", "source-layer": "building", "minzoom": 14, + "paint": {"fill-color": "#dcd5c8"}, + "metadata": {"olt:dark": {"fill-color": "#2c312d"}}}, + + {"id": "road-casing", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 10, + "filter": ["match", ["get", "class"], ["motorway", "trunk", "primary", "secondary", "tertiary"], true, false], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": {"line-color": "#c6baa5", "line-width": ["interpolate", ["exponential", 1.2], ["zoom"], 10, 1.8, 12, 3.6, 16, 11]}, + "metadata": {"olt:dark": {"line-color": "#0f1411"}}}, + {"id": "road-minor-casing", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 12, + "filter": ["match", ["get", "class"], ["minor", "service"], true, false], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": {"line-color": "#d3cbbc", "line-width": ["interpolate", ["exponential", 1.2], ["zoom"], 12, 1.2, 16, 7]}, + "metadata": {"olt:dark": {"line-color": "#0f1411"}}}, + {"id": "road-track", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 11, + "filter": ["==", ["get", "class"], "track"], + "paint": {"line-color": "#8b7a62", "line-dasharray": [3, 2], "line-width": ["interpolate", ["linear"], ["zoom"], 11, 0.6, 16, 1.6]}, + "metadata": {"olt:dark": {"line-color": "#988b75"}}}, + {"id": "road-path", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 12, + "filter": ["==", ["get", "class"], "path"], + "paint": {"line-color": "#695d4f", "line-dasharray": [2, 2], "line-width": ["interpolate", ["linear"], ["zoom"], 12, 0.6, 16, 1.4]}, + "metadata": {"olt:dark": {"line-color": "#b1a690"}}}, + {"id": "road-minor", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 12, + "filter": ["match", ["get", "class"], ["minor", "service"], true, false], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": {"line-color": "#ffffff", "line-width": ["interpolate", ["exponential", 1.2], ["zoom"], 12, 0.6, 16, 5]}, + "metadata": {"olt:dark": {"line-color": "#3c433e"}}}, + {"id": "road-secondary", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 9, + "filter": ["match", ["get", "class"], ["secondary", "tertiary"], true, false], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": {"line-color": "#ffffff", "line-width": ["interpolate", ["exponential", 1.2], ["zoom"], 9, 0.5, 12, 2, 16, 9]}, + "metadata": {"olt:dark": {"line-color": "#4a514b"}}}, + {"id": "road-primary", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 7, + "filter": ["match", ["get", "class"], ["primary", "trunk"], true, false], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": {"line-color": "#f2dfb0", "line-width": ["interpolate", ["exponential", 1.2], ["zoom"], 7, 0.5, 12, 2.5, 16, 10], + "line-opacity": ["interpolate", ["linear"], ["zoom"], 7, 0.6, 9, 1]}, + "metadata": {"olt:dark": {"line-color": "#5b5747"}}}, + {"id": "road-motorway", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 5, + "filter": ["==", ["get", "class"], "motorway"], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": {"line-color": "#e8c49a", "line-width": ["interpolate", ["exponential", 1.2], ["zoom"], 5, 0.5, 8, 1.2, 12, 3, 16, 12], + "line-opacity": ["interpolate", ["linear"], ["zoom"], 5, 0.5, 8, 1]}, + "metadata": {"olt:dark": {"line-color": "#6b5c43"}}}, + {"id": "rail", "type": "line", "source": "openmaptiles", "source-layer": "transportation", "minzoom": 9, + "filter": ["==", ["get", "class"], "rail"], + "paint": {"line-color": "#a29e96", "line-width": ["interpolate", ["linear"], ["zoom"], 9, 0.6, 16, 1.4]}, + "metadata": {"olt:dark": {"line-color": "#5b605b"}}}, + {"id": "boundary-state", "type": "line", "source": "openmaptiles", "source-layer": "boundary", "minzoom": 3, + "filter": ["all", ["==", ["get", "admin_level"], 4], ["!=", ["get", "maritime"], 1]], + "paint": {"line-color": "#9a8ea2", "line-dasharray": [4, 2], "line-width": ["interpolate", ["linear"], ["zoom"], 4, 0.6, 10, 1.2]}, + "metadata": {"olt:dark": {"line-color": "#7a7389"}}}, + {"id": "boundary-country", "type": "line", "source": "openmaptiles", "source-layer": "boundary", + "filter": ["all", ["==", ["get", "admin_level"], 2], ["!=", ["get", "maritime"], 1], ["!=", ["get", "disputed"], 1]], + "layout": {"line-join": "round"}, + "paint": {"line-color": "#83788b", "line-width": ["interpolate", ["linear"], ["zoom"], 3, 0.8, 10, 2]}, + "metadata": {"olt:dark": {"line-color": "#8f869c"}}}, + + {"id": "waterway-label", "type": "symbol", "source": "openmaptiles", "source-layer": "waterway", "minzoom": 12, + "filter": ["match", ["geometry-type"], ["LineString", "MultiLineString"], true, false], + "layout": {"symbol-placement": "line", "symbol-spacing": 400, "text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], + "text-font": ["Noto Sans Italic"], "text-size": 11, "text-letter-spacing": 0.05}, + "paint": {"text-color": "#36678d", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#86b5d6", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "water-label", "type": "symbol", "source": "openmaptiles", "source-layer": "water_name", + "filter": ["match", ["geometry-type"], ["Point", "MultiPoint"], true, false], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Italic"], + "text-size": ["interpolate", ["linear"], ["zoom"], 5, 10, 12, 12], "text-max-width": 7, "text-letter-spacing": 0.05}, + "paint": {"text-color": "#36678d", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#86b5d6", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "park-label", "type": "symbol", "source": "openmaptiles", "source-layer": "park", "minzoom": 8, + "filter": ["all", ["match", ["geometry-type"], ["Point", "MultiPoint"], true, false], ["has", "name"]], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Italic"], + "text-size": 11, "text-max-width": 8, "text-padding": 8, "symbol-sort-key": ["coalesce", ["get", "rank"], 99]}, + "paint": {"text-color": "#3d6a37", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#94c58d", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "road-label", "type": "symbol", "source": "openmaptiles", "source-layer": "transportation_name", "minzoom": 12, + "filter": ["match", ["get", "class"], ["motorway", "trunk", "primary", "secondary", "tertiary"], true, false], + "layout": {"symbol-placement": "line", "text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], + "text-font": ["Noto Sans Regular"], "text-size": 10.5}, + "paint": {"text-color": "#5c574d", "text-halo-color": "rgba(255, 255, 255, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#aaa392", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "path-label", "type": "symbol", "source": "openmaptiles", "source-layer": "transportation_name", "minzoom": 14, + "filter": ["match", ["get", "class"], ["path", "track"], true, false], + "layout": {"symbol-placement": "line", "text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], + "text-font": ["Noto Sans Italic"], "text-size": 10}, + "paint": {"text-color": "#695d4f", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#b1a690", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "poi-outdoor", "type": "symbol", "source": "openmaptiles", "source-layer": "poi", "minzoom": 13, + "filter": ["match", ["get", "subclass"], ["camp_site", "alpine_hut", "wilderness_hut", "shelter"], true, false], + "layout": {"icon-image": ["match", ["get", "subclass"], "camp_site", "campsite_11", "shelter", "shelter_11", "lodging_11"], + "text-field": ["step", ["zoom"], "", 14, ["coalesce", ["get", "name_en"], ["get", "name"], ""]], + "text-font": ["Noto Sans Regular"], "text-size": 10, "text-anchor": "top", "text-offset": [0, 0.8], + "text-max-width": 8, "text-optional": true}, + "paint": {"text-color": "#5a4a3a", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#cdc2ab", "text-halo-color": "rgba(26, 33, 28, 0.85)", "icon-opacity": 0.85}}}, + {"id": "peak", "type": "symbol", "source": "openmaptiles", "source-layer": "mountain_peak", "minzoom": 9, + "filter": ["all", ["match", ["get", "class"], ["peak", "volcano"], true, false], ["has", "name"]], + "layout": {"text-field": ["format", "▲", {"font-scale": 0.85}, "\n", {}, ["coalesce", ["get", "name_en"], ["get", "name"]], {}, + ["case", ["has", "ele_ft"], ["concat", "\n", ["number-format", ["get", "ele_ft"], {"locale": "en-US"}], " ft"], ""], {"font-scale": 0.85}], + "text-font": ["Noto Sans Regular"], "text-size": 11, "text-anchor": "top", "text-offset": [0, -0.55], + "text-line-height": 1.15, "text-max-width": 8, "text-padding": 6, + "symbol-sort-key": ["-", 0, ["coalesce", ["get", "ele"], 0]]}, + "paint": {"text-color": "#4a3a29", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#ddd0b5", "text-halo-color": "rgba(26, 33, 28, 0.85)"}, + "olt:km": {"text-field": ["format", "▲", {"font-scale": 0.85}, "\n", {}, ["coalesce", ["get", "name_en"], ["get", "name"]], {}, + ["case", ["has", "ele"], ["concat", "\n", ["number-format", ["get", "ele"], {"locale": "en-US"}], " m"], ""], {"font-scale": 0.85}]}}}, + {"id": "place-hamlet", "type": "symbol", "source": "openmaptiles", "source-layer": "place", "minzoom": 12, + "filter": ["match", ["get", "class"], ["hamlet", "locality", "isolated_dwelling"], true, false], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Regular"], + "text-size": 10, "text-max-width": 8}, + "paint": {"text-color": "#4f5650", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#b4ad9b", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "place-village", "type": "symbol", "source": "openmaptiles", "source-layer": "place", "minzoom": 10, + "filter": ["==", ["get", "class"], "village"], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Regular"], + "text-size": ["interpolate", ["linear"], ["zoom"], 10, 10.5, 14, 12], "text-max-width": 8}, + "paint": {"text-color": "#343a35", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#cfc8b6", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "place-town", "type": "symbol", "source": "openmaptiles", "source-layer": "place", "minzoom": 7, + "filter": ["==", ["get", "class"], "town"], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Regular"], + "text-size": ["interpolate", ["linear"], ["zoom"], 7, 10.5, 12, 13], "text-max-width": 8}, + "paint": {"text-color": "#2c322d", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#ddd6c4", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "place-city", "type": "symbol", "source": "openmaptiles", "source-layer": "place", "minzoom": 4, + "filter": ["==", ["get", "class"], "city"], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Regular"], + "text-size": ["interpolate", ["linear"], ["zoom"], 4, 11, 10, 15], "text-max-width": 8, + "symbol-sort-key": ["coalesce", ["get", "rank"], 99]}, + "paint": {"text-color": "#232824", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.4}, + "metadata": {"olt:dark": {"text-color": "#e6dfcd", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "place-state", "type": "symbol", "source": "openmaptiles", "source-layer": "place", "minzoom": 4, "maxzoom": 8, + "filter": ["==", ["get", "class"], "state"], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Italic"], + "text-size": ["interpolate", ["linear"], ["zoom"], 4, 10, 8, 12], "text-transform": "uppercase", + "text-letter-spacing": 0.15, "text-max-width": 9}, + "paint": {"text-color": "#776f7e", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#9c94a8", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}}, + {"id": "place-country", "type": "symbol", "source": "openmaptiles", "source-layer": "place", "maxzoom": 7, + "filter": ["==", ["get", "class"], "country"], + "layout": {"text-field": ["coalesce", ["get", "name_en"], ["get", "name"]], "text-font": ["Noto Sans Bold"], + "text-size": ["interpolate", ["linear"], ["zoom"], 2, 10, 6, 13], "text-max-width": 7}, + "paint": {"text-color": "#5b5462", "text-halo-color": "rgba(242, 239, 230, 0.85)", "text-halo-width": 1.2}, + "metadata": {"olt:dark": {"text-color": "#b0a8bb", "text-halo-color": "rgba(26, 33, 28, 0.85)"}}} + ] +} diff --git a/web/assets/prefs.js b/web/assets/prefs.js index fff99cc..d24adef 100644 --- a/web/assets/prefs.js +++ b/web/assets/prefs.js @@ -1,5 +1,6 @@ /* Runs in
, before first paint: marks that JavaScript runs, and applies the - reader's saved theme and length order. Saved by app.js (footer switches). */ + reader's saved theme, length order and base map. Saved by app.js (the footer + switches, and the Outdoor / Plain switch on a trail map). */ (function () { 'use strict'; var root = document.documentElement; @@ -7,7 +8,9 @@ try { var theme = localStorage.getItem('lh-theme'); var units = localStorage.getItem('lh-units'); + var basemap = localStorage.getItem('lh-basemap'); if (theme === 'light' || theme === 'dark') root.dataset.theme = theme; if (units === 'km') root.dataset.units = 'km'; /* anything else, an old 'mi' included, is miles */ + if (basemap === 'plain') root.dataset.basemap = 'plain'; /* anything else is the outdoor map */ } catch (e) { /* storage blocked: defaults apply */ } })(); diff --git a/web/assets/style.css b/web/assets/style.css index f3fc56d..c60f8de 100644 --- a/web/assets/style.css +++ b/web/assets/style.css @@ -704,6 +704,22 @@ body:has(.hero--home) .site-header .wordmark { visibility: hidden; } :root:not([data-theme="light"]) .maplibregl-ctrl-icon, :root:not([data-theme="light"]) .maplibregl-ctrl-attrib-button { filter: invert(1); } } +/* The Outdoor / Plain switch of a trail map (app.js basemapControl): two toggle + buttons side by side, top left, the pressed one in ink like a .seg choice. */ +.maplibregl-ctrl-group.basemap-switch { display: flex; } +.maplibregl-ctrl-group.basemap-switch button { + inline-size: auto; block-size: auto; width: auto; height: auto; + min-block-size: 29px; + padding: 0 var(--space-2); + color: var(--ink-2); + font: 500 0.75rem/1 var(--font-sans); +} +.maplibregl-ctrl-group.basemap-switch button + button { border-block-start: 0; border-inline-start: 1px solid var(--rule); } +.maplibregl-ctrl-group.basemap-switch button[aria-pressed="true"]:not(:disabled) { background: var(--ink); color: var(--paper); font-weight: 600; } +.maplibregl-ctrl-group.basemap-switch button[aria-pressed="true"]:focus-visible { outline-color: var(--paper); } +@media (pointer: coarse) { + .maplibregl-ctrl-group.basemap-switch button { min-block-size: 2.75rem; padding: 0 var(--space-3); } +} .maplibregl-ctrl-scale { background: color-mix(in srgb, var(--surface) 88%, transparent) !important; border-color: var(--ink) !important; diff --git a/web/assets/vendor/README.md b/web/assets/vendor/README.md index 57a1904..35aee97 100644 --- a/web/assets/vendor/README.md +++ b/web/assets/vendor/README.md @@ -1,7 +1,8 @@ # Third-party assets Served from `/assets/`, so pages make no requests to CDNs or font services at -runtime. Map tiles, glyphs and sprites still come from OpenFreeMap. +runtime. Map tiles, glyphs and sprites still come from OpenFreeMap, and the +trail maps' elevation tiles from Terrain Tiles on AWS. ## MapLibre GL JS @@ -25,6 +26,44 @@ To upgrade: download `dist/maplibre-gl.js`, `dist/maplibre-gl.css` and `LICENSE.txt` of the new version into `maplibre-gl/`, update this file, and check that the trail maps still draw. +## maplibre-contour + +| File | Package | Version | Licence | +| --- | --- | --- | --- | +| `maplibre-contour/maplibre-contour.js` | maplibre-contour | 0.1.1 | BSD-3-Clause (with code from d3-contour, ISC, and vt-pbf, MIT), `maplibre-contour/LICENSE.txt` | + +Draws the contour lines of the trail pages' outdoor map in the browser, from +the same elevation tiles as the relief. `maplibre-contour.js` is the package's +`dist/index.min.js` and `LICENSE.txt` its `LICENSE`, unchanged, from the npm +tarball `https://registry.npmjs.org/maplibre-contour/-/maplibre-contour-0.1.1.tgz` +(SHA-1 `d8aa3e3b62c8d097fc4eacb3d849635a0b662ede`, as the registry lists it), +downloaded 2026-11-15; unpkg serves the same bytes. SHA-256: + +```text +055e45d0a76aaeaaf5a96765b8ce524abba3272456be75e715081e235ebd1262 maplibre-contour.js +b4a3261f4af65db24e6a2ca23093ac25619e6fe0b5ca5ec75fb09a49817b5c8d LICENSE.txt +``` + +It defines `window.mlcontour`. Only trail pages load it (deferred, after +MapLibre; `olt/layout.py` `outdoor=True`), and `app.js` draws the map without +contours when it is missing. It runs its work in a worker made from a `blob:` +URL (`worker-src blob:`) and fetches the elevation tiles there with `fetch()` +(`connect-src` names the tiles' path). No `eval`, no source map. + +To upgrade: put `dist/index.min.js` of the new version here as +`maplibre-contour.js`, with its `LICENSE`, update this file, and check the +contours and the relief on a trail page in Firefox and in Chromium. + +## Outdoor map style (`../map/`) + +`outdoor.json` is this site's own style for the trail pages' outdoor map, +derived from OpenFreeMap's Liberty style (MIT), a fork of OSM Liberty and OSM +Bright (BSD-3-Clause code, CC BY 4.0 design). `LICENSE.txt` beside it keeps +their notices; the design credit, "© OpenMapTiles", is in the corner of every +map. The style keeps OpenFreeMap's tiles, glyphs and sprites. Its elevation +source is Terrain Tiles on AWS, the data `tools/elevation.py` uses, credited +under every trail map (`olt/common.py` `TRAIL_MAP_CREDIT`). + ## Web fonts (`../fonts/`) Latin subset only, as served by Google Fonts on 2026-11-10. Characters outside diff --git a/web/assets/vendor/maplibre-contour/LICENSE.txt b/web/assets/vendor/maplibre-contour/LICENSE.txt new file mode 100644 index 0000000..014eea4 --- /dev/null +++ b/web/assets/vendor/maplibre-contour/LICENSE.txt @@ -0,0 +1,72 @@ +BSD 3-Clause License + +Copyright (c) 2023, Michael Barry and maplibre-contour contributors + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- + +Contains code from d3-contour https://github.com/d3/d3-contour + +Copyright 2012-2023 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +--- + +Contains code from vt-pbf https://github.com/mapbox/vt-pbf + +The MIT License (MIT) + +Copyright (c) 2015 Anand Thakker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/web/assets/vendor/maplibre-contour/maplibre-contour.js b/web/assets/vendor/maplibre-contour/maplibre-contour.js new file mode 100644 index 0000000..948099c --- /dev/null +++ b/web/assets/vendor/maplibre-contour/maplibre-contour.js @@ -0,0 +1,15 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).mlcontour=e()}(this,(function(){"use strict";var t,e,i;function r(r,s){if(t)if(e){var n="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),i=s(o),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([n],{type:"text/javascript"})))}else e=s;else t=s}return r(0,(function(t){class e{constructor(t,e){this.start=t,this.end=e,this.points=[],this.append=this.append.bind(this),this.prepend=this.prepend.bind(this)}append(t,e){this.points.push(Math.round(t),Math.round(e))}prepend(t,e){this.points.splice(0,0,Math.round(t),Math.round(e))}lineString(){return this.toArray()}isEmpty(){return this.points.length<2}appendFragment(t){this.points.push(...t.points),this.end=t.end}toArray(){return this.points}}const i=[[],[[[1,2],[0,1]]],[[[2,1],[1,2]]],[[[2,1],[0,1]]],[[[1,0],[2,1]]],[[[1,2],[0,1]],[[1,0],[2,1]]],[[[1,0],[1,2]]],[[[1,0],[0,1]]],[[[0,1],[1,0]]],[[[1,2],[1,0]]],[[[0,1],[1,0]],[[2,1],[1,2]]],[[[2,1],[1,0]]],[[[0,1],[2,1]]],[[[1,2],[2,1]]],[[[0,1],[1,2]]],[]];function r(t,e,i,r){return(e=2*e+r[0])+(i=2*i+r[1])*(t+1)*2}function s(t,e,i){return(e-t)/(i-t)}function n(t,n,o=4096,a=1){if(!t)return{};const h=o/(n.width-1);let l,c,d,u,f,p;const w={},g=new Map,m=new Map;function b(t,e,i){0===t[0]?i(h*(p-1),h*(f-s(d,e,l))):2===t[0]?i(h*p,h*(f-s(u,e,c))):0===t[1]?i(h*(p-s(c,e,l)),h*(f-1)):i(h*(p-s(u,e,d)),h*f)}for(f=1-a;fTrack: {esc(src.get("line_source", ""))}, read {esc(src.get("source_checked", ""))}, drawn simplified to 30 m. Credit: {esc(credit)} Base map: OpenFreeMap, © OpenMapTiles, data © OpenStreetMap contributors.
+Track: {esc(src.get("line_source", ""))}, read {esc(src.get("source_checked", ""))}, drawn simplified to 30 m. Credit: {esc(credit)} {common.TRAIL_MAP_CREDIT}
{reason_html}
{esc(rule)}
{actions_html} -Base map: OpenFreeMap, © OpenMapTiles, data © OpenStreetMap contributors.
+{common.TRAIL_MAP_CREDIT}