@map-jr/styles 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -2
- package/NOTICE.md +6 -2
- package/README.md +188 -55
- package/dist/maplibre/elevation-radar.min.json +1 -1
- package/dist/maplibre/elevation-zero.min.json +1 -1
- package/dist/maplibre/elevation.min.json +1 -1
- package/dist/styles/elevation-radar.min.json +1 -1
- package/dist/styles/elevation-zero.min.json +1 -1
- package/dist/styles/elevation.min.json +1 -1
- package/dist/styles/openfreemap-bright.min.json +1 -1
- package/dist/styles/openfreemap-dark.min.json +1 -1
- package/dist/styles/openfreemap-fiord.min.json +1 -1
- package/dist/styles/openfreemap-liberty.min.json +1 -1
- package/dist/styles/openfreemap-positron.min.json +1 -1
- package/icons/pinhead/LICENSE +121 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,83 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
Each version has one entry. The styles are served at `https://styles.map-jr.org/<major>/`, so a version that breaks a
|
|
4
|
-
map increases the first number, and its entry starts with a section "Breaking changes".
|
|
5
|
-
increases the second number
|
|
4
|
+
map increases the first number, and its entry starts with a section "Breaking changes". A version that adds to a
|
|
5
|
+
map increases the second number, and a fix increases the third. See [Release](README.md#release).
|
|
6
|
+
|
|
7
|
+
## 1.3.0 (2026-12-01)
|
|
8
|
+
|
|
9
|
+
- Road shields are drawn again. A shield no longer stretches around its number: each shape is drawn for each number
|
|
10
|
+
of characters (`shield_us_interstate_2`, `shield_us_interstate_3`), and the number is set in the middle of it, so
|
|
11
|
+
the number of an Interstate or US Highway shield sits where it belongs and a number of 3 characters has a wider
|
|
12
|
+
shield. The Interstate shield has a larger crown and a full blue field, and the US Highway shield has the outline of
|
|
13
|
+
the sign: three points along the top, a slanted edge to each shoulder, and a waist under it. Each shield has a
|
|
14
|
+
slight gradient, and a thin shade around a white outline, which keeps it visible on the light map.
|
|
15
|
+
- A sign keeps its colors in the dark scheme: a US Highway shield, a US state route and each other black number on a
|
|
16
|
+
white sign are white in dark too. Only the neutral plate of a network that is not listed follows the scheme, and in
|
|
17
|
+
light it has a grey outline in place of a black one.
|
|
18
|
+
- More road networks have the colors of their signs: 700, and 120 variants of them, in place of 207. A network that
|
|
19
|
+
OSM Americana draws from artwork has a plate in the colors of the artwork: the New Jersey Turnpike is white on
|
|
20
|
+
green, the Garden State Parkway yellow on green, a California route white on green, a Minnesota route white on blue
|
|
21
|
+
with a yellow outline, a Kansas route black on yellow. A network below a country or a state is kept when its sign
|
|
22
|
+
has colors of its own: the turnpikes, parkways and toll roads of the United States (`US:NJ:NJTP`,
|
|
23
|
+
`US:PA:Turnpike`, `US:TX:NTTA`), the departmental roads of France (`FR:77:D-road`), the expressways of China, the
|
|
24
|
+
prefectural roads of Japan. A variant of a network (`US:US:Truck`, `US:I:Express`, `US:CA:Business`) has the shield
|
|
25
|
+
of its network in place of the neutral plate. The county roads of the United States keep the neutral plate.
|
|
26
|
+
- Road shields have the artwork of OSM Americana, for 229 networks that it draws from artwork and their variants:
|
|
27
|
+
the spade of a California route, the keystone of Pennsylvania, the maple leaf of the Trans-Canada Highway, the logo
|
|
28
|
+
of the New Jersey Turnpike. The artwork is not in the style: each file is an image of the style by its URL
|
|
29
|
+
(`https://styles.map-jr.org/1/shields/<name>.svg`, 196 files), which the map requests when a road in view has its
|
|
30
|
+
network. The image is the artwork, with the plate of the network after it in a `coalesce`, until the artwork has
|
|
31
|
+
loaded and when it does not load. This needs a Map Jr. GL with the fix of
|
|
32
|
+
[map-jr/map-jr-gl#2827](https://github.com/map-jr/map-jr-gl/issues/2827): Map Jr. GL to 0.11.0 draws the plates, as
|
|
33
|
+
before, and the 33 logos that have no number. The MapLibre styles have the plates.
|
|
34
|
+
- POI icons are badges: a white glyph on a disc in the color of its category (food, shops, leisure, lodging, outdoors,
|
|
35
|
+
health, education, worship, services, transport), with a gradient and a darker rim, the same in light and dark.
|
|
36
|
+
Public transport has a rounded square, and a metro station a rounded square with a white disc cut in it, the train
|
|
37
|
+
in the disc. The icon of an airport label is the badge too. A badge is 19 pixels, with a glyph of 13. See [POI icons](README.md#how-it-is-made).
|
|
38
|
+
- Elevation and Elevation · zero: a POI icon is chosen by the class and the subclass of the POI (`styles/poi.mjs`),
|
|
39
|
+
and most glyphs are from [Pinhead](https://pinhead.ink) (CC0). A clinic has the icon of a doctor and not the hospital
|
|
40
|
+
cross, a bookshop is not a library, a charging station is not a fuel pump, a metro station and a tram stop are not
|
|
41
|
+
main-line stations, a nightclub is not a bar, a viewpoint, an embassy, a courthouse and an artwork have icons of
|
|
42
|
+
their own, and a Christian, Muslim, Jewish or Hindu place of worship has its symbol. Shops have icons by kind:
|
|
43
|
+
convenience, marketplace, mall, beauty, jewelry, optician, electronics, furniture, hardware, florist, gifts,
|
|
44
|
+
alcohol, pets, outdoor gear, sweets. The sports have one icon, but golf, swimming and skiing. A theme park has an
|
|
45
|
+
icon, where it had none.
|
|
46
|
+
- Elevation and Elevation · zero: no label for generic offices (an embassy and a government office keep theirs), post
|
|
47
|
+
boxes, parcel lockers, telephones, waste baskets, recycling points, games (chess, billiards, escape rooms),
|
|
48
|
+
dormitories, nursing homes, drinking water, shelters, brownfields, basins and zoo enclosures. Bus stops and stations
|
|
49
|
+
are no longer drawn at zoom 14 by the POI layers: the transit layers draw them, stations from zoom 12 and stops from
|
|
50
|
+
15.
|
|
51
|
+
- The peaks of rank 2 and of rank 3 and more are drawn: their layers compared the class of the peak with a number,
|
|
52
|
+
and drew nothing. A volcano has an icon of its own, in Elevation and in Elevation · radar. A mountain pass is no
|
|
53
|
+
longer drawn as a peak: it has the sign of a pass and the plain grey label of a minor peak, with its elevation, from
|
|
54
|
+
zoom 9, in a layer of its own (`poi_peak_pass`) below the peaks.
|
|
55
|
+
- Elevation · radar draws the peaks as Elevation does: each with the triangle, and the peaks of rank 2 from zoom 9
|
|
56
|
+
and of rank 3 from zoom 11 (they had the mountain icon, from zoom 4 and 10).
|
|
57
|
+
- Elevation: the global state `relief` (`true` by default) switches off the hillshade and the labels of peaks, as in
|
|
58
|
+
Elevation · radar. With `relief` false and `terrain: null`, a map of Elevation is Elevation · zero and loads no
|
|
59
|
+
elevation tiles.
|
|
60
|
+
- Elevation and Elevation · zero: the shaded relief of Natural Earth is brighter in dark (`raster-brightness-max` 0.7)
|
|
61
|
+
and has no `raster-saturation` and no `raster-brightness-min`; the ice of the land cover has its light color in
|
|
62
|
+
dark too; the dashed outline of parks is gone (the layer `park_outline` is removed).
|
|
63
|
+
- Elevation · radar: the water is `#d8dae2` in light and `#333e49` in dark.
|
|
64
|
+
- MapLibre styles: the sprite has 307 images, in 28 KB at 1x and 65 KB at 2x, where 1.2.1 had 293 images in 63 KB and
|
|
65
|
+
154 KB. A badge and a sign have one image for both color schemes, and the PNG files have a palette of 256 colors:
|
|
66
|
+
a gradient has a few steps less, and the plain colors are exact.
|
|
67
|
+
- Size: Elevation is 32 KB with gzip, where 1.2.1 was 27 KB, with the artwork, 700 networks in place of 207, and the
|
|
68
|
+
badges. The shield layer names a network once in an expression, with the same lists in each expression; a badge is
|
|
69
|
+
written short, and the paths of its glyph have one decimal; the SVG images have single quotes, which are one
|
|
70
|
+
character in JSON. The OpenFreeMap styles draw the same.
|
|
71
|
+
|
|
72
|
+
## 1.2.1 (2026-11-25)
|
|
73
|
+
|
|
74
|
+
- `https://styles.map-jr.org/data/natural-earth-5.1.2.pmtiles`: a PMTiles archive of the countries and the states and
|
|
75
|
+
provinces of Natural Earth 5.1.2 (public domain), for the PMTiles example of map-jr-gl. Its name has the version of
|
|
76
|
+
the data, and each upload from `main` or a release writes it.
|
|
77
|
+
- Elevation and Elevation · zero load the shaded relief of Natural Earth from OpenFreeMap as WebP
|
|
78
|
+
(`ne2sr/{z}/{x}/{y}.webp`) in place of PNG: the same 512-pixel tiles, with exactly the same pixels (the PNG tiles of
|
|
79
|
+
OpenFreeMap are its WebP tiles decoded), at about a sixteenth of the bytes. The source, layer and paint are the
|
|
80
|
+
same.
|
|
6
81
|
|
|
7
82
|
## 1.2.0 (2026-11-19)
|
|
8
83
|
|
package/NOTICE.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# Third-party material
|
|
2
2
|
|
|
3
3
|
The MIT licence in `LICENSE` covers what is written for this repository: the build (`build.mjs`, `lib/`, `scripts/`,
|
|
4
|
-
`test/`), the style modules (`styles/*.mjs`) and the shield templates (`shields
|
|
4
|
+
`test/`), the style modules (`styles/*.mjs`) and the shield templates (`shields/shapes.mjs`, `shields/shields.mjs`).
|
|
5
5
|
The material below comes from other projects and keeps its own terms. `dist/` is built from both.
|
|
6
6
|
|
|
7
7
|
| Material | From | Terms |
|
|
8
8
|
|---|---|---|
|
|
9
9
|
| `icons/upstream/*.svg` | [openfreemap-styles](https://github.com/hyperknot/openfreemap-styles), the liberty and bright icon sets | `icons/upstream/LICENSE-liberty.md`, `icons/upstream/LICENSE-bright.md` |
|
|
10
10
|
| `icons/extra/*.svg` | Glyphs of [Maki](https://github.com/mapbox/maki), on the disc of the sprite icons | CC0 1.0: `icons/extra/LICENSE-maki.txt` |
|
|
11
|
+
| `icons/pinhead/*.svg` | Icons of [Pinhead](https://pinhead.ink) by Wayside Mapping, at the version in `icons/pinhead/VERSION` | CC0 1.0: `icons/pinhead/LICENSE` |
|
|
11
12
|
| `styles/src/openfreemap/*.json` | [openfreemap-styles](https://github.com/hyperknot/openfreemap-styles), at the commit in `styles/src/openfreemap/COMMIT` | BSD 3-Clause for the style code and CC-BY 4.0 for the design: `styles/src/openfreemap/LICENSE*.md` |
|
|
12
13
|
| `styles/src/elevation.json` | Based on [OSM Liberty](https://github.com/maputnik/osm-liberty), with the tiles and the sprite of OpenFreeMap | BSD 3-Clause for the style code and CC-BY 4.0 for the design, as `styles/src/openfreemap/LICENSE-liberty.md` |
|
|
13
14
|
| `styles/src/elevation-radar.json` | Based on a style of the OpenMapTiles family; the closest is [MapTiler Basic](https://github.com/openmaptiles/maptiler-basic-gl-style) | BSD 3-Clause for the style code and CC-BY 4.0 for the design |
|
|
14
|
-
| `
|
|
15
|
+
| `data/natural-earth-5.1.2.pmtiles` | Countries and states and provinces at 1:50m of [Natural Earth](https://www.naturalearthdata.com/) 5.1.2, made into vector tiles (zoom 0 to 6) by `scripts/natural-earth-pmtiles.mjs` of [map-jr-gl](https://github.com/map-jr/map-jr-gl) | Public domain |
|
|
16
|
+
| The outline of the US Route shield in `shields/shapes.mjs` | The proportions of [US_blank.svg](https://commons.wikimedia.org/wiki/File:US_blank.svg) of Wikimedia Commons, a drawing of the sign of the MUTCD | Public domain |
|
|
17
|
+
| `shields/artwork/*.svg` | The shield artwork of [OSM Americana](https://github.com/osm-americana/openstreetmap-americana) (its folder `icons/`), made small, some of it in other colors. Some of it depicts logos or insignia that may be subject to trademark restrictions when used outside the context of a map, as Americana says | CC0 1.0 |
|
|
18
|
+
| `shields/networks.json` | Made from the shield definitions of [OSM Americana](https://github.com/osm-americana/openstreetmap-americana) (`https://americanamap.org/shields.json`), and from the colors of its shield artwork (`https://americanamap.org/sprites/`) | CC0 1.0 |
|
|
15
19
|
|
|
16
20
|
Map data shown with the styles: OpenFreeMap, © OpenMapTiles, data from OpenStreetMap; terrain © Mapterhorn.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# map-jr-styles
|
|
2
2
|
|
|
3
|
-
Map styles for [
|
|
3
|
+
Map styles for [Map Jr. GL](https://github.com/map-jr/map-jr-gl) that carry their own icons and road shields as SVG
|
|
4
4
|
templates, in place of a sprite sheet, and versions of the elevation styles for
|
|
5
5
|
[MapLibre GL JS](https://maplibre.org/maplibre-gl-js/). Each elevation style has a light and a dark branch, chosen by
|
|
6
6
|
the global state property `color-scheme`.
|
|
@@ -9,11 +9,11 @@ the global state property `color-scheme`.
|
|
|
9
9
|
|
|
10
10
|
Pass a link as the `style` of the map. Each one is the latest release of version 1.
|
|
11
11
|
|
|
12
|
-
| Style |
|
|
12
|
+
| Style | Map Jr. GL | MapLibre GL JS 5.16+ | What it is |
|
|
13
13
|
|---|---|---|---|
|
|
14
|
-
| Elevation | [elevation.json](https://styles.map-jr.org/1/elevation.json) | [maplibre/elevation.json](https://styles.map-jr.org/1/maplibre/elevation.json) | A full-color terrain map. Dark is the same map under bright moonlight. |
|
|
14
|
+
| Elevation | [elevation.json](https://styles.map-jr.org/1/elevation.json) | [maplibre/elevation.json](https://styles.map-jr.org/1/maplibre/elevation.json) | A full-color terrain map. Dark is the same map under bright moonlight. The global state `relief` switches off the hillshade and the labels of peaks. |
|
|
15
15
|
| Elevation · zero | [elevation-zero.json](https://styles.map-jr.org/1/elevation-zero.json) | [maplibre/elevation-zero.json](https://styles.map-jr.org/1/maplibre/elevation-zero.json) | Elevation without the elevation tiles: no hillshade, no 3D terrain, no labels of peaks. It keeps the shaded relief of Natural Earth at low zooms. |
|
|
16
|
-
| Elevation · radar | [elevation-radar.json](https://styles.map-jr.org/1/elevation-radar.json) | [maplibre/elevation-radar.json](https://styles.map-jr.org/1/maplibre/elevation-radar.json) | A neutral base for an overlay (a choropleth, snowfall), with relief and peaks for context, which the global state `relief` switches off. |
|
|
16
|
+
| Elevation · radar | [elevation-radar.json](https://styles.map-jr.org/1/elevation-radar.json) | [maplibre/elevation-radar.json](https://styles.map-jr.org/1/maplibre/elevation-radar.json) | A neutral base for an overlay (a choropleth, snowfall), with relief and peaks for context, which the global state `relief` switches off too. |
|
|
17
17
|
| OpenFreeMap Bright | [openfreemap-bright.json](https://styles.map-jr.org/1/openfreemap-bright.json) | [OpenFreeMap's](https://tiles.openfreemap.org/styles/bright) | The styles of OpenFreeMap as they are, with the images of the sprite inside the style. For MapLibre, use the styles of OpenFreeMap itself. |
|
|
18
18
|
| OpenFreeMap Dark | [openfreemap-dark.json](https://styles.map-jr.org/1/openfreemap-dark.json) | [OpenFreeMap's](https://tiles.openfreemap.org/styles/dark) | 〃 |
|
|
19
19
|
| OpenFreeMap Fiord | [openfreemap-fiord.json](https://styles.map-jr.org/1/openfreemap-fiord.json) | [OpenFreeMap's](https://tiles.openfreemap.org/styles/fiord) | 〃 |
|
|
@@ -21,24 +21,24 @@ Pass a link as the `style` of the map. Each one is the latest release of version
|
|
|
21
21
|
| OpenFreeMap Positron | [openfreemap-positron.json](https://styles.map-jr.org/1/openfreemap-positron.json) | [OpenFreeMap's](https://tiles.openfreemap.org/styles/positron) | 〃 |
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
createMap('map', {style: 'https://styles.map-jr.org/1/elevation.json'}); //
|
|
24
|
+
createMap('map', {style: 'https://styles.map-jr.org/1/elevation.json'}); // Map Jr. GL
|
|
25
25
|
new maplibregl.Map({container: 'map', style: 'https://styles.map-jr.org/1/maplibre/elevation.json'}); // MapLibre GL JS
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
The same styles are in the npm package [`@map-jr/styles`](#from-npm): `@map-jr/styles/<name>.json` and
|
|
29
29
|
`@map-jr/styles/maplibre/<name>.json`. In this repository they are built to `dist/styles/` and `dist/maplibre/`.
|
|
30
30
|
|
|
31
|
-
Each style also has a `.min.json` without white space. The styles need a
|
|
31
|
+
Each style also has a `.min.json` without white space. The styles need a Map Jr. GL build that reads
|
|
32
32
|
`metadata["map-jr:images"]` and `params` of the `image` expression. MapLibre GL JS draws them without icons: use the
|
|
33
33
|
MapLibre styles for it ([below](#maplibre-gl-js)).
|
|
34
34
|
|
|
35
|
-
The three elevation styles have no `glyphs`:
|
|
35
|
+
The three elevation styles have no `glyphs`: Map Jr. GL draws their labels with the fonts of the browser, and makes no
|
|
36
36
|
requests for fonts. Each `text-font` is a stack of the fonts of the system, such as
|
|
37
37
|
`["system-ui Semibold", "Segoe UI Semibold", "Roboto Medium", "sans-serif"]`: SF Pro on Apple systems, Segoe UI on
|
|
38
38
|
Windows, Roboto on Android. The first name gives the weight and the style (Regular, Semibold, Bold, Italic, Semibold
|
|
39
|
-
Italic). This needs a
|
|
39
|
+
Italic). This needs a Map Jr. GL with commit `bd4d4ea` (a `text-font` stack as a CSS family list, with `system-ui`
|
|
40
40
|
unquoted); an older one draws the labels in the `fontFamily` of the map. To give every reader the same font, pass the
|
|
41
|
-
font files in the `fonts` option of
|
|
41
|
+
font files in the `fonts` option of Map Jr. GL. MapLibre GL JS does not load a style
|
|
42
42
|
with text and no `glyphs`: its versions of these three styles have the glyphs of OpenFreeMap. The OpenFreeMap styles
|
|
43
43
|
keep the glyphs of OpenFreeMap.
|
|
44
44
|
|
|
@@ -53,10 +53,11 @@ createMap('map', {style: 'https://styles.map-jr.org/1/elevation.json'});
|
|
|
53
53
|
| Path | What it gives | Cached |
|
|
54
54
|
|---|---|---|
|
|
55
55
|
| `/1/<name>.json` | The latest release of version 1, without white space. It takes each change that does not break a map. | A day in the browser, then up to a week more while it is fetched again in the background; 5 minutes at the edge |
|
|
56
|
+
| `/1/shields/<name>.svg` | The artwork of a road shield, which the elevation styles load when a road in view has its network | As its folder |
|
|
56
57
|
| `/1/version.json` | `{version, commit}` of the folder | As its folder |
|
|
57
58
|
|
|
58
59
|
A new major version (`/2/`) breaks a map: a layer id is renamed or removed, a global state property changes, or the
|
|
59
|
-
styles need a newer
|
|
60
|
+
styles need a newer Map Jr. GL. Every other release is a new minor version (`1.1`), and `/1/` moves to it. To keep
|
|
60
61
|
one release as it is, host the zip of its GitHub release.
|
|
61
62
|
|
|
62
63
|
### MapLibre GL JS
|
|
@@ -74,19 +75,25 @@ map.setGlobalStateProperty('color-scheme', 'dark');
|
|
|
74
75
|
| `/1/maplibre/{elevation,elevation-zero,elevation-radar}.json` | The style, without white space. |
|
|
75
76
|
| `/1/maplibre/sprite.json`, `sprite.png`, `sprite@2x.json`, `sprite@2x.png` | The sprite that the three styles share: each icon and shield in the colors of the light and of the dark branch. |
|
|
76
77
|
|
|
77
|
-
Each differs from the
|
|
78
|
+
Each differs from the Map Jr. GL style in three things:
|
|
78
79
|
|
|
79
80
|
- **The icons are in a sprite.** Each icon with `params` becomes one image of the sprite for each set of colors that it
|
|
80
81
|
can have, named by the icon and a hash of its colors (`arrow-94b3af`). The `icon-image` of a layer chooses the name
|
|
81
|
-
with a `match` on the class,
|
|
82
|
+
with a `match` on the class, and has a `case` on `color-scheme` where the two branches differ. A road shield is one
|
|
83
|
+
image for each shape, number of characters and set of colors, chosen by a `step` on the length of the route number.
|
|
84
|
+
The sprite has 307 images: 28 KB at 1x, 65 KB at 2x.
|
|
85
|
+
The PNG files have a palette of 256 colors (`encodeIndexed` in `lib/png.mjs`), which makes them a quarter of the
|
|
86
|
+
size. A sheet has about 5,000 colors, mostly the steps of the gradients and the edges of the shapes: each pixel gets
|
|
87
|
+
the nearest color of the palette, a gradient has a few steps less, and the color of a plain icon or of an outline
|
|
88
|
+
stays exact. `encode` writes each color as it is, in 232 KB at 2x.
|
|
82
89
|
- **The labels use glyphs.** The fonts of the system become the Noto Sans fonts of OpenFreeMap
|
|
83
90
|
(`https://tiles.openfreemap.org/fonts/`): Regular, and Bold for Semibold and Bold, and Italic for both italics. So
|
|
84
|
-
the labels look less like the platform than in
|
|
91
|
+
the labels look less like the platform than in Map Jr. GL.
|
|
85
92
|
- **No `map-jr:` metadata.** MapLibre has no server render and no SVG images, so `map-jr:ssr` and `map-jr:images` are
|
|
86
93
|
removed.
|
|
87
94
|
|
|
88
|
-
MapLibre GL JS reads the global state `relief` of Elevation · radar from 5.16.0. With `relief` false
|
|
89
|
-
elevation tiles, and its attribution leaves out Mapterhorn. The OpenFreeMap styles have no MapLibre version: OpenFreeMap
|
|
95
|
+
MapLibre GL JS reads the global state `relief` of Elevation and of Elevation · radar from 5.16.0. With `relief` false
|
|
96
|
+
Elevation · radar loads no elevation tiles, and its attribution leaves out Mapterhorn. The OpenFreeMap styles have no MapLibre version: OpenFreeMap
|
|
90
97
|
serves them for MapLibre already (`https://tiles.openfreemap.org/styles/liberty`).
|
|
91
98
|
|
|
92
99
|
### From npm
|
|
@@ -103,6 +110,9 @@ import style from '@map-jr/styles/elevation.json' with {type: 'json'};
|
|
|
103
110
|
createMap('map', {style});
|
|
104
111
|
```
|
|
105
112
|
|
|
113
|
+
The elevation styles load the artwork of the road shields from `https://styles.map-jr.org/1/shields/`, also from
|
|
114
|
+
the package.
|
|
115
|
+
|
|
106
116
|
The MapLibre styles are at `@map-jr/styles/maplibre/<name>.json`. Their sprite stays at `https://styles.map-jr.org/1/`:
|
|
107
117
|
the package does not have it.
|
|
108
118
|
|
|
@@ -121,9 +131,12 @@ section as its text and `dist/` as a zip. Nobody pushes a tag or makes a release
|
|
|
121
131
|
`/1/`, and `2.0.0` writes `/2/` and leaves `/1/` as it was.
|
|
122
132
|
|
|
123
133
|
1. **Check `main`.** The workflow `build` is green for the commit to release.
|
|
124
|
-
2. **Choose the version.**
|
|
125
|
-
- A
|
|
126
|
-
|
|
134
|
+
2. **Choose the version.**
|
|
135
|
+
- A fix that adds nothing (a color, a wrong filter, the docs of the package) increases the third number: `1.2.0` →
|
|
136
|
+
`1.2.1`.
|
|
137
|
+
- A change that adds to a map without breaking it (a new layer, style or global state property) increases the second
|
|
138
|
+
number: `1.2.1` → `1.3.0`.
|
|
139
|
+
- A change that breaks a map (a layer id renamed or removed, a global state property changed, a newer Map Jr. GL
|
|
127
140
|
needed) increases the first number: `1.3.0` → `2.0.0`. Its section in the changelog starts with "Breaking
|
|
128
141
|
changes", which says what stopped working and what to do instead.
|
|
129
142
|
3. **Open the pull request of the release.** On a branch from `main`, set `"version"` in `package.json`, and add
|
|
@@ -144,14 +157,16 @@ section as its text and `dist/` as a zip. Nobody pushes a tag or makes a release
|
|
|
144
157
|
npm view @map-jr/styles@1.3.0 version
|
|
145
158
|
```
|
|
146
159
|
|
|
147
|
-
The first gives `{"version":"1.3","commit":"…"}`, with the commit of the merge, and the second `1.3.0`. The edge has the new styles within 5
|
|
160
|
+
The first gives `{"version":"1.3.0","commit":"…"}`, with the commit of the merge, and the second `1.3.0`. The edge has the new styles within 5
|
|
148
161
|
minutes; a browser that has the last release gets the new one within a day.
|
|
149
162
|
|
|
150
163
|
A section whose heading says `(unreleased)` is not released: the workflow does nothing for it. The workflow stops,
|
|
151
164
|
and uploads nothing, when the changelog has no section for the version, when `/<major>/` has the same release from
|
|
152
165
|
another commit or a newer release, or when npm has the version and the tag `v<version>` does not exist. A run that stopped after the upload can be run again from the Actions tab
|
|
153
166
|
(**Run workflow** on `main`): it does only what is left. To undo a release, release the earlier state as a newer
|
|
154
|
-
version. `node scripts/publish.mjs --dry-run` lists the files that a release uploads, without uploading them.
|
|
167
|
+
version. `node scripts/publish.mjs --dry-run` lists the files that a release uploads, without uploading them. Each upload, from
|
|
168
|
+
`main` and from a release, also writes `data/` to `/data/`, outside the version folders, so a file there is live when its
|
|
169
|
+
pull request merges. A new build of a file gets a new name, such as `natural-earth-5.1.2.pmtiles` with the version of its data.
|
|
155
170
|
|
|
156
171
|
It needs, in the repository:
|
|
157
172
|
|
|
@@ -184,7 +199,7 @@ pnpm run build
|
|
|
184
199
|
```
|
|
185
200
|
|
|
186
201
|
`dist/` is committed, so that a style has a URL. `pnpm run check` fails when `dist/` is not what the sources give;
|
|
187
|
-
CI runs it, and `pnpm test`. The build writes the
|
|
202
|
+
CI runs it, and `pnpm test`. The build writes the Map Jr. GL styles to `dist/styles/`, and the MapLibre styles and
|
|
188
203
|
their sprite to `dist/maplibre/`.
|
|
189
204
|
|
|
190
205
|
## Editing a style with Maputnik
|
|
@@ -192,19 +207,19 @@ their sprite to `dist/maplibre/`.
|
|
|
192
207
|
An edit in Maputnik reaches the repository as a change to the sources, because the build writes `dist/` from them
|
|
193
208
|
and overwrites an edit made there.
|
|
194
209
|
|
|
195
|
-
1. Open the built style in the Maputnik of
|
|
210
|
+
1. Open the built style in the Maputnik of Map Jr. GL:
|
|
196
211
|
`https://map-jr.github.io/maputnik/?style=https://styles.map-jr.org/@main/elevation.json`.
|
|
197
212
|
2. Edit it, and save it with **Save** (a file such as `elevation.json`).
|
|
198
213
|
3. Apply it to the sources, and build:
|
|
199
214
|
|
|
200
215
|
```bash
|
|
201
|
-
|
|
216
|
+
pnpm run apply-edit ~/Downloads/elevation.json
|
|
202
217
|
pnpm run build
|
|
203
218
|
```
|
|
204
219
|
|
|
205
220
|
The command builds the style from the sources in memory and compares it with the saved style, layer by layer and
|
|
206
221
|
property by property. It finds the style by the file name, or by the layers when the name is not the name of a
|
|
207
|
-
style. A second argument gives the name: `
|
|
222
|
+
style. A second argument gives the name: `pnpm run apply-edit saved.json elevation-radar`. For each difference it
|
|
208
223
|
tries the places that the value can come from, builds again, and keeps a change only when it removes differences and
|
|
209
224
|
adds none.
|
|
210
225
|
|
|
@@ -215,8 +230,8 @@ adds none.
|
|
|
215
230
|
| The dark value of a `case` on `color-scheme` | `PAIRS` in `styles/<name>.mjs`, by the `dark\|light` pair of the source. When other layers share the pair and keep their value, the dark value goes into the source. |
|
|
216
231
|
| The light value of such a `case` | The source, and the pair in `PAIRS` moves to the new light value |
|
|
217
232
|
|
|
218
|
-
The command does not map a value that a module makes: the images and their colors (`useIcons`, `ICON_DARK`),
|
|
219
|
-
road shields, the peak and name labels, the layers that a module adds (`place_capital`), and a value that a module
|
|
233
|
+
The command does not map a value that a module makes: the images and their colors (`useIcons`, `ICON_DARK`, `styles/poi.mjs`),
|
|
234
|
+
the road shields, the peak and name labels, the layers that a module adds (`place_capital`), and a value that a module
|
|
220
235
|
sets (the hillshade colors, the light airport colors). It does not map an edit that changes the length of a filter to
|
|
221
236
|
which a module adds a clause. It lists each of these with its layer and property and writes nothing for it, so that
|
|
222
237
|
you can change the module by hand. At the end it builds from the files again, lists each property that still differs
|
|
@@ -230,13 +245,19 @@ icons/upstream/*.svg the SVG sources of the OpenFreeMap sprite (ofm_f384), one
|
|
|
230
245
|
icons/extra.json POI classes the sprite has no icon for: new icons from Maki glyphs, and aliases
|
|
231
246
|
icons/extra/*.svg the new icons (pnpm run update-icons)
|
|
232
247
|
icons/custom/*.svg icons drawn for this repository
|
|
233
|
-
|
|
234
|
-
shields/
|
|
235
|
-
shields/
|
|
248
|
+
icons/pinhead/*.svg the Pinhead glyphs of the POI icons (pnpm run update-pinhead)
|
|
249
|
+
shields/shapes.mjs the shapes of the road shields, as SVG templates for each number of characters
|
|
250
|
+
shields/shields.mjs the networks whose look is set by hand
|
|
251
|
+
shields/networks.json the look and the artwork of each road network, from OSM Americana (pnpm run update-shields)
|
|
252
|
+
shields/artwork/*.svg the shield artwork of OSM Americana, which a style loads from a URL
|
|
236
253
|
styles/src/*.json the source styles, which use the sprite
|
|
237
254
|
styles/*.mjs one module for each style (or family): its dark palette and its fixes
|
|
238
255
|
styles/shared.mjs the dark icon colors and the neutral shield plate
|
|
256
|
+
styles/poi.mjs the POI icons of the elevation styles: which icon each class and subclass gets, and which POIs have no label
|
|
239
257
|
lib/ the build steps
|
|
258
|
+
lib/badges.mjs a POI icon as a badge
|
|
259
|
+
lib/poi.mjs the icon of a POI by its class and subclass, and the icons of the peaks
|
|
260
|
+
lib/png.mjs reads and writes the PNG of a sprite
|
|
240
261
|
lib/maplibre.mjs the MapLibre styles and their sprite
|
|
241
262
|
```
|
|
242
263
|
|
|
@@ -250,47 +271,159 @@ from a [Maki](https://github.com/mapbox/maki) glyph in the look of the sprite, a
|
|
|
250
271
|
class that has one (`atm` is `bank`, `yoga` is `sports_centre`). In the styles of this repository an alias costs no
|
|
251
272
|
image: the layer draws it from the image of its target.
|
|
252
273
|
|
|
274
|
+
**POI icons.** Elevation and Elevation · zero choose the icon of a POI by its class and its subclass, the OSM value
|
|
275
|
+
that the tiles carry (the religion of a place of worship, the kind of shop, the sport of a pitch): `styles/poi.mjs`
|
|
276
|
+
lists each icon with the tags it takes. A class (`bank`) takes each POI of the class that no icon takes by its
|
|
277
|
+
subclass, and a class with a subclass (`shop/convenience`, `hospital/clinic`) takes those alone. So a clinic has the
|
|
278
|
+
icon of a doctor, a bookshop is not a library, a charging station is not a fuel pump, and the sports have one icon.
|
|
279
|
+
`lib/poi.mjs` writes this as one `match` on the class, with a `match` on the subclass inside the classes that have
|
|
280
|
+
icons by subclass. A class that no icon lists has no icon. The POI layers have no label for street furniture, generic
|
|
281
|
+
offices (an embassy and a government office keep theirs), post boxes, parcel lockers, games, dormitories and the
|
|
282
|
+
other POIs that `HIDDEN` lists; stations and stops are in their own layers.
|
|
283
|
+
|
|
284
|
+
The glyphs are from [Pinhead](https://pinhead.ink) (CC0, the npm package `@waysidemapping/pinhead`, whose version is
|
|
285
|
+
in `icons/pinhead/VERSION`), or the glyph of a sprite icon (`sprite:bar`). `pnpm run update-pinhead` copies the
|
|
286
|
+
Pinhead glyphs that `styles/poi.mjs` names into `icons/pinhead/`. The peaks have plain icons by their class: a
|
|
287
|
+
triangle, and a volcano of Pinhead. A mountain pass has the sign of a pass (`icons/custom/mountain_pass.svg`) and
|
|
288
|
+
the plain label of a minor peak, in the layer `poi_peak_pass`.
|
|
289
|
+
|
|
290
|
+
**POI badges.** A POI icon is a badge (`lib/badges.mjs`): the glyph in white, 13 pixels, on a disc of 19 pixels in the
|
|
291
|
+
color of its category, with a gradient from light to dark and a darker rim. Public transport (stations, stops,
|
|
292
|
+
ferries, aerial lifts, airports) has a rounded square in place of the disc, and a metro station a rounded square
|
|
293
|
+
with a white disc cut in it, its glyph in blue in the disc (`SHAPES` of `styles/poi.mjs`). The color is in the image, so a badge is
|
|
294
|
+
the same in the light and in the dark scheme and has no slot; two icons with the same glyph and color share one
|
|
295
|
+
image (`poi-<icon>`). A style has about a hundred badges, so each is written short, the paths of its glyph have one
|
|
296
|
+
decimal (a tenth of a pixel, which does not show), and the build writes the attributes of each SVG image with single
|
|
297
|
+
quotes, which are one character in JSON where a double quote is two. The categories (`CATEGORIES` of
|
|
298
|
+
`styles/poi.mjs`):
|
|
299
|
+
|
|
300
|
+
| Category | Color | Icons |
|
|
301
|
+
|---|---|---|
|
|
302
|
+
| `food` | `#ee7d22` | Restaurants, cafes, bars, nightclubs, pubs, bakeries, sweets |
|
|
303
|
+
| `shop` | `#e0a011` | Shops, supermarkets, convenience stores, clothes, hairdressers, bookshops |
|
|
304
|
+
| `leisure` | `#dc5195` | Museums, galleries, theatres, cinemas, attractions, zoos, castles, monuments, stadiums |
|
|
305
|
+
| `lodging` | `#8a68d6` | Hotels |
|
|
306
|
+
| `outdoors` | `#3fa552` | Parks, gardens, playgrounds, viewpoints, campsites, sports, marinas |
|
|
307
|
+
| `health` | `#e5493f` | Hospitals, doctors and clinics, dentists, pharmacies, vets |
|
|
308
|
+
| `education` | `#a8794c` | Schools, colleges, libraries |
|
|
309
|
+
| `worship` | `#93847a` | Places of worship (Christian, Muslim, Jewish, Hindu, other), cemeteries |
|
|
310
|
+
| `services` | `#70839a` | Banks, ATMs, post offices, town halls, courts, embassies, police, fire stations, laundries, toilets |
|
|
311
|
+
| `transport` | `#2f80ed` | Stations, stops, airports, ferries, parking, fuel, charging, bicycles, cars |
|
|
312
|
+
|
|
253
313
|
**Styles.** A style module gets the source style and changes it: `useIcons` puts the templates that the layers use
|
|
254
314
|
into `metadata["map-jr:images"]`, turns each `icon-image` into an `image` expression with the colors as `params`,
|
|
255
315
|
and removes `sprite`. `retune` gives the dark branch of the source style new values, by its `dark|light` pair.
|
|
256
316
|
|
|
257
|
-
**Road shields.** `useShields` gives the shield layer one
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
317
|
+
**Road shields.** `useShields` gives the shield layer one image for each shape and number of characters (2 and
|
|
318
|
+
fewer, 3, 4, 5, 6 and more), such as `shield_us_interstate_3`, and sets the route number in the middle of it. A shield
|
|
319
|
+
does not stretch (no `icon-text-fit`), so its curves and its outline stay as they are drawn, and a number of 3
|
|
320
|
+
characters has a wider shield than one of 2, as on the road. The shape and the colors come from `route_1_network` of
|
|
321
|
+
the OpenMapTiles layer `transportation_name`. To add a network, add its name to an entry of `MANUAL` in
|
|
322
|
+
`shields/shields.mjs`, or add an entry. To add a shape, add it to `SHAPES` in `shields/shapes.mjs`: the sizes that it
|
|
323
|
+
is drawn for, a function that returns the SVG with slots for a size, and the offset of the number when it is not in
|
|
324
|
+
the middle (below the crown of an Interstate shield).
|
|
325
|
+
|
|
326
|
+
Each shape has the slots `{{background}}`, `{{border}}`, `{{color}}` (a second color: the crown of an Interstate
|
|
327
|
+
shield) and `{{shade}}`, a thin dark line around a light outline, which keeps a white outline visible on a light map.
|
|
328
|
+
The field has a slight gradient from light to dark.
|
|
261
329
|
|
|
262
330
|
| Shape | Networks |
|
|
263
331
|
|---|---|
|
|
264
332
|
| `us_interstate` | US Interstates |
|
|
265
333
|
| `us_highway` | US Highways |
|
|
266
|
-
| `pill` | US state routes, and the networks Americana draws as a pill or an ellipse |
|
|
334
|
+
| `pill` | US state routes, in the colors of the state where its sign has some, and the networks Americana draws as a pill or an ellipse |
|
|
267
335
|
| `hex` | German Autobahn, Italian autostrade, and the networks Americana draws as a horizontal hexagon |
|
|
268
|
-
| `rect` | The other networks, with the colors of their signs; a neutral plate for a network that is not listed |
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
336
|
+
| `rect` | The other networks, with the colors of their signs or of their artwork; a neutral plate for a network that is not listed |
|
|
337
|
+
|
|
338
|
+
A sign keeps its colors in both color schemes: a US Highway shield, a US state route and each other black number on
|
|
339
|
+
a white sign are white in the dark scheme too, as the blue Interstate shield is blue in both. Only the neutral plate
|
|
340
|
+
of a network that is not listed follows the scheme (`PLATE` in `styles/shared.mjs`): white with a grey outline, and
|
|
341
|
+
dark with a light number in the dark scheme.
|
|
342
|
+
|
|
343
|
+
The colors, the shapes and the artwork come from OSM Americana: `pnpm run update-shields` downloads its shield
|
|
344
|
+
definitions and its shield artwork, and writes `shields/networks.json` (700 networks with a plate, 120 variants of
|
|
345
|
+
networks, and the artwork of 229 networks) and `shields/artwork/` (196 files). Pass the folder `icons/` of a checkout
|
|
346
|
+
of Americana as the second argument to read the artwork from it: `node scripts/update-shields.mjs "" ../openstreetmap-americana/icons`.
|
|
347
|
+
|
|
348
|
+
- A network that Americana draws as a plain shape has that shape and its colors.
|
|
349
|
+
- A network that Americana draws from artwork (most US states, the New Jersey Turnpike, the highways of Japan) has a
|
|
350
|
+
plain plate in the colors of the artwork: the most common color inside it, and the most common color along its
|
|
351
|
+
edge. So the New Jersey Turnpike is white on green, the Garden State Parkway yellow on green, a California route
|
|
352
|
+
white on green, and a Kansas route black on yellow. Artwork of many colors, with no color for a plate, is left out.
|
|
353
|
+
- A variant of a network, which has a banner over its shield in Americana (`US:US:Truck`, `US:I:Express`,
|
|
354
|
+
`US:CA:Business`), has the look of its network.
|
|
355
|
+
- `MANUAL` in `shields/shields.mjs` wins over both, and a US state that neither lists has the pill.
|
|
356
|
+
|
|
357
|
+
**Artwork.** In the styles for Map Jr. GL, a network that Americana draws from artwork is drawn with that artwork: the
|
|
358
|
+
spade of a California route, the keystone of Pennsylvania, the maple leaf of the Trans-Canada Highway, the logo of the
|
|
359
|
+
New Jersey Turnpike. The artwork is not in the style. Each file of `shields/artwork/` is an image of the style by its
|
|
360
|
+
URL (`"artwork_us_ca_2": "https://styles.map-jr.org/1/shields/us_ca_2.svg"`), and the map requests it when a road in
|
|
361
|
+
view has its network, so a map of California loads the files of California.
|
|
362
|
+
|
|
363
|
+
- The image of such a network is `["coalesce", ["image", <artwork>], ["image", <plate>, {params}]]`: the artwork, with
|
|
364
|
+
the plate of the network until the artwork has loaded and when it does not load. A network that has no plate of its
|
|
365
|
+
own has a white sign there.
|
|
366
|
+
- Artwork has one file for each number, or a file for a number of 2, of 3 and of 4 characters. The number has the
|
|
367
|
+
color that Americana gives it, and is smaller from 3 characters where one file is for each number.
|
|
368
|
+
- Americana sets the number in a box of the artwork, which is not always in its middle (the number of a California
|
|
369
|
+
route is below the middle of the spade). A style sets the number in the middle of an image, so such a file has
|
|
370
|
+
empty space on one side, which puts the box in the middle, and the pixels in its name (`us_ca_2.o0_1`). The number
|
|
371
|
+
is then in the same place on the artwork and on the plate, and the style needs no place for each network.
|
|
372
|
+
- A logo has no number (the New Jersey Turnpike, the Garden State Parkway, 33 networks): its image is the artwork
|
|
373
|
+
alone, and its `text-field` is empty.
|
|
374
|
+
- Americana draws some artwork in other colors (the keystone of the Pennsylvania Turnpike is the keystone of
|
|
375
|
+
Pennsylvania in green). Such a file has the colors in its name, and a filter that gives each color its place.
|
|
376
|
+
- The Interstate and the US Highway shield are drawn here (`shields/shapes.mjs`), and have no artwork.
|
|
377
|
+
- Artwork that is a plain white shape with an outline, the same for each city or region of a country, is left out
|
|
378
|
+
(the cities and provinces of Korea, the states of Venezuela, the cities of the Netherlands: 203 networks, 2 KB of
|
|
379
|
+
a style with gzip). These networks have their plate. The states of Mexico and the departments of Peru keep their
|
|
380
|
+
shield with a crossbar.
|
|
381
|
+
- The MapLibre styles have the plates and none of the artwork: a sprite cannot have an image from a URL.
|
|
382
|
+
|
|
383
|
+
This needs a Map Jr. GL that asks for the first image of a `coalesce` and draws the next one in the meantime
|
|
384
|
+
([map-jr/map-jr-gl#2827](https://github.com/map-jr/map-jr-gl/issues/2827)). Map Jr. GL to 0.11.0 does not request
|
|
385
|
+
the artwork when a template is after it: it draws the plate of the network, as the styles did before, and the logos.
|
|
386
|
+
|
|
387
|
+
A network below a country or a state (a name of three parts and more) is kept when its sign has colors of its own:
|
|
388
|
+
the turnpikes, parkways and toll roads of the United States (`US:NJ:NJTP`), the departmental roads of France
|
|
389
|
+
(`FR:77:D-road`), the expressways of China, the prefectural roads of Japan, the state routes of Australia. Two kinds
|
|
390
|
+
are left out, to keep the styles small, and have the neutral plate: the county roads of the United States (the blue
|
|
391
|
+
pentagon with a yellow number, about 500 networks), and each network whose sign is a white plate with a black outline
|
|
392
|
+
(about 650, such as `CA:ON:primary` and the roads of a Korean city).
|
|
393
|
+
|
|
394
|
+
The shield layer names a network once in an expression: its `icon-image` is one `match` on the network, with the
|
|
395
|
+
whole image of a look (the artwork, the shape and its colors) in each arm, and `text-color` is another. The arms of the
|
|
396
|
+
expressions have the same lists of networks in the same order, the longest last, so that with gzip a list costs
|
|
397
|
+
little after the first time. Elevation is 32 KB with gzip, of which the road shields (their layer, their shapes and
|
|
398
|
+
the URLs of the artwork) are 12 KB and the badges 11 KB.
|
|
274
399
|
|
|
275
400
|
**Global state.** The elevation styles of this repository read these properties of the global state of the map:
|
|
276
401
|
|
|
277
402
|
| Property | Values | Effect |
|
|
278
403
|
|---|---|---|
|
|
279
|
-
| `color-scheme` | `light` (default), `dark` | The branch of the style.
|
|
404
|
+
| `color-scheme` | `light` (default), `dark` | The branch of the style. Map Jr. GL sets it from `colorScheme`. |
|
|
280
405
|
| `elevation-unit` | `ft` (default), `m` | The unit of the elevation in peak labels. Set it with `globalState: {'elevation-unit': 'm'}`. |
|
|
281
|
-
| `relief` | `true` (default), `false` | Elevation · radar: the hillshade and the labels of peaks. With `false` they are hidden, and no elevation tiles
|
|
282
|
-
| `language` | none (default), or a language code of the tiles such as `de`, `fr`, `ja` | The language of the names
|
|
406
|
+
| `relief` | `true` (default), `false` | Elevation and Elevation · radar: the hillshade and the labels of peaks. With `false` they are hidden, and their layers load no elevation tiles. |
|
|
407
|
+
| `language` | none (default), or a language code of the tiles such as `de`, `fr`, `ja` | The language of the names; without it, a name in a script other than Latin also shows its Latin form, and other names are English. |
|
|
283
408
|
|
|
284
409
|
`relief` switches layers with a `global-state` expression in `visibility`, which MapLibre GL JS reads from
|
|
285
|
-
5.16.0, and
|
|
286
|
-
older
|
|
410
|
+
5.16.0, and Map Jr. GL from 0.9.0. An
|
|
411
|
+
older Map Jr. GL shows the layers and loads their tiles whatever the state is.
|
|
412
|
+
|
|
413
|
+
Elevation with `relief` false has the layers of Elevation · zero, so a map changes between the two with its
|
|
414
|
+
configuration and no new style. Elevation also has a 3D terrain, which reads the elevation tiles while it is on: a
|
|
415
|
+
map switches it off with `terrain: null`, and then loads no elevation tiles.
|
|
416
|
+
|
|
417
|
+
```js
|
|
418
|
+
createMap('map', {style: 'https://styles.map-jr.org/1/elevation.json', globalState: {relief: false}, terrain: null});
|
|
419
|
+
```
|
|
287
420
|
|
|
288
421
|
**OpenFreeMap styles.** `styles/openfreemap.mjs` builds the five styles of OpenFreeMap with `inlineSprite`: the
|
|
289
422
|
images that a layer can ask for go into the style as plain SVG, and the layers are not changed, except for
|
|
290
423
|
`map-jr:ssr` in their metadata (below).
|
|
291
424
|
|
|
292
425
|
**Server render.** `ssr` in `lib/style.mjs` gives the layers of each style `metadata["map-jr:ssr"]`: changes for
|
|
293
|
-
the first view that the server renderer of
|
|
426
|
+
the first view that the server renderer of Map Jr. GL writes (`renderToSVG`, `renderFirstView`, the `ssr` prop of
|
|
294
427
|
the Vue component), which a page shows inline until the map draws. MapLibre GL JS and the map in the browser ignore
|
|
295
428
|
them. The first view is a placeholder, like a blurred image while the full one loads: it must be small, and it only
|
|
296
429
|
gives the colors and the large shapes of the place. The map draws everything else over it.
|
|
@@ -306,14 +439,14 @@ gives the colors and the large shapes of the place. The map draws everything els
|
|
|
306
439
|
| Roads: minor and service | the same, from zoom 15 | |
|
|
307
440
|
| Names of countries, states, cities and towns | `{"filter": …}` | |
|
|
308
441
|
| Everything else: buildings, casings, tunnels, railways, paths, rivers drawn as lines, other labels and icons, image patterns | `{"hidden": true}` | |
|
|
309
|
-
| A layer below the zoom where its width or opacity can be seen (0.1 pixel, 5%) | `{"minzoom": …}` | The server does not fetch or read its tiles. (
|
|
442
|
+
| A layer below the zoom where its width or opacity can be seen (0.1 pixel, 5%) | `{"minzoom": …}` | The server does not fetch or read its tiles. (Map Jr. GL 0.8.0 also wrote their paths, which draw nothing.) |
|
|
310
443
|
|
|
311
444
|
The filter of a road layer draws each class from its zoom, and the layer gets `minzoom` of the most important class
|
|
312
|
-
that its own filter names. The filters are written for
|
|
313
|
-
of the render. (
|
|
445
|
+
that its own filter names. The filters are written for Map Jr. GL 0.9.0, which reads `["zoom"]` in a filter as the zoom
|
|
446
|
+
of the render. (Map Jr. GL 0.8.0 reads the zoom of the tile, which is never above 14 on OpenMapTiles: with it, minor
|
|
314
447
|
roads do not show.)
|
|
315
448
|
|
|
316
|
-
Render the placeholder with `tileZoomOffset: 2` (
|
|
449
|
+
Render the placeholder with `tileZoomOffset: 2` (Map Jr. GL 0.9.0 or later): the server builds it from tiles two zooms
|
|
317
450
|
lower, which have fewer and longer features, and fetches fewer tiles.
|
|
318
451
|
|
|
319
452
|
| Over six views and six styles, gzip | `overrides: false` | Placeholder | Placeholder, `tileZoomOffset: 2` |
|
|
@@ -323,10 +456,10 @@ lower, which have fewer and longer features, and fetches fewer tiles.
|
|
|
323
456
|
| Paris at zoom 10 | 67 to 150 KB | 31 to 42 KB | 13 to 18 KB |
|
|
324
457
|
|
|
325
458
|
The views are Manhattan at zoom 12 and 15, Oakland at 13.5, Paris at 10, the Alps at 11 and Atlanta's suburbs at 15,
|
|
326
|
-
800 × 500, measured with
|
|
459
|
+
800 × 500, measured with Map Jr. GL at c4d5e87. A layer whose source style has `map-jr:ssr` keeps it. To render
|
|
327
460
|
without the changes, pass `overrides: false`; to change one layer, pass `overrides: {"<layer id>": {…}}`.
|
|
328
461
|
|
|
329
|
-
**MapLibre styles.** `maplibre` in `lib/maplibre.mjs` builds them from the built
|
|
462
|
+
**MapLibre styles.** `maplibre` in `lib/maplibre.mjs` builds them from the built Map Jr. GL style of each style that
|
|
330
463
|
has a global state `color-scheme`. For each `image` expression it finds the values that the image and its colors can
|
|
331
464
|
depend on: the labels of each `match` in it, and the names of the images, less those that the filter of the layer
|
|
332
465
|
leaves out. It works out the name and the colors for each value, in light and in dark, with the expressions of
|
|
@@ -339,7 +472,7 @@ then checked with `validateStyleMin` of MapLibre.
|
|
|
339
472
|
|
|
340
473
|
`pnpm run preview` draws each style in light and dark, side by side, at the views of `test/views.json` (a range of
|
|
341
474
|
zoom levels and kinds of place), into `test/shots/`. Set `STATE` to try a global state: `STATE='{"elevation-unit":"m"}' node test/preview.mjs elevation chamonix`. It needs Playwright with Chromium, and the `dist/` folder of a
|
|
342
|
-
|
|
475
|
+
Map Jr. GL build in `test/lib/`. Pass a style and a view to draw one: `node test/preview.mjs elevation-radar rockies`.
|
|
343
476
|
|
|
344
477
|
`test/maplibre.html` shows a MapLibre style in MapLibre GL JS, with the sprite of the checkout. Serve the repository
|
|
345
478
|
root (`python3 -m http.server 8123`) and open
|
|
@@ -350,6 +483,6 @@ lists the images that the sprite does not have.
|
|
|
350
483
|
## Sources and licences
|
|
351
484
|
|
|
352
485
|
The code and the shield templates of this repository have the MIT licence (`LICENSE`). The icons, the source styles
|
|
353
|
-
and the network table come from OpenFreeMap, OSM Liberty, OpenMapTiles, Maki and OSM Americana and keep their
|
|
354
|
-
`NOTICE.md`. The idea of a shape and colors for each route network follows
|
|
486
|
+
and the network table come from OpenFreeMap, OSM Liberty, OpenMapTiles, Maki, Pinhead and OSM Americana and keep their
|
|
487
|
+
own terms: see `NOTICE.md`. The idea of a shape and colors for each route network follows
|
|
355
488
|
[Trailblazer](https://github.com/osm-americana/trailblazer).
|