diff --git a/.gitignore b/.gitignore index 306a408..f511187 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ node_modules/ .claude/ +# MapProxy tile cache +tiles/cache/ + # TODO: where does this rule come from? docs/_book diff --git a/frontend/App.vue b/frontend/App.vue index 6df6f09..3df7a7d 100644 --- a/frontend/App.vue +++ b/frontend/App.vue @@ -268,7 +268,7 @@ function initMap() { attributionControl: false }) - L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', { + L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', { maxZoom: 18, subdomains: 'abcd' }).addTo(map) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 34e186c..4d086e3 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -28,7 +28,13 @@ export default defineConfig({ } ], server: { - port: 5173 + port: 5173, + proxy: { + '/tiles': { + target: 'http://localhost:8080', + changeOrigin: true + } + } }, build: { outDir: resolve(__dirname, '../dist') diff --git a/tiles/docker-compose.yml b/tiles/docker-compose.yml new file mode 100644 index 0000000..461a0be --- /dev/null +++ b/tiles/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + mapproxy: + image: kartoza/mapproxy:latest + ports: + - "8080:8080" + volumes: + - ./mapproxy/mapproxy.yaml:/srv/mapproxy/mapproxy.yaml + - ./mapproxy/seed.yaml:/srv/mapproxy/seed.yaml + - ./cache:/srv/mapproxy/cache_data + environment: + - MAPPROXY_PROCESSES=4 + restart: unless-stopped diff --git a/tiles/mapproxy/mapproxy.yaml b/tiles/mapproxy/mapproxy.yaml new file mode 100644 index 0000000..a8951f5 --- /dev/null +++ b/tiles/mapproxy/mapproxy.yaml @@ -0,0 +1,34 @@ +services: + tms: + grids: [GLOBAL_WEBMERCATOR] + origin: nw + restful: true + +layers: + - name: stamen_watercolor + title: Stamen Watercolor (Cached) + sources: [stamen_watercolor_cache] + +caches: + stamen_watercolor_cache: + grids: [GLOBAL_WEBMERCATOR] + sources: [stamen_watercolor_source] + cache: + type: file + directory: /srv/mapproxy/cache_data/stamen_watercolor + +sources: + stamen_watercolor_source: + type: tile + url: https://tiles.stadiamaps.com/tiles/stamen_watercolor/%(z)s/%(x)s/%(y)s.jpg + grid: GLOBAL_WEBMERCATOR + +grids: + GLOBAL_WEBMERCATOR: + srs: EPSG:3857 + origin: nw + +globals: + cache: + base_dir: /srv/mapproxy/cache_data + lock_dir: /srv/mapproxy/cache_data/.locks diff --git a/tiles/mapproxy/seed.yaml b/tiles/mapproxy/seed.yaml new file mode 100644 index 0000000..29ad3a7 --- /dev/null +++ b/tiles/mapproxy/seed.yaml @@ -0,0 +1,13 @@ +seeds: + stamen_watercolor_seed: + caches: [stamen_watercolor_cache] + grids: [GLOBAL_WEBMERCATOR] + coverages: [china_coverage] + levels: + from: 1 + to: 10 + +coverages: + china_coverage: + bbox: [73.0, 18.0, 135.0, 54.0] + srs: EPSG:4326