Map textures after field test: forest texture dropped (too busy), scrub / dwarf pine gets its own tint + bushes from zoom 11 instead of the grass texture; strict reserves and natural monuments a step darker than landscape protected areas; fix military outline losing its source
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 18s

This commit is contained in:
randy committed 2026-11-24 13:00:52 +01:00
1 parent 25f5c42a1b
commit 357d28bf72
3 files changed
+36 -20

No files matched your search

+2 -2
View File
@@ -31,9 +31,9 @@ independence from connectivity.
** [ ] Point detail/sidepanel: black header banner with white location name and an NPS pictogram in the corner; amenities (water, waste, power, slope) shown as a pictogram grid, no extra text; action buttons for "route here" (Valhalla), "start leveling", "save offline"
** [x] Filter panel as a "Unigrid Matrix" — an icon grid to toggle categories on/off, styled like the legend on an official NPS paper map, instead of plain dropdowns
* [ ] Custom vector style (MVT/MapLibre) using the NPS color palette — muted natural tones for forests, water, and contours — so POIs and routes stand out at high zoom
** [x] Landuse & protections: national parks keep the flat Park Tiles sage, other protected areas (nature reserves, landscape areas, …) a translucent gray-green with a dashed edge, military areas red-hatched (`protectedAreasAndTextures` in `public/js/map_themes.js`). National parks are told apart by substring of OpenMapTiles' park `class` (the OSM protection_title when there is one, so it's per-language)
** [x] Landuse & protections: national parks keep the flat Park Tiles sage, other protected areas (nature reserves, landscape areas, …) a translucent gray-green with a dashed edge, strict reserves / natural monuments a step darker than landscape areas (substring of the class again, `STRICT_RESERVE`), military areas red-hatched (`protectedAreasAndTextures` in `public/js/map_themes.js`). National parks are told apart by substring of OpenMapTiles' park `class` (the OSM protection_title when there is one, so it's per-language)
*** [ ] Private land — not in the OpenMapTiles schema (no access tags on landuse); needs our own Planetiler layer or an Overpass overlay
** [x] OpenTopoMap-style `fill-pattern` texture for forest (tree icons) and meadow/pasture (grass texture) landcover, instead of flat fill colors — Liberty's own sprite (`public/vendor/liberty-sprite/`) only has a `wetland` dot pattern, no tree/grass, so this needs custom pattern images added to the sprite sheet; works offline and online alike since it's just a style/sprite change, unlike pulling in OpenTopoMap's own raster tiles (online-only, restrictive tile-usage policy, wouldn't match the NPS palette) — done without touching the sprite: the patterns are drawn on a canvas on MapLibre's `styleimagemissing` (`patternImage`), trees from zoom 12, grass from 13, with night variants
** [x] OpenTopoMap-style `fill-pattern` texture for forest (tree icons) and meadow/pasture (grass texture) landcover, instead of flat fill colors — Liberty's own sprite (`public/vendor/liberty-sprite/`) only has a `wetland` dot pattern, no tree/grass, so this needs custom pattern images added to the sprite sheet; works offline and online alike since it's just a style/sprite change, unlike pulling in OpenTopoMap's own raster tiles (online-only, restrictive tile-usage policy, wouldn't match the NPS palette) — done without touching the sprite: the patterns are drawn on a canvas on MapLibre's `styleimagemissing` (`patternImage`), grass from 13, scrub / dwarf pine (kosodrevina, `subclass=scrub`) its own tint + bushes from 11, with night variants. Forest texture dropped after a field test: too busy, and OSM rarely says broadleaf/needleleaf anyway
** [x] Elevation-tinted terrain — a `color-relief` layer (hypsometric tint, this app's own green→brown→gray palette) under the hillshade layer, same "Terrain shading" toggle
** [x] Road hierarchy: clearly distinguish paved roads from unpaved/gravel/track — critical for knowing if the camper can get there
** [x] Park Tiles "Standard" look as the base map — `PARK_TILES_PATCH` in `public/js/map_themes.js`, colors sampled from the Park Tiles legend swatches (values in `docs/nps-resources.adoc`): flat sage park areas above landcover with a tint band inside the boundary, cream land, Park Tiles road colors. Replaced the looser `ONLINE_STYLE_PATCH` palette (briefly both, switchable, to compare); map legend at `/symbols.html`
+33 -18
View File
@@ -97,12 +97,17 @@ const NATIONAL_PARK = ["any", ...["nation", "národn", "narodn", "nemzeti", "naz
// National parks keep the flat Park Tiles sage; other protected areas
// (nature reserves, landscape areas, Natura 2000, …) get a translucent
// gray-green with a dashed edge, so the map tells "national park rules"
// from "some protection" at a glance. Military areas red-hatched. Forest
// and meadow get a tree/grass texture over their flat fill from zoom 12/13.
// from "some protection" at a glance; strict reserves and monuments (where
// you mostly can't leave the marked trail) a step darker than landscape
// areas / Natura 2000. Military areas red-hatched. Meadows get a grass
// texture from zoom 13, scrub / dwarf pine its own bushes from 11 (no forest texture: OSM rarely says what kind, and
// trees everywhere were too busy).
// The pattern images are drawn at runtime (patternImage below, on
// MapLibre's styleimagemissing), so there's no sprite sheet to extend and
// they work offline alike.
const PROTECTED_FILL = "rgba(140, 165, 120, 0.18)";
// ponytail: same substring trick as NATIONAL_PARK, a word per language.
const STRICT_RESERVE = ["any", ...["rezerv", "reserv", "wilderness", "wildnis", "pamiatk", "památk", "monument", "denkmal"].map((word) => ["in", word, ["coalesce", ["get", "class"], ""]])];
const protectedFill = (strict, other, nationalPark) => ["case", NATIONAL_PARK, nationalPark, STRICT_RESERVE, strict, other];
const PROTECTED_LINE = "#7d9468";
function protectedAreasAndTextures(style) {
@@ -112,7 +117,7 @@ function protectedAreasAndTextures(style) {
const band = find("park_tintband");
if (!park || !outline) return style;
const sage = park.paint["fill-color"];
park.paint["fill-color"] = ["case", ["!", NATIONAL_PARK], PROTECTED_FILL, sage];
park.paint["fill-color"] = protectedFill("rgba(130, 160, 110, 0.32)", "rgba(140, 165, 120, 0.14)", sage);
park.paint["fill-outline-color"] = ["case", ["!", NATIONAL_PARK], "rgba(0, 0, 0, 0)", sage];
const protectedOutline = {
...outline,
@@ -124,8 +129,8 @@ function protectedAreasAndTextures(style) {
if (band) band.filter = ["all", band.filter, NATIONAL_PARK];
const textures = [
{ id: "landcover_wood_pattern", source: "landcover", class: "wood", pattern: "forest", minzoom: 12 },
{ id: "landcover_grass_pattern", source: "landcover", class: "grass", pattern: "grass", minzoom: 13 },
{ id: "landcover_grass_pattern", source: "landcover", class: "grass", pattern: "grass", minzoom: 13, not: "scrub" },
{ id: "landcover_scrub_pattern", source: "landcover", class: "grass", pattern: "scrub", minzoom: 11, only: "scrub" },
{ id: "landuse_military", source: "landuse", class: "military", pattern: "military", minzoom: 8 },
].map((t) => ({
id: t.id,
@@ -133,11 +138,13 @@ function protectedAreasAndTextures(style) {
source: park.source,
"source-layer": t.source,
minzoom: t.minzoom,
filter: ["==", ["get", "class"], t.class],
filter: ["all", ["==", ["get", "class"], t.class],
...(t.not ? [["!=", ["get", "subclass"], t.not]] : []),
...(t.only ? [["==", ["get", "subclass"], t.only]] : [])],
paint: { "fill-pattern": `maptool-pattern-${t.pattern}` },
}));
const military = {
...textures[2],
...textures.find((t) => t.id === "landuse_military"),
id: "landuse_military_outline",
type: "line",
paint: { "line-color": "#c0392b", "line-width": 1.2, "line-opacity": 0.7 },
@@ -149,8 +156,10 @@ function protectedAreasAndTextures(style) {
}
const PATTERNS = {
forest: { day: "rgba(110, 130, 90, 0.45)", night: "rgba(120, 150, 110, 0.35)" },
grass: { day: "rgba(130, 140, 95, 0.45)", night: "rgba(120, 140, 105, 0.3)" },
// Scrub, incl. dwarf pine (kosodrevina) above the tree line: its own
// tint (bg) plus bushes, so it reads apart from both meadow and forest.
scrub: { day: "rgba(95, 125, 80, 0.55)", night: "rgba(110, 140, 100, 0.4)", bg: "rgba(150, 170, 120, 0.3)", bgNight: "rgba(60, 80, 55, 0.35)" },
military: { day: "rgba(192, 57, 43, 0.4)", night: "rgba(192, 57, 43, 0.35)" },
};
@@ -166,13 +175,19 @@ export function patternImage(id) {
ctx.strokeStyle = ctx.fillStyle = match[2] ? colors.night : colors.day;
ctx.lineWidth = 2;
ctx.lineCap = "round";
if (match[1] === "forest") {
// Two little trees, staggered, so the texture doesn't read as a grid.
for (const [x, y] of [[12, 14], [36, 38]]) {
ctx.beginPath();
ctx.arc(x, y - 3, 6, 0, 2 * Math.PI);
ctx.fill();
ctx.fillRect(x - 1, y + 2, 2, 5);
if (colors.bg) {
ctx.fillStyle = match[2] ? colors.bgNight : colors.bg;
ctx.fillRect(0, 0, size, size);
ctx.fillStyle = match[2] ? colors.night : colors.day;
}
if (match[1] === "scrub") {
// Low bushes: three overlapping dots each, staggered.
for (const [x, y] of [[12, 16], [36, 40], [34, 14], [10, 38]]) {
for (const dx of [-3, 0, 3]) {
ctx.beginPath();
ctx.arc(x + dx, y - (dx ? 0 : 2), 3, 0, 2 * Math.PI);
ctx.fill();
}
}
} else if (match[1] === "grass") {
for (const [x, y] of [[10, 16], [34, 40], [30, 12]]) {
@@ -247,13 +262,13 @@ const NIGHT_PATCH = {
waterway_river: { "line-color": "#1a3040" },
waterway_other: { "line-color": "#1a3040" },
park: {
"fill-color": ["case", ["!", NATIONAL_PARK], "rgba(120, 150, 110, 0.12)", "#1f2b22"],
"fill-color": protectedFill("rgba(120, 150, 110, 0.2)", "rgba(120, 150, 110, 0.09)", "#1f2b22"),
"fill-outline-color": ["case", ["!", NATIONAL_PARK], "rgba(0, 0, 0, 0)", "#1f2b22"],
},
park_outline: { "line-color": "#4f6b3a" },
park_outline_protected: { "line-color": "#46593a" },
landcover_wood_pattern: { "fill-pattern": "maptool-pattern-forest-night" },
landcover_grass_pattern: { "fill-pattern": "maptool-pattern-grass-night" },
landcover_scrub_pattern: { "fill-pattern": "maptool-pattern-scrub-night" },
landuse_military: { "fill-pattern": "maptool-pattern-military-night" },
landuse_military_outline: { "line-color": "#8a3a30" },
park_tintband: { "line-color": "#2b3a26" },
+1
View File
@@ -85,6 +85,7 @@
["Military area", "landuse_military"],
["Forest", "landcover_wood"],
["Grass, meadow", "landcover_grass"],
["Scrub, dwarf pine", "landcover_scrub_pattern"],
["Wetland", "landcover_wetland"],
["Sand", "landcover_sand"],
["Glacier", "landcover_ice"],