# slippy-tile

> Helps convert Slippy Map url tile schemas

Latest version **4.0.0** (published 2018-02-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install slippy-tile
pnpm add slippy-tile
yarn add slippy-tile
bun add slippy-tile
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2018-02-21 |
| First published | 2016-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Denis Carriere |
| Maintainers | deniscarriere |
| Keywords | gis, geo, geospatial, map, url, slippy, tile, slippytile |

## Links

- npm: https://www.npmjs.com/package/slippy-tile
- npm.io page: https://npm.io/package/slippy-tile

## Dependencies (1)

- [global-mercator](https://npm.io/package/global-mercator.md) *

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2018-02-21
- 3.0.2 — 2017-10-24
- 3.0.1 — 2017-10-24
- 3.0.0 — 2017-09-29
- 2.3.1 — 2017-09-11
- 2.3.0 — 2017-09-11
- 2.2.0 — 2017-09-08
- 2.1.0 — 2017-04-25
- 2.0.0 — 2017-04-01
- 1.13.1 — 2017-03-27
- 1.13.0 — 2017-03-27
- 1.12.1 — 2017-03-15
- 1.12.0 — 2017-03-15
- 1.11.0 — 2017-03-08
- 1.10.2 — 2017-02-19
- … 28 more at https://npm.io/package/slippy-tile/versions

## README

# Slippy Tile

[![Build Status](https://travis-ci.org/DenisCarriere/slippy-tile.svg?branch=master)](https://travis-ci.org/DenisCarriere/slippy-tile)
[![npm version](https://badge.fury.io/js/slippy-tile.svg)](https://badge.fury.io/js/slippy-tile)
[![Coverage Status](https://coveralls.io/repos/github/DenisCarriere/slippy-tile/badge.svg?branch=master)](https://coveralls.io/github/DenisCarriere/slippy-tile?branch=master)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/DenisCarriere/slippy-tile/master/LICENSE)
[![ES5](https://camo.githubusercontent.com/d341caa63123c99b79fda7f8efdc29b35f9f2e70/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f65732d352d627269676874677265656e2e737667)](http://kangax.github.io/compat-table/es5/)

[![Standard - JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

Slippy Tile helps parse a Tile scheme URL from a given Tile [x, y, zoom].

## Install

**npm**

```bash
$ npm install --save slippy-tile
```

**web**

```html
<script src="https://wzrd.in/standalone/slippy-tile@latest"></script>
```

## Quickstart

```javascript
var slippyTile = require('slippy-tile')
var tile = [10, 15, 8] // [x, y, zoom]
var scheme = 'https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png'
var url = slippyTile(tile, scheme)
//= https://b.tile.openstreetmap.org/8/10/15.png
```

## Scheme

You can provide your own scheme by following the same syntax as JOSM.

**Options**

-   `{x}` or `{TileColumn}`: Tile Column
-   `{y}` or `{TileRow}`: Tile Row for Google Maps Compatible scheme
-   `{-y}`: Tile Row for TMS scheme
-   `{zoom}` or `{z}` or `{TileMatrix}`: Zoom Level
-   `{bbox}`: GeoJSON Bounding Box
-   `{bbox4326}`: GeoJSON Bounding Box using EPSG:4326 (WGS84)
-   `{bbox3857}`: GeoJSON Bounding Box using EPSG:3857 (World Mercator)
-   `{quadkey}` or `{q}`: Microsoft's Quadkey
-   `{switch:1,2,3}`: Selects a random sample
-   `{height}` default = 256
-   `{width}`: default = 256
-   `{size}`: default = 256,256
-   `{proj}`: default = EPSG:3857
-   `{format}`: default = image/png

## API

### slippyTile

Substitutes the given tile information [x, y, z] to the URL tile scheme.

**Parameters**

-   `tile` **Tile** Tile [x, y, z]
-   `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL Tile scheme or provider unique key
-   `options` **Object** Additional params
**Examples**

```javascript
slippyTile([10, 15, 8], 'https://{s}.tile.openstreetmap.org/{zoom}/{x}/{y}.png')
//='https://c.tile.openstreetmap.org/8/10/15.png'
```

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** parsed URL

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