4.0.0 • Published 6 years ago

slippy-tile v4.0.0

Weekly downloads
5
License
MIT
Repository
-
Last release
6 years ago

Slippy Tile

Build Status npm version Coverage Status MIT licensed ES5

Standard - JavaScript Style Guide

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

Install

npm

$ npm install --save slippy-tile

web

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

Quickstart

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 URL Tile scheme or provider unique key
  • options Object Additional params Examples
slippyTile([10, 15, 8], 'https://{s}.tile.openstreetmap.org/{zoom}/{x}/{y}.png')
//='https://c.tile.openstreetmap.org/8/10/15.png'

Returns string parsed URL

4.0.0

6 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.13.1

7 years ago

1.13.0

7 years ago

1.12.1

7 years ago

1.12.0

7 years ago

1.11.0

7 years ago

1.10.2

7 years ago

1.10.1

7 years ago

1.10.0

7 years ago

1.9.0

7 years ago

1.8.5

7 years ago

1.8.4

7 years ago

1.8.2

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago