map: added OpenTopoMap layer
This commit is contained in:
parent
1793da1262
commit
33bdc41e7b
9 changed files with 35 additions and 6 deletions
|
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## <a id="unreleased"></a>[Unreleased]
|
## <a id="unreleased"></a>[Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Map: OpenTopoMap layer
|
||||||
|
|
||||||
## <a id="v1.11.13"></a>[v1.11.13] - 2024-09-17
|
## <a id="v1.11.13"></a>[v1.11.13] - 2024-09-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -238,6 +238,7 @@
|
||||||
"mapStyleGoogleNormal": "Google Maps",
|
"mapStyleGoogleNormal": "Google Maps",
|
||||||
"mapStyleGoogleHybrid": "Google Maps (Hybrid)",
|
"mapStyleGoogleHybrid": "Google Maps (Hybrid)",
|
||||||
"mapStyleGoogleTerrain": "Google Maps (Terrain)",
|
"mapStyleGoogleTerrain": "Google Maps (Terrain)",
|
||||||
|
"mapStyleOpenTopoMap": "OpenTopoMap",
|
||||||
"mapStyleOsmHot": "Humanitarian OSM",
|
"mapStyleOsmHot": "Humanitarian OSM",
|
||||||
"mapStyleStamenWatercolor": "Stamen Watercolor",
|
"mapStyleStamenWatercolor": "Stamen Watercolor",
|
||||||
|
|
||||||
|
@ -1032,6 +1033,7 @@
|
||||||
"mapZoomInTooltip": "Zoom in",
|
"mapZoomInTooltip": "Zoom in",
|
||||||
"mapZoomOutTooltip": "Zoom out",
|
"mapZoomOutTooltip": "Zoom out",
|
||||||
"mapPointNorthUpTooltip": "Point north up",
|
"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/)",
|
"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)",
|
"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",
|
"openMapPageTooltip": "View on Map page",
|
||||||
|
|
|
@ -14,11 +14,12 @@ extension ExtraEntryMapStyle on EntryMapStyle {
|
||||||
|
|
||||||
bool get needMobileService {
|
bool get needMobileService {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.googleNormal:
|
||||||
case EntryMapStyle.stamenWatercolor:
|
case EntryMapStyle.googleHybrid:
|
||||||
return false;
|
case EntryMapStyle.googleTerrain:
|
||||||
default:
|
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ extension ExtraEntryMapStyleView on EntryMapStyle {
|
||||||
EntryMapStyle.googleNormal => l10n.mapStyleGoogleNormal,
|
EntryMapStyle.googleNormal => l10n.mapStyleGoogleNormal,
|
||||||
EntryMapStyle.googleHybrid => l10n.mapStyleGoogleHybrid,
|
EntryMapStyle.googleHybrid => l10n.mapStyleGoogleHybrid,
|
||||||
EntryMapStyle.googleTerrain => l10n.mapStyleGoogleTerrain,
|
EntryMapStyle.googleTerrain => l10n.mapStyleGoogleTerrain,
|
||||||
|
EntryMapStyle.openTopoMap => l10n.mapStyleOpenTopoMap,
|
||||||
EntryMapStyle.osmHot => l10n.mapStyleOsmHot,
|
EntryMapStyle.osmHot => l10n.mapStyleOsmHot,
|
||||||
EntryMapStyle.stamenWatercolor => l10n.mapStyleStamenWatercolor,
|
EntryMapStyle.stamenWatercolor => l10n.mapStyleStamenWatercolor,
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,8 @@ class Attribution extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
switch (style) {
|
switch (style) {
|
||||||
|
case EntryMapStyle.openTopoMap:
|
||||||
|
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOpenTopoMap);
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.osmHot:
|
||||||
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOsmHot);
|
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOsmHot);
|
||||||
case EntryMapStyle.stamenWatercolor:
|
case EntryMapStyle.stamenWatercolor:
|
||||||
|
|
|
@ -185,6 +185,7 @@ class _GeoMapState extends State<GeoMap> {
|
||||||
onMarkerTap: _onMarkerTap,
|
onMarkerTap: _onMarkerTap,
|
||||||
onMarkerLongPress: onMarkerLongPress,
|
onMarkerLongPress: onMarkerLongPress,
|
||||||
);
|
);
|
||||||
|
case EntryMapStyle.openTopoMap:
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.osmHot:
|
||||||
case EntryMapStyle.stamenWatercolor:
|
case EntryMapStyle.stamenWatercolor:
|
||||||
child = EntryLeafletMap<AvesEntry>(
|
child = EntryLeafletMap<AvesEntry>(
|
||||||
|
|
|
@ -198,6 +198,8 @@ class _EntryLeafletMapState<T> extends State<EntryLeafletMap<T>> with TickerProv
|
||||||
|
|
||||||
Widget _buildMapLayer() {
|
Widget _buildMapLayer() {
|
||||||
switch (widget.style) {
|
switch (widget.style) {
|
||||||
|
case EntryMapStyle.openTopoMap:
|
||||||
|
return const OpenTopoMapLayer();
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.osmHot:
|
||||||
return const OSMHotLayer();
|
return const OSMHotLayer();
|
||||||
case EntryMapStyle.stamenWatercolor:
|
case EntryMapStyle.stamenWatercolor:
|
||||||
|
|
|
@ -2,6 +2,20 @@ import 'package:aves/model/device.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/flutter_map.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 {
|
class OSMHotLayer extends StatelessWidget {
|
||||||
const OSMHotLayer({super.key});
|
const OSMHotLayer({super.key});
|
||||||
|
|
||||||
|
@ -23,7 +37,6 @@ class StamenWatercolorLayer extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TileLayer(
|
return TileLayer(
|
||||||
urlTemplate: 'https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg',
|
urlTemplate: 'https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg',
|
||||||
subdomains: const ['a', 'b', 'c', 'd'],
|
|
||||||
retinaMode: MediaQuery.devicePixelRatioOf(context) > 1,
|
retinaMode: MediaQuery.devicePixelRatioOf(context) > 1,
|
||||||
userAgentPackageName: device.userAgent,
|
userAgentPackageName: device.userAgent,
|
||||||
);
|
);
|
||||||
|
|
|
@ -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 {
|
enum EntryMapStyle {
|
||||||
// Google
|
// Google
|
||||||
googleNormal,
|
googleNormal,
|
||||||
googleHybrid,
|
googleHybrid,
|
||||||
googleTerrain,
|
googleTerrain,
|
||||||
// Leaflet
|
// Leaflet
|
||||||
// browse providers at https://leaflet-extras.github.io/leaflet-providers/preview/
|
openTopoMap,
|
||||||
osmHot,
|
osmHot,
|
||||||
stamenWatercolor,
|
stamenWatercolor,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue