This repository was archived by the owner on Jun 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·68 lines (54 loc) · 1.77 KB
/
update.sh
File metadata and controls
executable file
·68 lines (54 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -e #exit on failure
maplibreVersion=3.0.1
jsCookieVersion=3.0.1
geocoderVersion=master
vectorTextProtocolVersion=master
maplibreUrl=https://github.com/maplibre/maplibre-gl-js/releases/download/v$maplibreVersion/dist.zip
jsCookieUrl=https://github.com/js-cookie/js-cookie/releases/download/v$jsCookieVersion/js.cookie.min.js
geocoderUrl=https://github.com/Joxit/pelias-mapbox-gl-js/archive/refs/heads/$geocoderVersion.zip
vectorTextProtocolUrl=https://github.com/jimmyrocks/maplibre-gl-vector-text-protocol/archive/refs/heads/$vectorTextProtocolVersion.zip
base='https://tileserver.cyclemap.us/styles/maptiler-cyclemap'
curl --output style.json "$base/style.json"
sed --in-place --expression="s#$base#https://cyclemap.us/sprite#g" style.json
cp style.json style-normal.json
sed --expression='s/hsl(25, 60%, 45%)/red/2' style.json >style-red.json
sed \
--expression='s/hsl(120, 60%, 30%)/hsl(0, 0%, 100%)/g' \
--expression='s/hsl(25, 60%, 45%)/hsl(0, 0%, 100%)/1' \
--expression='s/"line-color":"hsl(0, 0%, \(95\|97\|100\)%)"/&,"line-opacity":0.2/g' \
--expression='s/"line-color":"hsl(25, 60%, 45%)","line-width":{[^{}]*}/"line-color":"red","line-width":{"base":1.1,"stops":[[9,4],[18,6]]}/' \
style.json >style-highlight.json
mkdir --parents sprite
for filename in sprite{,@2x}.{png,json}; do
curl --output sprite/$filename "$base/$filename"
done
curl \
--location \
--silent \
"$maplibreUrl" |
bsdtar \
--extract \
--strip-components 1 \
--file -
curl --output js.cookie.min.js \
--location \
"$jsCookieUrl"
curl \
--location \
--silent \
"$geocoderUrl" |
bsdtar \
--extract \
--strip-components 1 \
--file - \
'*geocoder*'
curl \
--location \
--silent \
"$vectorTextProtocolUrl" |
bsdtar \
--extract \
--strip-components 2 \
--file - \
'*/dist/*.min.js'