mbtiles 0.5.0 copy "mbtiles: ^0.5.0" to clipboard
mbtiles: ^0.5.0 copied to clipboard

Mapbox MBTiles v1.3 files, support for vector and raster tiles.

mbtiles #

Mapbox MBTiles v1.3 files, support for vector and raster tiles.

  • Supported raster tiles: jpg, png, webp
  • Supported vector tiles: pbf
  • Web is not supported because of its missing support for SQLite.

Pub Version likes Pub Points stars codecov

Getting started #

Add the dependency

Add the following to your pubspec.yaml file:

dependencies:
  mbtiles: ^0.5.0

or run the following command in your terminal:

dart pub add mbtiles

Usage #

1. Open your .mbtiles file.

First, you need to open your .mbtiles file. You can open it as read-only or as a writeable database.

  • [Flutter] It is recommended to store the mbtiles file in one of the directories provided by the path_provider package.
  • [Flutter] The mbtiles file cannot be opened if it is inside your flutter assets! Copy it to your file system first.
  • [Flutter] If you want to open the file from the internal device storage or SD card, you need to ask for permission first! You can use permission_handler to request the needed permission from the user.
final mbtiles = MbTiles(path: 'path/to/your/mbtiles-file.mbtiles');

2. Work with the database

Afterward you can request tiles, read the metadata, etc.

// get metadata
final metadata = mbtiles.getMetadata();
// get tile data
final tile = mbtiles.getTile(z: 0, x: 0, y: 0);

3. Close the database

After you don't need the MBTiles file anymore, close its sqlite database connection.

mbtiles.close();

See the example program for more information.

Additional information #

7
likes
160
points
2.46k
downloads

Publisher

verified publisherjoscha-eckert.de

Weekly Downloads

Mapbox MBTiles v1.3 files, support for vector and raster tiles.

Repository (GitHub)
View/report issues

Topics

#mbtiles #map #mvt

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

latlong2, meta, sqlite3

More

Packages that depend on mbtiles