diff --git a/.gitignore b/.gitignore index 20bbbd4..52d1cbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,31 @@ -# https://dart.dev/guides/libraries/private-files -# Created by `dart pub` -.dart_tool/ - -# Avoid committing pubspec.lock for library packages; see -# https://dart.dev/guides/libraries/private-files#pubspeclock. -pubspec.lock +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ +# IntelliJ related +*.iml +*.ipr +*.iws .idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock +**/doc/api/ +.dart_tool/ +build/ +.flutter-plugins +.flutter-plugins-dependencies \ No newline at end of file diff --git a/README.md b/README.md index b9fb2d8..6e86432 100644 --- a/README.md +++ b/README.md @@ -1,232 +1,32 @@ -# flutter_map_cache +This repository contains multiple flutter packages that extend the +functionality of [flutter_map](https://pub.dev/packages/flutter_map). -A slim yet powerful caching plugin for flutter_map tile layers. +A combined example app can be found under +[./example](https://github.com/josxha/flutter_map_plugins). -Many tile providers require users in their tile usage policy to cache -tile requests. This lowers the load on those servers and provides a better -experience to users. +### [flutter_map_cache](https://pub.dev/packages/flutter_map_cache) -![Pub Likes](https://img.shields.io/pub/likes/flutter_map_cache) -![Pub Points](https://img.shields.io/pub/points/flutter_map_cache) -![Pub Popularity](https://img.shields.io/pub/popularity/flutter_map_cache) -![Pub Version](https://img.shields.io/pub/v/flutter_map_cache) +### [flutter_map_pmtiles](https://pub.dev/packages/flutter_map_pmtiles) -![GitHub last commit](https://img.shields.io/github/last-commit/josxha/flutter_map_cache) -![GitHub issues](https://img.shields.io/github/issues/josxha/flutter_map_cache) -![GitHub Repo stars](https://img.shields.io/github/stars/josxha/flutter_map_cache?style=social) +This package provides the `PmTilesTileProvider` that can be used with +flutter_map tile layers. -## Features +- This package uses [pmtiles](https://pub.dev/packages/pmtiles) under the hood + for the PMTiles support. +- PMTiles is an open archive format for pyramids of tile data, accessible via + HTTP Range Requests. Head over to [protomaps.com](https://protomaps.com/) to + learn more about + PMTiles. -The package uses [dio](https://pub.dev/packages/dio) with the -[dio_cache_interceptor](https://pub.dev/packages/dio_cache_interceptor) package -and supports the storage backend that -you like. +### [vector_map_tiles_pmtiles](https://pub.dev/packages/vector_map_tiles_pmtiles) -Supported storage backends are: +This package provides the `PmTilesVectorTileProvider` that can be used with +the [vector_map_tiles](https://pub.dev/packages/vector_map_tiles) which itself +adds support for vector tiles to flutter_map. -| Storage backend | Description | -|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------| -| In-Memory | - For testing purposes
- `flutter_map` has memory caching itself | -| File System | - Easy to setup, no additional storage backend package required
- potentially slower than using a database | -| [Drift](https://pub.dev/packages/drift) | - SQLite database
- good platform support | -| [Hive](https://pub.dev/packages/hive) | - key-value database
- easy to integrate | -| [ObjectBox](https://pub.dev/packages/objectbox) | - NoSQL, ACID compliant
- Fast library
- More complex integration | -| [Isar](https://pub.dev/packages/isar) | - NoSQL
- Fast library
- More complex integration | - -Other storage backends will be supported as soon as the underlying package -[dio_cache_interceptor](https://pub.dev/packages/dio_cache_interceptor) supports -them. - -## Getting started - -1. Add the packages you want to use to your `pubspec.yaml` file. Only add the - packages for the backend you want to use. - -```yaml -dependencies: - flutter_map: ^6.0.0 # in case you don't have it yet - flutter_map_cache: ^1.3.0 # this package - path_provider: ^2.1.2 # in case the storage backend requires a path - - # drift - dio_cache_interceptor_db_store: ^5.1.0 - sqlite3_flutter_libs: ^0.5.15 - - # file system - dio_cache_interceptor_file_store: ^1.2.2 - - # hive - dio_cache_interceptor_hive_store: ^3.2.1 - - # objectbox - dio_cache_interceptor_objectbox_store: ^1.1.3 - objectbox_flutter_libs: ^1.4.1 - - # isar - isar: ^3.1.0+1 - isar_flutter_libs: ^3.1.0+1 -``` - -2. ⚠️ Some storage backends have their own required setups. Please check them - out in their package documentations. - -## Usage - -Using the cache is easy. Here is an example how to use the **Hive** backend: - -1. First get the cache directory of the app (i.e. with - the [path_provider](https://pub.dev/packages/path_provider) - package). - -```dart -import 'package:path_provider/path_provider.dart'; - -Future getPath() async { - final cacheDirectory = await getTemporaryDirectory(); - return cacheDirectory.path; -} -``` - -2. Then use the directory path to initialize the `HiveCacheStore`. You can wrap - FlutterMap inside a `FutureBuilder` to use - the `getPath()` method. - -```dart -@override -Widget build(BuildContext context) { - return FlutterMap( - options: MapOptions(), - children: [ - TileLayer( - urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - tileProvider: CachedTileProvider( - // maxStale keeps the tile cached for the given Duration and - // tries to revalidate the next time it gets requested - maxStale: const Duration(days: 30), - store: HiveCacheStore( - path, - hiveBoxName: 'HiveCacheStore', - ), - ), - ), - ], - ); -} -``` - -You can find additional example usages for other storage backends here: - -- [In Memory (for testing)](https://github.com/josxha/flutter_map_cache/wiki/Use-the-In%E2%80%90Memory-Store-(for-testing)) -- [File System](https://github.com/josxha/flutter_map_cache/wiki/Use-the-File-System) - -...or check out -[the example app](https://github.com/josxha/flutter_map_cache/tree/main/example) -on GitHub for a full example implementation of most storage backends. - -## Common use cases & frequent questions - -### How about web? - -
- Click here to expand. - -This package supports the web as long as you use a storage backend that supports -web. - -- In Memory works out of the box -- Hive uses for its web support IndexedDB under the hood to support web. -- Drift (SqLite) - requires [additional setup steps for web](https://drift.simonbinder.eu/web/) - ---- -
- -### Does this package support cancellation of tile requests? - -
- Click here to expand. - -Yes. This package includes the tile cancellation that would otherwise be -provided -by [flutter_map_cancellable_tile_provider](https://pub.dev/packages/flutter_map_cancellable_tile_provider/) -out of the box. - ---- -
- -### Remove the api key from the url before it gets used for caching - -
- Click here to expand. - -Commercial tile providers often use an api key that is attached as a parameter -to the url. While this shouldn't be a problem when the api key stays the same -you might want to make it immune to api key changes anyway. - -``` -final _uuid = Uuid(); - -CachedTileProvider( - keyBuilder: (request) { - return _uuid.v5( - Uuid.NAMESPACE_URL, - request.uri.replace(queryParameters: {}).toString(), - ); - }, -), -``` - ---- -
- -### How about pre-downloading, bulk-downloading or offline map? - -
- Click here to expand. - -This package does not provide support to download tiles automatically. -Only tiles that were previously visited with an active internet connection -show up on the map. - -If you need bulk-downloading functionality you can check out the package -[flutter_map_tile_caching](https://pub.dev/packages/flutter_map_tile_caching) -(Paid license is needed or your project has to be open sourced under the -GPL-3.0 license). - -Please note that free tile providers such as -[OpenStreetMap](https://www.openstreetmap.org/) forbids bulk -downloading (more than 250 tiles on a higher zoom level) of tiles in their -[tile usage policy](https://operations.osmfoundation.org/policies/tiles/). -If you use a paid tile provider, bulk-downloading can cause high costs if -you pay per tile request. Using a proper offline map solution (e.g. MBTiles) -would be my recommendation here. - ---- -
- -### What if I want to use sqflite? - -
- Click here to expand. - -Because [dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor) -already supports Drift as a SQLite solution it's unlikely that sqflite will -be supported any day soon. - -If you still are required to use only sqflite, I recommend to create your own -tile provider by using the -[cached_network_image](https://pub.dev/packages/cached_network_image) package. - ---- -
- -## Additional information - -Pull requests are welcome. If you want to add support for another storage -backend you can check out -[dio_cache_interceptor](https://github.com/llfbandit/dio_cache_interceptor). - -If you need help you -can [open an issue](https://github.com/josxha/flutter_map_cache/issues/new/choose) -or join -the [`flutter_map` discord server](https://discord.gg/BwpEsjqMAH). +- This package uses [pmtiles](https://pub.dev/packages/pmtiles) under the hood + for the PMTiles support. +- PMTiles is an open archive format for pyramids of tile data, accessible via + HTTP Range Requests. Head over to [protomaps.com](https://protomaps.com/) to + learn more about + PMTiles. \ No newline at end of file diff --git a/example/.metadata b/example/.metadata index 2e239db..b5c370f 100644 --- a/example/.metadata +++ b/example/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - channel: stable + revision: "41456452f29d64e8deb623a3c927524bcf9f111b" + channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: android - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: ios - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: linux - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: macos - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: web - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: windows - create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 - base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2 + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b # User provided section diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..9f28fb7 --- /dev/null +++ b/example/README.md @@ -0,0 +1 @@ +Example app for all flutter_map_plugins \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 3dd4da6..118ee1d 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,12 +22,8 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - namespace "com.github.josxha.example" + namespace "com.example.example" compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion @@ -44,10 +41,11 @@ android { } defaultConfig { - applicationId "com.github.josxha.flutter_map_cache_example" + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion 19 // connectivity_plus requires at least version 19, default: flutter.minSdkVersion + minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -66,6 +64,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 519a499..19b862e 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,24 +1,24 @@ + android:label="example" + android:name="${applicationName}" + android:icon="@mipmap/ic_launcher"> + android:name=".MainActivity" + android:exported="true" + android:launchMode="singleTop" + android:theme="@style/LaunchTheme" + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" + android:hardwareAccelerated="true" + android:windowSoftInputMode="adjustResize"> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> @@ -27,7 +27,7 @@ + android:name="flutterEmbedding" + android:value="2" /> diff --git a/example/android/app/src/main/kotlin/com/github/josxha/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt similarity index 73% rename from example/android/app/src/main/kotlin/com/github/josxha/example/MainActivity.kt rename to example/android/app/src/main/kotlin/com/example/example/MainActivity.kt index cd9ec8d..e793a00 100644 --- a/example/android/app/src/main/kotlin/com/github/josxha/example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -1,4 +1,4 @@ -package com.github.josxha.example +package com.example.example import io.flutter.embedding.android.FlutterActivity diff --git a/example/android/build.gradle b/example/android/build.gradle index f7eb7f6..e83fb5d 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -6,7 +6,6 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 94adc3a..598d13f 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index dcf0f19..3c472b9 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 44e62bc..7cd7128 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,11 +1,29 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false +} + +include ":app" diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9625e10..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 52f2d61..69cdaed 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -168,7 +168,8 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 331C8080294A63A400263BE5 = { @@ -344,7 +345,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -366,7 +367,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -383,7 +384,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -401,7 +402,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -417,7 +418,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -471,7 +472,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -520,7 +521,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -544,7 +545,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -566,7 +567,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e42adcb..87131a0 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight - UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone UIApplicationSupportsIndirectInputEvents diff --git a/example/lib/example_app_wrapper.dart b/example/lib/example_app_wrapper.dart deleted file mode 100644 index 0cd5508..0000000 --- a/example/lib/example_app_wrapper.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_map_cache_example/connectivity_icon.dart'; - -class ExampleAppWrapper extends StatelessWidget { - final Widget child; - - const ExampleAppWrapper({required this.child, super.key}); - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'FlutterMap Cache', - debugShowCheckedModeBanner: false, - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.white), - useMaterial3: true, - ), - home: Scaffold( - appBar: AppBar( - title: const Text('FlutterMap Cache'), - actions: const [ConnectivityIcon()], - ), - body: child, - ), - ); - } -} diff --git a/example/lib/cache_store_types.dart b/example/lib/flutter_map_cache/cache_store_types.dart similarity index 100% rename from example/lib/cache_store_types.dart rename to example/lib/flutter_map_cache/cache_store_types.dart diff --git a/example/lib/connectivity_icon.dart b/example/lib/flutter_map_cache/connectivity_icon.dart similarity index 100% rename from example/lib/connectivity_icon.dart rename to example/lib/flutter_map_cache/connectivity_icon.dart diff --git a/example/lib/flutter_map_cache/page.dart b/example/lib/flutter_map_cache/page.dart new file mode 100644 index 0000000..fdd2356 --- /dev/null +++ b/example/lib/flutter_map_cache/page.dart @@ -0,0 +1,120 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:flutter_map_cache/flutter_map_cache.dart'; +import 'package:flutter_map_plugins_example/flutter_map_cache/cache_store_types.dart'; +import 'package:flutter_map_plugins_example/flutter_map_cache/connectivity_icon.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:path_provider/path_provider.dart'; + +class FlutterMapCachePage extends StatefulWidget { + const FlutterMapCachePage({super.key}); + + @override + State createState() => _FlutterMapCachePageState(); +} + +class _FlutterMapCachePageState extends State { + CacheStore _cacheStore = MemCacheStore(); + final _dio = Dio(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('FlutterMap Cache'), + actions: const [ConnectivityIcon()], + ), + body: Column( + children: [ + Expanded( + child: FlutterMap( + options: const MapOptions( + initialCenter: LatLng(47.141344, 9.553680), + interactionOptions: InteractionOptions( + flags: InteractiveFlag.all & ~InteractiveFlag.rotate, + ), + maxZoom: 16, + initialZoom: 8, + ), + children: [ + TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + tileProvider: CachedTileProvider( + dio: _dio, + maxStale: const Duration(days: 30), + store: _cacheStore, + interceptors: [ + LogInterceptor( + logPrint: (object) => debugPrint(object.toString()), + responseHeader: false, + requestHeader: false, + request: false, + ), + ], + ), + userAgentPackageName: 'com.github.josxha/flutter_map_cache', + ), + ], + ), + ), + Container( + color: Colors.white, + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + const Text('CacheStore Type'), + if (kIsWeb) + DropdownMenu( + initialSelection: CacheStoreTypes.memCache, + onSelected: (value) { + if (value == null) return; + debugPrint('CacheStore changed to ${value.name}'); + setState(() { + _cacheStore = value.getCacheStoreWeb(); + }); + }, + dropdownMenuEntries: CacheStoreTypes.dropdownList, + ), + if (!kIsWeb) + FutureBuilder( + // ignore: discarded_futures + future: getTemporaryDirectory(), // not available on web + builder: (context, snapshot) { + if (snapshot.hasData) { + final dataPath = snapshot.requireData.path; + return DropdownMenu( + initialSelection: CacheStoreTypes.memCache, + onSelected: (value) { + if (value == null) return; + debugPrint('CacheStore changed to ${value.name}'); + setState(() { + _cacheStore = value.getCacheStore(dataPath); + }); + }, + dropdownMenuEntries: CacheStoreTypes.dropdownList, + ); + } + if (snapshot.hasError) { + debugPrint(snapshot.error.toString()); + debugPrintStack(stackTrace: snapshot.stackTrace); + return Expanded( + child: Text(snapshot.error.toString()), + ); + } + return const Expanded(child: LinearProgressIndicator()); + }, + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/example/lib/flutter_map_pmtiles/page.dart b/example/lib/flutter_map_pmtiles/page.dart new file mode 100644 index 0000000..bb97218 --- /dev/null +++ b/example/lib/flutter_map_pmtiles/page.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:flutter_map_pmtiles/flutter_map_pmtiles.dart'; +import 'package:latlong2/latlong.dart'; + +class FlutterMapPmTilesPage extends StatefulWidget { + const FlutterMapPmTilesPage({super.key}); + + @override + State createState() => _FlutterMapPmTilesPageState(); +} + +// TODO: use your own tile source https://docs.protomaps.com/pmtiles/cloud-storage +const tileSource = + 'https://raw.githubusercontent.com/protomaps/PMTiles/main/spec/v3/stamen_toner(raster)CC-BY%2BODbL_z3.pmtiles'; + +class _FlutterMapPmTilesPageState extends State { + final Future _futureTileProvider = + PmTilesTileProvider.fromSource(tileSource); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.white, + title: const Text('flutter_map_pmtiles'), + ), + body: FutureBuilder( + future: _futureTileProvider, + builder: (context, snapshot) { + if (snapshot.hasData) { + final tileProvider = snapshot.data!; + return FlutterMap( + options: const MapOptions( + initialZoom: 1, + initialCenter: LatLng(0, 0), + maxZoom: 3.49, + ), + children: [ + TileLayer(tileProvider: tileProvider), + ], + ); + } + if (snapshot.hasError) { + debugPrint(snapshot.error.toString()); + debugPrintStack(stackTrace: snapshot.stackTrace); + return Center(child: Text(snapshot.error.toString())); + } + return const Center(child: CircularProgressIndicator()); + }, + ), + ); + } +} diff --git a/example/lib/main.dart b/example/lib/main.dart index 3019031..b60b0fa 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,111 +1,83 @@ -import 'dart:io'; - -import 'package:dio/dio.dart'; -import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_map/flutter_map.dart'; -import 'package:flutter_map_cache/flutter_map_cache.dart'; -import 'package:flutter_map_cache_example/cache_store_types.dart'; -import 'package:flutter_map_cache_example/example_app_wrapper.dart'; -import 'package:flutter_map_cache_example/misc.dart'; -import 'package:path_provider/path_provider.dart'; +import 'package:flutter_map_plugins_example/flutter_map_cache/page.dart'; +import 'package:flutter_map_plugins_example/flutter_map_pmtiles/page.dart'; +import 'package:flutter_map_plugins_example/vector_map_tiles_pmtiles/page.dart'; -void main() => runApp(const ExampleApp()); +void main() { + runApp(const MyApp()); +} -class ExampleApp extends StatefulWidget { - const ExampleApp({super.key}); +class MyApp extends StatelessWidget { + const MyApp({super.key}); @override - State createState() => _ExampleAppState(); + Widget build(BuildContext context) { + return MaterialApp( + title: 'flutter_map_plugins', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.white), + ), + home: const Material(child: SelectionPage()), + ); + } } -class _ExampleAppState extends State { - CacheStore _cacheStore = MemCacheStore(); - final _dio = Dio(); +class SelectionPage extends StatelessWidget { + const SelectionPage({super.key}); @override Widget build(BuildContext context) { - return ExampleAppWrapper( - child: Column( + return Padding( + padding: const EdgeInsets.all(8), + child: GridView.count( + crossAxisCount: 2, + childAspectRatio: 5, children: [ - Expanded( - child: FlutterMap( - options: mapOptions, - children: [ - TileLayer( - urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - tileProvider: CachedTileProvider( - dio: _dio, - maxStale: const Duration(days: 30), - store: _cacheStore, - interceptors: [ - LogInterceptor( - logPrint: (object) => debugPrint(object.toString()), - responseHeader: false, - requestHeader: false, - request: false, - ), - ], - ), - userAgentPackageName: 'com.github.josxha/flutter_map_cache', - ), - ], - ), + SelectionItemWidget( + title: 'flutter_map_cache', + desc: + 'A slim yet powerful caching plugin for flutter_map tile layers.', + pageBuilder: (context) => const FlutterMapCachePage(), ), - Container( - color: Colors.white, - padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - const Text('CacheStore Type'), - if (kIsWeb) - DropdownMenu( - initialSelection: CacheStoreTypes.memCache, - onSelected: (value) { - if (value == null) return; - debugPrint('CacheStore changed to ${value.name}'); - setState(() { - _cacheStore = value.getCacheStoreWeb(); - }); - }, - dropdownMenuEntries: CacheStoreTypes.dropdownList, - ), - if (!kIsWeb) - FutureBuilder( - // ignore: discarded_futures - future: getTemporaryDirectory(), // not available on web - builder: (context, snapshot) { - if (snapshot.hasData) { - final dataPath = snapshot.requireData.path; - return DropdownMenu( - initialSelection: CacheStoreTypes.memCache, - onSelected: (value) { - if (value == null) return; - debugPrint('CacheStore changed to ${value.name}'); - setState(() { - _cacheStore = value.getCacheStore(dataPath); - }); - }, - dropdownMenuEntries: CacheStoreTypes.dropdownList, - ); - } - if (snapshot.hasError) { - debugPrint(snapshot.error.toString()); - debugPrintStack(stackTrace: snapshot.stackTrace); - return Expanded( - child: Text(snapshot.error.toString()), - ); - } - return const Expanded(child: LinearProgressIndicator()); - }, - ), - ], - ), + SelectionItemWidget( + title: 'flutter_map_pmtiles', + desc: 'PMTiles for flutter_map', + pageBuilder: (context) => const FlutterMapPmTilesPage(), + ), + SelectionItemWidget( + title: 'vector_map_tiles_pmtiles', + desc: 'PMTiles for vector_map_files / flutter_map', + pageBuilder: (context) => VectorMapTilesPmTilesPage(), ), ], ), ); } } + +class SelectionItemWidget extends StatelessWidget { + final String title; + final String desc; + final WidgetBuilder pageBuilder; + + const SelectionItemWidget({ + super.key, + required this.title, + required this.desc, + required this.pageBuilder, + }); + + @override + Widget build(BuildContext context) { + return Card( + child: InkWell( + onTap: () => + Navigator.of(context).push(MaterialPageRoute(builder: pageBuilder)), + child: ListTile( + title: Text(title), + subtitle: Text(desc), + ), + ), + ); + } +} diff --git a/example/lib/misc.dart b/example/lib/misc.dart deleted file mode 100644 index 4fad459..0000000 --- a/example/lib/misc.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter_map/flutter_map.dart'; -import 'package:latlong2/latlong.dart'; - -const mapOptions = MapOptions( - initialCenter: LatLng(47.141344, 9.553680), - interactionOptions: InteractionOptions( - flags: InteractiveFlag.all & ~InteractiveFlag.rotate, - ), - maxZoom: 16, - initialZoom: 8, -); diff --git a/example/lib/vector_map_tiles_pmtiles/page.dart b/example/lib/vector_map_tiles_pmtiles/page.dart new file mode 100644 index 0000000..038ec8f --- /dev/null +++ b/example/lib/vector_map_tiles_pmtiles/page.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:vector_map_tiles/vector_map_tiles.dart' as vmt; +import 'package:vector_map_tiles_pmtiles/vector_map_tiles.dart'; +import 'package:vector_tile_renderer/vector_tile_renderer.dart' as vtr; + +// TODO: use your own tile source https://docs.protomaps.com/pmtiles/cloud-storage +const tileSource = 'https://build.protomaps.com/20240128.pmtiles'; + +class VectorMapTilesPmTilesPage extends StatelessWidget { + final Future _futureTileProvider = + PmTilesVectorTileProvider.fromSource(tileSource); + + VectorMapTilesPmTilesPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.white, + title: const Text('vector_map_tiles_pmtiles'), + ), + body: FutureBuilder( + future: _futureTileProvider, + builder: (context, snapshot) { + if (snapshot.hasData) { + final tileProvider = snapshot.data!; + return FlutterMap( + options: const MapOptions( + initialZoom: 1, + initialCenter: LatLng(0, 0), + maxZoom: 3.49, + ), + children: [ + vmt.VectorTileLayer( + theme: vtr.ProvidedThemes.lightTheme(), + tileProviders: vmt.TileProviders({ + 'openmaptiles': tileProvider, + }), + ), + ], + ); + } + if (snapshot.hasError) { + debugPrint(snapshot.error.toString()); + debugPrintStack(stackTrace: snapshot.stackTrace); + return Center(child: Text(snapshot.error.toString())); + } + return const Center(child: CircularProgressIndicator()); + }, + ), + ); + } +} diff --git a/example/lib/vector_map_tiles_pmtiles/protomaps_theme.dart b/example/lib/vector_map_tiles_pmtiles/protomaps_theme.dart new file mode 100644 index 0000000..f0c7245 --- /dev/null +++ b/example/lib/vector_map_tiles_pmtiles/protomaps_theme.dart @@ -0,0 +1,3228 @@ +// ignore_for_file: prefer_single_quotes, require_trailing_commas + +const theme = { + "version": 8, + "sources": { + "protomaps": { + "type": "vector", + "attribution": "Protomaps © OpenStreetMap", + "url": "https://example.com/tiles.json" + } + }, + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "#cccccc" + } + }, + { + "id": "earth", + "type": "fill", + "source": "protomaps", + "source-layer": "earth", + "paint": { + "fill-color": "#e0e0e0" + } + }, + { + "id": "landuse_park", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "national_park", + "park", + "cemetery", + "protected_area", + "nature_reserve", + "forest", + "golf_course" + ] + ], + "paint": { + "fill-color": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + "#cfddd5", + 12, + "#9cd3b4" + ] + } + }, + { + "id": "landuse_hospital", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "==", + "pmap:kind", + "hospital" + ] + ], + "paint": { + "fill-color": "#e4dad9" + } + }, + { + "id": "landuse_industrial", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "==", + "pmap:kind", + "industrial" + ] + ], + "paint": { + "fill-color": "#d1dde1" + } + }, + { + "id": "landuse_school", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "school", + "university", + "college" + ] + ], + "paint": { + "fill-color": "#e4ded7" + } + }, + { + "id": "landuse_beach", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "beach" + ] + ], + "paint": { + "fill-color": "#e8e4d0" + } + }, + { + "id": "landuse_zoo", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "zoo" + ] + ], + "paint": { + "fill-color": "#c6dcdc" + } + }, + { + "id": "landuse_military", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "military", + "naval_base", + "airfield" + ] + ], + "paint": { + "fill-color": "#c6dcdc" + } + }, + { + "id": "natural_wood", + "type": "fill", + "source": "protomaps", + "source-layer": "natural", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "wood", + "nature_reserve", + "forest" + ] + ], + "paint": { + "fill-color": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + "#d0ded0", + 12, + "#a0d9a0" + ] + } + }, + { + "id": "natural_scrub", + "type": "fill", + "source": "protomaps", + "source-layer": "natural", + "filter": [ + "in", + "pmap:kind", + "scrub", + "grassland", + "grass" + ], + "paint": { + "fill-color": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + "#cedcd7", + 12, + "#99d2bb" + ] + } + }, + { + "id": "natural_glacier", + "type": "fill", + "source": "protomaps", + "source-layer": "natural", + "filter": [ + "==", + "pmap:kind", + "glacier" + ], + "paint": { + "fill-color": "#e7e7e7" + } + }, + { + "id": "natural_sand", + "type": "fill", + "source": "protomaps", + "source-layer": "natural", + "filter": [ + "==", + "pmap:kind", + "sand" + ], + "paint": { + "fill-color": "#e2e0d7" + } + }, + { + "id": "landuse_aerodrome", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "aerodrome" + ] + ], + "paint": { + "fill-color": "#dadbdf" + } + }, + { + "id": "transit_runway", + "type": "line", + "source": "protomaps", + "source-layer": "transit", + "filter": [ + "any", + [ + "in", + "pmap:kind_detail", + "runway" + ] + ], + "paint": { + "line-color": "#e9e9ed", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 10, + 0, + 12, + 4, + 18, + 30 + ] + } + }, + { + "id": "transit_taxiway", + "type": "line", + "source": "protomaps", + "source-layer": "transit", + "minzoom": 13, + "filter": [ + "any", + [ + "in", + "pmap:kind_detail", + "taxiway" + ] + ], + "paint": { + "line-color": "#e9e9ed", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 15, + 6 + ] + } + }, + { + "id": "water", + "type": "fill", + "source": "protomaps", + "source-layer": "water", + "paint": { + "fill-color": "#80deea" + } + }, + { + "id": "physical_line_stream", + "type": "line", + "source": "protomaps", + "source-layer": "physical_line", + "minzoom": 14, + "filter": [ + "all", + [ + "in", + "pmap:kind", + "stream" + ] + ], + "paint": { + "line-color": "#80deea", + "line-width": 0.5 + } + }, + { + "id": "physical_line_river", + "type": "line", + "source": "protomaps", + "source-layer": "physical_line", + "minzoom": 9, + "filter": [ + "all", + [ + "in", + "pmap:kind", + "river" + ] + ], + "paint": { + "line-color": "#80deea", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 9, + 0, + 9.5, + 1, + 18, + 12 + ] + } + }, + { + "id": "landuse_pedestrian", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "==", + "pmap:kind", + "pedestrian" + ] + ], + "paint": { + "fill-color": "#e3e0d4" + } + }, + { + "id": "landuse_pier", + "type": "fill", + "source": "protomaps", + "source-layer": "landuse", + "filter": [ + "any", + [ + "==", + "pmap:kind", + "pier" + ] + ], + "paint": { + "fill-color": "#e0e0e0" + } + }, + { + "id": "roads_tunnels_other_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "in", + "pmap:kind", + "other", + "path" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 14, + 0, + 20, + 7 + ] + } + }, + { + "id": "roads_tunnels_minor_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-dasharray": [ + 3, + 2 + ], + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + 0, + 12.5, + 0.5, + 15, + 2, + 18, + 11 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 12, + 0, + 12.5, + 1 + ] + } + }, + { + "id": "roads_tunnels_link_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-dasharray": [ + 3, + 2 + ], + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 18, + 11 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 12, + 0, + 12.5, + 1 + ] + } + }, + { + "id": "roads_tunnels_medium_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "medium_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-dasharray": [ + 3, + 2 + ], + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 0.5, + 18, + 13 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 10, + 0, + 10.5, + 1 + ] + } + }, + { + "id": "roads_tunnels_major_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-dasharray": [ + 3, + 2 + ], + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 0.5, + 18, + 13 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 9, + 0, + 9.5, + 1 + ] + } + }, + { + "id": "roads_tunnels_highway_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-dasharray": [ + 6, + 0.5 + ], + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 3.5, + 0.5, + 18, + 15 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 1, + 20, + 15 + ] + } + }, + { + "id": "roads_tunnels_other", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "in", + "pmap:kind", + "other", + "path" + ] + ], + "paint": { + "line-color": "#d5d5d5", + "line-dasharray": [ + 4.5, + 0.5 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 14, + 0, + 20, + 7 + ] + } + }, + { + "id": "roads_tunnels_minor", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ] + ], + "paint": { + "line-color": "#d5d5d5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + 0, + 12.5, + 0.5, + 15, + 2, + 18, + 11 + ] + } + }, + { + "id": "roads_tunnels_link", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#d5d5d5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 18, + 11 + ] + } + }, + { + "id": "roads_tunnels_medium", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "medium_road" + ] + ], + "paint": { + "line-color": "#d5d5d5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 12, + 1.2, + 15, + 3, + 18, + 13 + ] + } + }, + { + "id": "roads_tunnels_major", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#d5d5d5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 6, + 0, + 12, + 1.6, + 15, + 3, + 18, + 13 + ] + } + }, + { + "id": "roads_tunnels_highway", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "<", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#d5d5d5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 6, + 1.1, + 12, + 1.6, + 15, + 5, + 18, + 15 + ] + } + }, + { + "id": "buildings", + "type": "fill", + "source": "protomaps", + "source-layer": "buildings", + "paint": { + "fill-color": "#cccccc", + "fill-opacity": 0.5 + } + }, + { + "id": "transit_pier", + "type": "line", + "source": "protomaps", + "source-layer": "transit", + "filter": [ + "any", + [ + "==", + "pmap:kind", + "pier" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 12, + 0, + 12.5, + 0.5, + 20, + 16 + ] + } + }, + { + "id": "roads_minor_service_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 13, + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ], + [ + "==", + "pmap:kind_detail", + "service" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 18, + 8 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 0.8 + ] + } + }, + { + "id": "roads_minor_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ], + [ + "!=", + "pmap:kind_detail", + "service" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + 0, + 12.5, + 0.5, + 15, + 2, + 18, + 11 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 12, + 0, + 12.5, + 1 + ] + } + }, + { + "id": "roads_link_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 13, + "filter": [ + "all", + [ + "==", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 18, + 11 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1.5 + ] + } + }, + { + "id": "roads_medium_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "medium_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 12, + 1.2, + 15, + 3, + 18, + 13 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 10, + 0, + 10.5, + 1.5 + ] + } + }, + { + "id": "roads_major_casing_late", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 6, + 0, + 12, + 1.6, + 15, + 3, + 18, + 13 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 9, + 0, + 9.5, + 1 + ] + } + }, + { + "id": "roads_highway_casing_late", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 3.5, + 0.5, + 18, + 15 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 1, + 20, + 15 + ] + } + }, + { + "id": "roads_other", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "in", + "pmap:kind", + "other", + "path" + ] + ], + "paint": { + "line-color": "#ebebeb", + "line-dasharray": [ + 3, + 1 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 14, + 0, + 20, + 7 + ] + } + }, + { + "id": "roads_link", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 18, + 11 + ] + } + }, + { + "id": "roads_minor_service", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ], + [ + "==", + "pmap:kind_detail", + "service" + ] + ], + "paint": { + "line-color": "#ebebeb", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 18, + 8 + ] + } + }, + { + "id": "roads_minor", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ], + [ + "!=", + "pmap:kind_detail", + "service" + ] + ], + "paint": { + "line-color": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + "#ebebeb", + 16, + "#ffffff" + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + 0, + 12.5, + 0.5, + 15, + 2, + 18, + 11 + ] + } + }, + { + "id": "roads_medium", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "medium_road" + ] + ], + "paint": { + "line-color": "#f5f5f5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 12, + 1.2, + 15, + 3, + 18, + 13 + ] + } + }, + { + "id": "roads_major_casing_early", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "maxzoom": 12, + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 0.5, + 18, + 13 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 9, + 0, + 9.5, + 1 + ] + } + }, + { + "id": "roads_major", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 6, + 0, + 12, + 1.6, + 15, + 3, + 18, + 13 + ] + } + }, + { + "id": "roads_highway_casing_early", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "maxzoom": 12, + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 3.5, + 0.5, + 18, + 15 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 1 + ] + } + }, + { + "id": "roads_highway", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + "==", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 6, + 1.1, + 12, + 1.6, + 15, + 5, + 18, + 15 + ] + } + }, + { + "id": "transit_railway", + "type": "line", + "source": "protomaps", + "source-layer": "transit", + "filter": [ + "all", + [ + "==", + "pmap:kind", + "rail" + ] + ], + "paint": { + "line-dasharray": [ + 0.3, + 0.75 + ], + "line-opacity": 0.5, + "line-color": "#a7b1b3", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 6, + 0.15, + 18, + 9 + ] + } + }, + { + "id": "boundaries_country", + "type": "line", + "source": "protomaps", + "source-layer": "boundaries", + "filter": [ + "<=", + "pmap:min_admin_level", + 2 + ], + "paint": { + "line-color": "#adadad", + "line-width": 1, + "line-dasharray": [ + 3, + 2 + ] + } + }, + { + "id": "boundaries", + "type": "line", + "source": "protomaps", + "source-layer": "boundaries", + "filter": [ + ">", + "pmap:min_admin_level", + 2 + ], + "paint": { + "line-color": "#adadad", + "line-width": 0.5, + "line-dasharray": [ + 3, + 2 + ] + } + }, + { + "id": "roads_bridges_other_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "in", + "pmap:kind", + "other", + "path" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 14, + 0, + 20, + 7 + ] + } + }, + { + "id": "roads_bridges_link_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 18, + 11 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 12, + 0, + 12.5, + 1.5 + ] + } + }, + { + "id": "roads_bridges_minor_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + 0, + 12.5, + 0.5, + 15, + 2, + 18, + 11 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 0.8 + ] + } + }, + { + "id": "roads_bridges_medium_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "medium_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 12, + 1.2, + 15, + 3, + 18, + 13 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 10, + 0, + 10.5, + 1.5 + ] + } + }, + { + "id": "roads_bridges_major_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 0.5, + 18, + 10 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 9, + 0, + 9.5, + 1.5 + ] + } + }, + { + "id": "roads_bridges_other", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "in", + "pmap:kind", + "other", + "path" + ] + ], + "paint": { + "line-color": "#ebebeb", + "line-dasharray": [ + 2, + 1 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 14, + 0, + 20, + 7 + ] + } + }, + { + "id": "roads_bridges_minor", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "minor_road" + ] + ], + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 11, + 0, + 12.5, + 0.5, + 15, + 2, + 18, + 11 + ] + } + }, + { + "id": "roads_bridges_link", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 13, + 0, + 13.5, + 1, + 18, + 11 + ] + } + }, + { + "id": "roads_bridges_medium", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "medium_road" + ] + ], + "paint": { + "line-color": "#f0eded", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 12, + 1.2, + 15, + 3, + 18, + 13 + ] + } + }, + { + "id": "roads_bridges_major", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "major_road" + ] + ], + "paint": { + "line-color": "#f5f5f5", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 6, + 0, + 12, + 1.6, + 15, + 3, + 18, + 13 + ] + } + }, + { + "id": "roads_bridges_highway_casing", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 12, + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#e0e0e0", + "line-gap-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 3.5, + 0.5, + 18, + 15 + ], + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 7, + 0, + 7.5, + 1, + 20, + 15 + ] + } + }, + { + "id": "roads_bridges_highway", + "type": "line", + "source": "protomaps", + "source-layer": "roads", + "filter": [ + "all", + [ + ">", + "pmap:level", + 0 + ], + [ + "==", + "pmap:kind", + "highway" + ], + [ + "!=", + "pmap:link", + 1 + ] + ], + "paint": { + "line-color": "#ffffff", + "line-width": [ + "interpolate", + [ + "exponential", + 1.6 + ], + [ + "zoom" + ], + 3, + 0, + 6, + 1.1, + 12, + 1.6, + 15, + 5, + 18, + 15 + ] + } + }, + { + "id": "physical_line_waterway_label", + "type": "symbol", + "source": "protomaps", + "source-layer": "physical_line", + "minzoom": 13, + "filter": [ + "all", + [ + "in", + "pmap:kind", + "river", + "stream" + ] + ], + "layout": { + "symbol-placement": "line", + "text-font": [ + "Noto Sans Regular" + ], + "text-field": [ + "get", + "name" + ], + "text-size": 12, + "text-letter-spacing": 0.3 + }, + "paint": { + "text-color": "#ffffff" + } + }, + { + "id": "physical_point_peak", + "type": "symbol", + "source": "protomaps", + "source-layer": "physical_point", + "filter": [ + "any", + [ + "==", + "pmap:kind", + "peak" + ] + ], + "layout": { + "text-font": [ + "Noto Sans Italic" + ], + "text-field": [ + "get", + "name" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 10, + 8, + 16, + 12 + ], + "text-letter-spacing": 0.1, + "text-max-width": 9 + }, + "paint": { + "text-color": "#7e9aa0", + "text-halo-width": 1.5 + } + }, + { + "id": "roads_labels_minor", + "type": "symbol", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 15, + "filter": [ + "any", + [ + "in", + "pmap:kind", + "minor_road", + "other", + "path" + ] + ], + "layout": { + "symbol-sort-key": [ + "get", + "pmap:min_zoom" + ], + "symbol-placement": "line", + "text-font": [ + "Noto Sans Regular" + ], + "text-field": [ + "get", + "name" + ], + "text-size": 12 + }, + "paint": { + "text-color": "#91888b", + "text-halo-color": "#ffffff", + "text-halo-width": 2 + } + }, + { + "id": "physical_point_ocean", + "type": "symbol", + "source": "protomaps", + "source-layer": "physical_point", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "sea", + "ocean", + "lake", + "water", + "bay", + "strait", + "fjord" + ] + ], + "layout": { + "text-font": [ + "Noto Sans Medium" + ], + "text-field": [ + "get", + "name" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 3, + 10, + 10, + 12 + ], + "text-letter-spacing": 0.1, + "text-max-width": 9, + "text-transform": "uppercase" + }, + "paint": { + "text-color": "#ffffff" + } + }, + { + "id": "physical_point_lakes", + "type": "symbol", + "source": "protomaps", + "source-layer": "physical_point", + "filter": [ + "any", + [ + "in", + "pmap:kind", + "lake", + "water" + ] + ], + "layout": { + "text-font": [ + "Noto Sans Medium" + ], + "text-field": [ + "get", + "name" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 3, + 0, + 6, + 12, + 10, + 12 + ], + "text-letter-spacing": 0.1, + "text-max-width": 9 + }, + "paint": { + "text-color": "#ffffff" + } + }, + { + "id": "roads_labels_major", + "type": "symbol", + "source": "protomaps", + "source-layer": "roads", + "minzoom": 11, + "filter": [ + "any", + [ + "in", + "pmap:kind", + "highway", + "major_road", + "medium_road" + ] + ], + "layout": { + "symbol-sort-key": [ + "get", + "pmap:min_zoom" + ], + "symbol-placement": "line", + "text-font": [ + "Noto Sans Regular" + ], + "text-field": [ + "get", + "name" + ], + "text-size": 12 + }, + "paint": { + "text-color": "#938a8d", + "text-halo-color": "#ffffff", + "text-halo-width": 2 + } + }, + { + "id": "places_subplace", + "type": "symbol", + "source": "protomaps", + "source-layer": "places", + "filter": [ + "==", + "pmap:kind", + "neighbourhood" + ], + "layout": { + "symbol-sort-key": [ + "get", + "pmap:min_zoom" + ], + "text-field": "{name}", + "text-font": [ + "Noto Sans Regular" + ], + "text-max-width": 7, + "text-letter-spacing": 0.1, + "text-padding": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 5, + 2, + 8, + 4, + 12, + 18, + 15, + 20 + ], + "text-size": [ + "interpolate", + [ + "exponential", + 1.2 + ], + [ + "zoom" + ], + 11, + 8, + 14, + 14, + 18, + 24 + ], + "text-transform": "uppercase" + }, + "paint": { + "text-color": "#8f8f8f", + "text-halo-color": "#e0e0e0", + "text-halo-width": 2 + } + }, + { + "id": "pois_important", + "type": "symbol", + "source": "protomaps", + "source-layer": "pois", + "filter": [ + "any", + [ + "<", + [ + "get", + "pmap:min_zoom" + ], + 13 + ] + ], + "layout": { + "symbol-sort-key": [ + "get", + "pmap:min_zoom" + ], + "text-font": [ + "Noto Sans Regular" + ], + "text-field": [ + "get", + "name" + ], + "text-size": 11, + "text-max-width": 9, + "icon-padding": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 2, + 14, + 2, + 16, + 20, + 17, + 2, + 22, + 2 + ] + }, + "paint": { + "text-color": "#8f8f8f", + "text-halo-color": "#e0e0e0", + "text-halo-width": 1.5 + } + }, + { + "id": "places_locality_circle", + "type": "circle", + "source": "protomaps", + "source-layer": "places", + "filter": [ + "==", + "pmap:kind", + "locality" + ], + "paint": { + "circle-radius": 2, + "circle-stroke-width": 1.5, + "circle-stroke-color": "#a3a3a3", + "circle-color": "#ffffff", + "circle-translate": [ + -6, + 0 + ] + }, + "maxzoom": 8 + }, + { + "id": "places_locality", + "type": "symbol", + "source": "protomaps", + "source-layer": "places", + "filter": [ + "==", + "pmap:kind", + "locality" + ], + "layout": { + "text-field": "{name}", + "text-font": [ + "case", + [ + "<=", + [ + "get", + "pmap:min_zoom" + ], + 5 + ], + [ + "literal", + [ + "Noto Sans Medium" + ] + ], + [ + "literal", + [ + "Noto Sans Regular" + ] + ] + ], + "text-padding": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 5, + 3, + 8, + 7, + 12, + 11 + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 2, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 13 + ], + 8, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 13 + ], + 13, + 0 + ], + 4, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 13 + ], + 10, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 13 + ], + 15, + 0 + ], + 6, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 12 + ], + 11, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 12 + ], + 17, + 0 + ], + 8, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 11 + ], + 11, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 11 + ], + 18, + 0 + ], + 10, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 9 + ], + 12, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 9 + ], + 20, + 0 + ], + 15, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 8 + ], + 12, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 8 + ], + 22, + 0 + ] + ], + "icon-padding": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 2, + 8, + 4, + 10, + 8, + 12, + 6, + 22, + 2 + ], + "text-anchor": [ + "step", + [ + "zoom" + ], + "left", + 8, + "center" + ], + "text-radial-offset": 0.2 + }, + "paint": { + "text-color": "#5c5c5c", + "text-halo-color": "#e0e0e0", + "text-halo-width": 1 + } + }, + { + "id": "places_region", + "type": "symbol", + "source": "protomaps", + "source-layer": "places", + "filter": [ + "==", + "pmap:kind", + "region" + ], + "layout": { + "symbol-sort-key": [ + "get", + "pmap:min_zoom" + ], + "text-field": [ + "step", + [ + "zoom" + ], + [ + "get", + "name:short" + ], + 6, + [ + "get", + "name" + ] + ], + "text-font": [ + "Noto Sans Regular" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 3, + 11, + 7, + 16 + ], + "text-radial-offset": 0.2, + "text-anchor": "center", + "text-transform": "uppercase" + }, + "paint": { + "text-color": "#b3b3b3", + "text-halo-color": "#e0e0e0", + "text-halo-width": 2 + } + }, + { + "id": "places_country", + "type": "symbol", + "source": "protomaps", + "source-layer": "places", + "filter": [ + "==", + "pmap:kind", + "country" + ], + "layout": { + "symbol-sort-key": [ + "get", + "pmap:min_zoom" + ], + "text-field": "{name}", + "text-font": [ + "Noto Sans Medium" + ], + "text-size": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 2, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 10 + ], + 8, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 10 + ], + 12, + 0 + ], + 6, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 8 + ], + 10, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 8 + ], + 18, + 0 + ], + 8, + [ + "case", + [ + "<", + [ + "get", + "pmap:population_rank" + ], + 7 + ], + 11, + [ + ">=", + [ + "get", + "pmap:population_rank" + ], + 7 + ], + 20, + 0 + ] + ], + "icon-padding": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 2, + 14, + 2, + 16, + 20, + 17, + 2, + 22, + 2 + ], + "text-transform": "uppercase" + }, + "paint": { + "text-color": "#a3a3a3" + } + } + ], + "glyphs": "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf" +}; diff --git a/example/linux/CMakeLists.txt b/example/linux/CMakeLists.txt index c3750cc..9cb0d1d 100644 --- a/example/linux/CMakeLists.txt +++ b/example/linux/CMakeLists.txt @@ -4,10 +4,10 @@ project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "flutter_map_cache") +set(BINARY_NAME "example") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "com.github.josxha.example") +set(APPLICATION_ID "com.example.example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. @@ -123,6 +123,12 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) COMPONENT Runtime) endforeach(bundled_library) +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 061d011..27e0f50 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -227,7 +227,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { @@ -384,7 +384,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; @@ -398,7 +398,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; @@ -412,7 +412,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.github.josxha.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8fedab6..397f3d3 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - + @@ -34,7 +34,7 @@ @@ -42,7 +42,7 @@