@deck.gl/carto 8.8.0-beta.4 → 8.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/dist.dev.js +1253 -107
  2. package/dist/es5/index.js +23 -3
  3. package/dist/es5/index.js.map +1 -1
  4. package/dist/es5/layers/carto-layer.js +3 -3
  5. package/dist/es5/layers/carto-layer.js.map +1 -1
  6. package/dist/es5/layers/h3-tile-layer.js +26 -3
  7. package/dist/es5/layers/h3-tile-layer.js.map +1 -1
  8. package/dist/es5/layers/h3-tileset-2d.js +19 -13
  9. package/dist/es5/layers/h3-tileset-2d.js.map +1 -1
  10. package/dist/es5/layers/quadbin-layer.js +71 -0
  11. package/dist/es5/layers/quadbin-layer.js.map +1 -0
  12. package/dist/es5/layers/{quadkey-tile-layer.js → quadbin-tile-layer.js} +17 -17
  13. package/dist/es5/layers/quadbin-tile-layer.js.map +1 -0
  14. package/dist/es5/layers/{quadkey-tileset-2d.js → quadbin-tileset-2d.js} +25 -57
  15. package/dist/es5/layers/quadbin-tileset-2d.js.map +1 -0
  16. package/dist/es5/layers/quadbin-utils.js +122 -0
  17. package/dist/es5/layers/quadbin-utils.js.map +1 -0
  18. package/dist/esm/index.js +2 -1
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/layers/carto-layer.js +3 -3
  21. package/dist/esm/layers/carto-layer.js.map +1 -1
  22. package/dist/esm/layers/h3-tile-layer.js +20 -3
  23. package/dist/esm/layers/h3-tile-layer.js.map +1 -1
  24. package/dist/esm/layers/h3-tileset-2d.js +20 -16
  25. package/dist/esm/layers/h3-tileset-2d.js.map +1 -1
  26. package/dist/esm/layers/quadbin-layer.js +29 -0
  27. package/dist/esm/layers/quadbin-layer.js.map +1 -0
  28. package/dist/esm/layers/{quadkey-tile-layer.js → quadbin-tile-layer.js} +10 -10
  29. package/dist/esm/layers/quadbin-tile-layer.js.map +1 -0
  30. package/dist/esm/layers/quadbin-tileset-2d.js +37 -0
  31. package/dist/esm/layers/quadbin-tileset-2d.js.map +1 -0
  32. package/dist/esm/layers/quadbin-utils.js +88 -0
  33. package/dist/esm/layers/quadbin-utils.js.map +1 -0
  34. package/dist.min.js +138 -138
  35. package/package.json +2 -2
  36. package/src/index.ts +6 -1
  37. package/src/layers/carto-layer.ts +7 -7
  38. package/src/layers/h3-tile-layer.ts +24 -3
  39. package/src/layers/h3-tileset-2d.ts +20 -10
  40. package/src/layers/quadbin-layer.ts +43 -0
  41. package/src/layers/{quadkey-tile-layer.ts → quadbin-tile-layer.ts} +15 -13
  42. package/src/layers/quadbin-tileset-2d.ts +34 -0
  43. package/src/layers/quadbin-utils.ts +102 -0
  44. package/typed/index.d.ts +2 -1
  45. package/typed/index.d.ts.map +1 -1
  46. package/typed/layers/carto-layer.d.ts +2 -2
  47. package/typed/layers/carto-layer.d.ts.map +1 -1
  48. package/typed/layers/h3-tile-layer.d.ts.map +1 -1
  49. package/typed/layers/h3-tileset-2d.d.ts +6 -0
  50. package/typed/layers/h3-tileset-2d.d.ts.map +1 -1
  51. package/typed/layers/quadbin-layer.d.ts +20 -0
  52. package/typed/layers/quadbin-layer.d.ts.map +1 -0
  53. package/typed/layers/quadbin-tile-layer.d.ts +21 -0
  54. package/typed/layers/quadbin-tile-layer.d.ts.map +1 -0
  55. package/typed/layers/quadbin-tileset-2d.d.ts +13 -0
  56. package/typed/layers/quadbin-tileset-2d.d.ts.map +1 -0
  57. package/typed/layers/quadbin-utils.d.ts +11 -0
  58. package/typed/layers/quadbin-utils.d.ts.map +1 -0
  59. package/dist/es5/layers/quadkey-tile-layer.js.map +0 -1
  60. package/dist/es5/layers/quadkey-tileset-2d.js.map +0 -1
  61. package/dist/esm/layers/quadkey-tile-layer.js.map +0 -1
  62. package/dist/esm/layers/quadkey-tileset-2d.js +0 -71
  63. package/dist/esm/layers/quadkey-tileset-2d.js.map +0 -1
  64. package/src/layers/quadkey-tileset-2d.ts +0 -59
package/dist/dist.dev.js CHANGED
@@ -6546,6 +6546,991 @@ function getPointAtIndex(positions, index, size, offset, out = []) {
6546
6546
 
6547
6547
  /***/ }),
6548
6548
 
6549
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/assert.js":
6550
+ /*!*****************************************************************************************!*\
6551
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/assert.js ***!
6552
+ \*****************************************************************************************/
6553
+ /*! exports provided: default */
6554
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6555
+
6556
+ "use strict";
6557
+ __webpack_require__.r(__webpack_exports__);
6558
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return assert; });
6559
+ function assert(condition, message) {
6560
+ if (!condition) {
6561
+ throw new Error(message || '@math.gl/web-mercator: assertion failed.');
6562
+ }
6563
+ }
6564
+ //# sourceMappingURL=assert.js.map
6565
+
6566
+ /***/ }),
6567
+
6568
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js":
6569
+ /*!*********************************************************************************************!*\
6570
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js ***!
6571
+ \*********************************************************************************************/
6572
+ /*! exports provided: default */
6573
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6574
+
6575
+ "use strict";
6576
+ __webpack_require__.r(__webpack_exports__);
6577
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return fitBounds; });
6578
+ /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assert */ "../../node_modules/@math.gl/web-mercator/dist/esm/assert.js");
6579
+ /* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
6580
+ /* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
6581
+
6582
+
6583
+
6584
+ function fitBounds(options) {
6585
+ const {
6586
+ width,
6587
+ height,
6588
+ bounds,
6589
+ minExtent = 0,
6590
+ maxZoom = 24,
6591
+ offset = [0, 0]
6592
+ } = options;
6593
+ const [[west, south], [east, north]] = bounds;
6594
+ const padding = getPaddingObject(options.padding);
6595
+ const nw = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["lngLatToWorld"])([west, Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["clamp"])(north, -_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["MAX_LATITUDE"], _web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["MAX_LATITUDE"])]);
6596
+ const se = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["lngLatToWorld"])([east, Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["clamp"])(south, -_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["MAX_LATITUDE"], _web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["MAX_LATITUDE"])]);
6597
+ const size = [Math.max(Math.abs(se[0] - nw[0]), minExtent), Math.max(Math.abs(se[1] - nw[1]), minExtent)];
6598
+ const targetSize = [width - padding.left - padding.right - Math.abs(offset[0]) * 2, height - padding.top - padding.bottom - Math.abs(offset[1]) * 2];
6599
+ Object(_assert__WEBPACK_IMPORTED_MODULE_0__["default"])(targetSize[0] > 0 && targetSize[1] > 0);
6600
+ const scaleX = targetSize[0] / size[0];
6601
+ const scaleY = targetSize[1] / size[1];
6602
+ const offsetX = (padding.right - padding.left) / 2 / scaleX;
6603
+ const offsetY = (padding.bottom - padding.top) / 2 / scaleY;
6604
+ const center = [(se[0] + nw[0]) / 2 + offsetX, (se[1] + nw[1]) / 2 + offsetY];
6605
+ const centerLngLat = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["worldToLngLat"])(center);
6606
+ const zoom = Math.min(maxZoom, Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["log2"])(Math.abs(Math.min(scaleX, scaleY))));
6607
+ Object(_assert__WEBPACK_IMPORTED_MODULE_0__["default"])(Number.isFinite(zoom));
6608
+ return {
6609
+ longitude: centerLngLat[0],
6610
+ latitude: centerLngLat[1],
6611
+ zoom
6612
+ };
6613
+ }
6614
+
6615
+ function getPaddingObject(padding = 0) {
6616
+ if (typeof padding === 'number') {
6617
+ return {
6618
+ top: padding,
6619
+ bottom: padding,
6620
+ left: padding,
6621
+ right: padding
6622
+ };
6623
+ }
6624
+
6625
+ Object(_assert__WEBPACK_IMPORTED_MODULE_0__["default"])(Number.isFinite(padding.top) && Number.isFinite(padding.bottom) && Number.isFinite(padding.left) && Number.isFinite(padding.right));
6626
+ return padding;
6627
+ }
6628
+ //# sourceMappingURL=fit-bounds.js.map
6629
+
6630
+ /***/ }),
6631
+
6632
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js":
6633
+ /*!**************************************************************************************************!*\
6634
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js ***!
6635
+ \**************************************************************************************************/
6636
+ /*! exports provided: default, getFlyToDuration */
6637
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6638
+
6639
+ "use strict";
6640
+ __webpack_require__.r(__webpack_exports__);
6641
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return flyToViewport; });
6642
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFlyToDuration", function() { return getFlyToDuration; });
6643
+ /* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
6644
+ /* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
6645
+ /* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
6646
+
6647
+
6648
+
6649
+ const EPSILON = 0.01;
6650
+ const VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom'];
6651
+ const DEFAULT_OPTS = {
6652
+ curve: 1.414,
6653
+ speed: 1.2
6654
+ };
6655
+ function flyToViewport(startProps, endProps, t, options) {
6656
+ const {
6657
+ startZoom,
6658
+ startCenterXY,
6659
+ uDelta,
6660
+ w0,
6661
+ u1,
6662
+ S,
6663
+ rho,
6664
+ rho2,
6665
+ r0
6666
+ } = getFlyToTransitionParams(startProps, endProps, options);
6667
+
6668
+ if (u1 < EPSILON) {
6669
+ const viewport = {};
6670
+
6671
+ for (const key of VIEWPORT_TRANSITION_PROPS) {
6672
+ const startValue = startProps[key];
6673
+ const endValue = endProps[key];
6674
+ viewport[key] = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["lerp"])(startValue, endValue, t);
6675
+ }
6676
+
6677
+ return viewport;
6678
+ }
6679
+
6680
+ const s = t * S;
6681
+ const w = Math.cosh(r0) / Math.cosh(r0 + rho * s);
6682
+ const u = w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2) / u1;
6683
+ const scaleIncrement = 1 / w;
6684
+ const newZoom = startZoom + Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["scaleToZoom"])(scaleIncrement);
6685
+ const newCenterWorld = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["scale"]([], uDelta, u);
6686
+ gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["add"](newCenterWorld, newCenterWorld, startCenterXY);
6687
+ const newCenter = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["worldToLngLat"])(newCenterWorld);
6688
+ return {
6689
+ longitude: newCenter[0],
6690
+ latitude: newCenter[1],
6691
+ zoom: newZoom
6692
+ };
6693
+ }
6694
+ function getFlyToDuration(startProps, endProps, options) {
6695
+ const opts = { ...DEFAULT_OPTS,
6696
+ ...options
6697
+ };
6698
+ const {
6699
+ screenSpeed,
6700
+ speed,
6701
+ maxDuration
6702
+ } = opts;
6703
+ const {
6704
+ S,
6705
+ rho
6706
+ } = getFlyToTransitionParams(startProps, endProps, opts);
6707
+ const length = 1000 * S;
6708
+ let duration;
6709
+
6710
+ if (Number.isFinite(screenSpeed)) {
6711
+ duration = length / (screenSpeed / rho);
6712
+ } else {
6713
+ duration = length / speed;
6714
+ }
6715
+
6716
+ return Number.isFinite(maxDuration) && duration > maxDuration ? 0 : duration;
6717
+ }
6718
+
6719
+ function getFlyToTransitionParams(startProps, endProps, opts) {
6720
+ opts = Object.assign({}, DEFAULT_OPTS, opts);
6721
+ const rho = opts.curve;
6722
+ const startZoom = startProps.zoom;
6723
+ const startCenter = [startProps.longitude, startProps.latitude];
6724
+ const startScale = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["zoomToScale"])(startZoom);
6725
+ const endZoom = endProps.zoom;
6726
+ const endCenter = [endProps.longitude, endProps.latitude];
6727
+ const scale = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["zoomToScale"])(endZoom - startZoom);
6728
+ const startCenterXY = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(startCenter);
6729
+ const endCenterXY = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(endCenter);
6730
+ const uDelta = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["sub"]([], endCenterXY, startCenterXY);
6731
+ const w0 = Math.max(startProps.width, startProps.height);
6732
+ const w1 = w0 / scale;
6733
+ const u1 = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["length"](uDelta) * startScale;
6734
+
6735
+ const _u1 = Math.max(u1, EPSILON);
6736
+
6737
+ const rho2 = rho * rho;
6738
+ const b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * _u1 * _u1) / (2 * w0 * rho2 * _u1);
6739
+ const b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * _u1 * _u1) / (2 * w1 * rho2 * _u1);
6740
+ const r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0);
6741
+ const r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
6742
+ const S = (r1 - r0) / rho;
6743
+ return {
6744
+ startZoom,
6745
+ startCenterXY,
6746
+ uDelta,
6747
+ w0,
6748
+ u1,
6749
+ S,
6750
+ rho,
6751
+ rho2,
6752
+ r0,
6753
+ r1
6754
+ };
6755
+ }
6756
+ //# sourceMappingURL=fly-to-viewport.js.map
6757
+
6758
+ /***/ }),
6759
+
6760
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js":
6761
+ /*!*********************************************************************************************!*\
6762
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js ***!
6763
+ \*********************************************************************************************/
6764
+ /*! exports provided: default */
6765
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6766
+
6767
+ "use strict";
6768
+ __webpack_require__.r(__webpack_exports__);
6769
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getBounds; });
6770
+ /* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
6771
+ /* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
6772
+ /* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
6773
+
6774
+
6775
+
6776
+ const DEGREES_TO_RADIANS = Math.PI / 180;
6777
+ function getBounds(viewport, z = 0) {
6778
+ const {
6779
+ width,
6780
+ height,
6781
+ unproject
6782
+ } = viewport;
6783
+ const unprojectOps = {
6784
+ targetZ: z
6785
+ };
6786
+ const bottomLeft = unproject([0, height], unprojectOps);
6787
+ const bottomRight = unproject([width, height], unprojectOps);
6788
+ let topLeft;
6789
+ let topRight;
6790
+ const halfFov = viewport.fovy ? 0.5 * viewport.fovy * DEGREES_TO_RADIANS : Math.atan(0.5 / viewport.altitude);
6791
+ const angleToGround = (90 - viewport.pitch) * DEGREES_TO_RADIANS;
6792
+
6793
+ if (halfFov > angleToGround - 0.01) {
6794
+ topLeft = unprojectOnFarPlane(viewport, 0, z);
6795
+ topRight = unprojectOnFarPlane(viewport, width, z);
6796
+ } else {
6797
+ topLeft = unproject([0, 0], unprojectOps);
6798
+ topRight = unproject([width, 0], unprojectOps);
6799
+ }
6800
+
6801
+ return [bottomLeft, bottomRight, topRight, topLeft];
6802
+ }
6803
+
6804
+ function unprojectOnFarPlane(viewport, x, targetZ) {
6805
+ const {
6806
+ pixelUnprojectionMatrix
6807
+ } = viewport;
6808
+ const coord0 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_2__["transformVector"])(pixelUnprojectionMatrix, [x, 0, 1, 1]);
6809
+ const coord1 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_2__["transformVector"])(pixelUnprojectionMatrix, [x, viewport.height, 1, 1]);
6810
+ const z = targetZ * viewport.distanceScales.unitsPerMeter[2];
6811
+ const t = (z - coord0[2]) / (coord1[2] - coord0[2]);
6812
+ const coord = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_1__["lerp"]([], coord0, coord1, t);
6813
+ const result = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])(coord);
6814
+ result.push(targetZ);
6815
+ return result;
6816
+ }
6817
+ //# sourceMappingURL=get-bounds.js.map
6818
+
6819
+ /***/ }),
6820
+
6821
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/index.js":
6822
+ /*!****************************************************************************************!*\
6823
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/index.js ***!
6824
+ \****************************************************************************************/
6825
+ /*! exports provided: default, WebMercatorViewport, getBounds, fitBounds, normalizeViewportProps, flyToViewport, getFlyToDuration, MAX_LATITUDE, lngLatToWorld, worldToLngLat, worldToPixels, pixelsToWorld, zoomToScale, scaleToZoom, altitudeToFovy, fovyToAltitude, getMeterZoom, getDistanceScales, addMetersToLngLat, getViewMatrix, getProjectionMatrix, getProjectionParameters */
6826
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6827
+
6828
+ "use strict";
6829
+ __webpack_require__.r(__webpack_exports__);
6830
+ /* harmony import */ var _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-viewport */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js");
6831
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__["default"]; });
6832
+
6833
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebMercatorViewport", function() { return _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__["default"]; });
6834
+
6835
+ /* harmony import */ var _get_bounds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./get-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js");
6836
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBounds", function() { return _get_bounds__WEBPACK_IMPORTED_MODULE_1__["default"]; });
6837
+
6838
+ /* harmony import */ var _fit_bounds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fit-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js");
6839
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fitBounds", function() { return _fit_bounds__WEBPACK_IMPORTED_MODULE_2__["default"]; });
6840
+
6841
+ /* harmony import */ var _normalize_viewport_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./normalize-viewport-props */ "../../node_modules/@math.gl/web-mercator/dist/esm/normalize-viewport-props.js");
6842
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "normalizeViewportProps", function() { return _normalize_viewport_props__WEBPACK_IMPORTED_MODULE_3__["default"]; });
6843
+
6844
+ /* harmony import */ var _fly_to_viewport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fly-to-viewport */ "../../node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js");
6845
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flyToViewport", function() { return _fly_to_viewport__WEBPACK_IMPORTED_MODULE_4__["default"]; });
6846
+
6847
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFlyToDuration", function() { return _fly_to_viewport__WEBPACK_IMPORTED_MODULE_4__["getFlyToDuration"]; });
6848
+
6849
+ /* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
6850
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAX_LATITUDE", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["MAX_LATITUDE"]; });
6851
+
6852
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lngLatToWorld", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["lngLatToWorld"]; });
6853
+
6854
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "worldToLngLat", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["worldToLngLat"]; });
6855
+
6856
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "worldToPixels", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["worldToPixels"]; });
6857
+
6858
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pixelsToWorld", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["pixelsToWorld"]; });
6859
+
6860
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zoomToScale", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["zoomToScale"]; });
6861
+
6862
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scaleToZoom", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["scaleToZoom"]; });
6863
+
6864
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "altitudeToFovy", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["altitudeToFovy"]; });
6865
+
6866
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fovyToAltitude", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["fovyToAltitude"]; });
6867
+
6868
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMeterZoom", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getMeterZoom"]; });
6869
+
6870
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDistanceScales", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getDistanceScales"]; });
6871
+
6872
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addMetersToLngLat", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["addMetersToLngLat"]; });
6873
+
6874
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getViewMatrix", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getViewMatrix"]; });
6875
+
6876
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectionMatrix", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getProjectionMatrix"]; });
6877
+
6878
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectionParameters", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getProjectionParameters"]; });
6879
+
6880
+
6881
+
6882
+
6883
+
6884
+
6885
+
6886
+
6887
+ //# sourceMappingURL=index.js.map
6888
+
6889
+ /***/ }),
6890
+
6891
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js":
6892
+ /*!*********************************************************************************************!*\
6893
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/math-utils.js ***!
6894
+ \*********************************************************************************************/
6895
+ /*! exports provided: createMat4, transformVector, mod, lerp, clamp, log2 */
6896
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6897
+
6898
+ "use strict";
6899
+ __webpack_require__.r(__webpack_exports__);
6900
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMat4", function() { return createMat4; });
6901
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformVector", function() { return transformVector; });
6902
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mod", function() { return mod; });
6903
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; });
6904
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clamp", function() { return clamp; });
6905
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "log2", function() { return log2; });
6906
+ /* harmony import */ var gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! gl-matrix/vec4 */ "../../node_modules/gl-matrix/esm/vec4.js");
6907
+
6908
+ function createMat4() {
6909
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
6910
+ }
6911
+ function transformVector(matrix, vector) {
6912
+ const result = Object(gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_0__["transformMat4"])([], vector, matrix);
6913
+ Object(gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_0__["scale"])(result, result, 1 / result[3]);
6914
+ return result;
6915
+ }
6916
+ function mod(value, divisor) {
6917
+ const modulus = value % divisor;
6918
+ return modulus < 0 ? divisor + modulus : modulus;
6919
+ }
6920
+ function lerp(start, end, step) {
6921
+ return step * end + (1 - step) * start;
6922
+ }
6923
+ function clamp(x, min, max) {
6924
+ return x < min ? min : x > max ? max : x;
6925
+ }
6926
+
6927
+ function ieLog2(x) {
6928
+ return Math.log(x) * Math.LOG2E;
6929
+ }
6930
+
6931
+ const log2 = Math.log2 || ieLog2;
6932
+ //# sourceMappingURL=math-utils.js.map
6933
+
6934
+ /***/ }),
6935
+
6936
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/normalize-viewport-props.js":
6937
+ /*!***********************************************************************************************************!*\
6938
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/normalize-viewport-props.js ***!
6939
+ \***********************************************************************************************************/
6940
+ /*! exports provided: default */
6941
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6942
+
6943
+ "use strict";
6944
+ __webpack_require__.r(__webpack_exports__);
6945
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeViewportProps; });
6946
+ /* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
6947
+ /* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
6948
+
6949
+
6950
+ const TILE_SIZE = 512;
6951
+ function normalizeViewportProps(props) {
6952
+ const {
6953
+ width,
6954
+ height,
6955
+ pitch = 0
6956
+ } = props;
6957
+ let {
6958
+ longitude,
6959
+ latitude,
6960
+ zoom,
6961
+ bearing = 0
6962
+ } = props;
6963
+
6964
+ if (longitude < -180 || longitude > 180) {
6965
+ longitude = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["mod"])(longitude + 180, 360) - 180;
6966
+ }
6967
+
6968
+ if (bearing < -180 || bearing > 180) {
6969
+ bearing = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["mod"])(bearing + 180, 360) - 180;
6970
+ }
6971
+
6972
+ const minZoom = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["log2"])(height / TILE_SIZE);
6973
+
6974
+ if (zoom <= minZoom) {
6975
+ zoom = minZoom;
6976
+ latitude = 0;
6977
+ } else {
6978
+ const halfHeightPixels = height / 2 / Math.pow(2, zoom);
6979
+ const minLatitude = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])([0, halfHeightPixels])[1];
6980
+
6981
+ if (latitude < minLatitude) {
6982
+ latitude = minLatitude;
6983
+ } else {
6984
+ const maxLatitude = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])([0, TILE_SIZE - halfHeightPixels])[1];
6985
+
6986
+ if (latitude > maxLatitude) {
6987
+ latitude = maxLatitude;
6988
+ }
6989
+ }
6990
+ }
6991
+
6992
+ return {
6993
+ width,
6994
+ height,
6995
+ longitude,
6996
+ latitude,
6997
+ zoom,
6998
+ pitch,
6999
+ bearing
7000
+ };
7001
+ }
7002
+ //# sourceMappingURL=normalize-viewport-props.js.map
7003
+
7004
+ /***/ }),
7005
+
7006
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js":
7007
+ /*!*****************************************************************************************************!*\
7008
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js ***!
7009
+ \*****************************************************************************************************/
7010
+ /*! exports provided: MAX_LATITUDE, DEFAULT_ALTITUDE, zoomToScale, scaleToZoom, lngLatToWorld, worldToLngLat, getMeterZoom, getDistanceScales, addMetersToLngLat, getViewMatrix, getProjectionParameters, getProjectionMatrix, altitudeToFovy, fovyToAltitude, worldToPixels, pixelsToWorld */
7011
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
7012
+
7013
+ "use strict";
7014
+ __webpack_require__.r(__webpack_exports__);
7015
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_LATITUDE", function() { return MAX_LATITUDE; });
7016
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_ALTITUDE", function() { return DEFAULT_ALTITUDE; });
7017
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zoomToScale", function() { return zoomToScale; });
7018
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scaleToZoom", function() { return scaleToZoom; });
7019
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lngLatToWorld", function() { return lngLatToWorld; });
7020
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "worldToLngLat", function() { return worldToLngLat; });
7021
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMeterZoom", function() { return getMeterZoom; });
7022
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDistanceScales", function() { return getDistanceScales; });
7023
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMetersToLngLat", function() { return addMetersToLngLat; });
7024
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getViewMatrix", function() { return getViewMatrix; });
7025
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProjectionParameters", function() { return getProjectionParameters; });
7026
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProjectionMatrix", function() { return getProjectionMatrix; });
7027
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "altitudeToFovy", function() { return altitudeToFovy; });
7028
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fovyToAltitude", function() { return fovyToAltitude; });
7029
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "worldToPixels", function() { return worldToPixels; });
7030
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pixelsToWorld", function() { return pixelsToWorld; });
7031
+ /* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
7032
+ /* harmony import */ var gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gl-matrix/mat4 */ "../../node_modules/gl-matrix/esm/mat4.js");
7033
+ /* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
7034
+ /* harmony import */ var gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! gl-matrix/vec3 */ "../../node_modules/gl-matrix/esm/vec3.js");
7035
+ /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./assert */ "../../node_modules/@math.gl/web-mercator/dist/esm/assert.js");
7036
+
7037
+
7038
+
7039
+
7040
+
7041
+ const PI = Math.PI;
7042
+ const PI_4 = PI / 4;
7043
+ const DEGREES_TO_RADIANS = PI / 180;
7044
+ const RADIANS_TO_DEGREES = 180 / PI;
7045
+ const TILE_SIZE = 512;
7046
+ const EARTH_CIRCUMFERENCE = 40.03e6;
7047
+ const MAX_LATITUDE = 85.051129;
7048
+ const DEFAULT_ALTITUDE = 1.5;
7049
+ function zoomToScale(zoom) {
7050
+ return Math.pow(2, zoom);
7051
+ }
7052
+ function scaleToZoom(scale) {
7053
+ return Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["log2"])(scale);
7054
+ }
7055
+ function lngLatToWorld(lngLat) {
7056
+ const [lng, lat] = lngLat;
7057
+ Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(lng));
7058
+ Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(lat) && lat >= -90 && lat <= 90, 'invalid latitude');
7059
+ const lambda2 = lng * DEGREES_TO_RADIANS;
7060
+ const phi2 = lat * DEGREES_TO_RADIANS;
7061
+ const x = TILE_SIZE * (lambda2 + PI) / (2 * PI);
7062
+ const y = TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
7063
+ return [x, y];
7064
+ }
7065
+ function worldToLngLat(xy) {
7066
+ const [x, y] = xy;
7067
+ const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
7068
+ const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
7069
+ return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
7070
+ }
7071
+ function getMeterZoom(options) {
7072
+ const {
7073
+ latitude
7074
+ } = options;
7075
+ Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(latitude));
7076
+ const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
7077
+ return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 9;
7078
+ }
7079
+ function getDistanceScales(options) {
7080
+ const {
7081
+ latitude,
7082
+ longitude,
7083
+ highPrecision = false
7084
+ } = options;
7085
+ Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(latitude) && Number.isFinite(longitude));
7086
+ const worldSize = TILE_SIZE;
7087
+ const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
7088
+ const unitsPerDegreeX = worldSize / 360;
7089
+ const unitsPerDegreeY = unitsPerDegreeX / latCosine;
7090
+ const altUnitsPerMeter = worldSize / EARTH_CIRCUMFERENCE / latCosine;
7091
+ const result = {
7092
+ unitsPerMeter: [altUnitsPerMeter, altUnitsPerMeter, altUnitsPerMeter],
7093
+ metersPerUnit: [1 / altUnitsPerMeter, 1 / altUnitsPerMeter, 1 / altUnitsPerMeter],
7094
+ unitsPerDegree: [unitsPerDegreeX, unitsPerDegreeY, altUnitsPerMeter],
7095
+ degreesPerUnit: [1 / unitsPerDegreeX, 1 / unitsPerDegreeY, 1 / altUnitsPerMeter]
7096
+ };
7097
+
7098
+ if (highPrecision) {
7099
+ const latCosine2 = DEGREES_TO_RADIANS * Math.tan(latitude * DEGREES_TO_RADIANS) / latCosine;
7100
+ const unitsPerDegreeY2 = unitsPerDegreeX * latCosine2 / 2;
7101
+ const altUnitsPerDegree2 = worldSize / EARTH_CIRCUMFERENCE * latCosine2;
7102
+ const altUnitsPerMeter2 = altUnitsPerDegree2 / unitsPerDegreeY * altUnitsPerMeter;
7103
+ result.unitsPerDegree2 = [0, unitsPerDegreeY2, altUnitsPerDegree2];
7104
+ result.unitsPerMeter2 = [altUnitsPerMeter2, 0, altUnitsPerMeter2];
7105
+ }
7106
+
7107
+ return result;
7108
+ }
7109
+ function addMetersToLngLat(lngLatZ, xyz) {
7110
+ const [longitude, latitude, z0] = lngLatZ;
7111
+ const [x, y, z] = xyz;
7112
+ const {
7113
+ unitsPerMeter,
7114
+ unitsPerMeter2
7115
+ } = getDistanceScales({
7116
+ longitude,
7117
+ latitude,
7118
+ highPrecision: true
7119
+ });
7120
+ const worldspace = lngLatToWorld(lngLatZ);
7121
+ worldspace[0] += x * (unitsPerMeter[0] + unitsPerMeter2[0] * y);
7122
+ worldspace[1] += y * (unitsPerMeter[1] + unitsPerMeter2[1] * y);
7123
+ const newLngLat = worldToLngLat(worldspace);
7124
+ const newZ = (z0 || 0) + (z || 0);
7125
+ return Number.isFinite(z0) || Number.isFinite(z) ? [newLngLat[0], newLngLat[1], newZ] : newLngLat;
7126
+ }
7127
+ function getViewMatrix(options) {
7128
+ const {
7129
+ height,
7130
+ pitch,
7131
+ bearing,
7132
+ altitude,
7133
+ scale,
7134
+ center
7135
+ } = options;
7136
+ const vm = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["createMat4"])();
7137
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["translate"](vm, vm, [0, 0, -altitude]);
7138
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["rotateX"](vm, vm, -pitch * DEGREES_TO_RADIANS);
7139
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["rotateZ"](vm, vm, bearing * DEGREES_TO_RADIANS);
7140
+ const relativeScale = scale / height;
7141
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["scale"](vm, vm, [relativeScale, relativeScale, relativeScale]);
7142
+
7143
+ if (center) {
7144
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["translate"](vm, vm, gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_3__["negate"]([], center));
7145
+ }
7146
+
7147
+ return vm;
7148
+ }
7149
+ function getProjectionParameters(options) {
7150
+ const {
7151
+ width,
7152
+ height,
7153
+ altitude,
7154
+ pitch = 0,
7155
+ nearZMultiplier = 1,
7156
+ farZMultiplier = 1
7157
+ } = options;
7158
+ let {
7159
+ fovy = altitudeToFovy(DEFAULT_ALTITUDE)
7160
+ } = options;
7161
+
7162
+ if (altitude !== undefined) {
7163
+ fovy = altitudeToFovy(altitude);
7164
+ }
7165
+
7166
+ const halfFov = 0.5 * fovy * DEGREES_TO_RADIANS;
7167
+ const focalDistance = fovyToAltitude(fovy);
7168
+ const pitchRadians = pitch * DEGREES_TO_RADIANS;
7169
+ const topHalfSurfaceDistance = Math.sin(halfFov) * focalDistance / Math.sin(Math.min(Math.max(Math.PI / 2 - pitchRadians - halfFov, 0.01), Math.PI - 0.01));
7170
+ const farZ = Math.sin(pitchRadians) * topHalfSurfaceDistance + focalDistance;
7171
+ return {
7172
+ fov: 2 * halfFov,
7173
+ aspect: width / height,
7174
+ focalDistance,
7175
+ near: nearZMultiplier,
7176
+ far: farZ * farZMultiplier
7177
+ };
7178
+ }
7179
+ function getProjectionMatrix(options) {
7180
+ const {
7181
+ fov,
7182
+ aspect,
7183
+ near,
7184
+ far
7185
+ } = getProjectionParameters(options);
7186
+ const projectionMatrix = gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["perspective"]([], fov, aspect, near, far);
7187
+ return projectionMatrix;
7188
+ }
7189
+ function altitudeToFovy(altitude) {
7190
+ return 2 * Math.atan(0.5 / altitude) * RADIANS_TO_DEGREES;
7191
+ }
7192
+ function fovyToAltitude(fovy) {
7193
+ return 0.5 / Math.tan(0.5 * fovy * DEGREES_TO_RADIANS);
7194
+ }
7195
+ function worldToPixels(xyz, pixelProjectionMatrix) {
7196
+ const [x, y, z = 0] = xyz;
7197
+ Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z));
7198
+ return Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelProjectionMatrix, [x, y, z, 1]);
7199
+ }
7200
+ function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) {
7201
+ const [x, y, z] = xyz;
7202
+ Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(x) && Number.isFinite(y), 'invalid pixel coordinate');
7203
+
7204
+ if (Number.isFinite(z)) {
7205
+ const coord = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelUnprojectionMatrix, [x, y, z, 1]);
7206
+ return coord;
7207
+ }
7208
+
7209
+ const coord0 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelUnprojectionMatrix, [x, y, 0, 1]);
7210
+ const coord1 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelUnprojectionMatrix, [x, y, 1, 1]);
7211
+ const z0 = coord0[2];
7212
+ const z1 = coord1[2];
7213
+ const t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0);
7214
+ return gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["lerp"]([], coord0, coord1, t);
7215
+ }
7216
+ //# sourceMappingURL=web-mercator-utils.js.map
7217
+
7218
+ /***/ }),
7219
+
7220
+ /***/ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js":
7221
+ /*!********************************************************************************************************!*\
7222
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js ***!
7223
+ \********************************************************************************************************/
7224
+ /*! exports provided: default */
7225
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
7226
+
7227
+ "use strict";
7228
+ __webpack_require__.r(__webpack_exports__);
7229
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return WebMercatorViewport; });
7230
+ /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../node_modules/@math.gl/web-mercator/node_modules/@babel/runtime/helpers/esm/defineProperty.js");
7231
+ /* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
7232
+ /* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
7233
+ /* harmony import */ var _fit_bounds__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fit-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js");
7234
+ /* harmony import */ var _get_bounds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./get-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js");
7235
+ /* harmony import */ var gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! gl-matrix/mat4 */ "../../node_modules/gl-matrix/esm/mat4.js");
7236
+ /* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
7237
+ /* harmony import */ var gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! gl-matrix/vec3 */ "../../node_modules/gl-matrix/esm/vec3.js");
7238
+
7239
+
7240
+
7241
+
7242
+
7243
+
7244
+
7245
+
7246
+ class WebMercatorViewport {
7247
+ constructor(props = {
7248
+ width: 1,
7249
+ height: 1
7250
+ }) {
7251
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "latitude", void 0);
7252
+
7253
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "longitude", void 0);
7254
+
7255
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "zoom", void 0);
7256
+
7257
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "pitch", void 0);
7258
+
7259
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "bearing", void 0);
7260
+
7261
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "altitude", void 0);
7262
+
7263
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "fovy", void 0);
7264
+
7265
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "meterOffset", void 0);
7266
+
7267
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "center", void 0);
7268
+
7269
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "width", void 0);
7270
+
7271
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "height", void 0);
7272
+
7273
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "scale", void 0);
7274
+
7275
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "distanceScales", void 0);
7276
+
7277
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "viewMatrix", void 0);
7278
+
7279
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "projectionMatrix", void 0);
7280
+
7281
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "viewProjectionMatrix", void 0);
7282
+
7283
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "pixelProjectionMatrix", void 0);
7284
+
7285
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "pixelUnprojectionMatrix", void 0);
7286
+
7287
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "equals", viewport => {
7288
+ if (!(viewport instanceof WebMercatorViewport)) {
7289
+ return false;
7290
+ }
7291
+
7292
+ return viewport.width === this.width && viewport.height === this.height && gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["equals"](viewport.projectionMatrix, this.projectionMatrix) && gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["equals"](viewport.viewMatrix, this.viewMatrix);
7293
+ });
7294
+
7295
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "project", (lngLatZ, options = {}) => {
7296
+ const {
7297
+ topLeft = true
7298
+ } = options;
7299
+ const worldPosition = this.projectPosition(lngLatZ);
7300
+ const coord = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["worldToPixels"])(worldPosition, this.pixelProjectionMatrix);
7301
+ const [x, y] = coord;
7302
+ const y2 = topLeft ? y : this.height - y;
7303
+ return lngLatZ.length === 2 ? [x, y2] : [x, y2, coord[2]];
7304
+ });
7305
+
7306
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "unproject", (xyz, options = {}) => {
7307
+ const {
7308
+ topLeft = true,
7309
+ targetZ = undefined
7310
+ } = options;
7311
+ const [x, y, z] = xyz;
7312
+ const y2 = topLeft ? y : this.height - y;
7313
+ const targetZWorld = targetZ && targetZ * this.distanceScales.unitsPerMeter[2];
7314
+ const coord = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["pixelsToWorld"])([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);
7315
+ const [X, Y, Z] = this.unprojectPosition(coord);
7316
+
7317
+ if (Number.isFinite(z)) {
7318
+ return [X, Y, Z];
7319
+ }
7320
+
7321
+ return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
7322
+ });
7323
+
7324
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "projectPosition", xyz => {
7325
+ const [X, Y] = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["lngLatToWorld"])(xyz);
7326
+ const Z = (xyz[2] || 0) * this.distanceScales.unitsPerMeter[2];
7327
+ return [X, Y, Z];
7328
+ });
7329
+
7330
+ Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "unprojectPosition", xyz => {
7331
+ const [X, Y] = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["worldToLngLat"])(xyz);
7332
+ const Z = (xyz[2] || 0) * this.distanceScales.metersPerUnit[2];
7333
+ return [X, Y, Z];
7334
+ });
7335
+
7336
+ let {
7337
+ width,
7338
+ height,
7339
+ altitude = null,
7340
+ fovy = null
7341
+ } = props;
7342
+ const {
7343
+ latitude = 0,
7344
+ longitude = 0,
7345
+ zoom = 0,
7346
+ pitch = 0,
7347
+ bearing = 0,
7348
+ position = null,
7349
+ nearZMultiplier = 0.02,
7350
+ farZMultiplier = 1.01
7351
+ } = props;
7352
+ width = width || 1;
7353
+ height = height || 1;
7354
+
7355
+ if (fovy === null && altitude === null) {
7356
+ altitude = _web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["DEFAULT_ALTITUDE"];
7357
+ fovy = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["altitudeToFovy"])(altitude);
7358
+ } else if (fovy === null) {
7359
+ fovy = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["altitudeToFovy"])(altitude);
7360
+ } else if (altitude === null) {
7361
+ altitude = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["fovyToAltitude"])(fovy);
7362
+ }
7363
+
7364
+ const scale = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["zoomToScale"])(zoom);
7365
+ altitude = Math.max(0.75, altitude);
7366
+ const distanceScales = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["getDistanceScales"])({
7367
+ longitude,
7368
+ latitude
7369
+ });
7370
+ const center = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["lngLatToWorld"])([longitude, latitude]);
7371
+ center.push(0);
7372
+
7373
+ if (position) {
7374
+ gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_7__["add"](center, center, gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_7__["mul"]([], position, distanceScales.unitsPerMeter));
7375
+ }
7376
+
7377
+ this.projectionMatrix = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["getProjectionMatrix"])({
7378
+ width,
7379
+ height,
7380
+ pitch,
7381
+ fovy,
7382
+ nearZMultiplier,
7383
+ farZMultiplier
7384
+ });
7385
+ this.viewMatrix = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["getViewMatrix"])({
7386
+ height,
7387
+ scale,
7388
+ center,
7389
+ pitch,
7390
+ bearing,
7391
+ altitude
7392
+ });
7393
+ this.width = width;
7394
+ this.height = height;
7395
+ this.scale = scale;
7396
+ this.latitude = latitude;
7397
+ this.longitude = longitude;
7398
+ this.zoom = zoom;
7399
+ this.pitch = pitch;
7400
+ this.bearing = bearing;
7401
+ this.altitude = altitude;
7402
+ this.fovy = fovy;
7403
+ this.center = center;
7404
+ this.meterOffset = position || [0, 0, 0];
7405
+ this.distanceScales = distanceScales;
7406
+
7407
+ this._initMatrices();
7408
+
7409
+ Object.freeze(this);
7410
+ }
7411
+
7412
+ _initMatrices() {
7413
+ const {
7414
+ width,
7415
+ height,
7416
+ projectionMatrix,
7417
+ viewMatrix
7418
+ } = this;
7419
+ const vpm = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["createMat4"])();
7420
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["multiply"](vpm, vpm, projectionMatrix);
7421
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["multiply"](vpm, vpm, viewMatrix);
7422
+ this.viewProjectionMatrix = vpm;
7423
+ const m = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["createMat4"])();
7424
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["scale"](m, m, [width / 2, -height / 2, 1]);
7425
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["translate"](m, m, [1, -1, 0]);
7426
+ gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["multiply"](m, m, vpm);
7427
+ const mInverse = gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_5__["invert"](Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["createMat4"])(), m);
7428
+
7429
+ if (!mInverse) {
7430
+ throw new Error('Pixel project matrix not invertible');
7431
+ }
7432
+
7433
+ this.pixelProjectionMatrix = m;
7434
+ this.pixelUnprojectionMatrix = mInverse;
7435
+ }
7436
+
7437
+ projectFlat(lngLat) {
7438
+ return Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["lngLatToWorld"])(lngLat);
7439
+ }
7440
+
7441
+ unprojectFlat(xy) {
7442
+ return Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["worldToLngLat"])(xy);
7443
+ }
7444
+
7445
+ getMapCenterByLngLatPosition({
7446
+ lngLat,
7447
+ pos
7448
+ }) {
7449
+ const fromLocation = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["pixelsToWorld"])(pos, this.pixelUnprojectionMatrix);
7450
+ const toLocation = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["lngLatToWorld"])(lngLat);
7451
+ const translate = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_6__["add"]([], toLocation, gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_6__["negate"]([], fromLocation));
7452
+ const newCenter = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_6__["add"]([], this.center, translate);
7453
+ return Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_2__["worldToLngLat"])(newCenter);
7454
+ }
7455
+
7456
+ fitBounds(bounds, options = {}) {
7457
+ const {
7458
+ width,
7459
+ height
7460
+ } = this;
7461
+ const {
7462
+ longitude,
7463
+ latitude,
7464
+ zoom
7465
+ } = Object(_fit_bounds__WEBPACK_IMPORTED_MODULE_3__["default"])(Object.assign({
7466
+ width,
7467
+ height,
7468
+ bounds
7469
+ }, options));
7470
+ return new WebMercatorViewport({
7471
+ width,
7472
+ height,
7473
+ longitude,
7474
+ latitude,
7475
+ zoom
7476
+ });
7477
+ }
7478
+
7479
+ getBounds(options) {
7480
+ const corners = this.getBoundingRegion(options);
7481
+ const west = Math.min(...corners.map(p => p[0]));
7482
+ const east = Math.max(...corners.map(p => p[0]));
7483
+ const south = Math.min(...corners.map(p => p[1]));
7484
+ const north = Math.max(...corners.map(p => p[1]));
7485
+ return [[west, south], [east, north]];
7486
+ }
7487
+
7488
+ getBoundingRegion(options = {}) {
7489
+ return Object(_get_bounds__WEBPACK_IMPORTED_MODULE_4__["default"])(this, options.z || 0);
7490
+ }
7491
+
7492
+ getLocationAtPoint({
7493
+ lngLat,
7494
+ pos
7495
+ }) {
7496
+ return this.getMapCenterByLngLatPosition({
7497
+ lngLat,
7498
+ pos
7499
+ });
7500
+ }
7501
+
7502
+ }
7503
+ //# sourceMappingURL=web-mercator-viewport.js.map
7504
+
7505
+ /***/ }),
7506
+
7507
+ /***/ "../../node_modules/@math.gl/web-mercator/node_modules/@babel/runtime/helpers/esm/defineProperty.js":
7508
+ /*!********************************************************************************************************************************!*\
7509
+ !*** /Users/missx/Source/deck.gl/node_modules/@math.gl/web-mercator/node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
7510
+ \********************************************************************************************************************************/
7511
+ /*! exports provided: default */
7512
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
7513
+
7514
+ "use strict";
7515
+ __webpack_require__.r(__webpack_exports__);
7516
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _defineProperty; });
7517
+ function _defineProperty(obj, key, value) {
7518
+ if (key in obj) {
7519
+ Object.defineProperty(obj, key, {
7520
+ value: value,
7521
+ enumerable: true,
7522
+ configurable: true,
7523
+ writable: true
7524
+ });
7525
+ } else {
7526
+ obj[key] = value;
7527
+ }
7528
+
7529
+ return obj;
7530
+ }
7531
+
7532
+ /***/ }),
7533
+
6549
7534
  /***/ "../../node_modules/cartocolor/cartocolor.js":
6550
7535
  /*!*************************************************************************!*\
6551
7536
  !*** /Users/missx/Source/deck.gl/node_modules/cartocolor/cartocolor.js ***!
@@ -47202,7 +48187,7 @@ function buildMapsUrlFromBase(apiBaseUrl) {
47202
48187
  /*!**********************!*\
47203
48188
  !*** ./src/index.ts ***!
47204
48189
  \**********************/
47205
- /*! exports provided: getDefaultCredentials, setDefaultCredentials, CartoLayer, _CartoTileLayer, _H3TileLayer, _QuadkeyTileLayer, BASEMAP, colorBins, colorCategories, colorContinuous, FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, _getDataV2, _mapInstantiation */
48190
+ /*! exports provided: getDefaultCredentials, setDefaultCredentials, CartoLayer, _CartoTileLayer, _H3TileLayer, _QuadbinTileLayer, _tileToQuadbin, _quadbinToTile, _quadbinZoom, BASEMAP, colorBins, colorCategories, colorContinuous, FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, _getDataV2, _mapInstantiation */
47206
48191
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
47207
48192
 
47208
48193
  "use strict";
@@ -47221,37 +48206,45 @@ __webpack_require__.r(__webpack_exports__);
47221
48206
  /* harmony import */ var _layers_h3_tile_layer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./layers/h3-tile-layer */ "./src/layers/h3-tile-layer.ts");
47222
48207
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_H3TileLayer", function() { return _layers_h3_tile_layer__WEBPACK_IMPORTED_MODULE_3__["default"]; });
47223
48208
 
47224
- /* harmony import */ var _layers_quadkey_tile_layer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./layers/quadkey-tile-layer */ "./src/layers/quadkey-tile-layer.ts");
47225
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_QuadkeyTileLayer", function() { return _layers_quadkey_tile_layer__WEBPACK_IMPORTED_MODULE_4__["default"]; });
48209
+ /* harmony import */ var _layers_quadbin_tile_layer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./layers/quadbin-tile-layer */ "./src/layers/quadbin-tile-layer.ts");
48210
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_QuadbinTileLayer", function() { return _layers_quadbin_tile_layer__WEBPACK_IMPORTED_MODULE_4__["default"]; });
48211
+
48212
+ /* harmony import */ var _layers_quadbin_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./layers/quadbin-utils */ "./src/layers/quadbin-utils.ts");
48213
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_tileToQuadbin", function() { return _layers_quadbin_utils__WEBPACK_IMPORTED_MODULE_5__["tileToQuadbin"]; });
48214
+
48215
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_quadbinToTile", function() { return _layers_quadbin_utils__WEBPACK_IMPORTED_MODULE_5__["quadbinToTile"]; });
48216
+
48217
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_quadbinZoom", function() { return _layers_quadbin_utils__WEBPACK_IMPORTED_MODULE_5__["quadbinZoom"]; });
47226
48218
 
47227
- /* harmony import */ var _basemap__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./basemap */ "./src/basemap.ts");
47228
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BASEMAP", function() { return _basemap__WEBPACK_IMPORTED_MODULE_5__["default"]; });
48219
+ /* harmony import */ var _basemap__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./basemap */ "./src/basemap.ts");
48220
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BASEMAP", function() { return _basemap__WEBPACK_IMPORTED_MODULE_6__["default"]; });
47229
48221
 
47230
- /* harmony import */ var _style_color_bins_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style/color-bins-style */ "./src/style/color-bins-style.ts");
47231
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorBins", function() { return _style_color_bins_style__WEBPACK_IMPORTED_MODULE_6__["default"]; });
48222
+ /* harmony import */ var _style_color_bins_style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./style/color-bins-style */ "./src/style/color-bins-style.ts");
48223
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorBins", function() { return _style_color_bins_style__WEBPACK_IMPORTED_MODULE_7__["default"]; });
47232
48224
 
47233
- /* harmony import */ var _style_color_categories_style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./style/color-categories-style */ "./src/style/color-categories-style.ts");
47234
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorCategories", function() { return _style_color_categories_style__WEBPACK_IMPORTED_MODULE_7__["default"]; });
48225
+ /* harmony import */ var _style_color_categories_style__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./style/color-categories-style */ "./src/style/color-categories-style.ts");
48226
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorCategories", function() { return _style_color_categories_style__WEBPACK_IMPORTED_MODULE_8__["default"]; });
47235
48227
 
47236
- /* harmony import */ var _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./style/color-continuous-style */ "./src/style/color-continuous-style.ts");
47237
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorContinuous", function() { return _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_8__["default"]; });
48228
+ /* harmony import */ var _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./style/color-continuous-style */ "./src/style/color-continuous-style.ts");
48229
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorContinuous", function() { return _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_9__["default"]; });
47238
48230
 
47239
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./api */ "./src/api/index.ts");
47240
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["FORMATS"]; });
48231
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./api */ "./src/api/index.ts");
48232
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["FORMATS"]; });
47241
48233
 
47242
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["TILE_FORMATS"]; });
48234
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["TILE_FORMATS"]; });
47243
48235
 
47244
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["MAP_TYPES"]; });
48236
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["MAP_TYPES"]; });
47245
48237
 
47246
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["API_VERSIONS"]; });
48238
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["API_VERSIONS"]; });
47247
48239
 
47248
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchLayerData", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["fetchLayerData"]; });
48240
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchLayerData", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["fetchLayerData"]; });
47249
48241
 
47250
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchMap", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["fetchMap"]; });
48242
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchMap", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["fetchMap"]; });
47251
48243
 
47252
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_getDataV2", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["getDataV2"]; });
48244
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_getDataV2", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["getDataV2"]; });
48245
+
48246
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_mapInstantiation", function() { return _api__WEBPACK_IMPORTED_MODULE_10__["mapInstantiation"]; });
47253
48247
 
47254
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_mapInstantiation", function() { return _api__WEBPACK_IMPORTED_MODULE_9__["mapInstantiation"]; });
47255
48248
 
47256
48249
 
47257
48250
 
@@ -47280,7 +48273,7 @@ __webpack_require__.r(__webpack_exports__);
47280
48273
  /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
47281
48274
  /* harmony import */ var _carto_tile_layer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./carto-tile-layer */ "./src/layers/carto-tile-layer.ts");
47282
48275
  /* harmony import */ var _h3_tile_layer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./h3-tile-layer */ "./src/layers/h3-tile-layer.ts");
47283
- /* harmony import */ var _quadkey_tile_layer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./quadkey-tile-layer */ "./src/layers/quadkey-tile-layer.ts");
48276
+ /* harmony import */ var _quadbin_tile_layer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./quadbin-tile-layer */ "./src/layers/quadbin-tile-layer.ts");
47284
48277
  /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../api */ "./src/api/index.ts");
47285
48278
  /* harmony import */ var _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../api/maps-api-common */ "./src/api/maps-api-common.ts");
47286
48279
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../config */ "./src/config.ts");
@@ -47336,9 +48329,9 @@ const defaultProps = {
47336
48329
  type: 'array',
47337
48330
  value: null
47338
48331
  },
47339
- // (String, optional): aggregration SQL expression. Only used for spatial index datasets
48332
+ // (String, optional): aggregation SQL expression. Only used for spatial index datasets
47340
48333
  aggregationExp: null,
47341
- // (Number, optional): aggregration resolution level. Only used for spatial index datasets, defaults to 6 for quadkeys, 4 for h3
48334
+ // (Number, optional): aggregation resolution level. Only used for spatial index datasets, defaults to 6 for quadbins, 4 for h3
47342
48335
  aggregationResLevel: null
47343
48336
  };
47344
48337
  /** All properties supported by CartoLayer. */
@@ -47501,8 +48494,8 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
47501
48494
  return [_h3_tile_layer__WEBPACK_IMPORTED_MODULE_2__["default"], props];
47502
48495
  }
47503
48496
 
47504
- if (data.scheme === 'quadkey') {
47505
- return [_quadkey_tile_layer__WEBPACK_IMPORTED_MODULE_3__["default"], props];
48497
+ if (data.scheme === 'quadbin') {
48498
+ return [_quadbin_tile_layer__WEBPACK_IMPORTED_MODULE_3__["default"], props];
47506
48499
  }
47507
48500
 
47508
48501
  return props.formatTiles === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"].MVT ? [_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"], props] : [_carto_tile_layer__WEBPACK_IMPORTED_MODULE_1__["default"], props];
@@ -47783,14 +48776,35 @@ class H3TileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeL
47783
48776
  data,
47784
48777
  tileJSON
47785
48778
  } = this.state;
47786
- const maxZoom = parseInt(tileJSON.maxresolution);
48779
+ let minresolution = parseInt(tileJSON.minresolution);
48780
+ let maxresolution = parseInt(tileJSON.maxresolution); // Convert Mercator zooms provided in props into H3 res levels
48781
+ // and clip into valid range provided from the tilejson
48782
+
48783
+ if (this.props.minZoom) {
48784
+ minresolution = Math.max(minresolution, Object(_h3_tileset_2d__WEBPACK_IMPORTED_MODULE_1__["getHexagonResolution"])({
48785
+ zoom: this.props.minZoom,
48786
+ latitude: 0
48787
+ }));
48788
+ }
48789
+
48790
+ if (this.props.maxZoom) {
48791
+ maxresolution = Math.min(maxresolution, Object(_h3_tileset_2d__WEBPACK_IMPORTED_MODULE_1__["getHexagonResolution"])({
48792
+ zoom: this.props.maxZoom,
48793
+ latitude: 0
48794
+ }));
48795
+ } // The naming is unfortunate, but minZoom & maxZoom in the context
48796
+ // of a Tileset2D refer to the resolution levels, not the Mercator zooms
48797
+
48798
+
47787
48799
  return [new _spatial_index_tile_layer__WEBPACK_IMPORTED_MODULE_2__["default"](this.props, {
47788
48800
  id: `h3-tile-layer-${this.props.id}`,
47789
48801
  data,
47790
48802
  // @ts-expect-error Tileset2D should be generic over TileIndex
47791
48803
  TilesetClass: _h3_tileset_2d__WEBPACK_IMPORTED_MODULE_1__["default"],
47792
48804
  renderSubLayers,
47793
- maxZoom
48805
+ // minZoom and maxZoom are H3 resolutions, however we must use this naming as that is what the Tileset2D class expects
48806
+ minZoom: minresolution,
48807
+ maxZoom: maxresolution
47794
48808
  })];
47795
48809
  }
47796
48810
 
@@ -47806,11 +48820,12 @@ _defineProperty(H3TileLayer, "defaultProps", defaultProps);
47806
48820
  /*!*************************************!*\
47807
48821
  !*** ./src/layers/h3-tileset-2d.ts ***!
47808
48822
  \*************************************/
47809
- /*! exports provided: default */
48823
+ /*! exports provided: getHexagonResolution, default */
47810
48824
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
47811
48825
 
47812
48826
  "use strict";
47813
48827
  __webpack_require__.r(__webpack_exports__);
48828
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHexagonResolution", function() { return getHexagonResolution; });
47814
48829
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return H3Tileset2D; });
47815
48830
  /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/geo-layers */ "@deck.gl/core");
47816
48831
  /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__);
@@ -47825,20 +48840,26 @@ function getHexagonsInBoundingBox({
47825
48840
  east,
47826
48841
  south
47827
48842
  }, resolution) {
47828
- if (Math.abs(east - west) > 180) {
48843
+ const longitudeSpan = Math.abs(east - west);
48844
+
48845
+ if (longitudeSpan > 180) {
47829
48846
  // This is a known issue in h3-js: polyfill does not work correctly
47830
48847
  // when longitude span is larger than 180 degrees.
47831
- return [...new Set(getHexagonsInBoundingBox({
47832
- west,
47833
- north,
47834
- east: 0,
47835
- south
47836
- }, resolution).concat(getHexagonsInBoundingBox({
47837
- west: 0,
47838
- north,
47839
- east,
47840
- south
47841
- }, resolution)))];
48848
+ const nSegments = Math.ceil(longitudeSpan / 180);
48849
+ let h3Indices = [];
48850
+
48851
+ for (let s = 0; s < nSegments; s++) {
48852
+ const segmentEast = east + s * 180;
48853
+ const segmentWest = Math.min(segmentEast + 179.9999999, west);
48854
+ h3Indices = h3Indices.concat(getHexagonsInBoundingBox({
48855
+ west: segmentWest,
48856
+ north,
48857
+ east: segmentEast,
48858
+ south
48859
+ }, resolution));
48860
+ }
48861
+
48862
+ return [...new Set(h3Indices)];
47842
48863
  } // `polyfill()` fills based on hexagon center, which means tiles vanish
47843
48864
  // prematurely. Get more accurate coverage by oversampling
47844
48865
 
@@ -47869,15 +48890,18 @@ function tileToBoundingBox(index) {
47869
48890
 
47870
48891
 
47871
48892
  const BIAS = 2;
47872
-
47873
48893
  function getHexagonResolution(viewport) {
47874
48894
  const hexagonScaleFactor = 2 / 3 * viewport.zoom;
47875
48895
  const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180)); // Clip and bias
47876
48896
 
47877
48897
  return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
47878
48898
  }
47879
-
47880
48899
  class H3Tileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_Tileset2D"] {
48900
+ /**
48901
+ * Returns all tile indices in the current viewport. If the current zoom level is smaller
48902
+ * than minZoom, return an empty array. If the current zoom level is greater than maxZoom,
48903
+ * return tiles that are on maxZoom.
48904
+ */
47881
48905
  // @ts-expect-error Tileset2D should be generic over TileIndex
47882
48906
  getTileIndices({
47883
48907
  viewport,
@@ -47889,7 +48913,8 @@ class H3Tileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_Til
47889
48913
  let indices;
47890
48914
 
47891
48915
  if (typeof minZoom === 'number' && Number.isFinite(minZoom) && z < minZoom) {
47892
- z = minZoom;
48916
+ // TODO support `extent` prop
48917
+ return [];
47893
48918
  }
47894
48919
 
47895
48920
  if (typeof maxZoom === 'number' && Number.isFinite(maxZoom) && z > maxZoom) {
@@ -47948,20 +48973,68 @@ class H3Tileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_Til
47948
48973
 
47949
48974
  /***/ }),
47950
48975
 
47951
- /***/ "./src/layers/quadkey-tile-layer.ts":
48976
+ /***/ "./src/layers/quadbin-layer.ts":
48977
+ /*!*************************************!*\
48978
+ !*** ./src/layers/quadbin-layer.ts ***!
48979
+ \*************************************/
48980
+ /*! exports provided: default */
48981
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
48982
+
48983
+ "use strict";
48984
+ __webpack_require__.r(__webpack_exports__);
48985
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return QuadbinLayer; });
48986
+ /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/geo-layers */ "@deck.gl/core");
48987
+ /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__);
48988
+ /* harmony import */ var _quadbin_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./quadbin-utils */ "./src/layers/quadbin-utils.ts");
48989
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
48990
+
48991
+
48992
+
48993
+ const defaultProps = {
48994
+ getQuadbin: {
48995
+ type: 'accessor',
48996
+ value: d => d.quadbin
48997
+ }
48998
+ };
48999
+ /** All properties supported by QuadbinLayer. */
49000
+
49001
+ class QuadbinLayer extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_GeoCellLayer"] {
49002
+ indexToBounds() {
49003
+ const {
49004
+ data,
49005
+ getQuadbin
49006
+ } = this.props;
49007
+ return {
49008
+ data,
49009
+ _normalize: false,
49010
+ positionFormat: 'XY',
49011
+ getPolygon: (x, objectInfo) => Object(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["getQuadbinPolygon"])(getQuadbin(x, objectInfo))
49012
+ };
49013
+ }
49014
+
49015
+ }
49016
+
49017
+ _defineProperty(QuadbinLayer, "layerName", 'QuadbinLayer');
49018
+
49019
+ _defineProperty(QuadbinLayer, "defaultProps", defaultProps);
49020
+
49021
+ /***/ }),
49022
+
49023
+ /***/ "./src/layers/quadbin-tile-layer.ts":
47952
49024
  /*!******************************************!*\
47953
- !*** ./src/layers/quadkey-tile-layer.ts ***!
49025
+ !*** ./src/layers/quadbin-tile-layer.ts ***!
47954
49026
  \******************************************/
47955
49027
  /*! exports provided: default */
47956
49028
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
47957
49029
 
47958
49030
  "use strict";
47959
49031
  __webpack_require__.r(__webpack_exports__);
47960
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return QuadkeyTileLayer; });
49032
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return QuadbinTileLayer; });
47961
49033
  /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
47962
49034
  /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
47963
- /* harmony import */ var _quadkey_tileset_2d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./quadkey-tileset-2d */ "./src/layers/quadkey-tileset-2d.ts");
47964
- /* harmony import */ var _spatial_index_tile_layer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./spatial-index-tile-layer */ "./src/layers/spatial-index-tile-layer.ts");
49035
+ /* harmony import */ var _quadbin_layer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./quadbin-layer */ "./src/layers/quadbin-layer.ts");
49036
+ /* harmony import */ var _quadbin_tileset_2d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./quadbin-tileset-2d */ "./src/layers/quadbin-tileset-2d.ts");
49037
+ /* harmony import */ var _spatial_index_tile_layer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./spatial-index-tile-layer */ "./src/layers/spatial-index-tile-layer.ts");
47965
49038
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47966
49039
 
47967
49040
 
@@ -47974,17 +49047,17 @@ const renderSubLayers = props => {
47974
49047
  data
47975
49048
  } = props;
47976
49049
  if (!data || !data.length) return null;
47977
- return new _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["QuadkeyLayer"](props, {
47978
- getQuadkey: d => d.id
49050
+ return new _quadbin_layer__WEBPACK_IMPORTED_MODULE_1__["default"](props, {
49051
+ getQuadbin: d => d.id
47979
49052
  });
47980
49053
  };
47981
49054
 
47982
49055
  const defaultProps = {
47983
49056
  aggregationResLevel: 6
47984
49057
  };
47985
- /** All properties supported by QuadkeyTileLayer. */
49058
+ /** All properties supported by QuadbinTileLayer. */
47986
49059
 
47987
- class QuadkeyTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLayer"] {
49060
+ class QuadbinTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLayer"] {
47988
49061
  constructor(...args) {
47989
49062
  super(...args);
47990
49063
 
@@ -48020,11 +49093,11 @@ class QuadkeyTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["Compo
48020
49093
  tileJSON
48021
49094
  } = this.state;
48022
49095
  const maxZoom = parseInt(tileJSON?.maxresolution);
48023
- return [new _spatial_index_tile_layer__WEBPACK_IMPORTED_MODULE_2__["default"](this.props, {
48024
- id: `quadkey-tile-layer-${this.props.id}`,
49096
+ return [new _spatial_index_tile_layer__WEBPACK_IMPORTED_MODULE_3__["default"](this.props, {
49097
+ id: `quadbin-tile-layer-${this.props.id}`,
48025
49098
  data,
48026
49099
  // TODO: Tileset2D should be generic over TileIndex type
48027
- TilesetClass: _quadkey_tileset_2d__WEBPACK_IMPORTED_MODULE_1__["default"],
49100
+ TilesetClass: _quadbin_tileset_2d__WEBPACK_IMPORTED_MODULE_2__["default"],
48028
49101
  renderSubLayers,
48029
49102
  maxZoom
48030
49103
  })];
@@ -48032,69 +49105,33 @@ class QuadkeyTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["Compo
48032
49105
 
48033
49106
  }
48034
49107
 
48035
- _defineProperty(QuadkeyTileLayer, "layerName", 'QuadkeyTileLayer');
49108
+ _defineProperty(QuadbinTileLayer, "layerName", 'QuadbinTileLayer');
48036
49109
 
48037
- _defineProperty(QuadkeyTileLayer, "defaultProps", defaultProps);
49110
+ _defineProperty(QuadbinTileLayer, "defaultProps", defaultProps);
48038
49111
 
48039
49112
  /***/ }),
48040
49113
 
48041
- /***/ "./src/layers/quadkey-tileset-2d.ts":
49114
+ /***/ "./src/layers/quadbin-tileset-2d.ts":
48042
49115
  /*!******************************************!*\
48043
- !*** ./src/layers/quadkey-tileset-2d.ts ***!
49116
+ !*** ./src/layers/quadbin-tileset-2d.ts ***!
48044
49117
  \******************************************/
48045
49118
  /*! exports provided: default */
48046
49119
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
48047
49120
 
48048
49121
  "use strict";
48049
49122
  __webpack_require__.r(__webpack_exports__);
48050
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return QuadkeyTileset2D; });
49123
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return QuadbinTileset2D; });
48051
49124
  /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/geo-layers */ "@deck.gl/core");
48052
49125
  /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__);
49126
+ /* harmony import */ var _quadbin_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./quadbin-utils */ "./src/layers/quadbin-utils.ts");
48053
49127
 
48054
49128
 
48055
- function tileToQuadkey(tile) {
48056
- let index = '';
48057
-
48058
- for (let z = tile.z; z > 0; z--) {
48059
- let b = 0;
48060
- const mask = 1 << z - 1;
48061
- if ((tile.x & mask) !== 0) b++;
48062
- if ((tile.y & mask) !== 0) b += 2;
48063
- index += b.toString();
48064
- }
48065
-
48066
- return {
48067
- i: index
48068
- };
48069
- }
48070
-
48071
- function quadkeyToTile(index) {
48072
- const quadkey = index.i;
48073
- const tile = {
48074
- x: 0,
48075
- y: 0,
48076
- z: quadkey.length
48077
- };
48078
-
48079
- for (let i = tile.z; i > 0; i--) {
48080
- const mask = 1 << i - 1;
48081
- const q = Number(quadkey[tile.z - i]);
48082
- if (q === 1) tile.x |= mask;
48083
- if (q === 2) tile.y |= mask;
48084
-
48085
- if (q === 3) {
48086
- tile.x |= mask;
48087
- tile.y |= mask;
48088
- }
48089
- }
48090
-
48091
- return tile;
48092
- }
48093
-
48094
- class QuadkeyTileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_Tileset2D"] {
49129
+ class QuadbinTileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_Tileset2D"] {
48095
49130
  // @ts-expect-error for spatial indices, TileSet2d should be parametrized by TileIndexT
48096
49131
  getTileIndices(opts) {
48097
- return super.getTileIndices(opts).map(tileToQuadkey);
49132
+ return super.getTileIndices(opts).map(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["tileToQuadbin"]).map(i => ({
49133
+ i
49134
+ }));
48098
49135
  } // @ts-expect-error TileIndex must be generic
48099
49136
 
48100
49137
 
@@ -48105,22 +49142,25 @@ class QuadkeyTileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__[
48105
49142
  } // @ts-expect-error TileIndex must be generic
48106
49143
 
48107
49144
 
48108
- getTileMetadata(index) {
48109
- return super.getTileMetadata(quadkeyToTile(index));
49145
+ getTileMetadata({
49146
+ i
49147
+ }) {
49148
+ return super.getTileMetadata(Object(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["quadbinToTile"])(i));
48110
49149
  } // @ts-expect-error TileIndex must be generic
48111
49150
 
48112
49151
 
48113
49152
  getTileZoom({
48114
49153
  i
48115
49154
  }) {
48116
- return i.length;
49155
+ return Number(Object(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["quadbinZoom"])(i));
48117
49156
  } // @ts-expect-error TileIndex must be generic
48118
49157
 
48119
49158
 
48120
- getParentIndex(index) {
48121
- const i = index.i.slice(0, -1);
49159
+ getParentIndex({
49160
+ i
49161
+ }) {
48122
49162
  return {
48123
- i
49163
+ i: Object(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["quadbinParent"])(i)
48124
49164
  };
48125
49165
  }
48126
49166
 
@@ -48128,6 +49168,112 @@ class QuadkeyTileset2D extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__[
48128
49168
 
48129
49169
  /***/ }),
48130
49170
 
49171
+ /***/ "./src/layers/quadbin-utils.ts":
49172
+ /*!*************************************!*\
49173
+ !*** ./src/layers/quadbin-utils.ts ***!
49174
+ \*************************************/
49175
+ /*! exports provided: tileToQuadbin, quadbinToTile, quadbinZoom, quadbinParent, quadbinToWorldBounds, getQuadbinPolygon */
49176
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
49177
+
49178
+ "use strict";
49179
+ __webpack_require__.r(__webpack_exports__);
49180
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tileToQuadbin", function() { return tileToQuadbin; });
49181
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadbinToTile", function() { return quadbinToTile; });
49182
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadbinZoom", function() { return quadbinZoom; });
49183
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadbinParent", function() { return quadbinParent; });
49184
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadbinToWorldBounds", function() { return quadbinToWorldBounds; });
49185
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getQuadbinPolygon", function() { return getQuadbinPolygon; });
49186
+ /* harmony import */ var _math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/web-mercator */ "../../node_modules/@math.gl/web-mercator/dist/esm/index.js");
49187
+
49188
+ const TILE_SIZE = 512;
49189
+ const B = [0x5555555555555555n, 0x3333333333333333n, 0x0f0f0f0f0f0f0f0fn, 0x00ff00ff00ff00ffn, 0x0000ffff0000ffffn, 0x00000000ffffffffn];
49190
+ const S = [0n, 1n, 2n, 4n, 8n, 16n];
49191
+
49192
+ function indexToBigInt(index) {
49193
+ return BigInt(`0x${index}`);
49194
+ }
49195
+
49196
+ function bigIntToIndex(quadbin) {
49197
+ return quadbin.toString(16);
49198
+ }
49199
+
49200
+ function tileToQuadbin(tile) {
49201
+ if (tile.z < 0 || tile.z > 26) {
49202
+ throw new Error('Wrong zoom');
49203
+ }
49204
+
49205
+ const z = BigInt(tile.z);
49206
+ let x = BigInt(tile.x) << 32n - z;
49207
+ let y = BigInt(tile.y) << 32n - z;
49208
+
49209
+ for (let i = 0; i < 5; i++) {
49210
+ const s = S[5 - i];
49211
+ const b = B[4 - i];
49212
+ x = (x | x << s) & b;
49213
+ y = (y | y << s) & b;
49214
+ }
49215
+
49216
+ const quadbin = 0x4000000000000000n | 1n << 59n | z << 52n | (x | y << 1n) >> 12n | 0xfffffffffffffn >> z * 2n;
49217
+ return bigIntToIndex(quadbin);
49218
+ }
49219
+ function quadbinToTile(index) {
49220
+ const quadbin = indexToBigInt(index);
49221
+ const mode = quadbin >> 59n & 7n;
49222
+ const modeDep = quadbin >> 57n & 3n;
49223
+ const z = quadbin >> 52n & 0x1fn;
49224
+ const q = (quadbin & 0xfffffffffffffn) << 12n;
49225
+
49226
+ if (mode !== 1n && modeDep !== 0n) {
49227
+ throw new Error('Wrong mode');
49228
+ }
49229
+
49230
+ let x = q;
49231
+ let y = q >> 1n;
49232
+
49233
+ for (let i = 0; i < 6; i++) {
49234
+ const s = S[i];
49235
+ const b = B[i];
49236
+ x = (x | x >> s) & b;
49237
+ y = (y | y >> s) & b;
49238
+ }
49239
+
49240
+ x = x >> 32n - z;
49241
+ y = y >> 32n - z;
49242
+ return {
49243
+ z: Number(z),
49244
+ x: Number(x),
49245
+ y: Number(y)
49246
+ };
49247
+ }
49248
+ function quadbinZoom(index) {
49249
+ const quadbin = indexToBigInt(index);
49250
+ return quadbin >> 52n & 0x1fn;
49251
+ }
49252
+ function quadbinParent(index) {
49253
+ const quadbin = indexToBigInt(index);
49254
+ const zparent = quadbinZoom(index) - 1n;
49255
+ const parent = quadbin & ~(0x1fn << 52n) | zparent << 52n | 0xfffffffffffffn >> zparent * 2n;
49256
+ return bigIntToIndex(parent);
49257
+ }
49258
+ function quadbinToWorldBounds(quadbin) {
49259
+ const {
49260
+ x,
49261
+ y,
49262
+ z
49263
+ } = quadbinToTile(quadbin);
49264
+ const mask = 1 << z;
49265
+ const scale = mask / TILE_SIZE;
49266
+ return [[x / scale, TILE_SIZE - y / scale], [(x + 0.99) / scale, TILE_SIZE - (y + 0.99) / scale]];
49267
+ }
49268
+ function getQuadbinPolygon(quadbin) {
49269
+ const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin);
49270
+ const [w, n] = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])(topLeft);
49271
+ const [e, s] = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])(bottomRight);
49272
+ return [e, n, e, s, w, s, w, n, e, n];
49273
+ }
49274
+
49275
+ /***/ }),
49276
+
48131
49277
  /***/ "./src/layers/schema/carto-tile.ts":
48132
49278
  /*!*****************************************!*\
48133
49279
  !*** ./src/layers/schema/carto-tile.ts ***!