# @mapbox/tilebelt

> simple tile utilities

Latest version **2.0.3** (published 2025-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mapbox/tilebelt
pnpm add @mapbox/tilebelt
yarn add @mapbox/tilebelt
bun add @mapbox/tilebelt
```

## Health

**Score 58/100 (C)** — status: stable.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2025-12-05 |
| First published | 2016-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/mapbox__tilebelt) |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 51 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 288 |
| Author | morganherlocker |
| Maintainers | mapbox-npm-01, mapbox-npm-02, mapbox-npm-07, mapbox-npm-03, mapbox-npm-04, mapbox-npm-09, mapbox-npm-05, mapbox-npm-06, mapbox-npm-08, mapbox-npm-advanced-actions, mapbox-npm-ci, mapbox-npm, mapbox-admin, mapbox-machine-user, mbx-npm-ci-staging, mbx-npm-ci-production, mbx-npm-01-production, mbx-npm-02-production, mbx-npm-03-production, mbx-npm-04-production, mbx-npm-05-production, mbx-npm-06-production, mbx-npm-07-production, mbx-npm-08-production, mbx-npm-09-production, mbx-npm-02-staging, mbx-npm-advanced-actions-staging, mbx-npm-advanced-actions-production |
| Keywords | tile, map, geojson |

## Links

- npm: https://www.npmjs.com/package/@mapbox/tilebelt
- Repository: https://github.com/mapbox/tilebelt
- Issues: https://github.com/mapbox/tilebelt/issues
- npm.io page: https://npm.io/package/@mapbox/tilebelt

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.3 (latest) — 2025-12-05
- 2.0.0-dev.1 (dev) — 2024-10-02
- 2.0.2 — 2024-11-19
- 2.0.1 — 2024-11-19
- 2.0.0 — 2024-10-02
- 1.0.2 — 2020-09-10
- 1.0.1 — 2016-12-02

## README

# tilebelt

[![Run tests](https://github.com/mapbox/tilebelt/actions/workflows/test.yml/badge.svg)](https://github.com/mapbox/tilebelt/actions/workflows/test.yml)

simple [tile](http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) utilities

## install

```bash
npm install @mapbox/tilebelt
```

## usage

```js
import * as tilebelt from '@mapbox/tilebelt';

const tile = [10, 15, 8] // x,y,z

tilebelt.tileToGeoJSON(tile);
// {
//   "type": "Polygon",
//   "coordinates": [
//     [
//       [ -165.9375, 82.8533822917608 ],
//       [ -165.9375, 82.67628497834903 ],
//       [ -164.53125, 82.67628497834903 ],
//       [ -164.53125, 82.8533822917608 ],
//       [ -165.9375, 82.8533822917608 ]
//     ]
//   ]
// }

tilebelt.getParent(tile);
// [ 5, 7, 7 ]
```

## features

function | description
---|---
`tileToGeoJSON(tile)` | get a geojson representation of a tile
`tileToBBOX(tile)` | get the bbox of a tile
`bboxToTile(bbox)` | get the smallest tile to cover a bbox
`getChildren(tile)` | get the 4 tiles one zoom level higher
`getParent(tile)` | get the tile one zoom level lower
`getSiblings(tile)` | get the 4 sibling tiles for a tile
`hasSiblings(tiles, tile)` | check to see if an array of tiles contains a tiles siblings
`hasTile(tiles, tile)` | check to see if an array of tiles contains a particular tile
`tilesEqual(tile1, tile2)` | check to see if two tiles are the same
`tileToQuadkey(tile)` | get the quadkey for a tile
`quadkeyToTile(quadkey)` | get the tile for a quadkey
`pointToTile(lon, lat, zoom)` | get the tile for a point at a specified zoom level
`pointToTileFraction(lon, lat, zoom)` | get the precise fractional tile location for a point at a zoom level

## developing

```sh
npm ci          # install deps
npm test        # tests
npm run bench   # run benchmarks
npm run format  # format using prettier
```

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