From aa186636c695201a8d5443029d35839170aba34a Mon Sep 17 00:00:00 2001 From: HuggeK <48095810+HuggeK@users.noreply.github.com> Date: Sun, 7 Jun 2026 00:01:14 +0200 Subject: [PATCH 1/6] Added mapterhorn DEM tiles to golftiles.org. --- index.html | 20 ++++++++++++++++++-- styles/golfTilesStyle.json | 16 +++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index eb6c2c3..64482a8 100644 --- a/index.html +++ b/index.html @@ -44,10 +44,26 @@

Initial Demo using Maplibre GL JS over Sweden, finland and Denmark:

p.getHeader().then(h => { const map = new maplibregl.Map({ container: 'map', - zoom: h.maxZoom - 2, // golfTiles is rendered at max zoom of 14. + zoom: h.maxZoom - 1, // golfTiles is rendered at max zoom of 14. center: [15.59411, 56.52839], //Centers on Emmaboda GK. - style: 'https://golftiles.org/styles/golfTilesStyle.json' + pitch: 70, + style: 'https://golftiles.org/styles/golfTilesStyle.json', + maxPitch: 85 }); + map.addControl( + new maplibregl.NavigationControl({ + visualizePitch: true, + showZoom: true, + showCompass: true + }) + ); + + map.addControl( + new maplibregl.TerrainControl({ + source: 'terrainSource', + exaggeration: 1 + }) + ); }); diff --git a/styles/golfTilesStyle.json b/styles/golfTilesStyle.json index 66c7cf4..434e52e 100644 --- a/styles/golfTilesStyle.json +++ b/styles/golfTilesStyle.json @@ -6,7 +6,11 @@ "type": "vector", "url": "pmtiles://https://golftiles.org/samples/golfTiles_se_dk_fi.pmtiles", "attribution": "© OpenStreetMap. Schema and style golfTiles" - } + }, + "terrainSource": { + "type": "raster-dem", + "url": "https://tiles.mapterhorn.com/tilejson.json" + } }, "layers": [ { @@ -252,5 +256,11 @@ "text-color": "#000000" } } - ] -} \ No newline at end of file + ], + "terrain": { + "source": "terrainSource", + "exaggeration": 1.5 + }, + "sky": {} + +} From 82c5df62c9583ad3bf0aa5910a1fe7c37c7f3a78 Mon Sep 17 00:00:00 2001 From: HuggeK <48095810+HuggeK@users.noreply.github.com> Date: Mon, 8 Jun 2026 16:23:26 +0200 Subject: [PATCH 2/6] Worked some more on the style. --- custom-tilemaker/config.json | 2 +- styles/golfTilesStyle.json | 140 +++++++++++++++++++++++++++++++---- styles/schema_and_style.md | 13 ++++ 3 files changed, 140 insertions(+), 15 deletions(-) create mode 100644 styles/schema_and_style.md diff --git a/custom-tilemaker/config.json b/custom-tilemaker/config.json index 534f97c..778b97b 100644 --- a/custom-tilemaker/config.json +++ b/custom-tilemaker/config.json @@ -16,7 +16,7 @@ "high_resolution": true, "name": "Tilemaker golfTiles schema", "version": "0.1", - "description": "Tiles for features inside of golf_courses ", + "description": "Tiles for features inside of golf_course facilities", "compress": "gzip" }, "metadata": { diff --git a/styles/golfTilesStyle.json b/styles/golfTilesStyle.json index 434e52e..3de89de 100644 --- a/styles/golfTilesStyle.json +++ b/styles/golfTilesStyle.json @@ -13,6 +13,15 @@ } }, "layers": [ + { + "id": "facilities_base_layer", + "source": "golfTiles_source", + "source-layer": "facilities", + "type": "fill", + "paint": { + "fill-color": "#51aa60" + } + }, { "id": "ranges", "source": "golfTiles_source", @@ -26,6 +35,25 @@ "fill-color": "#6eb438" } }, + { + "id": "ranges_text_on_borders", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "filter": [ + "all", + ["==", ["get", "golf"], "driving_range"] + ], + "type": "symbol", + "layout": { + "text-field": "Driving Range", + "text-font": ["Open Sans Regular"], + "text-size": 14, + "text-variable-anchor": ["top", "bottom", "center", "left", "right"] + }, + "paint": { + "text-color": "#000000" + } + }, { "id": "roughs", "source": "golfTiles_source", @@ -79,11 +107,15 @@ } }, { - "id": "tees_borders", + "id": "tees_color_borders", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "line", - "filter": ["has", "tee"], + "filter": [ + "==", + ["typeof", ["get", "tee"]], + "string" + ], "paint": { "line-color": [ "coalesce", @@ -92,6 +124,27 @@ ] } }, + { + "id": "tees_numeric_borders", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "symbol", + "filter": [ + "==", + ["typeof", ["get", "tee"]], + "number" + ], + "layout": { + "text-field": ["to-string", ["get", "tee"]], + "text-font": ["Open Sans Regular"], + "text-size": 14, + "symbol-placement": "line", + "symbol-spacing": 250 + }, + "paint": { + "text-color": "#223631" + } + }, { "id": "greens", "source": "golfTiles_source", @@ -128,8 +181,26 @@ ["==", ["get", "natural"], "tree"] ], "paint": { - "circle-color": "#1a6b3c" - + "circle-color": "#1a6b3c", + "circle-radius": [ + "interpolate", + ["linear"], + ["zoom"], + 12, 1, + 13, 3, + 20, 4 + ] + } + }, + { + "id": "facility_borders", + "source": "golfTiles_source", + "source-layer": "facilities", + "type": "line", + "paint": { + "line-color": "#223631", + "line-width": 2, + "line-opacity": 0.8 } }, { @@ -208,21 +279,62 @@ "interpolate", ["linear"], ["zoom"], - 10, 2, - 15, 2, - 20, 2 + 12, 1, + 13, 2, + 20, 3 ] } }, { - "id": "facility_borders", + "id": "golf_carthpath", "source": "golfTiles_source", - "source-layer": "facilities", + "source-layer": "golf_lines", "type": "line", + "filter": [ + "all", + ["==", ["get", "golf"], "cartpath"] + ], "paint": { - "line-color": "#223631", - "line-width": 2, - "line-opacity": 0.8 + "line-color": "#fa8173" + } + }, + { + "id": "golf_path", + "source": "golfTiles_source", + "source-layer": "golf_lines", + "type": "line", + "filter": [ + "all", + ["==", ["get", "golf"], "hole"] + ], + "paint": { + "line-color": "#e47569" + } + }, + { + "id": "area:highway", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "fill", + "filter": [ + "has", + "area:highway" + ], + "paint": { + "fill-color": "#e6e6e6" + } + }, + { + "id": "highway", + "source": "golfTiles_source", + "source-layer": "golf_lines", + "type": "line", + "filter": [ + "has", + "highway" + ], + "paint": { + "line-color": "#ffffff" } }, { @@ -242,7 +354,7 @@ } }, { - "id": "facility_text_midpoints", + "id": "facility_text_center", "source": "golfTiles_source", "source-layer": "facilities", "type": "symbol", @@ -250,7 +362,7 @@ "text-field": ["get", "name"], "text-font": ["Open Sans Regular"], "text-size": 14, - "text-variable-anchor": ["center", "top", "bottom", "left", "right"] + "text-variable-anchor": ["bottom", "center", "top", "left", "right"] }, "paint": { "text-color": "#000000" diff --git a/styles/schema_and_style.md b/styles/schema_and_style.md new file mode 100644 index 0000000..3432609 --- /dev/null +++ b/styles/schema_and_style.md @@ -0,0 +1,13 @@ +Due to the nature of Maplibre GL styles are in .json files which one cannot annotate with comments some explanations of the behavior of the style and schema follows down below: (Note that this will be reworked as a proper documentation on github pages in the future like Shortbread does it.) + + + + +Note that ref= from OSM gets renamed to hole_number in the golfTiles schema. +set_AttributeInteger_and_log("hole_number", ref) -- this is one of the few times a rename of the key in the tiles occur. More suitable with hole_number than generic ref. + + + + +Only tees which are actual areas is rendered. +The style also have a way to style the borders of tee´s if the key tee= is set to a valid html color. If it is a not valid html color, the border will fallback on the same color as the tee itself. Could also be a #HEX color. If a number is used it will be displayed as text atop the border. This is using the expression syntax in Maplibre GL style spec ["typeof"](https://maplibre.org/maplibre-style-spec/expressions/#typeof). From 8cb124f9a01e0ed72ba10d342f4ecb6f47947e7f Mon Sep 17 00:00:00 2001 From: HuggeK <48095810+HuggeK@users.noreply.github.com> Date: Mon, 8 Jun 2026 22:29:46 +0200 Subject: [PATCH 3/6] Worked on the style, added processing in the lua generation script to compute hue value for a particular course name, (Use route=golf people!) Added lakes, rivers, waste areas, golf hole text info and coloring, roads, paths, to style. --- custom-tilemaker/process.lua | 19 ++- styles/golfTilesStyle.json | 272 ++++++++++++++++++++++++++++++----- 2 files changed, 252 insertions(+), 39 deletions(-) diff --git a/custom-tilemaker/process.lua b/custom-tilemaker/process.lua index d0d15b5..1f7cd47 100644 --- a/custom-tilemaker/process.lua +++ b/custom-tilemaker/process.lua @@ -121,6 +121,19 @@ local function set_AttributeInteger_or_Attribute(attributenkey, value) end end +-- Function to convert a name of a course into a hue. Uses FNV-1a +-- Requires lua 5.3 to be able to use the bitwise XOR tilde ~ +local function string_to_hue(str) + + local hash = 2166136261 -- FNV offset basis + for i = 1, #str do + hash = hash ~ string.byte(str, i) + hash = (hash * 16777619) % 2^32 + end + return hash % 360 -- The hue is a value in between 0-360. + +end + -- Nodes will only be processed if one of these keys is present. This reduces memory drastically as stated by the documentation. node_keys = { "golf", "tee", "natural", "leaf_cycle", "leaf_type", "information", "amenity", "vending", @@ -396,6 +409,10 @@ function way_function() -- Still sets the course info from the golf=holes even if no route=golf tags is present. if golf_course_name ~= "" and not set_golf_course_name then Attribute("golf:course:name", golf_course_name) -- Name of the course this hole belongs to. + + AttributeInteger("course_name_hash_hue", string_to_hue(golf_course_name)) + -- Run a "hash" function over the name here to calculate a hue for + -- the Maplibre GL style to use for golf=hole lines and other coloring to to lack of proper scripting support in the style itself. end if golf_course ~= "" and not set_golf_course then Attribute("golf:course", golf_course) @@ -539,7 +556,7 @@ function way_function() -- Rivers local waterway = Find("waterway") - if waterway == "stream" or waterway == "river" or waterway == "canal" then -- Is this to restrictive? Maybe more? + if waterway ~= "" then Layer("golf_lines", false) Attribute("waterway", waterway) -- "General" common "extra" attributes between nodes & ways/areas: diff --git a/styles/golfTilesStyle.json b/styles/golfTilesStyle.json index 3de89de..7c2acf4 100644 --- a/styles/golfTilesStyle.json +++ b/styles/golfTilesStyle.json @@ -14,16 +14,57 @@ }, "layers": [ { - "id": "facilities_base_layer", + "id": "Facilities base layer", "source": "golfTiles_source", "source-layer": "facilities", "type": "fill", "paint": { "fill-color": "#51aa60" } - }, + }, { - "id": "ranges", + "id": "Tourism campsite", + "source": "golfTiles_source", + "source-layer": "other_areas", + "type": "fill", + "filter": [ + "all", + ["==", ["get", "tourism"], "camp_site"] + ], + "paint": { + "fill-color": "#22a6aa" + } + }, + { + "id": "Lakes", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "fill", + "filter": [ + "all", + ["==", ["get", "water"], "lake"] + ], + "paint": { + "fill-color": "#184565" + } + }, + { + "id": "Streams and Rivers", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "line", + "filter": [ + "has", + "waterway" + ], + "paint": { + "line-color": "#184565" + } + }, + + + { + "id": "Ranges", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -36,7 +77,7 @@ } }, { - "id": "ranges_text_on_borders", + "id": "Ranges text on borders", "source": "golfTiles_source", "source-layer": "golf_areas", "filter": [ @@ -55,7 +96,7 @@ } }, { - "id": "roughs", + "id": "Roughs", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -68,7 +109,7 @@ } }, { - "id": "fairways", + "id": "Fairways", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -81,7 +122,20 @@ } }, { - "id": "bunkers", + "id": "Waste areas", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "fill", + "filter": [ + "all", + ["==", ["get", "natural"], "sand"] + ], + "paint": { + "fill-color": "#b5998d" + } + }, + { + "id": "Bunkers", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -94,7 +148,7 @@ } }, { - "id": "tees_areas", + "id": "Tees areas", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -107,7 +161,7 @@ } }, { - "id": "tees_color_borders", + "id": "Tees color borders", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "line", @@ -125,7 +179,7 @@ } }, { - "id": "tees_numeric_borders", + "id": "Tees Numeric Borders", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "symbol", @@ -146,7 +200,7 @@ } }, { - "id": "greens", + "id": "Greens", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -159,7 +213,7 @@ } }, { - "id": "trees_areas", + "id": "Trees Areas", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -172,7 +226,7 @@ } }, { - "id": "trees", + "id": "Trees", "source": "golfTiles_source", "source-layer": "golf_points", "type": "circle", @@ -193,7 +247,7 @@ } }, { - "id": "facility_borders", + "id": "Facility Borders", "source": "golfTiles_source", "source-layer": "facilities", "type": "line", @@ -204,7 +258,7 @@ } }, { - "id": "penalty_areas", + "id": "Penalty areas", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", @@ -218,7 +272,7 @@ } }, { - "id": "penalty_areas_borders", + "id": "Penalty areas borders", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "line", @@ -239,20 +293,20 @@ } }, { - "id": "out_of_bounds_lines", + "id": "Out of bounds lines", "source": "golfTiles_source", "source-layer": "golf_lines", "type": "line", "filter": [ "all", - ["==", ["get", "golf"], "hole"] + ["==", ["get", "golf"], "out_of_bounds"] ], "paint": { "line-color": "#faf9f9" } }, { - "id": "hole_lines", + "id": "Hole lines", "source": "golfTiles_source", "source-layer": "golf_lines", "type": "line", @@ -261,11 +315,92 @@ ["==", ["get", "golf"], "hole"] ], "paint": { - "line-color": "#1a3002" + "line-color": [ + "case", + ["has", "course_name_hash_hue"], + ["hsl", ["get", "course_name_hash_hue"], 70, 50], + "#cccccc" + ] + } + }, + { + "id": "Hole number, par, index, name and course name text on lines", + "source": "golfTiles_source", + "source-layer": "golf_lines", + "type": "symbol", + "filter": [ + "all", + ["==", ["get", "golf"], "hole"] + ], + "layout": { + "text-font": ["Open Sans Regular"], + "text-size": 14, + "symbol-placement": "line", + "symbol-spacing": 250, + "text-field": [ + "concat", + [ + "case", + ["has", "ref"], + [ + "concat", + "Hole ", + ["coalesce", ["get", "ref"], ""], + ". " + ], + "" + ], + [ + "case", + ["has", "par"], + [ + "concat", + "Par ", + ["coalesce", ["get", "par"], ""], + ". " + ], + "" + ], + [ + "case", + ["has", "handicap"], + [ + "concat", + "Index ", + ["coalesce", ["get", "handicap"], ""], + ". " + ], + "" + ], + [ + "case", + ["has", "name"], + [ + "concat", + ["coalesce", ["get", "name"], ""], + ". " + ], + "" + ], + [ + "case", + ["has", "golf:course:name"], + [ + "concat", + "Course: ", + ["coalesce", ["get", "golf:course:name"], ""], + ". " + ], + "" + ] + ] + }, + "paint": { + "text-color": "#223631" } }, { - "id": "golf_pins", + "id": "Golf pins", "source": "golfTiles_source", "source-layer": "golf_points", "type": "circle", @@ -286,7 +421,33 @@ } }, { - "id": "golf_carthpath", + "id": "Area:highway", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "fill", + "filter": [ + "has", + "area:highway" + ], + "paint": { + "fill-color": "#e6e6e6" + } + }, + { + "id": "Parking lot", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "fill", + "filter": [ + "all", + ["==", ["get", "amenity"], "parking"] + ], + "paint": { + "fill-color": "#999999" + } + }, + { + "id": "Golf Carthpaths", "source": "golfTiles_source", "source-layer": "golf_lines", "type": "line", @@ -295,50 +456,85 @@ ["==", ["get", "golf"], "cartpath"] ], "paint": { - "line-color": "#fa8173" + "line-color": "#fa8173", + "line-width": 2, + "line-dasharray": [2, 2] } }, { - "id": "golf_path", + "id": "Golf Paths", "source": "golfTiles_source", "source-layer": "golf_lines", "type": "line", "filter": [ "all", - ["==", ["get", "golf"], "hole"] + ["==", ["get", "golf"], "path"], + ["==", ["get", "highway"], "path"] ], "paint": { - "line-color": "#e47569" + "line-color": "#e47569", + "line-width": 2, + "line-dasharray": [2, 2] } }, { - "id": "area:highway", + "id": "Highways", + "source": "golfTiles_source", + "source-layer": "golf_lines", + "type": "line", + "filter": [ + "all", + ["has", "highway"], + ["!=", ["get", "highway"], "path"] + ], + "paint": { + "line-color": "#ffffff", + "line-width": 4 + } + }, + { + "id": "Golf Clubhouses", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", "filter": [ - "has", - "area:highway" + "all", + ["==", ["get", "golf"], "clubhouse"] ], "paint": { - "fill-color": "#e6e6e6" + "fill-color": "#7c3be4" } }, { - "id": "highway", + "id": "Restaurants", "source": "golfTiles_source", - "source-layer": "golf_lines", - "type": "line", + "source-layer": "golf_areas", + "type": "fill", "filter": [ - "has", - "highway" + "all", + ["==", ["get", "amenity"], "restaurant"] + ], + "paint": { + "fill-color": "#cda7c6" + } + }, + { + "id": "Buildings", + "source": "golfTiles_source", + "source-layer": "golf_areas", + "type": "fill", + "filter": [ + "all", + ["has", "building"], + ["!=", ["get", "golf"], "clubhouse"], + ["!=", ["get", "amenity"], "restaurant"] ], "paint": { - "line-color": "#ffffff" + "fill-color": "#ff8c75" } }, { - "id": "facility_text_on_borders", + "id": "Facility text on borders", "source": "golfTiles_source", "source-layer": "facilities", "type": "symbol", @@ -354,7 +550,7 @@ } }, { - "id": "facility_text_center", + "id": "Facility text center", "source": "golfTiles_source", "source-layer": "facilities", "type": "symbol", From 89a16c7f47ed3fc53c08e9f44b9c22f3e36e567b Mon Sep 17 00:00:00 2001 From: HuggeK <48095810+HuggeK@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:53:14 +0200 Subject: [PATCH 4/6] Rewrote logic to precompute course color for golf lines. --- custom-tilemaker/process.lua | 33 ++++++++++++++++++++++++++++----- styles/golfTilesStyle.json | 4 ++-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/custom-tilemaker/process.lua b/custom-tilemaker/process.lua index 1f7cd47..601cc35 100644 --- a/custom-tilemaker/process.lua +++ b/custom-tilemaker/process.lua @@ -121,16 +121,40 @@ local function set_AttributeInteger_or_Attribute(attributenkey, value) end end --- Function to convert a name of a course into a hue. Uses FNV-1a +local function hsl_to_rgb(h, s, l) + local c = (1 - math.abs(2*l - 1)) * s + local x = c * (1 - math.abs((h / 60) % 2 - 1)) + local m = l - c/2 + + local r, g, b = 0, 0, 0 + + if h < 60 then r, g, b = c, x, 0 + elseif h < 120 then r, g, b = x, c, 0 + elseif h < 180 then r, g, b = 0, c, x + elseif h < 240 then r, g, b = 0, x, c + elseif h < 300 then r, g, b = x, 0, c + else r, g, b = c, 0, x end + + return + math.floor((r + m) * 255), + math.floor((g + m) * 255), + math.floor((b + m) * 255) +end + +-- Function to convert a name of a course into a color. -- Requires lua 5.3 to be able to use the bitwise XOR tilde ~ -local function string_to_hue(str) +local function string_to_color(str) + --Uses FNV-1a: local hash = 2166136261 -- FNV offset basis for i = 1, #str do hash = hash ~ string.byte(str, i) hash = (hash * 16777619) % 2^32 end - return hash % 360 -- The hue is a value in between 0-360. + local hue = hash % 360 -- The hue is a value in between 0-360. + local r, g, b = hsl_to_rgb(hue, 0.65, 0.55) + + return string.format("#%02x%02x%02x", r, g, b) end @@ -410,8 +434,7 @@ function way_function() if golf_course_name ~= "" and not set_golf_course_name then Attribute("golf:course:name", golf_course_name) -- Name of the course this hole belongs to. - AttributeInteger("course_name_hash_hue", string_to_hue(golf_course_name)) - -- Run a "hash" function over the name here to calculate a hue for + Attribute("course_name_color", string_to_color(golf_course_name)) -- the Maplibre GL style to use for golf=hole lines and other coloring to to lack of proper scripting support in the style itself. end if golf_course ~= "" and not set_golf_course then diff --git a/styles/golfTilesStyle.json b/styles/golfTilesStyle.json index 7c2acf4..ffae795 100644 --- a/styles/golfTilesStyle.json +++ b/styles/golfTilesStyle.json @@ -317,8 +317,8 @@ "paint": { "line-color": [ "case", - ["has", "course_name_hash_hue"], - ["hsl", ["get", "course_name_hash_hue"], 70, 50], + ["has", "course_name_color"], + ["get", "course_name_color"], "#cccccc" ] } From bb00cbd20bd3b6d13fb896f7ebd97f331d6bca16 Mon Sep 17 00:00:00 2001 From: Claude Fable 5 Date: Sun, 5 Jul 2026 23:50:46 +0200 Subject: [PATCH 5/6] Fix style rendering: self-hosted glyphs and schema/style key mismatches - Add top-level glyphs pointing at GitHub Pages hosted fonts (docs/fonts/, see companion publishing PR); keeps Open Sans Regular so the 5 symbol layers can finally draw text. - Streams and Rivers: read source-layer golf_lines (process.lua writes waterway=* there, not golf_areas). - Area:highway: filter on area_highway, the attribute key actually written to the tiles. - Lakes: also render water=river polygons; layer renamed to 'Lakes and rivers'. - Hole labels: read hole_number (the renamed ref) so 'Hole N.' renders. - Document all of the above in styles/schema_and_style.md. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com> --- styles/golfTilesStyle.json | 17 ++++++++++------- styles/schema_and_style.md | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/styles/golfTilesStyle.json b/styles/golfTilesStyle.json index ffae795..c13c5a8 100644 --- a/styles/golfTilesStyle.json +++ b/styles/golfTilesStyle.json @@ -12,6 +12,7 @@ "url": "https://tiles.mapterhorn.com/tilejson.json" } }, + "glyphs": "https://huggek.github.io/golfTiles/fonts/{fontstack}/{range}.pbf", "layers": [ { "id": "Facilities base layer", @@ -36,13 +37,15 @@ } }, { - "id": "Lakes", + "id": "Lakes and rivers", "source": "golfTiles_source", "source-layer": "golf_areas", "type": "fill", "filter": [ - "all", - ["==", ["get", "water"], "lake"] + "match", + ["get", "water"], + ["lake", "river"], true, + false ], "paint": { "fill-color": "#184565" @@ -51,7 +54,7 @@ { "id": "Streams and Rivers", "source": "golfTiles_source", - "source-layer": "golf_areas", + "source-layer": "golf_lines", "type": "line", "filter": [ "has", @@ -341,11 +344,11 @@ "concat", [ "case", - ["has", "ref"], + ["has", "hole_number"], [ "concat", "Hole ", - ["coalesce", ["get", "ref"], ""], + ["coalesce", ["get", "hole_number"], ""], ". " ], "" @@ -427,7 +430,7 @@ "type": "fill", "filter": [ "has", - "area:highway" + "area_highway" ], "paint": { "fill-color": "#e6e6e6" diff --git a/styles/schema_and_style.md b/styles/schema_and_style.md index 3432609..9843178 100644 --- a/styles/schema_and_style.md +++ b/styles/schema_and_style.md @@ -11,3 +11,27 @@ set_AttributeInteger_and_log("hole_number", ref) -- this is one of the few times Only tees which are actual areas is rendered. The style also have a way to style the borders of tee´s if the key tee= is set to a valid html color. If it is a not valid html color, the border will fallback on the same color as the tee itself. Could also be a #HEX color. If a number is used it will be displayed as text atop the border. This is using the expression syntax in Maplibre GL style spec ["typeof"](https://maplibre.org/maplibre-style-spec/expressions/#typeof). + + + + +Font glyphs are self-hosted on GitHub Pages: the style's top-level glyphs property points at +https://huggek.github.io/golfTiles/fonts/{fontstack}/{range}.pbf and every symbol layer uses the +"Open Sans Regular" fontstack. The .pbf glyph ranges live in docs/fonts/ in this repository +(prebuilt ranges from the openmaptiles/fonts project). GitHub Pages serves them with +Access-Control-Allow-Origin: *, so the same glyphs URL also works when the style itself is served +from golftiles.org. Longer term the plan is: golftiles.org is the bucket endpoint for tiles and +style, and the GitHub Pages site is the demo page. + + + + +Geometry/attribute placement decisions the style relies on (all from custom-tilemaker/process.lua): +- waterway=* ways are written to the golf_lines layer (not golf_areas). The "Streams and Rivers" + style layer therefore reads source-layer golf_lines. +- natural=water polygons are written to golf_areas with the attribute water=lake or water=river. + The "Lakes and rivers" style layer renders both values. +- area:highway=* polygons are written with the attribute key area_highway (colon replaced with an + underscore, since expressions like ["get", "area:highway"] would read awkwardly and the colon has + no meaning in the tiles). The "Area:highway" style layer filters on area_highway. +- Hole labels read hole_number (the renamed ref, see above), not ref. From e96bf1fe9c6cd8ca16442829a9b49c0f6bca05ad Mon Sep 17 00:00:00 2001 From: Claude Fable 5 Date: Sun, 5 Jul 2026 23:50:55 +0200 Subject: [PATCH 6/6] Pin maplibre-gl to 5.24.0 and load the style relatively Unpinned unpkg URLs float to the latest major and can break the page silently; 5.24.0 matches the version the style was verified against. The relative style URL resolves to the same path on golftiles.org while letting local development serve the branch's own style instead of the deployed copy. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com> --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 64482a8..dbd6675 100644 --- a/index.html +++ b/index.html @@ -6,9 +6,9 @@ - + - + @@ -47,7 +47,7 @@

Initial Demo using Maplibre GL JS over Sweden, finland and Denmark:

zoom: h.maxZoom - 1, // golfTiles is rendered at max zoom of 14. center: [15.59411, 56.52839], //Centers on Emmaboda GK. pitch: 70, - style: 'https://golftiles.org/styles/golfTilesStyle.json', + style: 'styles/golfTilesStyle.json', // relative: resolves to golftiles.org in production and to the local copy when serving the repo root during development. maxPitch: 85 }); map.addControl(