Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slippy-tile

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slippy-tile

Helps convert Slippy Map url tile schemas

  • 1.2.3
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-23.08%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status npm version MIT licensed

Slippy Tile

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

Install

$ npm install --save slippy-tile

Quickstart

import slippyTile from 'slippy-tile'

const tile = [10, 15, 8] // x, y, zoom
const url = slippyTile(tile, 'osm')
//= https://b.tile.openstreetmap.org/8/10/15.png

Providers

NameUnique Key
OSM (Default)osm
OSM Cycle Maposm-cycle
OSM Humanitarianosm-hot
OSM Transportosm-transport
OSM Wikimediaosm-wikimedia
OSM Lyrkosm-lyrk
Bing Imagerybing-imagery
Strava Cycling & Runningstrava
National Geographic World Mapnatgeo
ESRI Imageryesri-imagery
ESRI Ocean Basemapesri-ocean
ESRI USA Topo Mapsesri-usa-topo
ESRI World Street Mapesri-street
ESRI World Topographic Mapesri-topo
DigitalGlobe Imagerydigitalgloble-imagery
DigitalGlobe Hybriddigitalgloble-hybrid

Scheme

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

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

Options

  • {x}: Tile Column
  • {y}: Tile Row
  • {-y}: Tile Row using TMS tile scheme
  • {zoom}: Zoom Level
  • {bbox}: GeoJSON Bounding Box
  • {quadkey}: Microsoft's Quadkey
  • {switch:1,2,3}: Selects a random sample
  • {height} default = 256
  • {width}: default = 256
  • {proj}: default = EPSG:3857

slippyTile

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

Parameters

  • tile Tile Tile [x, y, zoom]
  • scheme string Tile scheme URL or provider unique key

Examples

import slippyTile from 'slippyTile'
slippyTile([10, 15, 8], 'osm')
//='https://c.tile.openstreetmap.org/8/10/15.png'

Returns string

parseSwitch

Replaces {switch:a,b,c} with a random sample.

Parameters

Examples

import { parseSwitch } from 'slippyTile'
parseSwitch('http://tile-{switch:a,b,c}.openstreetmap.fr/hot/{zoom}/{x}/{y}.png')
//='http://tile-b.openstreetmap.fr/hot/{zoom}/{x}/{y}.png'

Returns string Parsed URL with switch replaced

providerLookup

Provider Lookup

Parameters

  • provider string Provider unique key

Examples

import { provider } from 'slippyTile'
provider('bing-imagery')
//='http://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=5250'

Returns string url Tile URL scheme

sample

Sample an item from a given list

Parameters

  • collection Array<any> List of items

Examples

import { sample } from 'slippyTile'
sample(['a', 'b', 'c'])
//='a'

Returns (string | number) Single item from the list

Changelog

1.2.2 - 2016-10-21

  • Removed js-yaml dependency
  • Removed all request related dependencies
  • Removed download method
  • Added DigitalGlobe as provider
  • Converted source.json to providers.yml

1.1.0 - 2016-10-14

  • Changed default function to url
  • Added download feature
  • Fallbacks, request-promise dependency for downloading Tile data Buffer
  • Update docs

1.0.0 - 2016-10-13

First Stable release of slippy-tile.

Keywords

FAQs

Package last updated on 21 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc