# @mapbox/quilt

> A light-weight utility library for patching static tiles together.

Latest version **0.3.0** (published 2023-08-14) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2023-08-14 |
| First published | 2020-05-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 42.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Mapbox |
| Maintainers | mbx-npm-ci-production, mbx-npm-ci-staging, mbx-npm-advanced-actions-production, mbx-npm-advanced-actions-staging, mbx-npm-09-production, mbx-npm-08-production, mbx-npm-07-production, mbx-npm-06-production, mbx-npm-05-production, mbx-npm-04-production, mbx-npm-03-production, mbx-npm-02-production, mbx-npm-01-production, mbx-npm-02-staging, 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 |
| Keywords | mapbox, map, tiles |

## Links

- npm: https://www.npmjs.com/package/@mapbox/quilt
- Repository: https://github.com/mapbox/quilt
- Homepage: https://github.com/mapbox/quilt#readme
- Issues: https://github.com/mapbox/quilt/issues
- npm.io page: https://npm.io/package/@mapbox/quilt

## Dependencies (4)

- [mapnik](https://npm.io/package/mapnik.md) ^4.5.9
- [p-retry](https://npm.io/package/p-retry.md) ^4.2.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.12
- [@mapbox/sphericalmercator](https://npm.io/package/@mapbox/sphericalmercator.md) ^1.1.0

## Recent versions

- 0.3.0 (latest) — 2023-08-14
- 0.2.0 — 2021-06-01
- 0.1.0 — 2020-05-01

## README

# Quilt

`@mapbox/quilt` is a light-weight utility library for patching together responses from the Mapbox [Static Tiles API](https://docs.mapbox.com/api/maps/#static-tiles) based on a given coordinate pair. It primarily takes its inspiration from [`@mapbox/abaculus`](https://github.com/mapbox/abaculus).

It is put to best use when you need to generate quick debugging images of how several different Mapbox styles will look when rendered by the Mapbox Static Tiles API.

## Usage

This library is written using a "constructor" framework. In order to retrieve an image, you must first initialize your "getImage" function with the desired configuration for your final image (coordinates, zoom level, & desired image size). You can then use your constructed function to return an image generated by stitching tiles together for one or more Mapbox styles at that location.

**usage example**
```js
const { makeGetQuilt } = require('@mapbox/quilt');

const getTileQuilt = makeGetQuilt(coordinates, zoom, size);
const finalImage = getTileQuilt({ style, accessToken })
  .then((err, result) => {
    return result;
    // expected result:
    // {
    //   decoded: < decoded PNG >,
    //   original: < Buffer > 
    // }
  })
```

## Developing

The package is tested on node v16 & v18, and cannot be assumed to work as expected when using alternate versions.

Tests are written with Jest & require that you have a valid Mapbox Access Token available via an environment variable (both `MapboxAccessToken` or `MAPBOX_ACCESS_TOKEN` will be considered valid variable names). 

In order to ensure you are using the proper token, we recommend running the tests like so:

**zsh:**
```bash
MAPBOX_ACCESS_TOKEN=your.token npm test
```

**bash:**
```bash
export MAPBOX_ACCESS_TOKEN=your.token && npm test
```

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