vector_map_tiles_pmtiles 1.0.1 vector_map_tiles_pmtiles: ^1.0.1 copied to clipboard
PMTiles tile provider for vector_map_tiles (flutter_map vector tiles). It uses HTTP Range Requests to request tiles from a single local or hosted file.
flutter_map_pmtiles #
A TileProvider for flutter_map that adds support for PMTiles.
Getting started #
Add the following packages to your pubspec.yaml
file:
dependencies:
flutter_map: ^6.0.0 # in case you don't have it yet
flutter_map_pmtiles: ^1.0.0 # this package
Usage #
- Initiate the TileProvider
// ...from an URL
final Future<PmTilesVectorTileProvider> _futureTileProvider = PmTilesVectorTileProvider
.fromSource('https://example.com/useYourOwnHostedPMTilesFile.pmtiles');
// ...from an local file on the file system
final Future<PmTilesVectorTileProvider> _futureTileProvider = PmTilesVectorTileProvider
.fromSource('some/file/system/path.pmtiles');
// ...or provide a PmTilesArchive directly
// (you'll need to add pmtiles as direct dependency to your project)
final Future<PmTilesVectorTileProvider> _futureTileProvider = PmTilesVectorTileProvider
.fromArchive(somePmTilesArchive);
-
Await the response of the future, e.g. by using a
FutureBuilder
. -
Provide your
PmTilesVectorTileProvider
to yourTileLayer
@override
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(),
children: [
VectorTileLayer(
theme: ProvidedThemes.lightTheme(),
tileProviders: TileProviders({
'openmaptiles': tileProvider,
}),
),
],
);
}
Additional information #
If you need help you
can open an issue
or join
the flutter_map
discord server.