global-mercator
Advanced tools
Comparing version 2.0.4 to 2.1.0
## Changelog | ||
# Changelog | ||
### 2.0.0 - 2017-02.18 | ||
## 2.1.0 - 2017-02-21 | ||
- Added `maxBBox` method | ||
- Added Benchmark performance testing | ||
## 2.0.0 - 2017-02.18 | ||
- Convert to ES5 | ||
- Convert project to support Rollup | ||
- Add `tileSize` @param | ||
- Add `tileSize` @param | ||
- Dropped Grid methods (BREAKS backwards compatibility - Major release 2.X) | ||
- Support browser, nodejs & commonjs | ||
### 1.9.0 - 2017-02-17 | ||
## 1.9.0 - 2017-02-17 | ||
@@ -18,11 +23,11 @@ - Update fixed bbox if zoom level = 0 | ||
### 1.8.0 - 2017-01-30 | ||
## 1.8.0 - 2017-01-30 | ||
- Publish web browser support for ES6. | ||
### 1.7.0 - 2017-01-24 | ||
## 1.7.0 - 2017-01-24 | ||
- Refactoring entire codebase to standard Javascript | ||
### 1.6.0 - 2017-01-05 | ||
## 1.6.0 - 2017-01-05 | ||
@@ -34,3 +39,3 @@ - BBox reduced decimal precision to 6 | ||
### 1.5.0 - 2016-12-25 | ||
## 1.5.0 - 2016-12-25 | ||
@@ -40,3 +45,3 @@ - Add bboxToCenter & hash function | ||
### 1.4.0 - 2016-12-4 | ||
## 1.4.0 - 2016-12-4 | ||
@@ -46,7 +51,7 @@ - Replace test tools for Jest | ||
### 1.3.5 - 2016-10-25 | ||
## 1.3.5 - 2016-10-25 | ||
Reduce library size by 430% (350KB to 80KB) | ||
### 1.3.1 - 2016-10-14 | ||
## 1.3.1 - 2016-10-14 | ||
@@ -68,3 +73,3 @@ - Update typings to allow `number[]` | ||
### 1.2.0 - 2016-10-13 | ||
## 1.2.0 - 2016-10-13 | ||
@@ -78,3 +83,3 @@ Added new features: | ||
### 1.1.0 - 2016-10-03 | ||
## 1.1.0 - 2016-10-03 | ||
@@ -84,4 +89,4 @@ - Remove Default export | ||
### 1.0.0 - 2016-10-01 | ||
## 1.0.0 - 2016-10-01 | ||
First Stable release was created |
@@ -585,2 +585,34 @@ (function (global, factory) { | ||
/** | ||
* Maximum extent of BBox | ||
* | ||
* @param {BBox|BBox[]} array BBox [west, south, east, north] | ||
* @returns {BBox} Maximum BBox | ||
* @example | ||
* var bbox = maxBBox([[-20, -30, 20, 30], [-110, -30, 120, 80]]) | ||
* //=[-110, -30, 120, 80] | ||
*/ | ||
function maxBBox (array) { | ||
// Single BBox | ||
if (array && array[0] && array.length === 4 && array[0][0] === undefined) { | ||
return array | ||
} | ||
// Multiple BBox | ||
if (array && array[0] && array[0][0] !== undefined) { | ||
var west = array[0][0]; | ||
var south = array[0][1]; | ||
var east = array[0][2]; | ||
var north = array[0][3]; | ||
array.map(function (bbox) { | ||
if (bbox[0] < west) { west = bbox[0]; } | ||
if (bbox[1] < south) { south = bbox[1]; } | ||
if (bbox[2] > east) { east = bbox[2]; } | ||
if (bbox[3] > north) { north = bbox[3]; } | ||
}); | ||
return [west, south, east, north] | ||
} | ||
} | ||
exports.hash = hash; | ||
@@ -613,2 +645,3 @@ exports.bboxToCenter = bboxToCenter; | ||
exports.range = range; | ||
exports.maxBBox = maxBBox; | ||
@@ -615,0 +648,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(r.globalMercator=r.globalMercator||{})}(this,function(r){"use strict";function e(r){return r=r||256,2*Math.PI*6378137/r}function t(r){var e=r[0],t=r[1],n=r[2];return(1<<n)*((1<<n)+e)+t}function n(r){var e=r[0],t=r[1],n=r[2],o=r[3],i=(e-n)/2+n,a=(t-o)/2+o;return i=Number(i.toFixed(6)),a=Number(a.toFixed(6)),[i,a]}function o(r){L(r);var e=r[0],t=r[1],n=e*q/180,o=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return o=o*q/180,n=Number(n.toFixed(1)),o=Number(o.toFixed(1)),[n,o]}function i(r){var e=r[0],t=r[1],n=e/q*180,o=t/q*180;return o=180/Math.PI*(2*Math.atan(Math.exp(o*Math.PI/180))-Math.PI/2),n=Number(n.toFixed(6)),o=Number(o.toFixed(6)),[n,o]}function a(r,e,t){var n=r[0],o=r[1],i=P(e,t),a=(n+q)/i,u=(o+q)/i;return[a,u,e]}function u(r,e){var t=o(L(r)),n=a(t,e);return s(n)}function l(r,e){if(0===e)return[0,0,0];var t=u(L(r),e);return g(t)}function f(r,e){if(0===e)return[0,0,0];var t=a(r,e);return s(t)}function c(r,e){I(r);var t=r[0],n=r[1],o=r[2],i=P(o,e),a=t*i-q,u=n*i-q;return a=Number(a.toFixed(1)),u=Number(u.toFixed(1)),[a,u]}function s(r,e){e=e||256,I(r);var t=r[0],n=r[1],o=r[2];if(0===o)return[0,0,0];var i=Math.ceil(t/e)-1,a=Math.ceil(n/e)-1;return i<0&&(i=0),a<0&&(a=0),[i,a,o]}function h(r,e){e=e||256,E(r);var t=r[0],n=r[1],o=r[2],i=c([t*e,n*e,o]),a=c([(t+1)*e,(n+1)*e,o]);return[i[0],i[1],a[0],a[1]]}function v(r){E(r);var e=r[0],t=r[1],n=r[2];if(0===n)return[-180,-85.051129,180,85.051129];var o=h([e,t,n]),a=o[0],u=o[1],l=o[2],f=o[3],c=i([a,u,n]),s=i([l,f,n]);return[c[0],c[1],s[0],s[1]]}function d(r){var e=M(r);return h(e)}function w(r){var e=M(r);return v(e)}function g(r){E(r);var e=r[0],t=r[1],n=r[2];if(0===n)return[0,0,0];var o=e,i=Math.pow(2,n)-1-t;return[o,i,n]}function M(r){var e=r[0],t=r[1],n=r[2],o=e,i=Math.pow(2,n)-t-1;return[o,i,n]}function b(r){var e=M(r);return T(e)}function T(r){E(r);var e=r[0],t=r[1],n=r[2];if(0===n)return"";var o="";return t=Math.pow(2,n)-1-t,k(n,0,-1).map(function(r){var n=0,i=1<<r-1;0!==(e&i)&&(n+=1),0!==(t&i)&&(n+=2),o=o.concat(n)}),o}function m(r){var e=x(r);return M(e)}function x(r){var e=0,t=0,n=r.length;return k(n,0,-1).map(function(o){var i=1<<o-1;switch(parseInt(r[n-o],0)){case 0:break;case 1:e+=i;break;case 2:t+=i;break;case 3:e+=i,t+=i;break;default:throw new Error("Invalid Quadkey digit sequence")}}),[e,t,n]}function p(r){var e=o([r[0],r[1]]),t=o([r[2],r[3]]);return[e[0],e[1],t[0],t[1]]}function E(r){var e=r[0],t=r[1],n=r[2];if(y(n),void 0===e||null===e)throw new Error("<x> is required");if(void 0===t||null===t)throw new Error("<y> is required");if(e<0)throw new Error("<x> must not be less than 0");if(t<0)throw new Error("<y> must not be less than 0");var o=Math.pow(2,n);if(e>=o||t>=o)throw new Error("Illegal parameters for tile");return r}function y(r){if(void 0===r||null===r)throw new Error("<zoom> is required");if(r<0)throw new Error("<zoom> cannot be less than 0");if(r>30)throw new Error("<zoom> cannot be greater than 30");return r}function L(r){var e=r[0],t=r[1];if(void 0===t||null===t)throw new Error("<lat> is required");if(void 0===e||null===e)throw new Error("<lng> is required");if(t<-90||t>90)throw new Error("LngLat <lat> must be within -90 to 90 degrees");if(e<-180||e>180)throw new Error("LngLat <lng> must be within -180 to 180 degrees");return[e,t]}function I(r){return r}function P(r,t){return e(t)/Math.pow(2,r)}function k(r,e,t){null==e&&(e=r||0,r=0),t||(t=e<r?-1:1);for(var n=Math.max(Math.ceil((e-r)/t),0),o=Array(n),i=0;i<n;i++,r+=t)o[i]=r;return o}var q=2*Math.PI*6378137/2;r.hash=t,r.bboxToCenter=n,r.lngLatToMeters=o,r.metersToLngLat=i,r.metersToPixels=a,r.lngLatToTile=u,r.lngLatToGoogle=l,r.metersToTile=f,r.pixelsToMeters=c,r.pixelsToTile=s,r.tileToBBoxMeters=h,r.tileToBBox=v,r.googleToBBoxMeters=d,r.googleToBBox=w,r.tileToGoogle=g,r.googleToTile=M,r.googleToQuadkey=b,r.tileToQuadkey=T,r.quadkeyToTile=m,r.quadkeyToGoogle=x,r.bboxToMeters=p,r.validateTile=E,r.validateZoom=y,r.validateLngLat=L,r.validatePixels=I,r.resolution=P,r.range=k,Object.defineProperty(r,"__esModule",{value:!0})}); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(r.globalMercator=r.globalMercator||{})}(this,function(r){"use strict";function e(r){return r=r||256,2*Math.PI*6378137/r}function t(r){var e=r[0],t=r[1],n=r[2];return(1<<n)*((1<<n)+e)+t}function n(r){var e=r[0],t=r[1],n=r[2],o=r[3],i=(e-n)/2+n,a=(t-o)/2+o;return i=Number(i.toFixed(6)),a=Number(a.toFixed(6)),[i,a]}function o(r){L(r);var e=r[0],t=r[1],n=e*q/180,o=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return o=o*q/180,n=Number(n.toFixed(1)),o=Number(o.toFixed(1)),[n,o]}function i(r){var e=r[0],t=r[1],n=e/q*180,o=t/q*180;return o=180/Math.PI*(2*Math.atan(Math.exp(o*Math.PI/180))-Math.PI/2),n=Number(n.toFixed(6)),o=Number(o.toFixed(6)),[n,o]}function a(r,e,t){var n=r[0],o=r[1],i=I(e,t),a=(n+q)/i,u=(o+q)/i;return[a,u,e]}function u(r,e){var t=o(L(r)),n=a(t,e);return s(n)}function l(r,e){if(0===e)return[0,0,0];var t=u(L(r),e);return g(t)}function f(r,e){if(0===e)return[0,0,0];var t=a(r,e);return s(t)}function c(r,e){B(r);var t=r[0],n=r[1],o=r[2],i=I(o,e),a=t*i-q,u=n*i-q;return a=Number(a.toFixed(1)),u=Number(u.toFixed(1)),[a,u]}function s(r,e){e=e||256,B(r);var t=r[0],n=r[1],o=r[2];if(0===o)return[0,0,0];var i=Math.ceil(t/e)-1,a=Math.ceil(n/e)-1;return i<0&&(i=0),a<0&&(a=0),[i,a,o]}function v(r,e){e=e||256,E(r);var t=r[0],n=r[1],o=r[2],i=c([t*e,n*e,o]),a=c([(t+1)*e,(n+1)*e,o]);return[i[0],i[1],a[0],a[1]]}function h(r){E(r);var e=r[0],t=r[1],n=r[2];if(0===n)return[-180,-85.051129,180,85.051129];var o=v([e,t,n]),a=o[0],u=o[1],l=o[2],f=o[3],c=i([a,u,n]),s=i([l,f,n]);return[c[0],c[1],s[0],s[1]]}function d(r){var e=M(r);return v(e)}function w(r){var e=M(r);return h(e)}function g(r){E(r);var e=r[0],t=r[1],n=r[2];if(0===n)return[0,0,0];var o=e,i=Math.pow(2,n)-1-t;return[o,i,n]}function M(r){var e=r[0],t=r[1],n=r[2],o=e,i=Math.pow(2,n)-t-1;return[o,i,n]}function m(r){var e=M(r);return x(e)}function x(r){E(r);var e=r[0],t=r[1],n=r[2];if(0===n)return"";var o="";return t=Math.pow(2,n)-1-t,P(n,0,-1).map(function(r){var n=0,i=1<<r-1;0!==(e&i)&&(n+=1),0!==(t&i)&&(n+=2),o=o.concat(n)}),o}function b(r){var e=T(r);return M(e)}function T(r){var e=0,t=0,n=r.length;return P(n,0,-1).map(function(o){var i=1<<o-1;switch(parseInt(r[n-o],0)){case 0:break;case 1:e+=i;break;case 2:t+=i;break;case 3:e+=i,t+=i;break;default:throw new Error("Invalid Quadkey digit sequence")}}),[e,t,n]}function p(r){var e=o([r[0],r[1]]),t=o([r[2],r[3]]);return[e[0],e[1],t[0],t[1]]}function E(r){var e=r[0],t=r[1],n=r[2];if(y(n),void 0===e||null===e)throw new Error("<x> is required");if(void 0===t||null===t)throw new Error("<y> is required");if(e<0)throw new Error("<x> must not be less than 0");if(t<0)throw new Error("<y> must not be less than 0");var o=Math.pow(2,n);if(e>=o||t>=o)throw new Error("Illegal parameters for tile");return r}function y(r){if(void 0===r||null===r)throw new Error("<zoom> is required");if(r<0)throw new Error("<zoom> cannot be less than 0");if(r>30)throw new Error("<zoom> cannot be greater than 30");return r}function L(r){var e=r[0],t=r[1];if(void 0===t||null===t)throw new Error("<lat> is required");if(void 0===e||null===e)throw new Error("<lng> is required");if(t<-90||t>90)throw new Error("LngLat <lat> must be within -90 to 90 degrees");if(e<-180||e>180)throw new Error("LngLat <lng> must be within -180 to 180 degrees");return[e,t]}function B(r){return r}function I(r,t){return e(t)/Math.pow(2,r)}function P(r,e,t){null==e&&(e=r||0,r=0),t||(t=e<r?-1:1);for(var n=Math.max(Math.ceil((e-r)/t),0),o=Array(n),i=0;i<n;i++,r+=t)o[i]=r;return o}function k(r){if(r&&r[0]&&4===r.length&&void 0===r[0][0])return r;if(r&&r[0]&&void 0!==r[0][0]){var e=r[0][0],t=r[0][1],n=r[0][2],o=r[0][3];return r.map(function(r){r[0]<e&&(e=r[0]),r[1]<t&&(t=r[1]),r[2]>n&&(n=r[2]),r[3]>o&&(o=r[3])}),[e,t,n,o]}}var q=2*Math.PI*6378137/2;r.hash=t,r.bboxToCenter=n,r.lngLatToMeters=o,r.metersToLngLat=i,r.metersToPixels=a,r.lngLatToTile=u,r.lngLatToGoogle=l,r.metersToTile=f,r.pixelsToMeters=c,r.pixelsToTile=s,r.tileToBBoxMeters=v,r.tileToBBox=h,r.googleToBBoxMeters=d,r.googleToBBox=w,r.tileToGoogle=g,r.googleToTile=M,r.googleToQuadkey=m,r.tileToQuadkey=x,r.quadkeyToTile=b,r.quadkeyToGoogle=T,r.bboxToMeters=p,r.validateTile=E,r.validateZoom=y,r.validateLngLat=L,r.validatePixels=B,r.resolution=I,r.range=P,r.maxBBox=k,Object.defineProperty(r,"__esModule",{value:!0})}); |
@@ -579,3 +579,35 @@ var originShift = 2 * Math.PI * 6378137 / 2.0; | ||
export { hash, bboxToCenter, lngLatToMeters, metersToLngLat, metersToPixels, lngLatToTile, lngLatToGoogle, metersToTile, pixelsToMeters, pixelsToTile, tileToBBoxMeters, tileToBBox, googleToBBoxMeters, googleToBBox, tileToGoogle, googleToTile, googleToQuadkey, tileToQuadkey, quadkeyToTile, quadkeyToGoogle, bboxToMeters, validateTile, validateZoom, validateLngLat, validatePixels, resolution, range }; | ||
/** | ||
* Maximum extent of BBox | ||
* | ||
* @param {BBox|BBox[]} array BBox [west, south, east, north] | ||
* @returns {BBox} Maximum BBox | ||
* @example | ||
* var bbox = maxBBox([[-20, -30, 20, 30], [-110, -30, 120, 80]]) | ||
* //=[-110, -30, 120, 80] | ||
*/ | ||
function maxBBox (array) { | ||
// Single BBox | ||
if (array && array[0] && array.length === 4 && array[0][0] === undefined) { | ||
return array | ||
} | ||
// Multiple BBox | ||
if (array && array[0] && array[0][0] !== undefined) { | ||
var west = array[0][0]; | ||
var south = array[0][1]; | ||
var east = array[0][2]; | ||
var north = array[0][3]; | ||
array.map(function (bbox) { | ||
if (bbox[0] < west) { west = bbox[0]; } | ||
if (bbox[1] < south) { south = bbox[1]; } | ||
if (bbox[2] > east) { east = bbox[2]; } | ||
if (bbox[3] > north) { north = bbox[3]; } | ||
}); | ||
return [west, south, east, north] | ||
} | ||
} | ||
export { hash, bboxToCenter, lngLatToMeters, metersToLngLat, metersToPixels, lngLatToTile, lngLatToGoogle, metersToTile, pixelsToMeters, pixelsToTile, tileToBBoxMeters, tileToBBox, googleToBBoxMeters, googleToBBox, tileToGoogle, googleToTile, googleToQuadkey, tileToQuadkey, quadkeyToTile, quadkeyToGoogle, bboxToMeters, validateTile, validateZoom, validateLngLat, validatePixels, resolution, range, maxBBox }; | ||
//# sourceMappingURL=global-mercator.es.js.map |
@@ -583,2 +583,34 @@ 'use strict'; | ||
/** | ||
* Maximum extent of BBox | ||
* | ||
* @param {BBox|BBox[]} array BBox [west, south, east, north] | ||
* @returns {BBox} Maximum BBox | ||
* @example | ||
* var bbox = maxBBox([[-20, -30, 20, 30], [-110, -30, 120, 80]]) | ||
* //=[-110, -30, 120, 80] | ||
*/ | ||
function maxBBox (array) { | ||
// Single BBox | ||
if (array && array[0] && array.length === 4 && array[0][0] === undefined) { | ||
return array | ||
} | ||
// Multiple BBox | ||
if (array && array[0] && array[0][0] !== undefined) { | ||
var west = array[0][0]; | ||
var south = array[0][1]; | ||
var east = array[0][2]; | ||
var north = array[0][3]; | ||
array.map(function (bbox) { | ||
if (bbox[0] < west) { west = bbox[0]; } | ||
if (bbox[1] < south) { south = bbox[1]; } | ||
if (bbox[2] > east) { east = bbox[2]; } | ||
if (bbox[3] > north) { north = bbox[3]; } | ||
}); | ||
return [west, south, east, north] | ||
} | ||
} | ||
exports.hash = hash; | ||
@@ -611,2 +643,3 @@ exports.bboxToCenter = bboxToCenter; | ||
exports.range = range; | ||
exports.maxBBox = maxBBox; | ||
//# sourceMappingURL=global-mercator.js.map |
@@ -42,1 +42,2 @@ /** | ||
export declare function range(start: number, stop?: number, step?: number): number[]; | ||
export declare function maxBBox(array: BBox|BBox[]): BBox |
32
index.js
@@ -578,1 +578,33 @@ var originShift = 2 * Math.PI * 6378137 / 2.0 | ||
} | ||
/** | ||
* Maximum extent of BBox | ||
* | ||
* @param {BBox|BBox[]} array BBox [west, south, east, north] | ||
* @returns {BBox} Maximum BBox | ||
* @example | ||
* var bbox = maxBBox([[-20, -30, 20, 30], [-110, -30, 120, 80]]) | ||
* //=[-110, -30, 120, 80] | ||
*/ | ||
export function maxBBox (array) { | ||
// Single BBox | ||
if (array && array[0] && array.length === 4 && array[0][0] === undefined) { | ||
return array | ||
} | ||
// Multiple BBox | ||
if (array && array[0] && array[0][0] !== undefined) { | ||
var west = array[0][0] | ||
var south = array[0][1] | ||
var east = array[0][2] | ||
var north = array[0][3] | ||
array.map(function (bbox) { | ||
if (bbox[0] < west) { west = bbox[0] } | ||
if (bbox[1] < south) { south = bbox[1] } | ||
if (bbox[2] > east) { east = bbox[2] } | ||
if (bbox[3] > north) { north = bbox[3] } | ||
}) | ||
return [west, south, east, north] | ||
} | ||
} |
{ | ||
"name": "global-mercator", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"description": "Tools to help with TMS, Quadkey & Google (XYZ) Tiles", | ||
@@ -25,3 +25,5 @@ "main": "dist/global-mercator.js", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"benchmark": "^2.1.3", | ||
"coveralls": "^2.11.15", | ||
@@ -28,0 +30,0 @@ "documentation": "^4.0.0-beta.18", |
@@ -34,3 +34,3 @@ # [Global Mercator](https://www.npmjs.com/package/global-mercator) | ||
var tile = [10, 15, 8] // [x, y, zoom] | ||
mercator.tileToBBox(tile) | ||
globalMercator.tileToBBox(tile) | ||
// [ -165.937, -82.853, -164.531, -82.676 ] | ||
@@ -66,7 +66,6 @@ ``` | ||
| [validatePixels(Pixels)](#validatepixels) | Validates Pixels coordinates | | ||
| [maxBBox(BBox\[\])](#maxbbox) | Maximum extent of BBox | | ||
## API | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
### hash | ||
@@ -83,3 +82,3 @@ | ||
```javascript | ||
const id = hash([312, 480, 4]) | ||
var id = hash([312, 480, 4]) | ||
//=5728 | ||
@@ -101,3 +100,3 @@ ``` | ||
```javascript | ||
const center = bboxToCenter([90, -45, 85, -50]) | ||
var center = bboxToCenter([90, -45, 85, -50]) | ||
//= [ 87.5, -47.5 ] | ||
@@ -119,3 +118,3 @@ ``` | ||
```javascript | ||
const meters = lngLatToMeters([126, 37]) | ||
var meters = lngLatToMeters([126, 37]) | ||
//=[ 14026255.8, 4439106.7 ] | ||
@@ -137,3 +136,3 @@ ``` | ||
```javascript | ||
const lnglat = metersToLngLat([14026255, 4439106]) | ||
var lnglat = metersToLngLat([14026255, 4439106]) | ||
//=[ 126, 37 ] | ||
@@ -152,3 +151,3 @@ ``` | ||
- `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`) | ||
- `tileSize` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile size (optional, default `256`) | ||
@@ -158,3 +157,3 @@ **Examples** | ||
```javascript | ||
const pixels = metersToPixels([14026255, 4439106], 13) | ||
var pixels = metersToPixels([14026255, 4439106], 13) | ||
//=[ 1782579.1, 1280877.3, 13 ] | ||
@@ -177,3 +176,3 @@ ``` | ||
```javascript | ||
const tile = lngLatToTile([126, 37], 13) | ||
var tile = lngLatToTile([126, 37], 13) | ||
//=[ 6963, 5003, 13 ] | ||
@@ -196,3 +195,3 @@ ``` | ||
```javascript | ||
const google = lngLatToGoogle([126, 37], 13) | ||
var google = lngLatToGoogle([126, 37], 13) | ||
//=[ 6963, 3188, 13 ] | ||
@@ -215,3 +214,3 @@ ``` | ||
```javascript | ||
const tile = metersToTile([14026255, 4439106], 13) | ||
var tile = metersToTile([14026255, 4439106], 13) | ||
//=[ 6963, 5003, 13 ] | ||
@@ -229,3 +228,3 @@ ``` | ||
- `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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile size (optional, default `256`) | ||
@@ -235,3 +234,3 @@ **Examples** | ||
```javascript | ||
const meters = pixelsToMeters([1782579, 1280877, 13]) | ||
var meters = pixelsToMeters([1782579, 1280877, 13]) | ||
//=[ 14026252.0, 4439099.5 ] | ||
@@ -249,3 +248,3 @@ ``` | ||
- `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/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile size (optional, default `256`) | ||
@@ -255,3 +254,3 @@ **Examples** | ||
```javascript | ||
const tile = pixelsToTile([1782579, 1280877, 13]) | ||
var tile = pixelsToTile([1782579, 1280877, 13]) | ||
//=[ 6963, 5003, 13 ] | ||
@@ -272,3 +271,3 @@ ``` | ||
- `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`) | ||
- `tileSize` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Tile size (optional, default `256`) | ||
@@ -278,3 +277,3 @@ **Examples** | ||
```javascript | ||
const bbox = tileToBBoxMeters([6963, 5003, 13]) | ||
var bbox = tileToBBoxMeters([6963, 5003, 13]) | ||
//=[ 14025277.4, 4437016.6, 14030169.4, 4441908.5 ] | ||
@@ -299,3 +298,3 @@ ``` | ||
```javascript | ||
const bbox = tileToBBox([6963, 5003, 13]) | ||
var bbox = tileToBBox([6963, 5003, 13]) | ||
//=[ 125.991, 36.985, 126.035, 37.020 ] | ||
@@ -317,3 +316,3 @@ ``` | ||
```javascript | ||
const bbox = googleToBBoxMeters([6963, 3188, 13]) | ||
var bbox = googleToBBoxMeters([6963, 3188, 13]) | ||
//=[ 14025277.4, 4437016.6, 14030169.4, 4441908.5 ] | ||
@@ -335,3 +334,3 @@ ``` | ||
```javascript | ||
const bbox = googleToBBox([6963, 3188, 13]) | ||
var bbox = googleToBBox([6963, 3188, 13]) | ||
//=[ 125.991, 36.985, 126.035, 37.020 ] | ||
@@ -353,3 +352,3 @@ ``` | ||
```javascript | ||
const google = tileToGoogle([6963, 5003, 13]) | ||
var google = tileToGoogle([6963, 5003, 13]) | ||
//=[ 6963, 3188, 13 ] | ||
@@ -371,3 +370,3 @@ ``` | ||
```javascript | ||
const tile = googleToTile([6963, 3188, 13]) | ||
var tile = googleToTile([6963, 3188, 13]) | ||
//=[ 6963, 5003, 13 ] | ||
@@ -389,3 +388,3 @@ ``` | ||
```javascript | ||
const quadkey = googleToQuadkey([6963, 3188, 13]) | ||
var quadkey = googleToQuadkey([6963, 3188, 13]) | ||
//='1321102330211' | ||
@@ -407,3 +406,3 @@ ``` | ||
```javascript | ||
const quadkey = tileToQuadkey([6963, 5003, 13]) | ||
var quadkey = tileToQuadkey([6963, 5003, 13]) | ||
//='1321102330211' | ||
@@ -425,3 +424,3 @@ ``` | ||
```javascript | ||
const tile = quadkeyToTile('1321102330211') | ||
var tile = quadkeyToTile('1321102330211') | ||
//=[ 6963, 5003, 13 ] | ||
@@ -443,3 +442,3 @@ ``` | ||
```javascript | ||
const google = quadkeyToGoogle('1321102330211') | ||
var google = quadkeyToGoogle('1321102330211') | ||
//=[ 6963, 3188, 13 ] | ||
@@ -461,3 +460,3 @@ ``` | ||
```javascript | ||
const meters = bboxToMeters([ 125, 35, 127, 37 ]) | ||
var meters = bboxToMeters([ 125, 35, 127, 37 ]) | ||
//=[ 13914936.3, 4163881.1, 14137575.3, 4439106.7 ] | ||
@@ -544,3 +543,3 @@ ``` | ||
- `y` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Pixels Y | ||
- `zoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Zoom level | ||
- `zoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Zoom level | ||
@@ -556,1 +555,18 @@ **Examples** | ||
Returns **Pixels** Pixels coordinates | ||
### maxBBox | ||
Maximum extent of BBox | ||
**Parameters** | ||
- `array` **(BBox | [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<BBox>)** BBox [west, south, east, north] | ||
**Examples** | ||
```javascript | ||
var bbox = maxBBox([[-20, -30, 20, 30], [-110, -30, 120, 80]]) | ||
//=[-110, -30, 120, 80] | ||
``` | ||
Returns **BBox** Maximum BBox |
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
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
180284
2427
544
9