added OSM Americana vector tile provider
This commit is contained in:
parent
33bdc41e7b
commit
c48687b77c
10 changed files with 124 additions and 1 deletions
|
@ -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)",
|
||||||
|
"mapStyleOsmAmericana": "OSM Americana",
|
||||||
"mapStyleOpenTopoMap": "OpenTopoMap",
|
"mapStyleOpenTopoMap": "OpenTopoMap",
|
||||||
"mapStyleOsmHot": "Humanitarian OSM",
|
"mapStyleOsmHot": "Humanitarian OSM",
|
||||||
"mapStyleStamenWatercolor": "Stamen Watercolor",
|
"mapStyleStamenWatercolor": "Stamen Watercolor",
|
||||||
|
@ -1033,6 +1034,7 @@
|
||||||
"mapZoomInTooltip": "Zoom in",
|
"mapZoomInTooltip": "Zoom in",
|
||||||
"mapZoomOutTooltip": "Zoom out",
|
"mapZoomOutTooltip": "Zoom out",
|
||||||
"mapPointNorthUpTooltip": "Point north up",
|
"mapPointNorthUpTooltip": "Point north up",
|
||||||
|
"mapAttributionOsmAmericana": "Map data © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors • Tiles by [OpenMapTiles](https://www.openmaptiles.org/), [CC BY](http://creativecommons.org/licenses/by/4.0)",
|
||||||
"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/)",
|
"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)",
|
||||||
|
|
|
@ -284,6 +284,11 @@ class Dependencies {
|
||||||
license: mit,
|
license: mit,
|
||||||
sourceUrl: 'https://github.com/Milad-Akarie/smooth_page_indicator',
|
sourceUrl: 'https://github.com/Milad-Akarie/smooth_page_indicator',
|
||||||
),
|
),
|
||||||
|
Dependency(
|
||||||
|
name: 'Vector Map Tiles',
|
||||||
|
license: bsd3,
|
||||||
|
sourceUrl: 'https://github.com/greensopinion/flutter-vector-map-tiles',
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
static const List<Dependency> dartPackages = [
|
static const List<Dependency> dartPackages = [
|
||||||
|
|
|
@ -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.osmAmericana => l10n.mapStyleOsmAmericana,
|
||||||
EntryMapStyle.openTopoMap => l10n.mapStyleOpenTopoMap,
|
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.osmAmericana:
|
||||||
|
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOsmAmericana);
|
||||||
case EntryMapStyle.openTopoMap:
|
case EntryMapStyle.openTopoMap:
|
||||||
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOpenTopoMap);
|
return _buildAttributionMarkdown(context, context.l10n.mapAttributionOpenTopoMap);
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.osmHot:
|
||||||
|
|
|
@ -185,6 +185,7 @@ class _GeoMapState extends State<GeoMap> {
|
||||||
onMarkerTap: _onMarkerTap,
|
onMarkerTap: _onMarkerTap,
|
||||||
onMarkerLongPress: onMarkerLongPress,
|
onMarkerLongPress: onMarkerLongPress,
|
||||||
);
|
);
|
||||||
|
case EntryMapStyle.osmAmericana:
|
||||||
case EntryMapStyle.openTopoMap:
|
case EntryMapStyle.openTopoMap:
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.osmHot:
|
||||||
case EntryMapStyle.stamenWatercolor:
|
case EntryMapStyle.stamenWatercolor:
|
||||||
|
|
|
@ -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.osmAmericana:
|
||||||
|
return const OsmAmericanaLayer();
|
||||||
case EntryMapStyle.openTopoMap:
|
case EntryMapStyle.openTopoMap:
|
||||||
return const OpenTopoMapLayer();
|
return const OpenTopoMapLayer();
|
||||||
case EntryMapStyle.osmHot:
|
case EntryMapStyle.osmHot:
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:aves/model/device.dart';
|
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';
|
||||||
|
import 'package:vector_map_tiles/vector_map_tiles.dart';
|
||||||
|
import 'package:vector_tile_renderer/vector_tile_renderer.dart' as vtr;
|
||||||
|
|
||||||
class OpenTopoMapLayer extends StatelessWidget {
|
class OpenTopoMapLayer extends StatelessWidget {
|
||||||
const OpenTopoMapLayer({super.key});
|
const OpenTopoMapLayer({super.key});
|
||||||
|
@ -42,3 +44,42 @@ class StamenWatercolorLayer extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class OsmAmericanaLayer extends StatefulWidget {
|
||||||
|
const OsmAmericanaLayer({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<OsmAmericanaLayer> createState() => _OsmAmericanaLayerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _OsmAmericanaLayerState extends State<OsmAmericanaLayer> {
|
||||||
|
late final Future<Style> _styleFuture;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_styleFuture = StyleReader(
|
||||||
|
uri: 'https://americanamap.org/style.json',
|
||||||
|
logger: const vtr.Logger.console(),
|
||||||
|
).read();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FutureBuilder<Style>(
|
||||||
|
future: _styleFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasError) return Text(snapshot.error.toString());
|
||||||
|
|
||||||
|
final style = snapshot.data;
|
||||||
|
if (style == null) return const SizedBox();
|
||||||
|
|
||||||
|
return VectorTileLayer(
|
||||||
|
tileProviders: style.providers,
|
||||||
|
theme: style.theme,
|
||||||
|
sprites: style.sprites,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
// OSM raster tile providers: https://wiki.openstreetmap.org/wiki/Raster_tile_providers
|
// OSM raster tile providers: https://wiki.openstreetmap.org/wiki/Raster_tile_providers
|
||||||
// OSM vector tile providers: https://wiki.openstreetmap.org/wiki/Vector_tiles#Providers
|
// OSM vector tile providers: https://wiki.openstreetmap.org/wiki/Vector_tiles#Providers
|
||||||
// Leaflet providers preview: https://leaflet-extras.github.io/leaflet-providers/preview/
|
// Leaflet providers preview: https://leaflet-extras.github.io/leaflet-providers/preview/
|
||||||
|
// OpenMapTiles styles: https://openmaptiles.org/styles/
|
||||||
enum EntryMapStyle {
|
enum EntryMapStyle {
|
||||||
// Google
|
// Google
|
||||||
googleNormal,
|
googleNormal,
|
||||||
googleHybrid,
|
googleHybrid,
|
||||||
googleTerrain,
|
googleTerrain,
|
||||||
// Leaflet
|
// Vector (OpenMapTiles)
|
||||||
|
osmAmericana,
|
||||||
|
// Raster (Leaflet)
|
||||||
openTopoMap,
|
openTopoMap,
|
||||||
osmHot,
|
osmHot,
|
||||||
stamenWatercolor,
|
stamenWatercolor,
|
||||||
|
|
63
pubspec.lock
63
pubspec.lock
|
@ -347,6 +347,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
|
executor_lib:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: executor_lib
|
||||||
|
sha256: "544889daa5726462657dab6410b75f2f8e3a77479d85b307a25c346e243bc38e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
expansion_tile_card:
|
expansion_tile_card:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1062,6 +1070,30 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
|
path_provider:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider
|
||||||
|
sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.4"
|
||||||
|
path_provider_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_android
|
||||||
|
sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.10"
|
||||||
|
path_provider_foundation:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_foundation
|
||||||
|
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.4.0"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1238,6 +1270,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
|
protobuf:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: protobuf
|
||||||
|
sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
provider:
|
provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1676,6 +1716,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.5.0"
|
version: "4.5.0"
|
||||||
|
vector_map_tiles:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: vector_map_tiles
|
||||||
|
sha256: "4dc9243195c1a49c7be82cc1caed0d300242bb94381752af5f6868d9d1404e25"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.0.0"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1684,6 +1732,21 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
|
vector_tile:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vector_tile
|
||||||
|
sha256: "3adb04426f3aebefce56f3fdf8ab2e23cc9f7d5b06ff8ca33ae87e3a1e441874"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
|
vector_tile_renderer:
|
||||||
|
dependency: "direct overridden"
|
||||||
|
description:
|
||||||
|
path: "../dart-vector-tile-renderer"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "5.2.0"
|
||||||
vm_service:
|
vm_service:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -111,6 +111,7 @@ dependencies:
|
||||||
url: https://github.com/deckerst/aves_streams_channel.git
|
url: https://github.com/deckerst/aves_streams_channel.git
|
||||||
transparent_image:
|
transparent_image:
|
||||||
url_launcher:
|
url_launcher:
|
||||||
|
vector_map_tiles:
|
||||||
vector_math:
|
vector_math:
|
||||||
volume_controller:
|
volume_controller:
|
||||||
xml:
|
xml:
|
||||||
|
@ -119,6 +120,8 @@ dependency_overrides:
|
||||||
# media_kit_video v1.2.4 depends on a specific old version of screen_brightness
|
# media_kit_video v1.2.4 depends on a specific old version of screen_brightness
|
||||||
media_kit_video: ^1.0.0
|
media_kit_video: ^1.0.0
|
||||||
screen_brightness: ^1.0.0
|
screen_brightness: ^1.0.0
|
||||||
|
vector_tile_renderer:
|
||||||
|
path: ../dart-vector-tile-renderer
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in a new issue