@deck.gl/carto 8.8.22 → 8.8.24

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.
package/dist/dist.dev.js CHANGED
@@ -13018,7 +13018,7 @@ __webpack_require__.r(__webpack_exports__);
13018
13018
 
13019
13019
 
13020
13020
 
13021
- const VERSION = true ? "8.8.22" : undefined;
13021
+ const VERSION = true ? "8.8.24" : undefined;
13022
13022
  const isBrowser = Object(_lib_is_browser__WEBPACK_IMPORTED_MODULE_0__["default"])();
13023
13023
  //# sourceMappingURL=globals.js.map
13024
13024
 
@@ -54543,7 +54543,7 @@ __webpack_require__.r(__webpack_exports__);
54543
54543
 
54544
54544
 
54545
54545
 
54546
- const VERSION = true ? "8.8.22" : undefined;
54546
+ const VERSION = true ? "8.8.24" : undefined;
54547
54547
  const isBrowser = Object(_env_is_browser__WEBPACK_IMPORTED_MODULE_0__["default"])();
54548
54548
  //# sourceMappingURL=globals.js.map
54549
54549
 
@@ -57920,13 +57920,16 @@ class QuadbinLayer extends _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_0__["_Ge
57920
57920
  indexToBounds() {
57921
57921
  const {
57922
57922
  data,
57923
+ extruded,
57923
57924
  getQuadbin
57924
- } = this.props;
57925
+ } = this.props; // To avoid z-fighting reduce polygon footprint when extruding
57926
+
57927
+ const coverage = extruded ? 0.99 : 1;
57925
57928
  return {
57926
57929
  data,
57927
57930
  _normalize: false,
57928
57931
  positionFormat: 'XY',
57929
- getPolygon: (x, objectInfo) => Object(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["getQuadbinPolygon"])(getQuadbin(x, objectInfo))
57932
+ getPolygon: (x, objectInfo) => Object(_quadbin_utils__WEBPACK_IMPORTED_MODULE_1__["getQuadbinPolygon"])(getQuadbin(x, objectInfo), coverage)
57930
57933
  };
57931
57934
  }
57932
57935
 
@@ -58113,7 +58116,7 @@ __webpack_require__.r(__webpack_exports__);
58113
58116
 
58114
58117
 
58115
58118
  const TILE_SIZE = 512;
58116
- function quadbinToWorldBounds(quadbin) {
58119
+ function quadbinToWorldBounds(quadbin, coverage) {
58117
58120
  const {
58118
58121
  x,
58119
58122
  y,
@@ -58121,10 +58124,10 @@ function quadbinToWorldBounds(quadbin) {
58121
58124
  } = Object(quadbin__WEBPACK_IMPORTED_MODULE_1__["cellToTile"])(quadbin);
58122
58125
  const mask = 1 << z;
58123
58126
  const scale = mask / TILE_SIZE;
58124
- return [[x / scale, TILE_SIZE - y / scale], [(x + 0.99) / scale, TILE_SIZE - (y + 0.99) / scale]];
58127
+ return [[x / scale, TILE_SIZE - y / scale], [(x + coverage) / scale, TILE_SIZE - (y + coverage) / scale]];
58125
58128
  }
58126
- function getQuadbinPolygon(quadbin) {
58127
- const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin);
58129
+ function getQuadbinPolygon(quadbin, coverage = 1) {
58130
+ const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);
58128
58131
  const [w, n] = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])(topLeft);
58129
58132
  const [e, s] = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])(bottomRight);
58130
58133
  return [e, n, e, s, w, s, w, n, e, n];
@@ -51,13 +51,15 @@ var QuadbinLayer = function (_GeoCellLayer) {
51
51
  value: function indexToBounds() {
52
52
  var _this$props = this.props,
53
53
  data = _this$props.data,
54
+ extruded = _this$props.extruded,
54
55
  getQuadbin = _this$props.getQuadbin;
56
+ var coverage = extruded ? 0.99 : 1;
55
57
  return {
56
58
  data: data,
57
59
  _normalize: false,
58
60
  positionFormat: 'XY',
59
61
  getPolygon: function getPolygon(x, objectInfo) {
60
- return (0, _quadbinUtils.getQuadbinPolygon)(getQuadbin(x, objectInfo));
62
+ return (0, _quadbinUtils.getQuadbinPolygon)(getQuadbin(x, objectInfo), coverage);
61
63
  }
62
64
  };
63
65
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/layers/quadbin-layer.ts"],"names":["defaultProps","getQuadbin","type","value","d","quadbin","QuadbinLayer","props","data","_normalize","positionFormat","getPolygon","x","objectInfo","GeoCellLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AAIA;;;;;;AAEA,IAAMA,YAA6C,GAAG;AACpDC,EAAAA,UAAU,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,eAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,OAAN;AAAA;AAA3B;AADwC,CAAtD;;IAiBqBC,Y;;;;;;;;;;;;WAOnB,yBAAuD;AACrD,wBAA2B,KAAKC,KAAhC;AAAA,UAAOC,IAAP,eAAOA,IAAP;AAAA,UAAaP,UAAb,eAAaA,UAAb;AAEA,aAAO;AACLO,QAAAA,IAAI,EAAJA,IADK;AAELC,QAAAA,UAAU,EAAE,KAFP;AAGLC,QAAAA,cAAc,EAAE,IAHX;AAKLC,QAAAA,UAAU,EAAE,oBAACC,CAAD,EAAWC,UAAX;AAAA,iBAA0B,qCAAkBZ,UAAU,CAACW,CAAD,EAAIC,UAAJ,CAA5B,CAA1B;AAAA;AALP,OAAP;AAOD;;;EAjBqEC,wB;;;8BAAnDR,Y,eAIA,c;8BAJAA,Y,kBAKGN,Y","sourcesContent":["import {AccessorFunction, DefaultProps} from '@deck.gl/core';\nimport {\n _GeoCellLayer as GeoCellLayer,\n _GeoCellLayerProps as GeoCellLayerProps\n} from '@deck.gl/geo-layers';\nimport {getQuadbinPolygon} from './quadbin-utils';\n\nconst defaultProps: DefaultProps<QuadbinLayerProps> = {\n getQuadbin: {type: 'accessor', value: d => d.quadbin}\n};\n\n/** All properties supported by QuadbinLayer. */\nexport type QuadbinLayerProps<DataT = any> = _QuadbinLayerProps<DataT> & GeoCellLayerProps<DataT>;\n\n/** Properties added by QuadbinLayer. */\ntype _QuadbinLayerProps<DataT> = {\n /**\n * Called for each data object to retrieve the quadbin string identifier.\n *\n * By default, it reads `quadbin` property of data object.\n */\n getQuadbin?: AccessorFunction<DataT, bigint>;\n};\n\nexport default class QuadbinLayer<DataT = any, ExtraProps = {}> extends GeoCellLayer<\n DataT,\n Required<_QuadbinLayerProps<DataT>> & ExtraProps\n> {\n static layerName = 'QuadbinLayer';\n static defaultProps = defaultProps;\n\n indexToBounds(): Partial<GeoCellLayer['props']> | null {\n const {data, getQuadbin} = this.props;\n\n return {\n data,\n _normalize: false,\n positionFormat: 'XY',\n\n getPolygon: (x: DataT, objectInfo) => getQuadbinPolygon(getQuadbin(x, objectInfo))\n };\n }\n}\n"],"file":"quadbin-layer.js"}
1
+ {"version":3,"sources":["../../../src/layers/quadbin-layer.ts"],"names":["defaultProps","getQuadbin","type","value","d","quadbin","QuadbinLayer","props","data","extruded","coverage","_normalize","positionFormat","getPolygon","x","objectInfo","GeoCellLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AAIA;;;;;;AAEA,IAAMA,YAA6C,GAAG;AACpDC,EAAAA,UAAU,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,eAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,OAAN;AAAA;AAA3B;AADwC,CAAtD;;IAiBqBC,Y;;;;;;;;;;;;WAOnB,yBAAuD;AACrD,wBAAqC,KAAKC,KAA1C;AAAA,UAAOC,IAAP,eAAOA,IAAP;AAAA,UAAaC,QAAb,eAAaA,QAAb;AAAA,UAAuBR,UAAvB,eAAuBA,UAAvB;AAEA,UAAMS,QAAQ,GAAGD,QAAQ,GAAG,IAAH,GAAU,CAAnC;AAEA,aAAO;AACLD,QAAAA,IAAI,EAAJA,IADK;AAELG,QAAAA,UAAU,EAAE,KAFP;AAGLC,QAAAA,cAAc,EAAE,IAHX;AAKLC,QAAAA,UAAU,EAAE,oBAACC,CAAD,EAAWC,UAAX;AAAA,iBAA0B,qCAAkBd,UAAU,CAACa,CAAD,EAAIC,UAAJ,CAA5B,EAA6CL,QAA7C,CAA1B;AAAA;AALP,OAAP;AAOD;;;EAnBqEM,wB;;;8BAAnDV,Y,eAIA,c;8BAJAA,Y,kBAKGN,Y","sourcesContent":["import {AccessorFunction, DefaultProps} from '@deck.gl/core';\nimport {\n _GeoCellLayer as GeoCellLayer,\n _GeoCellLayerProps as GeoCellLayerProps\n} from '@deck.gl/geo-layers';\nimport {getQuadbinPolygon} from './quadbin-utils';\n\nconst defaultProps: DefaultProps<QuadbinLayerProps> = {\n getQuadbin: {type: 'accessor', value: d => d.quadbin}\n};\n\n/** All properties supported by QuadbinLayer. */\nexport type QuadbinLayerProps<DataT = any> = _QuadbinLayerProps<DataT> & GeoCellLayerProps<DataT>;\n\n/** Properties added by QuadbinLayer. */\ntype _QuadbinLayerProps<DataT> = {\n /**\n * Called for each data object to retrieve the quadbin string identifier.\n *\n * By default, it reads `quadbin` property of data object.\n */\n getQuadbin?: AccessorFunction<DataT, bigint>;\n};\n\nexport default class QuadbinLayer<DataT = any, ExtraProps = {}> extends GeoCellLayer<\n DataT,\n Required<_QuadbinLayerProps<DataT>> & ExtraProps\n> {\n static layerName = 'QuadbinLayer';\n static defaultProps = defaultProps;\n\n indexToBounds(): Partial<GeoCellLayer['props']> | null {\n const {data, extruded, getQuadbin} = this.props;\n // To avoid z-fighting reduce polygon footprint when extruding\n const coverage = extruded ? 0.99 : 1;\n\n return {\n data,\n _normalize: false,\n positionFormat: 'XY',\n\n getPolygon: (x: DataT, objectInfo) => getQuadbinPolygon(getQuadbin(x, objectInfo), coverage)\n };\n }\n}\n"],"file":"quadbin-layer.js"}
@@ -16,7 +16,7 @@ var _quadbin = require("quadbin");
16
16
 
17
17
  var TILE_SIZE = 512;
18
18
 
19
- function quadbinToWorldBounds(quadbin) {
19
+ function quadbinToWorldBounds(quadbin, coverage) {
20
20
  var _cellToTile = (0, _quadbin.cellToTile)(quadbin),
21
21
  x = _cellToTile.x,
22
22
  y = _cellToTile.y,
@@ -24,11 +24,13 @@ function quadbinToWorldBounds(quadbin) {
24
24
 
25
25
  var mask = 1 << z;
26
26
  var scale = mask / TILE_SIZE;
27
- return [[x / scale, TILE_SIZE - y / scale], [(x + 0.99) / scale, TILE_SIZE - (y + 0.99) / scale]];
27
+ return [[x / scale, TILE_SIZE - y / scale], [(x + coverage) / scale, TILE_SIZE - (y + coverage) / scale]];
28
28
  }
29
29
 
30
30
  function getQuadbinPolygon(quadbin) {
31
- var _quadbinToWorldBounds = quadbinToWorldBounds(quadbin),
31
+ var coverage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
32
+
33
+ var _quadbinToWorldBounds = quadbinToWorldBounds(quadbin, coverage),
32
34
  _quadbinToWorldBounds2 = (0, _slicedToArray2.default)(_quadbinToWorldBounds, 2),
33
35
  topLeft = _quadbinToWorldBounds2[0],
34
36
  bottomRight = _quadbinToWorldBounds2[1];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/layers/quadbin-utils.ts"],"names":["TILE_SIZE","quadbinToWorldBounds","quadbin","x","y","z","mask","scale","getQuadbinPolygon","topLeft","bottomRight","w","n","e","s"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,GAAlB;;AAEO,SAASC,oBAAT,CAA8BC,OAA9B,EAAqE;AAC1E,oBAAkB,yBAAWA,OAAX,CAAlB;AAAA,MAAOC,CAAP,eAAOA,CAAP;AAAA,MAAUC,CAAV,eAAUA,CAAV;AAAA,MAAaC,CAAb,eAAaA,CAAb;;AACA,MAAMC,IAAI,GAAG,KAAKD,CAAlB;AACA,MAAME,KAAK,GAAGD,IAAI,GAAGN,SAArB;AACA,SAAO,CACL,CAACG,CAAC,GAAGI,KAAL,EAAYP,SAAS,GAAGI,CAAC,GAAGG,KAA5B,CADK,EAEL,CAAC,CAACJ,CAAC,GAAG,IAAL,IAAaI,KAAd,EAAqBP,SAAS,GAAG,CAACI,CAAC,GAAG,IAAL,IAAaG,KAA9C,CAFK,CAAP;AAID;;AAEM,SAASC,iBAAT,CAA2BN,OAA3B,EAAsD;AAC3D,8BAA+BD,oBAAoB,CAACC,OAAD,CAAnD;AAAA;AAAA,MAAOO,OAAP;AAAA,MAAgBC,WAAhB;;AACA,uBAAe,gCAAcD,OAAd,CAAf;AAAA;AAAA,MAAOE,CAAP;AAAA,MAAUC,CAAV;;AACA,wBAAe,gCAAcF,WAAd,CAAf;AAAA;AAAA,MAAOG,CAAP;AAAA,MAAUC,CAAV;;AACA,SAAO,CAACD,CAAD,EAAID,CAAJ,EAAOC,CAAP,EAAUC,CAAV,EAAaH,CAAb,EAAgBG,CAAhB,EAAmBH,CAAnB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BD,CAA5B,CAAP;AACD","sourcesContent":["import {worldToLngLat} from '@math.gl/web-mercator';\nimport {cellToTile} from 'quadbin';\n\nconst TILE_SIZE = 512;\n\nexport function quadbinToWorldBounds(quadbin: bigint): [number[], number[]] {\n const {x, y, z} = cellToTile(quadbin);\n const mask = 1 << z;\n const scale = mask / TILE_SIZE;\n return [\n [x / scale, TILE_SIZE - y / scale],\n [(x + 0.99) / scale, TILE_SIZE - (y + 0.99) / scale]\n ];\n}\n\nexport function getQuadbinPolygon(quadbin: bigint): number[] {\n const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin);\n const [w, n] = worldToLngLat(topLeft);\n const [e, s] = worldToLngLat(bottomRight);\n return [e, n, e, s, w, s, w, n, e, n];\n}\n"],"file":"quadbin-utils.js"}
1
+ {"version":3,"sources":["../../../src/layers/quadbin-utils.ts"],"names":["TILE_SIZE","quadbinToWorldBounds","quadbin","coverage","x","y","z","mask","scale","getQuadbinPolygon","topLeft","bottomRight","w","n","e","s"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,GAAlB;;AAEO,SAASC,oBAAT,CAA8BC,OAA9B,EAA+CC,QAA/C,EAAuF;AAC5F,oBAAkB,yBAAWD,OAAX,CAAlB;AAAA,MAAOE,CAAP,eAAOA,CAAP;AAAA,MAAUC,CAAV,eAAUA,CAAV;AAAA,MAAaC,CAAb,eAAaA,CAAb;;AACA,MAAMC,IAAI,GAAG,KAAKD,CAAlB;AACA,MAAME,KAAK,GAAGD,IAAI,GAAGP,SAArB;AACA,SAAO,CACL,CAACI,CAAC,GAAGI,KAAL,EAAYR,SAAS,GAAGK,CAAC,GAAGG,KAA5B,CADK,EAEL,CAAC,CAACJ,CAAC,GAAGD,QAAL,IAAiBK,KAAlB,EAAyBR,SAAS,GAAG,CAACK,CAAC,GAAGF,QAAL,IAAiBK,KAAtD,CAFK,CAAP;AAID;;AAEM,SAASC,iBAAT,CAA2BP,OAA3B,EAAoE;AAAA,MAAxBC,QAAwB,uEAAb,CAAa;;AACzE,8BAA+BF,oBAAoB,CAACC,OAAD,EAAUC,QAAV,CAAnD;AAAA;AAAA,MAAOO,OAAP;AAAA,MAAgBC,WAAhB;;AACA,uBAAe,gCAAcD,OAAd,CAAf;AAAA;AAAA,MAAOE,CAAP;AAAA,MAAUC,CAAV;;AACA,wBAAe,gCAAcF,WAAd,CAAf;AAAA;AAAA,MAAOG,CAAP;AAAA,MAAUC,CAAV;;AACA,SAAO,CAACD,CAAD,EAAID,CAAJ,EAAOC,CAAP,EAAUC,CAAV,EAAaH,CAAb,EAAgBG,CAAhB,EAAmBH,CAAnB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BD,CAA5B,CAAP;AACD","sourcesContent":["import {worldToLngLat} from '@math.gl/web-mercator';\nimport {cellToTile} from 'quadbin';\n\nconst TILE_SIZE = 512;\n\nexport function quadbinToWorldBounds(quadbin: bigint, coverage: number): [number[], number[]] {\n const {x, y, z} = cellToTile(quadbin);\n const mask = 1 << z;\n const scale = mask / TILE_SIZE;\n return [\n [x / scale, TILE_SIZE - y / scale],\n [(x + coverage) / scale, TILE_SIZE - (y + coverage) / scale]\n ];\n}\n\nexport function getQuadbinPolygon(quadbin: bigint, coverage = 1): number[] {\n const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);\n const [w, n] = worldToLngLat(topLeft);\n const [e, s] = worldToLngLat(bottomRight);\n return [e, n, e, s, w, s, w, n, e, n];\n}\n"],"file":"quadbin-utils.js"}
@@ -11,13 +11,15 @@ export default class QuadbinLayer extends GeoCellLayer {
11
11
  indexToBounds() {
12
12
  const {
13
13
  data,
14
+ extruded,
14
15
  getQuadbin
15
16
  } = this.props;
17
+ const coverage = extruded ? 0.99 : 1;
16
18
  return {
17
19
  data,
18
20
  _normalize: false,
19
21
  positionFormat: 'XY',
20
- getPolygon: (x, objectInfo) => getQuadbinPolygon(getQuadbin(x, objectInfo))
22
+ getPolygon: (x, objectInfo) => getQuadbinPolygon(getQuadbin(x, objectInfo), coverage)
21
23
  };
22
24
  }
23
25
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/layers/quadbin-layer.ts"],"names":["_GeoCellLayer","GeoCellLayer","getQuadbinPolygon","defaultProps","getQuadbin","type","value","d","quadbin","QuadbinLayer","indexToBounds","data","props","_normalize","positionFormat","getPolygon","x","objectInfo"],"mappings":";AACA,SACEA,aAAa,IAAIC,YADnB,QAGO,qBAHP;AAIA,SAAQC,iBAAR,QAAgC,iBAAhC;AAEA,MAAMC,YAA6C,GAAG;AACpDC,EAAAA,UAAU,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAEC,CAAC,IAAIA,CAAC,CAACC;AAAjC;AADwC,CAAtD;AAiBA,eAAe,MAAMC,YAAN,SAAyDR,YAAzD,CAGb;AAIAS,EAAAA,aAAa,GAA0C;AACrD,UAAM;AAACC,MAAAA,IAAD;AAAOP,MAAAA;AAAP,QAAqB,KAAKQ,KAAhC;AAEA,WAAO;AACLD,MAAAA,IADK;AAELE,MAAAA,UAAU,EAAE,KAFP;AAGLC,MAAAA,cAAc,EAAE,IAHX;AAKLC,MAAAA,UAAU,EAAE,CAACC,CAAD,EAAWC,UAAX,KAA0Bf,iBAAiB,CAACE,UAAU,CAACY,CAAD,EAAIC,UAAJ,CAAX;AALlD,KAAP;AAOD;;AAdD;;gBAHmBR,Y,eAIA,c;;gBAJAA,Y,kBAKGN,Y","sourcesContent":["import {AccessorFunction, DefaultProps} from '@deck.gl/core';\nimport {\n _GeoCellLayer as GeoCellLayer,\n _GeoCellLayerProps as GeoCellLayerProps\n} from '@deck.gl/geo-layers';\nimport {getQuadbinPolygon} from './quadbin-utils';\n\nconst defaultProps: DefaultProps<QuadbinLayerProps> = {\n getQuadbin: {type: 'accessor', value: d => d.quadbin}\n};\n\n/** All properties supported by QuadbinLayer. */\nexport type QuadbinLayerProps<DataT = any> = _QuadbinLayerProps<DataT> & GeoCellLayerProps<DataT>;\n\n/** Properties added by QuadbinLayer. */\ntype _QuadbinLayerProps<DataT> = {\n /**\n * Called for each data object to retrieve the quadbin string identifier.\n *\n * By default, it reads `quadbin` property of data object.\n */\n getQuadbin?: AccessorFunction<DataT, bigint>;\n};\n\nexport default class QuadbinLayer<DataT = any, ExtraProps = {}> extends GeoCellLayer<\n DataT,\n Required<_QuadbinLayerProps<DataT>> & ExtraProps\n> {\n static layerName = 'QuadbinLayer';\n static defaultProps = defaultProps;\n\n indexToBounds(): Partial<GeoCellLayer['props']> | null {\n const {data, getQuadbin} = this.props;\n\n return {\n data,\n _normalize: false,\n positionFormat: 'XY',\n\n getPolygon: (x: DataT, objectInfo) => getQuadbinPolygon(getQuadbin(x, objectInfo))\n };\n }\n}\n"],"file":"quadbin-layer.js"}
1
+ {"version":3,"sources":["../../../src/layers/quadbin-layer.ts"],"names":["_GeoCellLayer","GeoCellLayer","getQuadbinPolygon","defaultProps","getQuadbin","type","value","d","quadbin","QuadbinLayer","indexToBounds","data","extruded","props","coverage","_normalize","positionFormat","getPolygon","x","objectInfo"],"mappings":";AACA,SACEA,aAAa,IAAIC,YADnB,QAGO,qBAHP;AAIA,SAAQC,iBAAR,QAAgC,iBAAhC;AAEA,MAAMC,YAA6C,GAAG;AACpDC,EAAAA,UAAU,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAEC,CAAC,IAAIA,CAAC,CAACC;AAAjC;AADwC,CAAtD;AAiBA,eAAe,MAAMC,YAAN,SAAyDR,YAAzD,CAGb;AAIAS,EAAAA,aAAa,GAA0C;AACrD,UAAM;AAACC,MAAAA,IAAD;AAAOC,MAAAA,QAAP;AAAiBR,MAAAA;AAAjB,QAA+B,KAAKS,KAA1C;AAEA,UAAMC,QAAQ,GAAGF,QAAQ,GAAG,IAAH,GAAU,CAAnC;AAEA,WAAO;AACLD,MAAAA,IADK;AAELI,MAAAA,UAAU,EAAE,KAFP;AAGLC,MAAAA,cAAc,EAAE,IAHX;AAKLC,MAAAA,UAAU,EAAE,CAACC,CAAD,EAAWC,UAAX,KAA0BjB,iBAAiB,CAACE,UAAU,CAACc,CAAD,EAAIC,UAAJ,CAAX,EAA4BL,QAA5B;AALlD,KAAP;AAOD;;AAhBD;;gBAHmBL,Y,eAIA,c;;gBAJAA,Y,kBAKGN,Y","sourcesContent":["import {AccessorFunction, DefaultProps} from '@deck.gl/core';\nimport {\n _GeoCellLayer as GeoCellLayer,\n _GeoCellLayerProps as GeoCellLayerProps\n} from '@deck.gl/geo-layers';\nimport {getQuadbinPolygon} from './quadbin-utils';\n\nconst defaultProps: DefaultProps<QuadbinLayerProps> = {\n getQuadbin: {type: 'accessor', value: d => d.quadbin}\n};\n\n/** All properties supported by QuadbinLayer. */\nexport type QuadbinLayerProps<DataT = any> = _QuadbinLayerProps<DataT> & GeoCellLayerProps<DataT>;\n\n/** Properties added by QuadbinLayer. */\ntype _QuadbinLayerProps<DataT> = {\n /**\n * Called for each data object to retrieve the quadbin string identifier.\n *\n * By default, it reads `quadbin` property of data object.\n */\n getQuadbin?: AccessorFunction<DataT, bigint>;\n};\n\nexport default class QuadbinLayer<DataT = any, ExtraProps = {}> extends GeoCellLayer<\n DataT,\n Required<_QuadbinLayerProps<DataT>> & ExtraProps\n> {\n static layerName = 'QuadbinLayer';\n static defaultProps = defaultProps;\n\n indexToBounds(): Partial<GeoCellLayer['props']> | null {\n const {data, extruded, getQuadbin} = this.props;\n // To avoid z-fighting reduce polygon footprint when extruding\n const coverage = extruded ? 0.99 : 1;\n\n return {\n data,\n _normalize: false,\n positionFormat: 'XY',\n\n getPolygon: (x: DataT, objectInfo) => getQuadbinPolygon(getQuadbin(x, objectInfo), coverage)\n };\n }\n}\n"],"file":"quadbin-layer.js"}
@@ -1,7 +1,7 @@
1
1
  import { worldToLngLat } from '@math.gl/web-mercator';
2
2
  import { cellToTile } from 'quadbin';
3
3
  const TILE_SIZE = 512;
4
- export function quadbinToWorldBounds(quadbin) {
4
+ export function quadbinToWorldBounds(quadbin, coverage) {
5
5
  const {
6
6
  x,
7
7
  y,
@@ -9,10 +9,10 @@ export function quadbinToWorldBounds(quadbin) {
9
9
  } = cellToTile(quadbin);
10
10
  const mask = 1 << z;
11
11
  const scale = mask / TILE_SIZE;
12
- return [[x / scale, TILE_SIZE - y / scale], [(x + 0.99) / scale, TILE_SIZE - (y + 0.99) / scale]];
12
+ return [[x / scale, TILE_SIZE - y / scale], [(x + coverage) / scale, TILE_SIZE - (y + coverage) / scale]];
13
13
  }
14
- export function getQuadbinPolygon(quadbin) {
15
- const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin);
14
+ export function getQuadbinPolygon(quadbin, coverage = 1) {
15
+ const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);
16
16
  const [w, n] = worldToLngLat(topLeft);
17
17
  const [e, s] = worldToLngLat(bottomRight);
18
18
  return [e, n, e, s, w, s, w, n, e, n];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/layers/quadbin-utils.ts"],"names":["worldToLngLat","cellToTile","TILE_SIZE","quadbinToWorldBounds","quadbin","x","y","z","mask","scale","getQuadbinPolygon","topLeft","bottomRight","w","n","e","s"],"mappings":"AAAA,SAAQA,aAAR,QAA4B,uBAA5B;AACA,SAAQC,UAAR,QAAyB,SAAzB;AAEA,MAAMC,SAAS,GAAG,GAAlB;AAEA,OAAO,SAASC,oBAAT,CAA8BC,OAA9B,EAAqE;AAC1E,QAAM;AAACC,IAAAA,CAAD;AAAIC,IAAAA,CAAJ;AAAOC,IAAAA;AAAP,MAAYN,UAAU,CAACG,OAAD,CAA5B;AACA,QAAMI,IAAI,GAAG,KAAKD,CAAlB;AACA,QAAME,KAAK,GAAGD,IAAI,GAAGN,SAArB;AACA,SAAO,CACL,CAACG,CAAC,GAAGI,KAAL,EAAYP,SAAS,GAAGI,CAAC,GAAGG,KAA5B,CADK,EAEL,CAAC,CAACJ,CAAC,GAAG,IAAL,IAAaI,KAAd,EAAqBP,SAAS,GAAG,CAACI,CAAC,GAAG,IAAL,IAAaG,KAA9C,CAFK,CAAP;AAID;AAED,OAAO,SAASC,iBAAT,CAA2BN,OAA3B,EAAsD;AAC3D,QAAM,CAACO,OAAD,EAAUC,WAAV,IAAyBT,oBAAoB,CAACC,OAAD,CAAnD;AACA,QAAM,CAACS,CAAD,EAAIC,CAAJ,IAASd,aAAa,CAACW,OAAD,CAA5B;AACA,QAAM,CAACI,CAAD,EAAIC,CAAJ,IAAShB,aAAa,CAACY,WAAD,CAA5B;AACA,SAAO,CAACG,CAAD,EAAID,CAAJ,EAAOC,CAAP,EAAUC,CAAV,EAAaH,CAAb,EAAgBG,CAAhB,EAAmBH,CAAnB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BD,CAA5B,CAAP;AACD","sourcesContent":["import {worldToLngLat} from '@math.gl/web-mercator';\nimport {cellToTile} from 'quadbin';\n\nconst TILE_SIZE = 512;\n\nexport function quadbinToWorldBounds(quadbin: bigint): [number[], number[]] {\n const {x, y, z} = cellToTile(quadbin);\n const mask = 1 << z;\n const scale = mask / TILE_SIZE;\n return [\n [x / scale, TILE_SIZE - y / scale],\n [(x + 0.99) / scale, TILE_SIZE - (y + 0.99) / scale]\n ];\n}\n\nexport function getQuadbinPolygon(quadbin: bigint): number[] {\n const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin);\n const [w, n] = worldToLngLat(topLeft);\n const [e, s] = worldToLngLat(bottomRight);\n return [e, n, e, s, w, s, w, n, e, n];\n}\n"],"file":"quadbin-utils.js"}
1
+ {"version":3,"sources":["../../../src/layers/quadbin-utils.ts"],"names":["worldToLngLat","cellToTile","TILE_SIZE","quadbinToWorldBounds","quadbin","coverage","x","y","z","mask","scale","getQuadbinPolygon","topLeft","bottomRight","w","n","e","s"],"mappings":"AAAA,SAAQA,aAAR,QAA4B,uBAA5B;AACA,SAAQC,UAAR,QAAyB,SAAzB;AAEA,MAAMC,SAAS,GAAG,GAAlB;AAEA,OAAO,SAASC,oBAAT,CAA8BC,OAA9B,EAA+CC,QAA/C,EAAuF;AAC5F,QAAM;AAACC,IAAAA,CAAD;AAAIC,IAAAA,CAAJ;AAAOC,IAAAA;AAAP,MAAYP,UAAU,CAACG,OAAD,CAA5B;AACA,QAAMK,IAAI,GAAG,KAAKD,CAAlB;AACA,QAAME,KAAK,GAAGD,IAAI,GAAGP,SAArB;AACA,SAAO,CACL,CAACI,CAAC,GAAGI,KAAL,EAAYR,SAAS,GAAGK,CAAC,GAAGG,KAA5B,CADK,EAEL,CAAC,CAACJ,CAAC,GAAGD,QAAL,IAAiBK,KAAlB,EAAyBR,SAAS,GAAG,CAACK,CAAC,GAAGF,QAAL,IAAiBK,KAAtD,CAFK,CAAP;AAID;AAED,OAAO,SAASC,iBAAT,CAA2BP,OAA3B,EAA4CC,QAAQ,GAAG,CAAvD,EAAoE;AACzE,QAAM,CAACO,OAAD,EAAUC,WAAV,IAAyBV,oBAAoB,CAACC,OAAD,EAAUC,QAAV,CAAnD;AACA,QAAM,CAACS,CAAD,EAAIC,CAAJ,IAASf,aAAa,CAACY,OAAD,CAA5B;AACA,QAAM,CAACI,CAAD,EAAIC,CAAJ,IAASjB,aAAa,CAACa,WAAD,CAA5B;AACA,SAAO,CAACG,CAAD,EAAID,CAAJ,EAAOC,CAAP,EAAUC,CAAV,EAAaH,CAAb,EAAgBG,CAAhB,EAAmBH,CAAnB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BD,CAA5B,CAAP;AACD","sourcesContent":["import {worldToLngLat} from '@math.gl/web-mercator';\nimport {cellToTile} from 'quadbin';\n\nconst TILE_SIZE = 512;\n\nexport function quadbinToWorldBounds(quadbin: bigint, coverage: number): [number[], number[]] {\n const {x, y, z} = cellToTile(quadbin);\n const mask = 1 << z;\n const scale = mask / TILE_SIZE;\n return [\n [x / scale, TILE_SIZE - y / scale],\n [(x + coverage) / scale, TILE_SIZE - (y + coverage) / scale]\n ];\n}\n\nexport function getQuadbinPolygon(quadbin: bigint, coverage = 1): number[] {\n const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);\n const [w, n] = worldToLngLat(topLeft);\n const [e, s] = worldToLngLat(bottomRight);\n return [e, n, e, s, w, s, w, n, e, n];\n}\n"],"file":"quadbin-utils.js"}