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 - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

providers/mapbox.js

6

CHANGELOG.md

@@ -0,3 +1,9 @@

# Changelog
## 1.6.0 - 2017-01-11
- Add individual parsing functions for WMS & WMTS
- Improve typescript handling for `sample`
## 1.5.0 - 2017-01-05

@@ -4,0 +10,0 @@

81

index.js

@@ -12,4 +12,5 @@ "use strict";

* @example
* import * as slippyTile from 'slippy-tile'
* slippyTile.parse([10, 15, 8], slippyTile.osm.standard.url)
* const tile = [10, 15, 8]
* const url = 'https://{s}.tile.openstreetmap.org/{zoom}/{x}/{y}.png'
* slippyTile.parse(tile, url)
* //='https://c.tile.openstreetmap.org/8/10/15.png'

@@ -19,13 +20,8 @@ */

const [x, y, zoom] = tile;
url = url.replace(/{(zoom|z|level|TileMatrix)}/, String(zoom));
url = url.replace(/{(x|TileCol|col)}/, String(x));
url = url.replace(/{(y|TileRow|row)}/, String(y));
url = url.replace(/{height}/, '256');
url = url.replace(/{width}/, '256');
url = url.replace(/{proj}/, 'EPSG:3857');
url = url.replace(/{Style}/, 'default');
url = url.replace(/{TileMatrixSet}/, 'GoogleMapsCompatible');
if (url.match(/{bbox}/)) {
url = url.replace(/{bbox}/, mercator.googleToBBox(tile).join(','));
}
url = wms(tile, url);
url = wmts(url);
url = parseSwitch(url);
url = url.replace(/{(zoom|z|level)}/, String(zoom));
url = url.replace(/{(x|col)}/, String(x));
url = url.replace(/{(y|row)}/, String(y));
if (url.match(/{-y}/)) {

@@ -37,3 +33,5 @@ url = url.replace(/{-y}/, String(mercator.googleToTile(tile)[1]));

}
url = parseSwitch(url);
if (url.match(/{.*}/)) {
throw new Error(`Could not completly parse URL ${url}`);
}
return url;

@@ -43,2 +41,43 @@ }

/**
* Parse WMS URL to friendly SlippyTile format
*
* @param {Tile} tile Tile [x, y, z]
* @param {string} url WMTS URL scheme
* @returns {string}
* @example
* const tile = [10, 15, 8]
* const url = 'https://<Tile Server>/?layers=imagery&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}'
* slippyTile.wmts(tile, url)
* //='https://<Tile Server>/?layers=imagery&SRS=EPSG:3857&WIDTH=256&HEIGHT=256&BBOX=-165.9375,82.676285,-164.53125,82.853382'
*/
function wms(tile, url) {
url = url.replace(/{height}/, '256');
url = url.replace(/{width}/, '256');
url = url.replace(/{proj}/, 'EPSG:3857');
if (url.match(/{bbox}/)) {
url = url.replace(/{bbox}/, mercator.googleToBBox(tile).join(','));
}
return url;
}
exports.wms = wms;
/**
* Parse WMTS URL to friendly SlippyTile URL format
*
* @param {string} url WMTS URL scheme
* @returns {string}
* @example
* const url = 'https://<Tile Server>/WMTS/tile/1.0.0/Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg'
* slippyTile.wmts(url)
* //='https://<Tile Server>/WMTS/tile/1.0.0/Imagery/default/GoogleMapsCompatible/{z}/{y}/{x}.jpg'
*/
function wmts(url) {
url = url.replace(/{TileCol}/, '{x}');
url = url.replace(/{TileRow}/, '{y}');
url = url.replace(/{TileMatrix}/, '{z}');
url = url.replace(/{TileMatrixSet}/, 'GoogleMapsCompatible');
url = url.replace(/{Style}/, 'default');
return url;
}
exports.wmts = wmts;
/**
* Replaces {switch:a,b,c} with a random sample.

@@ -56,3 +95,3 @@ *

if (url.match(/{s}/i)) {
const random = String(sample(['a', 'b', 'c']));
const random = String(exports.sample(['a', 'b', 'c']));
return url.replace(/{s}/, random);

@@ -64,3 +103,3 @@ }

if (found) {
const random = String(sample(found[1].split(',')));
const random = String(exports.sample(found[1].split(',')));
return url.replace(pattern, random);

@@ -74,13 +113,11 @@ }

*
* @param {string[]} collection List of items
* @returns {string} Single item from the list
* @param {any[]} collection List of items
* @returns {any} Single item from the list
* @example
* import * as slippyTile from 'slippy-tile'
* slippyTile.sample(['a', 'b', 'c'])
* //='b'
*/
function sample(collection) {
exports.sample = (collection) => {
return collection[Math.floor(Math.random() * collection.length)];
}
exports.sample = sample;
};
//# sourceMappingURL=index.js.map

@@ -15,2 +15,3 @@ import * as mercator from 'global-mercator'

url: string
type: 'baselayer' | 'overlay'
}

@@ -30,20 +31,38 @@

* @example
* import * as slippyTile from 'slippy-tile'
* slippyTile.parse([10, 15, 8], slippyTile.osm.standard.url)
* const tile = [10, 15, 8]
* const url = 'https://{s}.tile.openstreetmap.org/{zoom}/{x}/{y}.png'
* slippyTile.parse(tile, url)
* //='https://c.tile.openstreetmap.org/8/10/15.png'
*/
export function parse (tile: Tile, url: string) {
export function parse(tile: Tile, url: string) {
const [x, y, zoom] = tile
url = url.replace(/{(zoom|z|level|TileMatrix)}/, String(zoom))
url = url.replace(/{(x|TileCol|col)}/, String(x))
url = url.replace(/{(y|TileRow|row)}/, String(y))
url = wms(tile, url)
url = wmts(url)
url = parseSwitch(url)
url = url.replace(/{(zoom|z|level)}/, String(zoom))
url = url.replace(/{(x|col)}/, String(x))
url = url.replace(/{(y|row)}/, String(y))
if (url.match(/{-y}/)) { url = url.replace(/{-y}/, String(mercator.googleToTile(tile)[1])) }
if (url.match(/{(quadkey|q)}/)) { url = url.replace(/{(quadkey|q)}/, mercator.googleToQuadkey(tile)) }
if (url.match(/{.*}/)) { throw new Error(`Could not completly parse URL ${url}`)}
return url
}
/**
* Parse WMS URL to friendly SlippyTile format
*
* @param {Tile} tile Tile [x, y, z]
* @param {string} url WMTS URL scheme
* @returns {string}
* @example
* const tile = [10, 15, 8]
* const url = 'https://<Tile Server>/?layers=imagery&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}'
* slippyTile.wmts(tile, url)
* //='https://<Tile Server>/?layers=imagery&SRS=EPSG:3857&WIDTH=256&HEIGHT=256&BBOX=-165.9375,82.676285,-164.53125,82.853382'
*/
export function wms(tile: Tile, url: string) {
url = url.replace(/{height}/, '256')
url = url.replace(/{width}/, '256')
url = url.replace(/{proj}/, 'EPSG:3857')
url = url.replace(/{Style}/, 'default')
url = url.replace(/{TileMatrixSet}/, 'GoogleMapsCompatible')
if (url.match(/{bbox}/)) { url = url.replace(/{bbox}/, mercator.googleToBBox(tile).join(',')) }
if (url.match(/{-y}/)) { url = url.replace(/{-y}/, String(mercator.googleToTile(tile)[1])) }
if (url.match(/{(quadkey|q)}/)) { url = url.replace(/{(quadkey|q)}/, mercator.googleToQuadkey(tile)) }
url = parseSwitch(url)
return url

@@ -53,2 +72,21 @@ }

/**
* Parse WMTS URL to friendly SlippyTile URL format
*
* @param {string} url WMTS URL scheme
* @returns {string}
* @example
* const url = 'https://<Tile Server>/WMTS/tile/1.0.0/Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg'
* slippyTile.wmts(url)
* //='https://<Tile Server>/WMTS/tile/1.0.0/Imagery/default/GoogleMapsCompatible/{z}/{y}/{x}.jpg'
*/
export function wmts(url: string) {
url = url.replace(/{TileCol}/, '{x}')
url = url.replace(/{TileRow}/, '{y}')
url = url.replace(/{TileMatrix}/, '{z}')
url = url.replace(/{TileMatrixSet}/, 'GoogleMapsCompatible')
url = url.replace(/{Style}/, 'default')
return url
}
/**
* Replaces {switch:a,b,c} with a random sample.

@@ -63,3 +101,3 @@ *

*/
export function parseSwitch (url: string) {
export function parseSwitch(url: string) {
// Default simple switch

@@ -80,14 +118,19 @@ if (url.match(/{s}/i)) {

interface Sample {
(collection: string[]): string
(collection: number[]): number
(collection: any[]): any
}
/**
* Sample an item from a given list
*
* @param {string[]} collection List of items
* @returns {string} Single item from the list
* @param {any[]} collection List of items
* @returns {any} Single item from the list
* @example
* import * as slippyTile from 'slippy-tile'
* slippyTile.sample(['a', 'b', 'c'])
* //='b'
*/
export function sample (collection: string[]): string {
export const sample: Sample = (collection: any[]) => {
return collection[Math.floor(Math.random() * collection.length)]
}
{
"name": "slippy-tile",
"version": "1.5.0",
"version": "1.6.0",
"description": "Helps convert Slippy Map url tile schemas",

@@ -26,8 +26,8 @@ "main": "index.js",

"devDependencies": {
"@types/jest": "^16.0.1",
"@types/jest": "^16.0.3",
"coveralls": "^2.11.15",
"documentation": "4.0.0-beta10",
"documentation": "^4.0.0-beta.18",
"jest-cli": "^18.1.0",
"tslint": "^4.2.0",
"typescript": "^2.0.10"
"typescript": "^2.1.4"
},

@@ -48,4 +48,4 @@ "keywords": [

"dependencies": {
"global-mercator": "^1.6.0",
"jest-cli": "^18.1.0"
"@types/node": "^6.0.58",
"global-mercator": "^1.6.1"
},

@@ -52,0 +52,0 @@ "jest": {

@@ -13,3 +13,4 @@ "use strict";

format: 'jpg',
type: 'baselayer',
};
//# sourceMappingURL=bing.js.map

@@ -14,2 +14,3 @@ import { Provider } from '../index'

format: 'jpg',
type: 'baselayer',
}

@@ -5,3 +5,3 @@ "use strict";

categories: [
'digitalgloble',
'digitalglobe',
'dg',

@@ -17,2 +17,3 @@ 'imagery',

url: 'https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0mpda/{z}/{x}/{y}.png',
type: 'baselayer',
};

@@ -31,3 +32,4 @@ exports.imagery = {

format: 'png',
type: 'baselayer',
};
//# sourceMappingURL=digitalglobe.js.map

@@ -6,3 +6,3 @@ import { Provider } from '../index'

categories: [
'digitalgloble',
'digitalglobe',
'dg',

@@ -18,2 +18,3 @@ 'imagery',

url: 'https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0mpda/{z}/{x}/{y}.png',
type: 'baselayer',
}

@@ -33,2 +34,3 @@

format: 'png',
type: 'baselayer',
}

@@ -10,6 +10,7 @@ "use strict";

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.',
attribution: 'National Geographic, Esri, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, INCREMENT P',
format: 'jpg',
type: 'baselayer',
};

@@ -23,6 +24,7 @@ exports.ocean = {

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/Ocean_Basemap/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'The ocean basemap includes bathymetry, surface and subsurface feature names, and derived depths. This service is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data.',
attribution: 'Esri, GEBCO, NOAA, National Geographic, DeLorme, HERE, Geonames.org, and other contributors',
format: 'jpg',
type: 'baselayer',
};

@@ -36,6 +38,7 @@ exports.usatopo = {

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map service presents detailed USGS topographic maps for the United States at multiple scales.',
attribution: '© 2011 National Geographic Society, i-cubed',
format: 'jpg',
type: 'baselayer',
};

@@ -49,6 +52,7 @@ exports.imagery = {

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map service presents satellite imagery for the world and high-resolution imagery for the United States and other areas around the world.',
attribution: 'Esri, DigitalGlobe, Earthstar Geographics, CNES/Airbus DS, GeoEye, USDA FSA, USGS, Getmapping, Aerogrid, IGN, IGP, and the GIS User Community',
format: 'jpg',
type: 'baselayer',
};

@@ -62,6 +66,7 @@ exports.street = {

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS/tile/1.0.0/World_Topo_Map/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map service presents highway-level data for the world and street-level data for North America, Europe, Africa, parts of the Middle East, Asia, and more.',
attribution: 'Esri, HERE, DeLorme, USGS, Intermap, INCREMENT P, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), MapmyIndia, © OpenStreetMap contributors, and the GIS User Community',
format: 'jpg',
type: 'baselayer',
};

@@ -76,7 +81,9 @@ exports.topo = {

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This world topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings.',
attribution: 'Esri, HERE, DeLorme, Intermap, INCREMENT P, GEBCO, USGS, FAO, NPS, NRCAN, GeoBase, IGN, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), swisstopo, MapmyIndia, © OpenStreetMap contributors, GIS User Community',
format: 'jpg',
type: 'baselayer',
};
exports.topographic = exports.topo;
//# sourceMappingURL=esri.js.map

@@ -11,6 +11,7 @@ import { Provider } from '../index'

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.',
attribution: 'National Geographic, Esri, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, INCREMENT P',
format: 'jpg',
type: 'baselayer',
}

@@ -25,6 +26,7 @@

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/Ocean_Basemap/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'The ocean basemap includes bathymetry, surface and subsurface feature names, and derived depths. This service is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data.',
attribution: 'Esri, GEBCO, NOAA, National Geographic, DeLorme, HERE, Geonames.org, and other contributors',
format: 'jpg',
type: 'baselayer',
}

@@ -39,6 +41,7 @@

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map service presents detailed USGS topographic maps for the United States at multiple scales.',
attribution: '© 2011 National Geographic Society, i-cubed',
format: 'jpg',
type: 'baselayer',
}

@@ -53,6 +56,7 @@

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map service presents satellite imagery for the world and high-resolution imagery for the United States and other areas around the world.',
attribution: 'Esri, DigitalGlobe, Earthstar Geographics, CNES/Airbus DS, GeoEye, USDA FSA, USGS, Getmapping, Aerogrid, IGN, IGP, and the GIS User Community',
format: 'jpg',
type: 'baselayer',
}

@@ -67,6 +71,7 @@

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS/tile/1.0.0/World_Topo_Map/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This map service presents highway-level data for the world and street-level data for North America, Europe, Africa, parts of the Middle East, Asia, and more.',
attribution: 'Esri, HERE, DeLorme, USGS, Intermap, INCREMENT P, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), MapmyIndia, © OpenStreetMap contributors, and the GIS User Community',
format: 'jpg',
type: 'baselayer',
}

@@ -82,6 +87,8 @@

],
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{zoom}/{y}/{x}',
url: 'https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg',
description: 'This world topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings.',
attribution: 'Esri, HERE, DeLorme, Intermap, INCREMENT P, GEBCO, USGS, FAO, NPS, NRCAN, GeoBase, IGN, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), swisstopo, MapmyIndia, © OpenStreetMap contributors, GIS User Community',
format: 'jpg',
type: 'baselayer',
}
export const topographic = topo

@@ -12,2 +12,13 @@ "use strict";

exports.digitalglobe = digitalglobe;
const mapbox = require("./mapbox");
exports.mapbox = mapbox;
// Alternate names
const openstreetmap = osm;
exports.openstreetmap = openstreetmap;
const arcgis = esri;
exports.arcgis = arcgis;
const dg = digitalglobe;
exports.dg = dg;
const microsoft = bing;
exports.microsoft = microsoft;
//# sourceMappingURL=index.js.map

@@ -6,8 +6,21 @@ import * as bing from './bing'

import * as digitalglobe from './digitalglobe'
import * as mapbox from './mapbox'
// Alternate names
const openstreetmap = osm
const arcgis = esri
const dg = digitalglobe
const microsoft = bing
export {
dg,
digitalglobe,
mapbox,
esri,
arcgis,
bing,
esri,
microsoft,
osm,
openstreetmap,
strava,
digitalglobe,
}

@@ -13,2 +13,3 @@ "use strict";

format: 'png',
type: 'baselayer',
};

@@ -26,2 +27,3 @@ exports.cycle = {

format: 'png',
type: 'baselayer',
};

@@ -40,2 +42,3 @@ exports.hot = {

format: 'png',
type: 'baselayer',
};

@@ -53,2 +56,3 @@ exports.transport = {

format: 'png',
type: 'baselayer',
};

@@ -66,2 +70,3 @@ exports.wikimedia = {

format: 'png',
type: 'baselayer',
};

@@ -79,2 +84,3 @@ exports.lyrk = {

format: 'png',
type: 'baselayer',
};

@@ -92,3 +98,4 @@ exports.mapbox = {

format: 'png',
type: 'baselayer',
};
//# sourceMappingURL=osm.js.map

@@ -14,2 +14,3 @@ import { Provider } from '../index'

format: 'png',
type: 'baselayer',
}

@@ -27,2 +28,3 @@ export const cycle: Provider = {

format: 'png',
type: 'baselayer',
}

@@ -42,2 +44,3 @@

format: 'png',
type: 'baselayer',
}

@@ -56,2 +59,3 @@

format: 'png',
type: 'baselayer',
}

@@ -70,2 +74,3 @@

format: 'png',
type: 'baselayer',
}

@@ -84,2 +89,3 @@

format: 'png',
type: 'baselayer',
}

@@ -98,2 +104,3 @@

format: 'png',
type: 'baselayer',
}

@@ -14,3 +14,4 @@ "use strict";

format: 'png',
type: 'overlay',
};
//# sourceMappingURL=strava.js.map

@@ -15,2 +15,3 @@ import { Provider } from '../index'

format: 'png',
type: 'overlay',
}

@@ -45,4 +45,4 @@ # [Slippy Tile](https://www.npmjs.com/package/slippy-tile)

| ESRI World Topographic Map | esri.topo
| DigitalGlobe Imagery | digitalgloble.imagery
| DigitalGlobe Hybrid | digitalgloble.hybrid
| DigitalGlobe Imagery | digitalglobe.imagery
| DigitalGlobe Hybrid | digitalglobe.hybrid

@@ -72,4 +72,2 @@

- `{proj}`: default = EPSG:3857
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
# parse

@@ -87,4 +85,5 @@

```javascript
import * as slippyTile from 'slippy-tile'
slippyTile.parse([10, 15, 8], slippyTile.osm.standard.url)
const tile = [10, 15, 8]
const url = 'https://{s}.tile.openstreetmap.org/{zoom}/{x}/{y}.png'
slippyTile.parse(tile, url)
//='https://c.tile.openstreetmap.org/8/10/15.png'

@@ -95,2 +94,40 @@ ```

# wms
Parse WMS URL to friendly SlippyTile format
**Parameters**
- `tile` **[Tile](https://en.wikipedia.org/wiki/Tiled_web_map)** Tile [x, y, z]
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** WMTS URL scheme
**Examples**
```javascript
const tile = [10, 15, 8]
const url = 'https://<Tile Server>/?layers=imagery&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}'
slippyTile.wmts(tile, url)
//='https://<Tile Server>/?layers=imagery&SRS=EPSG:3857&WIDTH=256&HEIGHT=256&BBOX=-165.9375,82.676285,-164.53125,82.853382'
```
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
# wmts
Parse WMTS URL to friendly SlippyTile URL format
**Parameters**
- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** WMTS URL scheme
**Examples**
```javascript
const url = 'https://<Tile Server>/WMTS/tile/1.0.0/Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg'
slippyTile.wmts(url)
//='https://<Tile Server>/WMTS/tile/1.0.0/Imagery/default/GoogleMapsCompatible/{z}/{y}/{x}.jpg'
```
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
# parseSwitch

@@ -120,3 +157,3 @@

- `collection` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** List of items
- `collection` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;any>** List of items

@@ -126,3 +163,2 @@ **Examples**

```javascript
import * as slippyTile from 'slippy-tile'
slippyTile.sample(['a', 'b', 'c'])

@@ -132,5 +168,11 @@ //='b'

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Single item from the list
Returns **any** Single item from the list
# Changelog
## 1.6.0 - 2017-01-11
- Add individual parsing functions for WMS & WMTS
- Improve typescript handling for `sample`
## 1.5.0 - 2017-01-05

@@ -137,0 +179,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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