flutter_map_pmtiles 1.0.3 copy "flutter_map_pmtiles: ^1.0.3" to clipboard
flutter_map_pmtiles: ^1.0.3 copied to clipboard

PMTiles tile provider for flutter_map. 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.

Pub Version likes Pub Points Pub Popularity

GitHub last commit stars GitHub issues codecov

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 #

  1. Initiate the TileProvider
// ...from an URL
final Future<PmTilesTileProvider> _futureTileProvider = PmTilesTileProvider
    .fromSource('https://example.com/useYourOwnHostedPMTilesFile.pmtiles');
// ...from an local file on the file system
final Future<PmTilesTileProvider> _futureTileProvider = PmTilesTileProvider
    .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<PmTilesTileProvider> _futureTileProvider = PmTilesTileProvider
    .fromArchive(somePmTilesArchive);
  1. Await the response of the future, e.g. by using a FutureBuilder.

  2. Provide your PmTilesTileProvider to your TileLayer

@override
Widget build(BuildContext context) {
  return FlutterMap(
    options: MapOptions(),
    children: [
      TileLayer(
        urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
        // use your awaited PmTilesTileProvider
        tileProvider: tileProvider,
      ),
    ],
  );
}

Additional information #

If you need help you can open an issue or join the flutter_map discord server.

3
likes
150
pub points
71%
popularity

Publisher

verified publisherjoscha-eckert.de

PMTiles tile provider for flutter_map. It uses HTTP Range Requests to request tiles from a single local or hosted file.

Repository (GitHub)
View/report issues

Topics

#flutter-map #map #pmtiles

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_map, pmtiles

More

Packages that depend on flutter_map_pmtiles