Skip to content
pubscout

pmtiles

2.2.0, released 5 months ago by bramp.net

A library for parsing Protomaps PMTiles files storing raster or vector map tiles.

$ flutter pub add pmtiles
Source repository

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.

Works with

Packages commonly used together with pmtiles: ones it builds on, ones built on it, and its own family.