# styled-map-package

> CLI for creating, viewing, and converting Styled Map Package (.smp) files

Latest version **6.1.0** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install styled-map-package
pnpm add styled-map-package
yarn add styled-map-package
bun add styled-map-package
```

Provides the commands `smp`, `styled-map-package`.

## Health

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

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

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 6.1.0 |
| Published | 2026-09-16 |
| First published | 2024-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 13 |
| Unpacked size | 26.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Maintainers | digidem-admin |

## Links

- npm: https://www.npmjs.com/package/styled-map-package
- Repository: https://github.com/digidem/styled-map-package
- Homepage: https://github.com/digidem/styled-map-package#readme
- Issues: https://github.com/digidem/styled-map-package/issues
- npm.io page: https://npm.io/package/styled-map-package

## Dependencies (13)

- [ora](https://npm.io/package/ora.md) ^9.4.1
- [open](https://npm.io/package/open.md) ^11.0.2
- [chalk](https://npm.io/package/chalk.md) ^6.0.0
- [commander](https://npm.io/package/commander.md) ^15.0.0
- [pretty-ms](https://npm.io/package/pretty-ms.md) ^9.3.1
- [itty-router](https://npm.io/package/itty-router.md) ^5.0.24
- [log-symbols](https://npm.io/package/log-symbols.md) ^7.0.0
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^7.1.2
- [readable-stream](https://npm.io/package/readable-stream.md) ^4.7.0
- [smp-noto-glyphs](https://npm.io/package/smp-noto-glyphs.md) ^2.0.0
- [@inquirer/prompts](https://npm.io/package/@inquirer/prompts.md) ^8.7.0
- [@whatwg-node/server](https://npm.io/package/@whatwg-node/server.md) ^0.11.0
- [styled-map-package-api](https://npm.io/package/styled-map-package-api.md) ^6.1.0

## Recent versions

- 6.1.0 (latest) — 2026-09-16
- 5.0.0-pre.5 (pre) — 2026-06-04
- 6.0.1 — 2026-09-07
- 6.0.0 — 2026-09-03
- 5.0.0 — 2026-09-01
- 5.0.0-pre.4 — 2026-03-23
- 5.0.0-pre.3 — 2026-03-18
- 5.0.0-pre.2 — 2026-03-18
- 5.0.0-pre.1 — 2026-03-18
- 5.0.0-pre.0 — 2026-03-17
- 4.1.0 — 2026-02-17
- 4.0.1 — 2025-12-15
- 4.0.0 — 2025-12-11
- 3.0.0 — 2025-05-05
- 2.2.1 — 2025-04-30
- … 5 more at https://npm.io/package/styled-map-package/versions

## README

# styled-map-package

CLI for creating, viewing, and converting Styled Map Package (`.smp`) files.

An `.smp` file is a ZIP archive containing all the resources needed to serve a MapLibre vector styled map offline: style JSON, vector and raster tiles, glyphs (fonts), sprites, and metadata.

## Installation

Requires Node.js >= 22.

```sh
npm install --global styled-map-package
```

## Commands

### `smp download`

Download an online map style to a `.smp` file for offline use.

```sh
smp download https://demotiles.maplibre.org/style.json \
  --bbox '-180,-80,180,80' \
  --zoom 5 \
  --output demotiles.smp
```

**Options:**

| Option                 | Description                                                            |
| ---------------------- | ---------------------------------------------------------------------- |
| `-o, --output <file>`  | Output file (writes to stdout if omitted)                              |
| `-b, --bbox <w,s,e,n>` | Bounding box (west, south, east, north)                                |
| `-z, --zoom <number>`  | Max zoom level (0-22)                                                  |
| `-t, --token <token>`  | Mapbox access token (required for Mapbox styles)                       |
| `-d, --dedupe`         | Deduplicate tiles with identical content to reduce file size           |
| `--skip-local-glyphs`  | Skip CJK/Hangul/Kana glyph ranges rendered locally by MapLibre GL      |
| `--all-glyph-ranges`   | Download every glyph range, not only those used by downloaded labels   |
| `--buffer-tiles`       | Download an extra tile ring around the bbox at each zoom below maxzoom |

When run interactively, missing options are prompted for.

The `--buffer-tiles` flag downloads one extra tile ring around the bbox at every
zoom level below maxzoom, so the map is not clipped at the edges of the
downloaded area when zooming out. The buffer is not added at maxzoom. `smp view`
automatically renders these buffer tiles.

### `smp view`

Preview a `.smp` file in a web browser.

```sh
smp view demotiles.smp --open
```

**Options:**

| Option                | Description                                                                |
| --------------------- | -------------------------------------------------------------------------- |
| `-o, --open`          | Open in the default web browser                                            |
| `-p, --port <number>` | Port to serve on (default: 3000)                                           |
| `--no-fallback`       | Return 404 for missing tiles and glyphs instead of serving empty fallbacks |

By default the viewer serves empty tiles and Noto Sans glyphs for any resource not present in the file, so incomplete packages (those covering a partial area or zoom range) preview without 404 errors. Missing vector tiles are served as empty MVTs, missing raster tiles as transparent pixels. Missing glyph ranges are served using bundled [Noto Sans](https://fonts.google.com/noto/specimen/Noto+Sans) glyphs (via [GoNotoKurrent](https://github.com/satbyy/go-noto-universal), covering 80+ scripts including Latin, Cyrillic, Greek, Arabic, Hebrew, Devanagari, Thai, and more). CJK and Hangul ranges are not bundled since MapLibre renders these client-side via `localIdeographFontFamily`. Pass `--no-fallback` to return 404s instead.

For packages downloaded with buffer tiles (recorded as `smp:bufferTiles` in the style metadata), the viewer also widens each source's `bounds` so the lower-zoom buffer tiles that extend beyond the data area are rendered rather than clipped. Combined with the empty-tile fallback, panning beyond the downloaded area shows blank tiles instead of console errors.

### `smp mbtiles`

Convert an MBTiles file to a `.smp` file.

```sh
smp mbtiles tiles.mbtiles --output map.smp
```

**Options:**

| Option                | Description                                      |
| --------------------- | ------------------------------------------------ |
| `-o, --output <file>` | Output `.smp` file (writes to stdout if omitted) |

### `smp validate`

Validate a `.smp` file against the [SMP specification](../../spec/1.0/).

```sh
smp validate map.smp
```

Reports errors (spec MUST violations) and warnings (SHOULD/RECOMMENDED), each annotated with a severity level:

- **fatal** — the file cannot be opened by the reader
- **rendering** — the map opens but content will be visibly broken (missing tiles, glyphs, sprites)
- **spec** — non-compliance that doesn't affect practical use

Glyph coverage is checked by reading the vector tiles and requiring every glyph range their labels use. Pass `--no-glyph-coverage` to skip reading tiles and only require range 0-255.

Exits with code 0 if valid, 1 if errors are found.

## License

MIT

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