vector_map_tiles_mbtiles 1.2.0 copy "vector_map_tiles_mbtiles: ^1.2.0" to clipboard
vector_map_tiles_mbtiles: ^1.2.0 copied to clipboard

Mapbox MBTiles vector tile provider for vector_map_files / flutter_map that can be used for a 100% offline map.

example/example.md

Basic usage #

  1. Open the MBTiles file:
// initiate your tile provider
final mbtiles = MbTiles(mbtilesPath: mbTilesPath, gzip: false);

// OR: in case your protobuf data is not gzip encoded use:
final mbtiles = MbTiles(mbtilesPath: mbTilesPath, gzip: false);
  1. Provide mbtiles to the MbTilesVectorTileProvider:
@override
Widget build(BuildContext context) {
  return FlutterMap(
    options: MapOptions(
      minZoom: 8,
      maxZoom: 18,
      initialZoom: 11,
      initialCenter:
      metadata.defaultCenter ?? const LatLng(0, 0),
    ),
    children: [
      VectorTileLayer(
        theme: _theme,
        tileProviders: TileProviders({
          'openmaptiles': MbTilesVectorTileProvider(
            mbtiles: mbtiles,
            silenceTileNotFound: true,
          ),
        }),
        // do not set maximumZoom here to the metadata.maxZoom
        // or tiles won't get over-zoomed.
        maximumZoom: 18,
      ),
    ],
  );
}

Need more information? #

10
likes
160
points
155
downloads

Publisher

verified publisherjoscha-eckert.de

Weekly Downloads

Mapbox MBTiles vector tile provider for vector_map_files / flutter_map that can be used for a 100% offline map.

Repository (GitHub)
View/report issues

Topics

#flutter-map #vector-map-tiles #map #mbtiles

Documentation

API reference

License

MIT (license)

Dependencies

flutter, mbtiles, vector_map_tiles

More

Packages that depend on vector_map_tiles_mbtiles