diff --git a/CHANGELOG.md b/CHANGELOG.md
index 752ec0678..a375b5a78 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
+### Added
+
+- Map: OpenTopoMap layer
+
## [v1.11.13] - 2024-09-17
### Added
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index bc217fb55..cad19c9e2 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -238,6 +238,7 @@
"mapStyleGoogleNormal": "Google Maps",
"mapStyleGoogleHybrid": "Google Maps (Hybrid)",
"mapStyleGoogleTerrain": "Google Maps (Terrain)",
+ "mapStyleOpenTopoMap": "OpenTopoMap",
"mapStyleOsmHot": "Humanitarian OSM",
"mapStyleStamenWatercolor": "Stamen Watercolor",
@@ -1032,6 +1033,7 @@
"mapZoomInTooltip": "Zoom in",
"mapZoomOutTooltip": "Zoom out",
"mapPointNorthUpTooltip": "Point north up",
+ "mapAttributionOpenTopoMap": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • [SRTM](https://www.earthdata.nasa.gov/sensors/srtm) | Tiles by [OpenTopoMap](https://opentopomap.org/), [CC BY-SA](https://creativecommons.org/licenses/by-sa/3.0/)",
"mapAttributionOsmHot": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [HOT](https://www.hotosm.org/) • Hosted by [OSM France](https://openstreetmap.fr/)",
"mapAttributionStamen": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [Stamen Design](https://stamen.com), [CC BY 3.0](https://creativecommons.org/licenses/by/3.0)",
"openMapPageTooltip": "View on Map page",
diff --git a/lib/model/settings/enums/map_style.dart b/lib/model/settings/enums/map_style.dart
index a10231bfa..a172459e6 100644
--- a/lib/model/settings/enums/map_style.dart
+++ b/lib/model/settings/enums/map_style.dart
@@ -14,11 +14,12 @@ extension ExtraEntryMapStyle on EntryMapStyle {
bool get needMobileService {
switch (this) {
- case EntryMapStyle.osmHot:
- case EntryMapStyle.stamenWatercolor:
- return false;
- default:
+ case EntryMapStyle.googleNormal:
+ case EntryMapStyle.googleHybrid:
+ case EntryMapStyle.googleTerrain:
return true;
+ default:
+ return false;
}
}
}
diff --git a/lib/view/src/settings/enums.dart b/lib/view/src/settings/enums.dart
index 12f15e10c..84ff9248c 100644
--- a/lib/view/src/settings/enums.dart
+++ b/lib/view/src/settings/enums.dart
@@ -68,6 +68,7 @@ extension ExtraEntryMapStyleView on EntryMapStyle {
EntryMapStyle.googleNormal => l10n.mapStyleGoogleNormal,
EntryMapStyle.googleHybrid => l10n.mapStyleGoogleHybrid,
EntryMapStyle.googleTerrain => l10n.mapStyleGoogleTerrain,
+ EntryMapStyle.openTopoMap => l10n.mapStyleOpenTopoMap,
EntryMapStyle.osmHot => l10n.mapStyleOsmHot,
EntryMapStyle.stamenWatercolor => l10n.mapStyleStamenWatercolor,
};
diff --git a/lib/widgets/common/map/attribution.dart b/lib/widgets/common/map/attribution.dart
index e050d8a99..c4a9d40d7 100644
--- a/lib/widgets/common/map/attribution.dart
+++ b/lib/widgets/common/map/attribution.dart
@@ -16,6 +16,8 @@ class Attribution extends StatelessWidget {
@override
Widget build(BuildContext context) {
switch (style) {
+ case EntryMapStyle.openTopoMap:
+ return _buildAttributionMarkdown(context, context.l10n.mapAttributionOpenTopoMap);
case EntryMapStyle.osmHot:
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOsmHot);
case EntryMapStyle.stamenWatercolor:
diff --git a/lib/widgets/common/map/geo_map.dart b/lib/widgets/common/map/geo_map.dart
index 402d69ade..f2cbdda57 100644
--- a/lib/widgets/common/map/geo_map.dart
+++ b/lib/widgets/common/map/geo_map.dart
@@ -185,6 +185,7 @@ class _GeoMapState extends State {
onMarkerTap: _onMarkerTap,
onMarkerLongPress: onMarkerLongPress,
);
+ case EntryMapStyle.openTopoMap:
case EntryMapStyle.osmHot:
case EntryMapStyle.stamenWatercolor:
child = EntryLeafletMap(
diff --git a/lib/widgets/common/map/leaflet/map.dart b/lib/widgets/common/map/leaflet/map.dart
index cca10254c..b37a63dd9 100644
--- a/lib/widgets/common/map/leaflet/map.dart
+++ b/lib/widgets/common/map/leaflet/map.dart
@@ -198,6 +198,8 @@ class _EntryLeafletMapState extends State> with TickerProv
Widget _buildMapLayer() {
switch (widget.style) {
+ case EntryMapStyle.openTopoMap:
+ return const OpenTopoMapLayer();
case EntryMapStyle.osmHot:
return const OSMHotLayer();
case EntryMapStyle.stamenWatercolor:
diff --git a/lib/widgets/common/map/leaflet/tile_layers.dart b/lib/widgets/common/map/leaflet/tile_layers.dart
index 9fa2e26df..94b4b69db 100644
--- a/lib/widgets/common/map/leaflet/tile_layers.dart
+++ b/lib/widgets/common/map/leaflet/tile_layers.dart
@@ -2,6 +2,20 @@ import 'package:aves/model/device.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
+class OpenTopoMapLayer extends StatelessWidget {
+ const OpenTopoMapLayer({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return TileLayer(
+ urlTemplate: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
+ subdomains: const ['a', 'b', 'c'],
+ retinaMode: MediaQuery.devicePixelRatioOf(context) > 1,
+ userAgentPackageName: device.userAgent,
+ );
+ }
+}
+
class OSMHotLayer extends StatelessWidget {
const OSMHotLayer({super.key});
@@ -23,7 +37,6 @@ class StamenWatercolorLayer extends StatelessWidget {
Widget build(BuildContext context) {
return TileLayer(
urlTemplate: 'https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg',
- subdomains: const ['a', 'b', 'c', 'd'],
retinaMode: MediaQuery.devicePixelRatioOf(context) > 1,
userAgentPackageName: device.userAgent,
);
diff --git a/plugins/aves_map/lib/src/style.dart b/plugins/aves_map/lib/src/style.dart
index 70b36f828..fbd7926d5 100644
--- a/plugins/aves_map/lib/src/style.dart
+++ b/plugins/aves_map/lib/src/style.dart
@@ -1,10 +1,13 @@
+// OSM raster tile providers: https://wiki.openstreetmap.org/wiki/Raster_tile_providers
+// OSM vector tile providers: https://wiki.openstreetmap.org/wiki/Vector_tiles#Providers
+// Leaflet providers preview: https://leaflet-extras.github.io/leaflet-providers/preview/
enum EntryMapStyle {
// Google
googleNormal,
googleHybrid,
googleTerrain,
// Leaflet
- // browse providers at https://leaflet-extras.github.io/leaflet-providers/preview/
+ openTopoMap,
osmHot,
stamenWatercolor,
}