feat: add switchable raster map styles

This commit is contained in:
Conrad Schulz 2026-06-15 17:37:17 +00:00
parent c204faaa9f
commit 646ac23823
6 changed files with 196 additions and 6 deletions

View file

@ -14,16 +14,18 @@ mbtiles:
- /data
# MapLibre GL Styles aus /data/styles/ servieren
# -> GET /styles/{id} (Style-JSON fuer MapLibre GL Clients)
# -> GET /style/{id} (Style-JSON fuer MapLibre GL Clients)
# -> GET /style/{id}/{z}/{x}/{y}.png|jpg (serverseitig gerenderte Raster-Tiles)
styles:
paths:
- /data/styles
rendering: true
# Sprites (Icons, Pins, Marker) aus /data/sprites/
# -> GET /sprites/{id}.json und /sprites/{id}.png
sprites:
- /data/sprites
# Schriftarten fuer Karten-Labels
# -> GET /fonts/{font_name}/{start}-{end}.pbf
# fonts:
# - /data/fonts
# Hinweis: Martin erwartet im fonts.paths Verzeichnis TTF/OTF Font-Dateien.
# In diesem Stack liegen bereits vorberechnete PBF-Glyph-Ranges in /data/fonts,
# daher bleibt fonts hier deaktiviert.

View file

@ -0,0 +1,90 @@
{
"version": 8,
"name": "Europa Detail",
"sources": {
"openmaptiles": {
"type": "vector",
"url": "mbtiles://{osm-europe}"
}
},
"glyphs": "/fonts/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "#f7f5ee"
}
},
{
"id": "water",
"type": "fill",
"source": "openmaptiles",
"source-layer": "water",
"paint": {
"fill-color": "#9ec9ff"
}
},
{
"id": "landuse",
"type": "fill",
"source": "openmaptiles",
"source-layer": "landuse",
"paint": {
"fill-color": "#d8e7cc",
"fill-opacity": 0.7
}
},
{
"id": "roads-major",
"type": "line",
"source": "openmaptiles",
"source-layer": "transportation",
"filter": [
"in",
"class",
"motorway",
"trunk",
"primary"
],
"paint": {
"line-color": "#f7b267",
"line-width": [
"interpolate",
[
"linear"
],
[
"zoom"
],
5,
0.5,
16,
3.5
]
}
},
{
"id": "roads-minor",
"type": "line",
"source": "openmaptiles",
"source-layer": "transportation",
"paint": {
"line-color": "#ffffff",
"line-width": [
"interpolate",
[
"linear"
],
[
"zoom"
],
8,
0.2,
16,
2.0
]
}
}
]
}

View file

@ -0,0 +1,21 @@
{
"version": 8,
"name": "Satelite World",
"sources": {
"satellite": {
"type": "raster",
"url": "mbtiles://{satellite}",
"tileSize": 256
}
},
"layers": [
{
"id": "satellite-raster",
"type": "raster",
"source": "satellite",
"paint": {
"raster-opacity": 1.0
}
}
]
}

60
config/styles/world.json Normal file
View file

@ -0,0 +1,60 @@
{
"version": 8,
"name": "World",
"sources": {
"openmaptiles": {
"type": "vector",
"url": "mbtiles://{osm}"
}
},
"glyphs": "/fonts/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "#f2efe9"
}
},
{
"id": "water",
"type": "fill",
"source": "openmaptiles",
"source-layer": "water",
"paint": {
"fill-color": "#a9d3ff"
}
},
{
"id": "landcover",
"type": "fill",
"source": "openmaptiles",
"source-layer": "landcover",
"paint": {
"fill-color": "#dcebcf"
}
},
{
"id": "roads",
"type": "line",
"source": "openmaptiles",
"source-layer": "transportation",
"paint": {
"line-color": "#ffffff",
"line-width": [
"interpolate",
[
"linear"
],
[
"zoom"
],
5,
0.3,
14,
2.0
]
}
}
]
}

View file

@ -10,11 +10,26 @@
"styles": {
"osm-intl": {
"style": "osm-intl.json"
},
"world": {
"style": "world.json"
},
"europa-detail": {
"style": "europa-detail.json"
},
"satelite-world": {
"style": "satelite-world.json"
}
},
"data": {
"osm": {
"mbtiles": "osm.mbtiles"
},
"osm-europe": {
"mbtiles": "osm-europe.mbtiles"
},
"satellite": {
"mbtiles": "satellite.mbtiles"
}
}
}

View file

@ -27,6 +27,8 @@ services:
- ./data/fonts:/data/fonts:ro
- ./data/sprites:/data/sprites:ro
- ./data/osm.mbtiles:/data/osm.mbtiles:ro
- ./data/osm-europe.mbtiles:/data/osm-europe.mbtiles:ro
- ./data/satellite.mbtiles:/data/satellite.mbtiles:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:8080/health', r => process.exit(r.statusCode === 200 ? 0 : 1))"]