mbtiles 0.3.1 mbtiles: ^0.3.1 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.
Getting started #
pubspec.yaml
dependencies:
# this package:
mbtiles: ^0.3.0
# coordinates will be returned as `LatLng`, include the following package
# if you want to work with them.
latlong2: ^0.9.0
# sqlite libraries in case not otherwise bundled (requires flutter):
sqlite3_flutter_libs: ^0.5.18
Usage #
// Get paths for the current platform (Windows would need "\" instead of "/").
// This is not needed if you use `sqlite3_flutter_libs` on Android or iOS.
final sqlitePath = 'assets/${Platform.operatingSystem}/sqlite3';
// open mbtiles
final mbtiles = MBTiles(
mbtilesPath: 'assets/mbtiles/countries-raster.mbtiles',
sqlitePath: sqlitePath,
);
// get metadata
final metadata = mbtiles.getMetadata();
// get tile data
final tile = mbtiles.getTile(z: 0, x: 0, y: 0);
// close mbtiles
mbtiles.dispose();
See the example program for more information.