pmtiles
2.2.0, released 5 months ago by bramp.net
A library for parsing Protomaps PMTiles files storing raster or vector map tiles.
What it does
Parses Protomaps PMTiles archives locally or remotely to read metadata, header info, and individual map tiles. It allows extraction of single tiles or batch streaming of multiple tiles optimized to reduce requests.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read Protomaps PMTiles archives directly from local files or HTTP URLs.
- You want to extract individual or multiple map tiles from a single-file archive format.
Skip it when
- You are running in Node.js or browser environments and require local file access (not supported on dart2js outside HTTP).
- You need a full high-level map widget rendering engine rather than just an archive parser.
Strengths
- Supports reading PMTiles archives locally and remotely via HTTP.
- Stream-based API for batch reading tiles to optimize backing store requests.
- Compatible with native Dart VM and dart2js for web/Chrome.
Weaknesses
- Local file access is not supported when compiled to JavaScript via dart2js (Node.js or browsers).
- Does not include visual map rendering widgets out of the box.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 9
Not documented
Future<int> main() async {
final archive = await PmTilesArchive.from("/path/to/file.pmtiles");
try {
print("Type: ${archive.tileType}");
final int tileId = ZXY(4, 3, 2).toTileId();
final Tile t = await archive.tile(tileId);
t.bytes();
} finally {
await archive.close();
}
return 0;
}Alternatives
Packages that do the same job and could replace pmtiles.
- google_maps_flutter_web
Web platform implementation of google_maps_flutter.
88Compare - google_maps_flutter_android
Android implementation of the google_maps_flutter plugin.
82Compare - google_maps_flutter_ios
iOS implementation of the google_maps_flutter plugin.
81Compare - mbtiles
Read and write Mapbox MBTiles v1.3 files with support for vector and raster tiles.
66Compare
Works with
Packages commonly used together with pmtiles: ones it builds on, ones built on it, and its own family.
- archivepmtiles depends on itEncodes and decodes archive and compression formats such as zip, tar, gzip, and zlib.
- poolpmtiles depends on itManage a finite pool of resources to control concurrent operations.
- fixnumpmtiles depends on itProvides 32‑ and 64‑bit signed fixed‑width integer types for Dart.
- protobufpmtiles depends on itProvides runtime support for Dart protocol buffer messages generated by protoc_plugin.
- latlong2pmtiles depends on itLightweight Dart library for latitude/longitude calculations.
- vector_map_tiles_pmtilesBuilt on pmtilesPMTiles tile provider for vector_map_tiles using HTTP Range Requests.
- flutter_map_pmtilesBuilt on pmtilesPMTiles tile provider for flutter_map supporting local or hosted files.