diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index ae1bb59..6f3949b 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -77,7 +77,9 @@ services: - "3001:3001" environment: DATABASE_URL: "postgres://maps:maps@postgres:5432/maps" - command: ["--listen-addresses", "0.0.0.0:3001"] + volumes: + - ./martin-config.yaml:/config.yaml:ro + command: ["--config", "/config.yaml"] depends_on: - postgres diff --git a/backend/src/routes/tiles.rs b/backend/src/routes/tiles.rs index 7d51839..c28d31e 100644 --- a/backend/src/routes/tiles.rs +++ b/backend/src/routes/tiles.rs @@ -20,6 +20,7 @@ const VALID_LAYERS: &[&str] = &[ "planet_osm_line", "planet_osm_point", "planet_osm_roads", + "osm_all", "pois", ]; @@ -99,27 +100,9 @@ pub async fn get_style( "version": 8, "name": "Privacy Maps", "sources": { - "planet_osm_polygon": { + "osm_all": { "type": "vector", - "tiles": [format!("{base}/tiles/planet_osm_polygon/{{z}}/{{x}}/{{y}}.pbf")], - "minzoom": 0, - "maxzoom": 14 - }, - "planet_osm_line": { - "type": "vector", - "tiles": [format!("{base}/tiles/planet_osm_line/{{z}}/{{x}}/{{y}}.pbf")], - "minzoom": 0, - "maxzoom": 14 - }, - "planet_osm_point": { - "type": "vector", - "tiles": [format!("{base}/tiles/planet_osm_point/{{z}}/{{x}}/{{y}}.pbf")], - "minzoom": 0, - "maxzoom": 14 - }, - "planet_osm_roads": { - "type": "vector", - "tiles": [format!("{base}/tiles/planet_osm_roads/{{z}}/{{x}}/{{y}}.pbf")], + "tiles": [format!("{base}/tiles/osm_all/{{z}}/{{x}}/{{y}}.pbf")], "minzoom": 0, "maxzoom": 14 } @@ -127,24 +110,24 @@ pub async fn get_style( "layers": [ { "id": "background", "type": "background", "paint": { "background-color": "#f0ebe3" } }, - { "id": "landuse", "type": "fill", "source": "planet_osm_polygon", + { "id": "landuse", "type": "fill", "source": "osm_all", "source-layer": "planet_osm_polygon", "paint": { "fill-color": "#d4e5c9", "fill-opacity": 0.6 } }, - { "id": "water", "type": "fill", "source": "planet_osm_polygon", + { "id": "water", "type": "fill", "source": "osm_all", "source-layer": "planet_osm_polygon", "filter": ["==", "natural", "water"], "paint": { "fill-color": "#a0c8f0" } }, - { "id": "roads-minor", "type": "line", "source": "planet_osm_line", + { "id": "roads-minor", "type": "line", "source": "osm_all", "source-layer": "planet_osm_line", "paint": { "line-color": "#ccc", "line-width": 1 } }, - { "id": "roads-main", "type": "line", "source": "planet_osm_roads", + { "id": "roads-main", "type": "line", "source": "osm_all", "source-layer": "planet_osm_roads", "paint": { "line-color": "#f5a623", "line-width": 2 } }, - { "id": "buildings", "type": "fill", "source": "planet_osm_polygon", + { "id": "buildings", "type": "fill", "source": "osm_all", "source-layer": "planet_osm_polygon", "filter": ["has", "building"], "paint": { "fill-color": "#d9d0c7", "fill-outline-color": "#bbb" } }, - { "id": "road-names", "type": "symbol", "source": "planet_osm_line", + { "id": "road-names", "type": "symbol", "source": "osm_all", "source-layer": "planet_osm_line", "minzoom": 13, "filter": ["has", "name"], @@ -162,7 +145,7 @@ pub async fn get_style( "text-halo-width": 1.5 } }, - { "id": "place-names", "type": "symbol", "source": "planet_osm_point", + { "id": "place-names", "type": "symbol", "source": "osm_all", "source-layer": "planet_osm_point", "minzoom": 10, "filter": ["all", ["has", "name"], ["has", "place"]], diff --git a/mobile/lib/features/map/presentation/screens/map_screen.dart b/mobile/lib/features/map/presentation/screens/map_screen.dart index 8ce1053..ce03ec4 100644 --- a/mobile/lib/features/map/presentation/screens/map_screen.dart +++ b/mobile/lib/features/map/presentation/screens/map_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:vector_map_tiles/vector_map_tiles.dart'; import '../../../../core/api/api_client.dart'; import '../../providers/map_provider.dart'; @@ -76,6 +77,10 @@ class _MapScreenState extends ConsumerState { tileProviders: style.providers, theme: style.theme, concurrency: 4, + memoryTileCacheMaxSize: 20 * 1024 * 1024, // 20 MB raw tiles + memoryTileDataCacheMaxSize: 50, // 50 parsed tiles + fileCacheMaximumSizeInBytes: 50 * 1024 * 1024, // 50 MB on disk + cacheFolder: () => getApplicationCacheDirectory(), ), loading: () => const SizedBox.shrink(), error: (e, _) => const SizedBox.shrink(),