global-mercator
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -77,2 +77,3 @@ 'use strict'; | ||
* @param {BBox} bbox - [west, south, east, north] coordinates | ||
* @param {number} [decimal=6] - coordinate decimals | ||
* @return {LngLat} center | ||
@@ -83,3 +84,3 @@ * @example | ||
*/ | ||
function bboxToCenter (bbox) { | ||
function bboxToCenter (bbox, decimal = 6) { | ||
var west = bbox[0]; | ||
@@ -91,4 +92,6 @@ var south = bbox[1]; | ||
var lat = (south - north) / 2 + north; | ||
lng = Number(lng.toFixed(6)); | ||
lat = Number(lat.toFixed(6)); | ||
if (decimal !== undefined && decimal !== null) { | ||
lng = Number(lng.toFixed(decimal)); | ||
lat = Number(lat.toFixed(decimal)); | ||
} | ||
return [lng, lat] | ||
@@ -102,2 +105,3 @@ } | ||
* @param {boolean} [validate=true] validates LatLng coordinates | ||
* @param {Object} accuracy - { enable: true, decimal: 6 } | ||
* @returns {Meters} Meters coordinates | ||
@@ -108,3 +112,3 @@ * @example | ||
*/ | ||
function lngLatToMeters (lnglat, validate) { | ||
function lngLatToMeters (lnglat, validate, accuracy = { enable: true, decimal: 1 }) { | ||
lnglat = validateLngLat(lnglat, validate); | ||
@@ -116,4 +120,6 @@ var lng = lnglat[0]; | ||
y = y * originShift / 180.0; | ||
x = Number(x.toFixed(1)); | ||
y = Number(y.toFixed(1)); | ||
if (accuracy.enable) { | ||
x = Number(x.toFixed(accuracy.decimal)); | ||
y = Number(y.toFixed(accuracy.decimal)); | ||
} | ||
return [x, y] | ||
@@ -126,2 +132,3 @@ } | ||
* @param {Meters} meters Meters in Mercator [x, y] | ||
* @param {number} [decimal=6] - coordinate decimals | ||
* @returns {LngLat} LngLat coordinates | ||
@@ -132,3 +139,3 @@ * @example | ||
*/ | ||
function metersToLngLat (meters) { | ||
function metersToLngLat (meters, decimal = 6) { | ||
var x = meters[0]; | ||
@@ -139,4 +146,6 @@ var y = meters[1]; | ||
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0); | ||
lng = Number(lng.toFixed(6)); | ||
lat = Number(lat.toFixed(6)); | ||
if (decimal !== undefined && decimal !== null) { | ||
lng = Number(lng.toFixed(decimal)); | ||
lat = Number(lat.toFixed(decimal)); | ||
} | ||
return [lng, lat] | ||
@@ -227,2 +236,3 @@ } | ||
* @param {number} [tileSize=256] Tile size | ||
* @param {number} [decimal=1] - coordinate decimals | ||
* @returns {Meters} Meters coordinates | ||
@@ -233,3 +243,3 @@ * @example | ||
*/ | ||
function pixelsToMeters (pixels, tileSize) { | ||
function pixelsToMeters (pixels, tileSize, decimal = 1) { | ||
var px = pixels[0]; | ||
@@ -241,4 +251,6 @@ var py = pixels[1]; | ||
var my = py * res - originShift; | ||
mx = Number(mx.toFixed(1)); | ||
my = Number(my.toFixed(1)); | ||
if (decimal !== undefined && decimal !== null) { | ||
mx = Number(mx.toFixed(decimal)); | ||
my = Number(my.toFixed(decimal)); | ||
} | ||
return [mx, my] | ||
@@ -265,3 +277,3 @@ } | ||
validateZoom(zoom, validate); | ||
validateZoom(zoom); | ||
var tx = Math.ceil(px / tileSize) - 1; | ||
@@ -812,36 +824,36 @@ var ty = Math.ceil(py / tileSize) - 1; | ||
exports.bboxToCenter = bboxToCenter; | ||
exports.bboxToMeters = bboxToMeters; | ||
exports.bboxToTile = bboxToTile; | ||
exports.googleToBBox = googleToBBox; | ||
exports.googleToBBoxMeters = googleToBBoxMeters; | ||
exports.googleToQuadkey = googleToQuadkey; | ||
exports.googleToTile = googleToTile; | ||
exports.hash = hash; | ||
exports.initialResolution = initialResolution; | ||
exports.hash = hash; | ||
exports.pointToTile = pointToTile; | ||
exports.pointToTileFraction = pointToTileFraction; | ||
exports.bboxToCenter = bboxToCenter; | ||
exports.latitude = latitude; | ||
exports.lngLatToGoogle = lngLatToGoogle; | ||
exports.lngLatToMeters = lngLatToMeters; | ||
exports.lngLatToTile = lngLatToTile; | ||
exports.longitude = longitude; | ||
exports.maxBBox = maxBBox; | ||
exports.metersToLngLat = metersToLngLat; | ||
exports.metersToPixels = metersToPixels; | ||
exports.lngLatToTile = lngLatToTile; | ||
exports.lngLatToGoogle = lngLatToGoogle; | ||
exports.metersToTile = metersToTile; | ||
exports.pixelsToMeters = pixelsToMeters; | ||
exports.pixelsToTile = pixelsToTile; | ||
exports.pointToTile = pointToTile; | ||
exports.pointToTileFraction = pointToTileFraction; | ||
exports.quadkeyToGoogle = quadkeyToGoogle; | ||
exports.quadkeyToTile = quadkeyToTile; | ||
exports.range = range; | ||
exports.resolution = resolution; | ||
exports.tileToBBox = tileToBBox; | ||
exports.tileToBBoxMeters = tileToBBoxMeters; | ||
exports.tileToBBox = tileToBBox; | ||
exports.googleToBBoxMeters = googleToBBoxMeters; | ||
exports.googleToBBox = googleToBBox; | ||
exports.tileToGoogle = tileToGoogle; | ||
exports.googleToTile = googleToTile; | ||
exports.googleToQuadkey = googleToQuadkey; | ||
exports.tileToQuadkey = tileToQuadkey; | ||
exports.quadkeyToTile = quadkeyToTile; | ||
exports.quadkeyToGoogle = quadkeyToGoogle; | ||
exports.bboxToMeters = bboxToMeters; | ||
exports.validTile = validTile; | ||
exports.validateLngLat = validateLngLat; | ||
exports.validateTile = validateTile; | ||
exports.validateZoom = validateZoom; | ||
exports.wrapTile = wrapTile; | ||
exports.validateZoom = validateZoom; | ||
exports.validateLngLat = validateLngLat; | ||
exports.resolution = resolution; | ||
exports.range = range; | ||
exports.maxBBox = maxBBox; | ||
exports.validTile = validTile; | ||
exports.latitude = latitude; | ||
exports.longitude = longitude; | ||
exports.bboxToTile = bboxToTile; |
@@ -16,5 +16,5 @@ /** | ||
export declare function hash(tile: Tile): number; | ||
export declare function bboxToCenter(bbox: BBox): LngLat; | ||
export declare function lngLatToMeters(lnglat: LngLat, validate?: boolean): Meters; | ||
export declare function metersToLngLat(meters: Meters): LngLat; | ||
export declare function bboxToCenter(bbox: BBox, decimal?: number): LngLat; | ||
export declare function lngLatToMeters(lnglat: LngLat, validate?: boolean, decimal?: number): Meters; | ||
export declare function metersToLngLat(meters: Meters, decimal?: number): LngLat; | ||
export declare function metersToPixels(meters: Meters, zoom: number): Pixels; | ||
@@ -24,3 +24,3 @@ export declare function lngLatToTile(lnglat: LngLat, zoom: number, validate?: boolean): Tile; | ||
export declare function metersToTile(meters: Meters, zoom: number): Tile; | ||
export declare function pixelsToMeters(pixels: Pixels, validate?: boolean): Meters; | ||
export declare function pixelsToMeters(pixels: Pixels, validate?: boolean, decimal?: number): Meters; | ||
export declare function pixelsToTile(pixels: Pixels, validate?: boolean): Tile; | ||
@@ -27,0 +27,0 @@ export declare function tileToBBoxMeters(tile: Tile, validate?: boolean): BBox; |
36
index.js
@@ -73,2 +73,3 @@ var originShift = 2 * Math.PI * 6378137 / 2.0 | ||
* @param {BBox} bbox - [west, south, east, north] coordinates | ||
* @param {number} [decimal=6] - coordinate decimals | ||
* @return {LngLat} center | ||
@@ -79,3 +80,3 @@ * @example | ||
*/ | ||
export function bboxToCenter (bbox) { | ||
export function bboxToCenter (bbox, decimal = 6) { | ||
var west = bbox[0] | ||
@@ -87,4 +88,6 @@ var south = bbox[1] | ||
var lat = (south - north) / 2 + north | ||
lng = Number(lng.toFixed(6)) | ||
lat = Number(lat.toFixed(6)) | ||
if (decimal !== undefined && decimal !== null) { | ||
lng = Number(lng.toFixed(decimal)) | ||
lat = Number(lat.toFixed(decimal)) | ||
} | ||
return [lng, lat] | ||
@@ -98,2 +101,3 @@ } | ||
* @param {boolean} [validate=true] validates LatLng coordinates | ||
* @param {Object} accuracy - { enable: true, decimal: 6 } | ||
* @returns {Meters} Meters coordinates | ||
@@ -104,3 +108,3 @@ * @example | ||
*/ | ||
export function lngLatToMeters (lnglat, validate) { | ||
export function lngLatToMeters (lnglat, validate, accuracy = { enable: true, decimal: 1 }) { | ||
lnglat = validateLngLat(lnglat, validate) | ||
@@ -112,4 +116,6 @@ var lng = lnglat[0] | ||
y = y * originShift / 180.0 | ||
x = Number(x.toFixed(1)) | ||
y = Number(y.toFixed(1)) | ||
if (accuracy.enable) { | ||
x = Number(x.toFixed(accuracy.decimal)) | ||
y = Number(y.toFixed(accuracy.decimal)) | ||
} | ||
return [x, y] | ||
@@ -122,2 +128,3 @@ } | ||
* @param {Meters} meters Meters in Mercator [x, y] | ||
* @param {number} [decimal=6] - coordinate decimals | ||
* @returns {LngLat} LngLat coordinates | ||
@@ -128,3 +135,3 @@ * @example | ||
*/ | ||
export function metersToLngLat (meters) { | ||
export function metersToLngLat (meters, decimal = 6) { | ||
var x = meters[0] | ||
@@ -135,4 +142,6 @@ var y = meters[1] | ||
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0) | ||
lng = Number(lng.toFixed(6)) | ||
lat = Number(lat.toFixed(6)) | ||
if (decimal !== undefined && decimal !== null) { | ||
lng = Number(lng.toFixed(decimal)) | ||
lat = Number(lat.toFixed(decimal)) | ||
} | ||
return [lng, lat] | ||
@@ -223,2 +232,3 @@ } | ||
* @param {number} [tileSize=256] Tile size | ||
* @param {number} [decimal=1] - coordinate decimals | ||
* @returns {Meters} Meters coordinates | ||
@@ -229,3 +239,3 @@ * @example | ||
*/ | ||
export function pixelsToMeters (pixels, tileSize) { | ||
export function pixelsToMeters (pixels, tileSize, decimal = 1) { | ||
var px = pixels[0] | ||
@@ -237,4 +247,6 @@ var py = pixels[1] | ||
var my = py * res - originShift | ||
mx = Number(mx.toFixed(1)) | ||
my = Number(my.toFixed(1)) | ||
if (decimal !== undefined && decimal !== null) { | ||
mx = Number(mx.toFixed(decimal)) | ||
my = Number(my.toFixed(decimal)) | ||
} | ||
return [mx, my] | ||
@@ -241,0 +253,0 @@ } |
{ | ||
"name": "global-mercator", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Tools to help with TMS, Quadkey & Google (XYZ) Tiles", | ||
@@ -5,0 +5,0 @@ "repository": { |
343
README.md
@@ -80,2 +80,101 @@ # Global Mercator | ||
#### Table of Contents | ||
- [hash](#hash) | ||
- [Parameters](#parameters) | ||
- [Examples](#examples) | ||
- [pointToTile](#pointtotile) | ||
- [Parameters](#parameters-1) | ||
- [Examples](#examples-1) | ||
- [pointToTileFraction](#pointtotilefraction) | ||
- [Parameters](#parameters-2) | ||
- [Examples](#examples-2) | ||
- [bboxToCenter](#bboxtocenter) | ||
- [Parameters](#parameters-3) | ||
- [Examples](#examples-3) | ||
- [lngLatToMeters](#lnglattometers) | ||
- [Parameters](#parameters-4) | ||
- [Examples](#examples-4) | ||
- [metersToLngLat](#meterstolnglat) | ||
- [Parameters](#parameters-5) | ||
- [Examples](#examples-5) | ||
- [metersToPixels](#meterstopixels) | ||
- [Parameters](#parameters-6) | ||
- [Examples](#examples-6) | ||
- [lngLatToTile](#lnglattotile) | ||
- [Parameters](#parameters-7) | ||
- [Examples](#examples-7) | ||
- [lngLatToGoogle](#lnglattogoogle) | ||
- [Parameters](#parameters-8) | ||
- [Examples](#examples-8) | ||
- [metersToTile](#meterstotile) | ||
- [Parameters](#parameters-9) | ||
- [Examples](#examples-9) | ||
- [pixelsToMeters](#pixelstometers) | ||
- [Parameters](#parameters-10) | ||
- [Examples](#examples-10) | ||
- [pixelsToTile](#pixelstotile) | ||
- [Parameters](#parameters-11) | ||
- [Examples](#examples-11) | ||
- [tileToBBoxMeters](#tiletobboxmeters) | ||
- [Parameters](#parameters-12) | ||
- [Examples](#examples-12) | ||
- [tileToBBox](#tiletobbox) | ||
- [Parameters](#parameters-13) | ||
- [Examples](#examples-13) | ||
- [googleToBBoxMeters](#googletobboxmeters) | ||
- [Parameters](#parameters-14) | ||
- [Examples](#examples-14) | ||
- [googleToBBox](#googletobbox) | ||
- [Parameters](#parameters-15) | ||
- [Examples](#examples-15) | ||
- [tileToGoogle](#tiletogoogle) | ||
- [Parameters](#parameters-16) | ||
- [Examples](#examples-16) | ||
- [googleToTile](#googletotile) | ||
- [Parameters](#parameters-17) | ||
- [Examples](#examples-17) | ||
- [googleToQuadkey](#googletoquadkey) | ||
- [Parameters](#parameters-18) | ||
- [Examples](#examples-18) | ||
- [tileToQuadkey](#tiletoquadkey) | ||
- [Parameters](#parameters-19) | ||
- [Examples](#examples-19) | ||
- [quadkeyToTile](#quadkeytotile) | ||
- [Parameters](#parameters-20) | ||
- [Examples](#examples-20) | ||
- [quadkeyToGoogle](#quadkeytogoogle) | ||
- [Parameters](#parameters-21) | ||
- [Examples](#examples-21) | ||
- [bboxToMeters](#bboxtometers) | ||
- [Parameters](#parameters-22) | ||
- [Examples](#examples-22) | ||
- [validateTile](#validatetile) | ||
- [Parameters](#parameters-23) | ||
- [Examples](#examples-23) | ||
- [wrapTile](#wraptile) | ||
- [Parameters](#parameters-24) | ||
- [Examples](#examples-24) | ||
- [validateZoom](#validatezoom) | ||
- [Parameters](#parameters-25) | ||
- [Examples](#examples-25) | ||
- [validateLngLat](#validatelnglat) | ||
- [Parameters](#parameters-26) | ||
- [Examples](#examples-26) | ||
- [maxBBox](#maxbbox) | ||
- [Parameters](#parameters-27) | ||
- [Examples](#examples-27) | ||
- [validTile](#validtile) | ||
- [Parameters](#parameters-28) | ||
- [Examples](#examples-28) | ||
- [latitude](#latitude) | ||
- [Parameters](#parameters-29) | ||
- [Examples](#examples-29) | ||
- [longitude](#longitude) | ||
- [Parameters](#parameters-30) | ||
- [Examples](#examples-30) | ||
- [bboxToTile](#bboxtotile) | ||
- [Parameters](#parameters-31) | ||
- [Examples](#examples-31) | ||
### hash | ||
@@ -85,7 +184,7 @@ | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** [x, y, z] | ||
**Examples** | ||
#### Examples | ||
@@ -97,3 +196,3 @@ ```javascript | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** hash | ||
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** hash | ||
@@ -105,9 +204,9 @@ ### pointToTile | ||
**Parameters** | ||
#### Parameters | ||
- `lnglat` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `lnglat` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -126,9 +225,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `lnglat` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `lnglat` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -146,7 +245,8 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `bbox` **BBox** [west, south, east, north] coordinates | ||
- `accurancy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** { enable: true, decimal: 6} (optional, default `{enable:true,decimal:6}`) | ||
**Examples** | ||
#### Examples | ||
@@ -164,8 +264,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `lnglat` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `lnglat` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `accurancy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** { enable: true, decimal: 6} (optional, default `{enable:true,decimal:1}`) | ||
**Examples** | ||
#### Examples | ||
@@ -183,7 +284,8 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `meters` **Meters** Meters in Mercator [x, y] | ||
- `accurancy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** { enable: true, decimal: 6} (optional, default `{enable:true,decimal:6}`) | ||
**Examples** | ||
#### Examples | ||
@@ -201,9 +303,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `meters` **Meters** Meters in Mercator [x, y] | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `tileSize` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `tileSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
**Examples** | ||
#### Examples | ||
@@ -221,9 +323,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `lnglat` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `lnglat` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -241,9 +343,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `lnglat` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `lnglat` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -261,8 +363,8 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `meters` **Meters** Meters in Mercator [x, y] | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
**Examples** | ||
#### Examples | ||
@@ -280,8 +382,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `pixels` **Pixels** Pixels [x, y, zoom] | ||
- `tileSize` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `tileSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `accurancy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** { enable: true, decimal: 6} (optional, default `{enable:true,decimal:6}`) | ||
**Examples** | ||
#### Examples | ||
@@ -299,9 +402,9 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `pixels` **Pixels** Pixels [x, y, zoom] | ||
- `tileSize` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Pixels coordinates (optional, default `true`) | ||
- `tileSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Pixels coordinates (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -319,12 +422,12 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** Tile [x, y, zoom] | ||
- `tileSize` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile X | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile Y | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `tileSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Tile size (optional, default `256`) | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `x` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile X | ||
- `y` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile Y | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
**Examples** | ||
#### Examples | ||
@@ -342,11 +445,11 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** Tile [x, y, zoom] | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `x` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile X | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile Y | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `x` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile X | ||
- `y` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** TMS Tile Y | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
**Examples** | ||
#### Examples | ||
@@ -364,7 +467,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `google` **Google** Google [x, y, zoom] | ||
**Examples** | ||
#### Examples | ||
@@ -382,7 +485,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `google` **Google** Google [x, y, zoom] | ||
**Examples** | ||
#### Examples | ||
@@ -400,8 +503,8 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** Tile [x, y, zoom] | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -419,7 +522,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `google` **Google** Google [x, y, zoom] | ||
**Examples** | ||
#### Examples | ||
@@ -437,7 +540,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `google` **Google** Google [x, y, zoom] | ||
**Examples** | ||
#### Examples | ||
@@ -449,3 +552,3 @@ ```javascript | ||
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
@@ -456,8 +559,8 @@ ### tileToQuadkey | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** Tile [x, y, zoom] | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -469,3 +572,3 @@ ```javascript | ||
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
@@ -476,7 +579,7 @@ ### quadkeyToTile | ||
**Parameters** | ||
#### Parameters | ||
- `quadkey` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
- `quadkey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
**Examples** | ||
#### Examples | ||
@@ -494,7 +597,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `quadkey` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
- `quadkey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Microsoft's Quadkey schema | ||
**Examples** | ||
#### Examples | ||
@@ -512,7 +615,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `bbox` **BBox** extent in [minX, minY, maxX, maxY] order | ||
**Examples** | ||
#### Examples | ||
@@ -530,8 +633,8 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** Tile [x, y, zoom] | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Tile (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -547,3 +650,3 @@ ```javascript | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if TMS Tile is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if TMS Tile is not valid. | ||
@@ -556,8 +659,8 @@ Returns **Tile** TMS Tile | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom Level | ||
- `tile` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom Level | ||
**Examples** | ||
#### Examples | ||
@@ -571,3 +674,3 @@ ```javascript | ||
Returns **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Wrapped Tile | ||
Returns **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Wrapped Tile | ||
@@ -578,8 +681,8 @@ ### validateZoom | ||
**Parameters** | ||
#### Parameters | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Zoom level (optional, default `true`) | ||
- `zoom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Zoom level | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates Zoom level (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -595,5 +698,5 @@ ```javascript | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if zoom is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if zoom is not valid. | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** zoom Zoom level | ||
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** zoom Zoom level | ||
@@ -604,8 +707,8 @@ ### validateLngLat | ||
**Parameters** | ||
#### Parameters | ||
- `lnglat` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `validate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
- `lnglat` **\[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)]** [Longitude, Latitude] | ||
- `validate` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** validates LatLng coordinates (optional, default `true`) | ||
**Examples** | ||
#### Examples | ||
@@ -619,3 +722,3 @@ ```javascript | ||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if LngLat is not valid. | ||
- Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** Will throw an error if LngLat is not valid. | ||
@@ -628,7 +731,7 @@ Returns **LngLat** LngLat coordinates | ||
**Parameters** | ||
#### Parameters | ||
- `array` **(BBox | [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<BBox>)** BBox [west, south, east, north] | ||
- `array` **(BBox | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<BBox>)** BBox [west, south, east, north] | ||
**Examples** | ||
#### Examples | ||
@@ -646,7 +749,7 @@ ```javascript | ||
**Parameters** | ||
#### Parameters | ||
- `tile` **Tile** Tile [x, y, zoom] | ||
**Examples** | ||
#### Examples | ||
@@ -662,3 +765,3 @@ ```javascript | ||
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** valid tile true/false | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** valid tile true/false | ||
@@ -669,7 +772,7 @@ ### latitude | ||
**Parameters** | ||
#### Parameters | ||
- `lat` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** latitude to modify | ||
- `lat` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** latitude to modify | ||
**Examples** | ||
#### Examples | ||
@@ -681,3 +784,3 @@ ```javascript | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** modified latitude | ||
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** modified latitude | ||
@@ -688,7 +791,7 @@ ### longitude | ||
**Parameters** | ||
#### Parameters | ||
- `lng` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** longitude to modify | ||
- `lng` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** longitude to modify | ||
**Examples** | ||
#### Examples | ||
@@ -700,3 +803,3 @@ ```javascript | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** modified longitude | ||
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** modified longitude | ||
@@ -707,8 +810,8 @@ ### bboxToTile | ||
**Parameters** | ||
#### Parameters | ||
- `bboxCoords` | ||
- `bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** BBox | ||
- `bbox` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>** BBox | ||
**Examples** | ||
#### Examples | ||
@@ -720,2 +823,2 @@ ```javascript | ||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** tile Tile | ||
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>** tile Tile |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80678
1582
781