diff --git a/config/styles/osm-intl.json b/config/styles/osm-intl.json new file mode 100644 index 0000000..074a3f0 --- /dev/null +++ b/config/styles/osm-intl.json @@ -0,0 +1,432 @@ +{ + "version": 8, + "name": "OSM International (OpenStreetMap)", + "metadata": { + "mapbox:url": "mapbox://styles/mapbox/outdoors-v11", + "maptiler:copyright": "© OpenStreetMap contributors, © MapTiler" + }, + "sources": { + "osm": { + "type": "vector", + "url": "mbtiles://{osm}" + } + }, + "glyphs": "/fonts/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "#e8e8e8" + } + }, + { + "id": "water-area", + "type": "fill", + "source": "osm", + "source-layer": "water", + "paint": { + "fill-color": "#b0d4fc" + } + }, + { + "id": "water-line", + "type": "line", + "source": "osm", + "source-layer": "water", + "paint": { + "line-color": "#b0d4fc", + "line-width": 1 + }, + "filter": [ + "==", + "$type", + "LineString" + ] + }, + { + "id": "landuse-forest", + "type": "fill", + "source": "osm", + "source-layer": "landuse", + "paint": { + "fill-color": "#d4e8c1", + "fill-opacity": 0.8 + }, + "filter": [ + "==", + "class", + "forest" + ] + }, + { + "id": "landuse-grass", + "type": "fill", + "source": "osm", + "source-layer": "landuse", + "paint": { + "fill-color": "#e8f0e0", + "fill-opacity": 0.6 + }, + "filter": [ + "==", + "class", + "grass" + ] + }, + { + "id": "landuse-park", + "type": "fill", + "source": "osm", + "source-layer": "landuse", + "paint": { + "fill-color": "#c8e6c9", + "fill-opacity": 0.7 + }, + "filter": [ + "==", + "class", + "park" + ] + }, + { + "id": "building", + "type": "fill", + "source": "osm", + "source-layer": "building", + "paint": { + "fill-color": "#ddd", + "fill-opacity": 0.6 + }, + "minzoom": 12 + }, + { + "id": "building-outline", + "type": "line", + "source": "osm", + "source-layer": "building", + "paint": { + "line-color": "#999", + "line-width": 0.5 + }, + "minzoom": 12 + }, + { + "id": "road-motorway", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#ff9e64", + "line-width": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 6, + 0.5, + 20, + 6 + ] + }, + "filter": [ + "==", + "class", + "motorway" + ] + }, + { + "id": "road-trunk", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#ffb366", + "line-width": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 6, + 0.4, + 20, + 5 + ] + }, + "filter": [ + "==", + "class", + "trunk" + ] + }, + { + "id": "road-primary", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#ffd699", + "line-width": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 6, + 0.3, + 20, + 4 + ] + }, + "filter": [ + "==", + "class", + "primary" + ] + }, + { + "id": "road-secondary", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#fff4cc", + "line-width": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 8, + 0.1, + 20, + 3 + ] + }, + "filter": [ + "==", + "class", + "secondary" + ] + }, + { + "id": "road-tertiary", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 10, + 0.05, + 20, + 2 + ] + }, + "filter": [ + "==", + "class", + "tertiary" + ] + }, + { + "id": "road-path", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#cccccc", + "line-width": 0.5, + "line-dasharray": [ + 2, + 2 + ] + }, + "filter": [ + "in", + "class", + "path", + "footway", + "cycleway" + ] + }, + { + "id": "railway", + "type": "line", + "source": "osm", + "source-layer": "road", + "paint": { + "line-color": "#999", + "line-width": 1, + "line-dasharray": [ + 1, + 1 + ] + }, + "filter": [ + "==", + "class", + "rail" + ], + "minzoom": 10 + }, + { + "id": "poi-icon", + "type": "symbol", + "source": "osm", + "source-layer": "poi", + "layout": { + "text-field": [ + "get", + "name_en" + ], + "text-font": [ + "Open Sans Regular" + ], + "text-offset": [ + 0, + 0.5 + ], + "text-size": 10 + }, + "paint": { + "text-color": "#333", + "text-halo-color": "#fff", + "text-halo-width": 1 + }, + "minzoom": 14 + }, + { + "id": "place-city", + "type": "symbol", + "source": "osm", + "source-layer": "place", + "layout": { + "text-field": [ + "get", + "name_en" + ], + "text-font": [ + "Open Sans Bold" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 5, + 12, + 14, + 20 + ] + }, + "paint": { + "text-color": "#222", + "text-halo-color": "#fff", + "text-halo-width": 2 + }, + "filter": [ + "==", + "class", + "city" + ] + }, + { + "id": "place-town", + "type": "symbol", + "source": "osm", + "source-layer": "place", + "layout": { + "text-field": [ + "get", + "name_en" + ], + "text-font": [ + "Open Sans Regular" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 7, + 10, + 14, + 14 + ] + }, + "paint": { + "text-color": "#555", + "text-halo-color": "#fff", + "text-halo-width": 1 + }, + "filter": [ + "==", + "class", + "town" + ] + }, + { + "id": "place-village", + "type": "symbol", + "source": "osm", + "source-layer": "place", + "layout": { + "text-field": [ + "get", + "name_en" + ], + "text-font": [ + "Open Sans Regular" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 10, + 8, + 14, + 12 + ] + }, + "paint": { + "text-color": "#777", + "text-halo-color": "#fff", + "text-halo-width": 0.5 + }, + "filter": [ + "==", + "class", + "village" + ], + "minzoom": 10 + } + ] +} \ No newline at end of file diff --git a/config/tileserver.json b/config/tileserver.json new file mode 100644 index 0000000..027e481 --- /dev/null +++ b/config/tileserver.json @@ -0,0 +1,20 @@ +{ + "options": { + "paths": { + "fonts": "/data/fonts", + "sprites": "/data/sprites", + "styles": "/data/styles", + "mbtiles": "/data" + } + }, + "styles": { + "osm-intl": { + "style": "osm-intl.json" + } + }, + "data": { + "osm": { + "mbtiles": "osm.mbtiles" + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 4d4a4e2..b0224ce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,23 +17,22 @@ services: start_period: 10s tileserver: - image: ghcr.io/maptiler/tileserver-gl:latest + image: maptiler/tileserver-gl:latest container_name: rd13_tileserver ports: - "9983:8080" volumes: - - ./data/styles:/data/styles:ro + - ./config/tileserver.json:/data/config.json:ro + - ./config/styles:/data/styles:ro - ./data/fonts:/data/fonts:ro - ./data/sprites:/data/sprites:ro - environment: - - PMTILES_CACHE_DIR=/tmp/pmtiles-cache - - NODE_ENV=production + - ./data/osm.mbtiles:/data/osm.mbtiles:ro restart: unless-stopped healthcheck: - test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"] + test: ["CMD", "node", "-e", "require('http').get('http://localhost:8080/health', r => process.exit(r.statusCode === 200 ? 0 : 1))"] interval: 30s timeout: 10s retries: 3 - start_period: 10s + start_period: 30s depends_on: - martin