# pmtiles

> PMTiles archive decoder for browsers

Latest version **4.5.0** (published 2026-08-10) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install pmtiles
pnpm add pmtiles
yarn add pmtiles
bun add pmtiles
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.5.0 |
| Published | 2026-08-10 |
| First published | 2021-02-17 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 371.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brandon Liu |
| Maintainers | bdon |

## Links

- npm: https://www.npmjs.com/package/pmtiles
- Homepage: https://github.com/protomaps/pmtiles
- npm.io page: https://npm.io/package/pmtiles

## Dependencies (1)

- [fflate](https://npm.io/package/fflate.md) ^0.8.2

## Recent versions

- 4.5.0 (latest) — 2026-08-10
- 3.0.0-alpha.2 (beta) — 2024-01-31
- 4.4.1 — 2026-04-08
- 4.4.0 — 2026-02-03
- 4.3.2 — 2025-12-26
- 4.3.1 — 2025-12-24
- 4.3.0 — 2025-02-21
- 4.2.1 — 2025-01-14
- 4.2.0 — 2025-01-14
- 4.1.0 — 2024-12-15
- 4.0.1 — 2024-11-26
- 4.0.0 — 2024-11-26
- 3.2.1 — 2024-10-30
- 3.2.0 — 2024-09-22
- 3.1.0 — 2024-09-19
- … 49 more at https://npm.io/package/pmtiles/versions

## README

# PMTiles for Browsers + NodeJS

See the [JavaScript API docs](https://pmtiles.io/typedoc/)

the [PMTiles](https://www.npmjs.com/package/pmtiles) package can be included via script tag or ES6 module:

```html
 <script src="https://unpkg.com/pmtiles@<VERSION>/dist/pmtiles.js"></script>
```

All the PMTiles exports are available under the global `pmtiles` variable e.g. `pmtiles.PMTiles`.

As an ES6 module: `npm add pmtiles`

```js
import { PMTiles } from "pmtiles";
```

### Leaflet: Raster tileset

Example of a raster PMTiles archive displayed in Leaflet:

```js
import { PMTiles, leafletRasterLayer } from "pmtiles";
const p = new PMTiles('example.pmtiles')
leafletRasterLayer(p,{attribution:'© <a href="https://openstreetmap.org">OpenStreetMap</a>'}).addTo(map)
````

[Live example](https://pmtiles.io/examples/leaflet.html) | [Code](https://github.com/protomaps/PMTiles/blob/main/js/examples/leaflet.html)

### Leaflet: Vector tileset

See [protomaps-leaflet](https://github.com/protomaps/protomaps-leaflet)

## MapLibre GL JS

Example of a PMTiles archive displayed in MapLibre GL JS:

```js
import { Protocol } from "pmtiles";
let protocol = new Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
var style = {
"version": 8,
"sources": {
    "example_source": {
        "type": "vector",
        "url": "pmtiles://https://example.com/example.pmtiles",
        "attribution": '© <a href="https://openstreetmap.org">OpenStreetMap</a>'
    ...
```

[Live example](https://pmtiles.io/examples/maplibre.html) | [Code](https://github.com/protomaps/PMTiles/blob/main/js/examples/maplibre.html)

# CORS

See the [Protomaps Docs on Cloud Storage](https://protomaps.com/docs/pmtiles/cloud-storage) for uploading and configuring CORS for Cloudflare R2, Amazon S3, Google Cloud Storage and more.

---
_Source: https://npm.io/package/pmtiles · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
