@deck.gl/carto 8.7.0-beta.1 → 8.7.0-beta.5

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 (48) hide show
  1. package/dist/dist.dev.js +1212 -98
  2. package/dist/es5/api/index.js +6 -0
  3. package/dist/es5/api/index.js.map +1 -1
  4. package/dist/es5/api/layer-map.js +65 -40
  5. package/dist/es5/api/layer-map.js.map +1 -1
  6. package/dist/es5/api/maps-api-common.js +7 -1
  7. package/dist/es5/api/maps-api-common.js.map +1 -1
  8. package/dist/es5/api/maps-v3-client.js +10 -8
  9. package/dist/es5/api/maps-v3-client.js.map +1 -1
  10. package/dist/es5/api/parseMap.js +5 -6
  11. package/dist/es5/api/parseMap.js.map +1 -1
  12. package/dist/es5/index.js +14 -0
  13. package/dist/es5/index.js.map +1 -1
  14. package/dist/es5/layers/carto-dynamic-tile-layer.js +59 -12
  15. package/dist/es5/layers/carto-dynamic-tile-layer.js.map +1 -1
  16. package/dist/es5/layers/carto-layer.js +26 -15
  17. package/dist/es5/layers/carto-layer.js.map +1 -1
  18. package/dist/es5/layers/schema/carto-dynamic-tile.js +197 -0
  19. package/dist/es5/layers/schema/carto-dynamic-tile.js.map +1 -0
  20. package/dist/esm/api/index.js +1 -1
  21. package/dist/esm/api/index.js.map +1 -1
  22. package/dist/esm/api/layer-map.js +54 -31
  23. package/dist/esm/api/layer-map.js.map +1 -1
  24. package/dist/esm/api/maps-api-common.js +5 -0
  25. package/dist/esm/api/maps-api-common.js.map +1 -1
  26. package/dist/esm/api/maps-v3-client.js +6 -2
  27. package/dist/esm/api/maps-v3-client.js.map +1 -1
  28. package/dist/esm/api/parseMap.js +6 -7
  29. package/dist/esm/api/parseMap.js.map +1 -1
  30. package/dist/esm/index.js +2 -1
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/layers/carto-dynamic-tile-layer.js +52 -8
  33. package/dist/esm/layers/carto-dynamic-tile-layer.js.map +1 -1
  34. package/dist/esm/layers/carto-layer.js +24 -12
  35. package/dist/esm/layers/carto-layer.js.map +1 -1
  36. package/dist/esm/layers/schema/carto-dynamic-tile.js +190 -0
  37. package/dist/esm/layers/schema/carto-dynamic-tile.js.map +1 -0
  38. package/dist.min.js +14 -14
  39. package/package.json +5 -4
  40. package/src/api/index.js +1 -1
  41. package/src/api/layer-map.js +50 -25
  42. package/src/api/maps-api-common.js +7 -0
  43. package/src/api/maps-v3-client.js +4 -3
  44. package/src/api/parseMap.js +2 -4
  45. package/src/index.js +2 -0
  46. package/src/layers/carto-dynamic-tile-layer.js +44 -9
  47. package/src/layers/carto-layer.js +29 -18
  48. package/src/layers/schema/carto-dynamic-tile.js +195 -0
package/dist/dist.dev.js CHANGED
@@ -27662,6 +27662,101 @@ var forEach = function () {
27662
27662
  };
27663
27663
  }();
27664
27664
 
27665
+ /***/ }),
27666
+
27667
+ /***/ "../../node_modules/ieee754/index.js":
27668
+ /*!****************************************************************!*\
27669
+ !*** /Users/alasarr/dev/deck.gl/node_modules/ieee754/index.js ***!
27670
+ \****************************************************************/
27671
+ /*! no static exports found */
27672
+ /***/ (function(module, exports) {
27673
+
27674
+ exports.read = function (buffer, offset, isLE, mLen, nBytes) {
27675
+ var e, m
27676
+ var eLen = (nBytes * 8) - mLen - 1
27677
+ var eMax = (1 << eLen) - 1
27678
+ var eBias = eMax >> 1
27679
+ var nBits = -7
27680
+ var i = isLE ? (nBytes - 1) : 0
27681
+ var d = isLE ? -1 : 1
27682
+ var s = buffer[offset + i]
27683
+
27684
+ i += d
27685
+
27686
+ e = s & ((1 << (-nBits)) - 1)
27687
+ s >>= (-nBits)
27688
+ nBits += eLen
27689
+ for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
27690
+
27691
+ m = e & ((1 << (-nBits)) - 1)
27692
+ e >>= (-nBits)
27693
+ nBits += mLen
27694
+ for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
27695
+
27696
+ if (e === 0) {
27697
+ e = 1 - eBias
27698
+ } else if (e === eMax) {
27699
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
27700
+ } else {
27701
+ m = m + Math.pow(2, mLen)
27702
+ e = e - eBias
27703
+ }
27704
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
27705
+ }
27706
+
27707
+ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
27708
+ var e, m, c
27709
+ var eLen = (nBytes * 8) - mLen - 1
27710
+ var eMax = (1 << eLen) - 1
27711
+ var eBias = eMax >> 1
27712
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
27713
+ var i = isLE ? 0 : (nBytes - 1)
27714
+ var d = isLE ? 1 : -1
27715
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
27716
+
27717
+ value = Math.abs(value)
27718
+
27719
+ if (isNaN(value) || value === Infinity) {
27720
+ m = isNaN(value) ? 1 : 0
27721
+ e = eMax
27722
+ } else {
27723
+ e = Math.floor(Math.log(value) / Math.LN2)
27724
+ if (value * (c = Math.pow(2, -e)) < 1) {
27725
+ e--
27726
+ c *= 2
27727
+ }
27728
+ if (e + eBias >= 1) {
27729
+ value += rt / c
27730
+ } else {
27731
+ value += rt * Math.pow(2, 1 - eBias)
27732
+ }
27733
+ if (value * c >= 2) {
27734
+ e++
27735
+ c /= 2
27736
+ }
27737
+
27738
+ if (e + eBias >= eMax) {
27739
+ m = 0
27740
+ e = eMax
27741
+ } else if (e + eBias >= 1) {
27742
+ m = ((value * c) - 1) * Math.pow(2, mLen)
27743
+ e = e + eBias
27744
+ } else {
27745
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
27746
+ e = 0
27747
+ }
27748
+ }
27749
+
27750
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
27751
+
27752
+ e = (e << mLen) | m
27753
+ eLen += mLen
27754
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
27755
+
27756
+ buffer[offset + i - d] |= s * 128
27757
+ }
27758
+
27759
+
27665
27760
  /***/ }),
27666
27761
 
27667
27762
  /***/ "../../node_modules/internmap/src/index.js":
@@ -50078,6 +50173,660 @@ webpackContext.id = "../../node_modules/moment/locale sync recursive ^\\.\\/.*$"
50078
50173
 
50079
50174
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
50080
50175
 
50176
+ /***/ }),
50177
+
50178
+ /***/ "../../node_modules/pbf/index.js":
50179
+ /*!************************************************************!*\
50180
+ !*** /Users/alasarr/dev/deck.gl/node_modules/pbf/index.js ***!
50181
+ \************************************************************/
50182
+ /*! no static exports found */
50183
+ /***/ (function(module, exports, __webpack_require__) {
50184
+
50185
+ "use strict";
50186
+
50187
+
50188
+ module.exports = Pbf;
50189
+
50190
+ var ieee754 = __webpack_require__(/*! ieee754 */ "../../node_modules/ieee754/index.js");
50191
+
50192
+ function Pbf(buf) {
50193
+ this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
50194
+ this.pos = 0;
50195
+ this.type = 0;
50196
+ this.length = this.buf.length;
50197
+ }
50198
+
50199
+ Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
50200
+ Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
50201
+ Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
50202
+ Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
50203
+
50204
+ var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
50205
+ SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
50206
+
50207
+ // Threshold chosen based on both benchmarking and knowledge about browser string
50208
+ // data structures (which currently switch structure types at 12 bytes or more)
50209
+ var TEXT_DECODER_MIN_LENGTH = 12;
50210
+ var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
50211
+
50212
+ Pbf.prototype = {
50213
+
50214
+ destroy: function() {
50215
+ this.buf = null;
50216
+ },
50217
+
50218
+ // === READING =================================================================
50219
+
50220
+ readFields: function(readField, result, end) {
50221
+ end = end || this.length;
50222
+
50223
+ while (this.pos < end) {
50224
+ var val = this.readVarint(),
50225
+ tag = val >> 3,
50226
+ startPos = this.pos;
50227
+
50228
+ this.type = val & 0x7;
50229
+ readField(tag, result, this);
50230
+
50231
+ if (this.pos === startPos) this.skip(val);
50232
+ }
50233
+ return result;
50234
+ },
50235
+
50236
+ readMessage: function(readField, result) {
50237
+ return this.readFields(readField, result, this.readVarint() + this.pos);
50238
+ },
50239
+
50240
+ readFixed32: function() {
50241
+ var val = readUInt32(this.buf, this.pos);
50242
+ this.pos += 4;
50243
+ return val;
50244
+ },
50245
+
50246
+ readSFixed32: function() {
50247
+ var val = readInt32(this.buf, this.pos);
50248
+ this.pos += 4;
50249
+ return val;
50250
+ },
50251
+
50252
+ // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
50253
+
50254
+ readFixed64: function() {
50255
+ var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
50256
+ this.pos += 8;
50257
+ return val;
50258
+ },
50259
+
50260
+ readSFixed64: function() {
50261
+ var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
50262
+ this.pos += 8;
50263
+ return val;
50264
+ },
50265
+
50266
+ readFloat: function() {
50267
+ var val = ieee754.read(this.buf, this.pos, true, 23, 4);
50268
+ this.pos += 4;
50269
+ return val;
50270
+ },
50271
+
50272
+ readDouble: function() {
50273
+ var val = ieee754.read(this.buf, this.pos, true, 52, 8);
50274
+ this.pos += 8;
50275
+ return val;
50276
+ },
50277
+
50278
+ readVarint: function(isSigned) {
50279
+ var buf = this.buf,
50280
+ val, b;
50281
+
50282
+ b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;
50283
+ b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;
50284
+ b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
50285
+ b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
50286
+ b = buf[this.pos]; val |= (b & 0x0f) << 28;
50287
+
50288
+ return readVarintRemainder(val, isSigned, this);
50289
+ },
50290
+
50291
+ readVarint64: function() { // for compatibility with v2.0.1
50292
+ return this.readVarint(true);
50293
+ },
50294
+
50295
+ readSVarint: function() {
50296
+ var num = this.readVarint();
50297
+ return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
50298
+ },
50299
+
50300
+ readBoolean: function() {
50301
+ return Boolean(this.readVarint());
50302
+ },
50303
+
50304
+ readString: function() {
50305
+ var end = this.readVarint() + this.pos;
50306
+ var pos = this.pos;
50307
+ this.pos = end;
50308
+
50309
+ if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
50310
+ // longer strings are fast with the built-in browser TextDecoder API
50311
+ return readUtf8TextDecoder(this.buf, pos, end);
50312
+ }
50313
+ // short strings are fast with our custom implementation
50314
+ return readUtf8(this.buf, pos, end);
50315
+ },
50316
+
50317
+ readBytes: function() {
50318
+ var end = this.readVarint() + this.pos,
50319
+ buffer = this.buf.subarray(this.pos, end);
50320
+ this.pos = end;
50321
+ return buffer;
50322
+ },
50323
+
50324
+ // verbose for performance reasons; doesn't affect gzipped size
50325
+
50326
+ readPackedVarint: function(arr, isSigned) {
50327
+ if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
50328
+ var end = readPackedEnd(this);
50329
+ arr = arr || [];
50330
+ while (this.pos < end) arr.push(this.readVarint(isSigned));
50331
+ return arr;
50332
+ },
50333
+ readPackedSVarint: function(arr) {
50334
+ if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
50335
+ var end = readPackedEnd(this);
50336
+ arr = arr || [];
50337
+ while (this.pos < end) arr.push(this.readSVarint());
50338
+ return arr;
50339
+ },
50340
+ readPackedBoolean: function(arr) {
50341
+ if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
50342
+ var end = readPackedEnd(this);
50343
+ arr = arr || [];
50344
+ while (this.pos < end) arr.push(this.readBoolean());
50345
+ return arr;
50346
+ },
50347
+ readPackedFloat: function(arr) {
50348
+ if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
50349
+ var end = readPackedEnd(this);
50350
+ arr = arr || [];
50351
+ while (this.pos < end) arr.push(this.readFloat());
50352
+ return arr;
50353
+ },
50354
+ readPackedDouble: function(arr) {
50355
+ if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
50356
+ var end = readPackedEnd(this);
50357
+ arr = arr || [];
50358
+ while (this.pos < end) arr.push(this.readDouble());
50359
+ return arr;
50360
+ },
50361
+ readPackedFixed32: function(arr) {
50362
+ if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
50363
+ var end = readPackedEnd(this);
50364
+ arr = arr || [];
50365
+ while (this.pos < end) arr.push(this.readFixed32());
50366
+ return arr;
50367
+ },
50368
+ readPackedSFixed32: function(arr) {
50369
+ if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
50370
+ var end = readPackedEnd(this);
50371
+ arr = arr || [];
50372
+ while (this.pos < end) arr.push(this.readSFixed32());
50373
+ return arr;
50374
+ },
50375
+ readPackedFixed64: function(arr) {
50376
+ if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
50377
+ var end = readPackedEnd(this);
50378
+ arr = arr || [];
50379
+ while (this.pos < end) arr.push(this.readFixed64());
50380
+ return arr;
50381
+ },
50382
+ readPackedSFixed64: function(arr) {
50383
+ if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
50384
+ var end = readPackedEnd(this);
50385
+ arr = arr || [];
50386
+ while (this.pos < end) arr.push(this.readSFixed64());
50387
+ return arr;
50388
+ },
50389
+
50390
+ skip: function(val) {
50391
+ var type = val & 0x7;
50392
+ if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
50393
+ else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
50394
+ else if (type === Pbf.Fixed32) this.pos += 4;
50395
+ else if (type === Pbf.Fixed64) this.pos += 8;
50396
+ else throw new Error('Unimplemented type: ' + type);
50397
+ },
50398
+
50399
+ // === WRITING =================================================================
50400
+
50401
+ writeTag: function(tag, type) {
50402
+ this.writeVarint((tag << 3) | type);
50403
+ },
50404
+
50405
+ realloc: function(min) {
50406
+ var length = this.length || 16;
50407
+
50408
+ while (length < this.pos + min) length *= 2;
50409
+
50410
+ if (length !== this.length) {
50411
+ var buf = new Uint8Array(length);
50412
+ buf.set(this.buf);
50413
+ this.buf = buf;
50414
+ this.length = length;
50415
+ }
50416
+ },
50417
+
50418
+ finish: function() {
50419
+ this.length = this.pos;
50420
+ this.pos = 0;
50421
+ return this.buf.subarray(0, this.length);
50422
+ },
50423
+
50424
+ writeFixed32: function(val) {
50425
+ this.realloc(4);
50426
+ writeInt32(this.buf, val, this.pos);
50427
+ this.pos += 4;
50428
+ },
50429
+
50430
+ writeSFixed32: function(val) {
50431
+ this.realloc(4);
50432
+ writeInt32(this.buf, val, this.pos);
50433
+ this.pos += 4;
50434
+ },
50435
+
50436
+ writeFixed64: function(val) {
50437
+ this.realloc(8);
50438
+ writeInt32(this.buf, val & -1, this.pos);
50439
+ writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
50440
+ this.pos += 8;
50441
+ },
50442
+
50443
+ writeSFixed64: function(val) {
50444
+ this.realloc(8);
50445
+ writeInt32(this.buf, val & -1, this.pos);
50446
+ writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
50447
+ this.pos += 8;
50448
+ },
50449
+
50450
+ writeVarint: function(val) {
50451
+ val = +val || 0;
50452
+
50453
+ if (val > 0xfffffff || val < 0) {
50454
+ writeBigVarint(val, this);
50455
+ return;
50456
+ }
50457
+
50458
+ this.realloc(4);
50459
+
50460
+ this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
50461
+ this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
50462
+ this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
50463
+ this.buf[this.pos++] = (val >>> 7) & 0x7f;
50464
+ },
50465
+
50466
+ writeSVarint: function(val) {
50467
+ this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
50468
+ },
50469
+
50470
+ writeBoolean: function(val) {
50471
+ this.writeVarint(Boolean(val));
50472
+ },
50473
+
50474
+ writeString: function(str) {
50475
+ str = String(str);
50476
+ this.realloc(str.length * 4);
50477
+
50478
+ this.pos++; // reserve 1 byte for short string length
50479
+
50480
+ var startPos = this.pos;
50481
+ // write the string directly to the buffer and see how much was written
50482
+ this.pos = writeUtf8(this.buf, str, this.pos);
50483
+ var len = this.pos - startPos;
50484
+
50485
+ if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
50486
+
50487
+ // finally, write the message length in the reserved place and restore the position
50488
+ this.pos = startPos - 1;
50489
+ this.writeVarint(len);
50490
+ this.pos += len;
50491
+ },
50492
+
50493
+ writeFloat: function(val) {
50494
+ this.realloc(4);
50495
+ ieee754.write(this.buf, val, this.pos, true, 23, 4);
50496
+ this.pos += 4;
50497
+ },
50498
+
50499
+ writeDouble: function(val) {
50500
+ this.realloc(8);
50501
+ ieee754.write(this.buf, val, this.pos, true, 52, 8);
50502
+ this.pos += 8;
50503
+ },
50504
+
50505
+ writeBytes: function(buffer) {
50506
+ var len = buffer.length;
50507
+ this.writeVarint(len);
50508
+ this.realloc(len);
50509
+ for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
50510
+ },
50511
+
50512
+ writeRawMessage: function(fn, obj) {
50513
+ this.pos++; // reserve 1 byte for short message length
50514
+
50515
+ // write the message directly to the buffer and see how much was written
50516
+ var startPos = this.pos;
50517
+ fn(obj, this);
50518
+ var len = this.pos - startPos;
50519
+
50520
+ if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
50521
+
50522
+ // finally, write the message length in the reserved place and restore the position
50523
+ this.pos = startPos - 1;
50524
+ this.writeVarint(len);
50525
+ this.pos += len;
50526
+ },
50527
+
50528
+ writeMessage: function(tag, fn, obj) {
50529
+ this.writeTag(tag, Pbf.Bytes);
50530
+ this.writeRawMessage(fn, obj);
50531
+ },
50532
+
50533
+ writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },
50534
+ writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },
50535
+ writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },
50536
+ writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },
50537
+ writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },
50538
+ writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },
50539
+ writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
50540
+ writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },
50541
+ writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },
50542
+
50543
+ writeBytesField: function(tag, buffer) {
50544
+ this.writeTag(tag, Pbf.Bytes);
50545
+ this.writeBytes(buffer);
50546
+ },
50547
+ writeFixed32Field: function(tag, val) {
50548
+ this.writeTag(tag, Pbf.Fixed32);
50549
+ this.writeFixed32(val);
50550
+ },
50551
+ writeSFixed32Field: function(tag, val) {
50552
+ this.writeTag(tag, Pbf.Fixed32);
50553
+ this.writeSFixed32(val);
50554
+ },
50555
+ writeFixed64Field: function(tag, val) {
50556
+ this.writeTag(tag, Pbf.Fixed64);
50557
+ this.writeFixed64(val);
50558
+ },
50559
+ writeSFixed64Field: function(tag, val) {
50560
+ this.writeTag(tag, Pbf.Fixed64);
50561
+ this.writeSFixed64(val);
50562
+ },
50563
+ writeVarintField: function(tag, val) {
50564
+ this.writeTag(tag, Pbf.Varint);
50565
+ this.writeVarint(val);
50566
+ },
50567
+ writeSVarintField: function(tag, val) {
50568
+ this.writeTag(tag, Pbf.Varint);
50569
+ this.writeSVarint(val);
50570
+ },
50571
+ writeStringField: function(tag, str) {
50572
+ this.writeTag(tag, Pbf.Bytes);
50573
+ this.writeString(str);
50574
+ },
50575
+ writeFloatField: function(tag, val) {
50576
+ this.writeTag(tag, Pbf.Fixed32);
50577
+ this.writeFloat(val);
50578
+ },
50579
+ writeDoubleField: function(tag, val) {
50580
+ this.writeTag(tag, Pbf.Fixed64);
50581
+ this.writeDouble(val);
50582
+ },
50583
+ writeBooleanField: function(tag, val) {
50584
+ this.writeVarintField(tag, Boolean(val));
50585
+ }
50586
+ };
50587
+
50588
+ function readVarintRemainder(l, s, p) {
50589
+ var buf = p.buf,
50590
+ h, b;
50591
+
50592
+ b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);
50593
+ b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);
50594
+ b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
50595
+ b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
50596
+ b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
50597
+ b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);
50598
+
50599
+ throw new Error('Expected varint not more than 10 bytes');
50600
+ }
50601
+
50602
+ function readPackedEnd(pbf) {
50603
+ return pbf.type === Pbf.Bytes ?
50604
+ pbf.readVarint() + pbf.pos : pbf.pos + 1;
50605
+ }
50606
+
50607
+ function toNum(low, high, isSigned) {
50608
+ if (isSigned) {
50609
+ return high * 0x100000000 + (low >>> 0);
50610
+ }
50611
+
50612
+ return ((high >>> 0) * 0x100000000) + (low >>> 0);
50613
+ }
50614
+
50615
+ function writeBigVarint(val, pbf) {
50616
+ var low, high;
50617
+
50618
+ if (val >= 0) {
50619
+ low = (val % 0x100000000) | 0;
50620
+ high = (val / 0x100000000) | 0;
50621
+ } else {
50622
+ low = ~(-val % 0x100000000);
50623
+ high = ~(-val / 0x100000000);
50624
+
50625
+ if (low ^ 0xffffffff) {
50626
+ low = (low + 1) | 0;
50627
+ } else {
50628
+ low = 0;
50629
+ high = (high + 1) | 0;
50630
+ }
50631
+ }
50632
+
50633
+ if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
50634
+ throw new Error('Given varint doesn\'t fit into 10 bytes');
50635
+ }
50636
+
50637
+ pbf.realloc(10);
50638
+
50639
+ writeBigVarintLow(low, high, pbf);
50640
+ writeBigVarintHigh(high, pbf);
50641
+ }
50642
+
50643
+ function writeBigVarintLow(low, high, pbf) {
50644
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
50645
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
50646
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
50647
+ pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
50648
+ pbf.buf[pbf.pos] = low & 0x7f;
50649
+ }
50650
+
50651
+ function writeBigVarintHigh(high, pbf) {
50652
+ var lsb = (high & 0x07) << 4;
50653
+
50654
+ pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
50655
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
50656
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
50657
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
50658
+ pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
50659
+ pbf.buf[pbf.pos++] = high & 0x7f;
50660
+ }
50661
+
50662
+ function makeRoomForExtraLength(startPos, len, pbf) {
50663
+ var extraLen =
50664
+ len <= 0x3fff ? 1 :
50665
+ len <= 0x1fffff ? 2 :
50666
+ len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
50667
+
50668
+ // if 1 byte isn't enough for encoding message length, shift the data to the right
50669
+ pbf.realloc(extraLen);
50670
+ for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
50671
+ }
50672
+
50673
+ function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }
50674
+ function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }
50675
+ function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }
50676
+ function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }
50677
+ function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }
50678
+ function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }
50679
+ function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
50680
+ function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }
50681
+ function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }
50682
+
50683
+ // Buffer code below from https://github.com/feross/buffer, MIT-licensed
50684
+
50685
+ function readUInt32(buf, pos) {
50686
+ return ((buf[pos]) |
50687
+ (buf[pos + 1] << 8) |
50688
+ (buf[pos + 2] << 16)) +
50689
+ (buf[pos + 3] * 0x1000000);
50690
+ }
50691
+
50692
+ function writeInt32(buf, val, pos) {
50693
+ buf[pos] = val;
50694
+ buf[pos + 1] = (val >>> 8);
50695
+ buf[pos + 2] = (val >>> 16);
50696
+ buf[pos + 3] = (val >>> 24);
50697
+ }
50698
+
50699
+ function readInt32(buf, pos) {
50700
+ return ((buf[pos]) |
50701
+ (buf[pos + 1] << 8) |
50702
+ (buf[pos + 2] << 16)) +
50703
+ (buf[pos + 3] << 24);
50704
+ }
50705
+
50706
+ function readUtf8(buf, pos, end) {
50707
+ var str = '';
50708
+ var i = pos;
50709
+
50710
+ while (i < end) {
50711
+ var b0 = buf[i];
50712
+ var c = null; // codepoint
50713
+ var bytesPerSequence =
50714
+ b0 > 0xEF ? 4 :
50715
+ b0 > 0xDF ? 3 :
50716
+ b0 > 0xBF ? 2 : 1;
50717
+
50718
+ if (i + bytesPerSequence > end) break;
50719
+
50720
+ var b1, b2, b3;
50721
+
50722
+ if (bytesPerSequence === 1) {
50723
+ if (b0 < 0x80) {
50724
+ c = b0;
50725
+ }
50726
+ } else if (bytesPerSequence === 2) {
50727
+ b1 = buf[i + 1];
50728
+ if ((b1 & 0xC0) === 0x80) {
50729
+ c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
50730
+ if (c <= 0x7F) {
50731
+ c = null;
50732
+ }
50733
+ }
50734
+ } else if (bytesPerSequence === 3) {
50735
+ b1 = buf[i + 1];
50736
+ b2 = buf[i + 2];
50737
+ if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
50738
+ c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
50739
+ if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
50740
+ c = null;
50741
+ }
50742
+ }
50743
+ } else if (bytesPerSequence === 4) {
50744
+ b1 = buf[i + 1];
50745
+ b2 = buf[i + 2];
50746
+ b3 = buf[i + 3];
50747
+ if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
50748
+ c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
50749
+ if (c <= 0xFFFF || c >= 0x110000) {
50750
+ c = null;
50751
+ }
50752
+ }
50753
+ }
50754
+
50755
+ if (c === null) {
50756
+ c = 0xFFFD;
50757
+ bytesPerSequence = 1;
50758
+
50759
+ } else if (c > 0xFFFF) {
50760
+ c -= 0x10000;
50761
+ str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
50762
+ c = 0xDC00 | c & 0x3FF;
50763
+ }
50764
+
50765
+ str += String.fromCharCode(c);
50766
+ i += bytesPerSequence;
50767
+ }
50768
+
50769
+ return str;
50770
+ }
50771
+
50772
+ function readUtf8TextDecoder(buf, pos, end) {
50773
+ return utf8TextDecoder.decode(buf.subarray(pos, end));
50774
+ }
50775
+
50776
+ function writeUtf8(buf, str, pos) {
50777
+ for (var i = 0, c, lead; i < str.length; i++) {
50778
+ c = str.charCodeAt(i); // code point
50779
+
50780
+ if (c > 0xD7FF && c < 0xE000) {
50781
+ if (lead) {
50782
+ if (c < 0xDC00) {
50783
+ buf[pos++] = 0xEF;
50784
+ buf[pos++] = 0xBF;
50785
+ buf[pos++] = 0xBD;
50786
+ lead = c;
50787
+ continue;
50788
+ } else {
50789
+ c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
50790
+ lead = null;
50791
+ }
50792
+ } else {
50793
+ if (c > 0xDBFF || (i + 1 === str.length)) {
50794
+ buf[pos++] = 0xEF;
50795
+ buf[pos++] = 0xBF;
50796
+ buf[pos++] = 0xBD;
50797
+ } else {
50798
+ lead = c;
50799
+ }
50800
+ continue;
50801
+ }
50802
+ } else if (lead) {
50803
+ buf[pos++] = 0xEF;
50804
+ buf[pos++] = 0xBF;
50805
+ buf[pos++] = 0xBD;
50806
+ lead = null;
50807
+ }
50808
+
50809
+ if (c < 0x80) {
50810
+ buf[pos++] = c;
50811
+ } else {
50812
+ if (c < 0x800) {
50813
+ buf[pos++] = c >> 0x6 | 0xC0;
50814
+ } else {
50815
+ if (c < 0x10000) {
50816
+ buf[pos++] = c >> 0xC | 0xE0;
50817
+ } else {
50818
+ buf[pos++] = c >> 0x12 | 0xF0;
50819
+ buf[pos++] = c >> 0xC & 0x3F | 0x80;
50820
+ }
50821
+ buf[pos++] = c >> 0x6 & 0x3F | 0x80;
50822
+ }
50823
+ buf[pos++] = c & 0x3F | 0x80;
50824
+ }
50825
+ }
50826
+ return pos;
50827
+ }
50828
+
50829
+
50081
50830
  /***/ }),
50082
50831
 
50083
50832
  /***/ "../../node_modules/webpack/buildin/module.js":
@@ -51678,7 +52427,7 @@ __webpack_require__.r(__webpack_exports__);
51678
52427
 
51679
52428
 
51680
52429
  const defaultProps = {
51681
- maskEnabled: true
52430
+ maskId: ''
51682
52431
  };
51683
52432
  class MaskExtension extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["LayerExtension"] {
51684
52433
  getShaders() {
@@ -51697,17 +52446,50 @@ class MaskExtension extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["LayerExt
51697
52446
 
51698
52447
  draw({
51699
52448
  uniforms,
52449
+ context,
51700
52450
  moduleParameters
51701
52451
  }) {
51702
52452
  uniforms.mask_maskByInstance = this.state.maskByInstance;
51703
52453
  const {
51704
- maskBounds
52454
+ maskId
52455
+ } = this.props;
52456
+ const {
52457
+ maskChannels
51705
52458
  } = moduleParameters;
52459
+ const {
52460
+ viewport
52461
+ } = context;
51706
52462
 
51707
- if (maskBounds) {
51708
- const bl = this.projectPosition([maskBounds[0], maskBounds[1], 0]);
51709
- const tr = this.projectPosition([maskBounds[2], maskBounds[3], 0]);
52463
+ if (maskChannels && maskChannels[maskId]) {
52464
+ const {
52465
+ index,
52466
+ bounds,
52467
+ coordinateOrigin: fromCoordinateOrigin
52468
+ } = maskChannels[maskId];
52469
+ let {
52470
+ coordinateSystem: fromCoordinateSystem
52471
+ } = maskChannels[maskId];
52472
+ uniforms.mask_enabled = true;
52473
+ uniforms.mask_channel = index;
52474
+
52475
+ if (fromCoordinateSystem === _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["COORDINATE_SYSTEM"].DEFAULT) {
52476
+ fromCoordinateSystem = viewport.isGeospatial ? _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["COORDINATE_SYSTEM"].LNGLAT : _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["COORDINATE_SYSTEM"].CARTESIAN;
52477
+ }
52478
+
52479
+ const opts = {
52480
+ modelMatrix: null,
52481
+ fromCoordinateOrigin,
52482
+ fromCoordinateSystem
52483
+ };
52484
+ const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);
52485
+ const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);
51710
52486
  uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];
52487
+ } else {
52488
+ if (maskId) {
52489
+ _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["log"].warn(`Could not find a mask layer with id: ${maskId}`)();
52490
+ }
52491
+
52492
+ uniforms.mask_enabled = false;
51711
52493
  }
51712
52494
  }
51713
52495
 
@@ -51738,13 +52520,24 @@ vec2 mask_getCoords(vec4 position) {
51738
52520
  `;
51739
52521
  const fs = `
51740
52522
  uniform sampler2D mask_texture;
52523
+ uniform int mask_channel;
51741
52524
  uniform bool mask_enabled;
51742
52525
  bool mask_isInBounds(vec2 texCoords) {
51743
52526
  if (!mask_enabled) {
51744
52527
  return true;
51745
52528
  }
51746
52529
  vec4 maskColor = texture2D(mask_texture, texCoords);
51747
- return maskColor.a > 0.5;
52530
+ float maskValue = 1.0;
52531
+ if (mask_channel == 0) {
52532
+ maskValue = maskColor.r;
52533
+ } else if (mask_channel == 1) {
52534
+ maskValue = maskColor.g;
52535
+ } else if (mask_channel == 2) {
52536
+ maskValue = maskColor.b;
52537
+ } else if (mask_channel == 3) {
52538
+ maskValue = maskColor.a;
52539
+ }
52540
+ return maskValue < 0.5;
51748
52541
  }
51749
52542
  `;
51750
52543
  const inject = {
@@ -51776,11 +52569,10 @@ varying vec2 mask_texCoords;
51776
52569
  `
51777
52570
  };
51778
52571
 
51779
- const getMaskUniforms = (opts = {}, context = {}) => {
52572
+ const getMaskUniforms = (opts = {}) => {
51780
52573
  const uniforms = {};
51781
52574
 
51782
52575
  if (opts.maskMap) {
51783
- uniforms.mask_enabled = opts.maskEnabled !== false;
51784
52576
  uniforms.mask_texture = opts.maskMap;
51785
52577
  }
51786
52578
 
@@ -52096,7 +52888,7 @@ module.exports = Object.assign(deck, {
52096
52888
  /*!**************************!*\
52097
52889
  !*** ./src/api/index.js ***!
52098
52890
  \**************************/
52099
- /*! exports provided: FORMATS, MAP_TYPES, API_VERSIONS, getDataV2, CONNECTIONS, fetchLayerData, fetchMap, getData, mapInstantiation */
52891
+ /*! exports provided: FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, getDataV2, CONNECTIONS, fetchLayerData, fetchMap, getData, mapInstantiation */
52100
52892
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
52101
52893
 
52102
52894
  "use strict";
@@ -52104,6 +52896,8 @@ __webpack_require__.r(__webpack_exports__);
52104
52896
  /* harmony import */ var _maps_api_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./maps-api-common */ "./src/api/maps-api-common.js");
52105
52897
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["FORMATS"]; });
52106
52898
 
52899
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["TILE_FORMATS"]; });
52900
+
52107
52901
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["MAP_TYPES"]; });
52108
52902
 
52109
52903
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["API_VERSIONS"]; });
@@ -52132,12 +52926,12 @@ __webpack_require__.r(__webpack_exports__);
52132
52926
  /*!******************************!*\
52133
52927
  !*** ./src/api/layer-map.js ***!
52134
52928
  \******************************/
52135
- /*! exports provided: LAYER_MAP, getColorAccessor, getSizeAccessor, getTextAccessor, getTextPixelOffsetAccessor, _domainFromValues */
52929
+ /*! exports provided: getLayer, getColorAccessor, getSizeAccessor, getTextAccessor, getTextPixelOffsetAccessor, _domainFromValues */
52136
52930
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
52137
52931
 
52138
52932
  "use strict";
52139
52933
  __webpack_require__.r(__webpack_exports__);
52140
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LAYER_MAP", function() { return LAYER_MAP; });
52934
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLayer", function() { return getLayer; });
52141
52935
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getColorAccessor", function() { return getColorAccessor; });
52142
52936
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSizeAccessor", function() { return getSizeAccessor; });
52143
52937
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextAccessor", function() { return getTextAccessor; });
@@ -52149,8 +52943,11 @@ __webpack_require__.r(__webpack_exports__);
52149
52943
  /* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! d3-format */ "../../node_modules/d3-format/src/index.js");
52150
52944
  /* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! moment-timezone */ "../../node_modules/moment-timezone/index.js");
52151
52945
  /* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_4__);
52152
- /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @deck.gl/geo-layers */ "@deck.gl/core");
52153
- /* harmony import */ var _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__);
52946
+ /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
52947
+ /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_5__);
52948
+ /* harmony import */ var _deck_gl_carto__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @deck.gl/carto */ "./src/index.js");
52949
+
52950
+
52154
52951
 
52155
52952
 
52156
52953
 
@@ -52208,45 +53005,66 @@ function mergePropMaps(a, b) {
52208
53005
  };
52209
53006
  }
52210
53007
 
52211
- const LAYER_MAP = {
52212
- point: {
52213
- Layer: _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__["GeoJsonLayer"],
52214
- propMap: mergePropMaps(sharedPropMap, {
52215
- visConfig: {
52216
- outline: 'stroked'
53008
+ function getLayer(type, config, dataset) {
53009
+ if (type === 'mvt' || type === 'tileset') {
53010
+ return getTileLayer(dataset);
53011
+ }
53012
+
53013
+ const hexagonId = config.columns?.hex_id;
53014
+ const layer = {
53015
+ point: {
53016
+ Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["GeoJsonLayer"],
53017
+ propMap: mergePropMaps(sharedPropMap, {
53018
+ visConfig: {
53019
+ outline: 'stroked'
53020
+ }
53021
+ }),
53022
+ defaultProps
53023
+ },
53024
+ geojson: {
53025
+ Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["GeoJsonLayer"],
53026
+ propMap: sharedPropMap,
53027
+ defaultProps: { ...defaultProps,
53028
+ lineWidthScale: 2
52217
53029
  }
52218
- }),
52219
- defaultProps
52220
- },
52221
- geojson: {
52222
- Layer: _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__["GeoJsonLayer"],
52223
- propMap: sharedPropMap,
52224
- defaultProps: { ...defaultProps,
52225
- lineWidthScale: 2
52226
- }
52227
- },
52228
- hexagonId: {
52229
- Layer: _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__["H3HexagonLayer"],
52230
- propMap: mergePropMaps(sharedPropMap, {
52231
- visConfig: {
52232
- coverage: 'coverage',
52233
- elevationScale: 'elevationScale'
53030
+ },
53031
+ hexagonId: {
53032
+ Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["H3HexagonLayer"],
53033
+ propMap: mergePropMaps(sharedPropMap, {
53034
+ visConfig: {
53035
+ coverage: 'coverage',
53036
+ elevationScale: 'elevationScale'
53037
+ }
53038
+ }),
53039
+ defaultProps: { ...defaultProps,
53040
+ getHexagon: d => d[hexagonId]
52234
53041
  }
52235
- }),
52236
- defaultProps: { ...defaultProps,
52237
- getHexagon: d => d.h3
52238
53042
  }
52239
- },
52240
- mvt: {
52241
- Layer: _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__["MVTLayer"],
53043
+ }[type];
53044
+ _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["log"].assert(layer, `Unsupported layer type: ${type}`);
53045
+ return layer;
53046
+ }
53047
+
53048
+ function getTileLayer(dataset) {
53049
+ const {
53050
+ data: {
53051
+ tiles: [tileUrl]
53052
+ }
53053
+ } = dataset;
53054
+ /* global URL */
53055
+
53056
+ const formatTiles = new URL(tileUrl).searchParams.get('formatTiles') || _deck_gl_carto__WEBPACK_IMPORTED_MODULE_6__["TILE_FORMATS"].MVT;
53057
+ return {
53058
+ Layer: formatTiles === _deck_gl_carto__WEBPACK_IMPORTED_MODULE_6__["TILE_FORMATS"].MVT ? _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["MVTLayer"] : _deck_gl_carto__WEBPACK_IMPORTED_MODULE_6__["_CartoDynamicTileLayer"],
52242
53059
  propMap: sharedPropMap,
52243
53060
  defaultProps: { ...defaultProps,
52244
53061
  pointRadiusScale: 0.3,
52245
53062
  lineWidthScale: 2,
52246
- uniqueIdProperty: 'geoid'
53063
+ uniqueIdProperty: 'geoid',
53064
+ formatTiles
52247
53065
  }
52248
- }
52249
- };
53066
+ };
53067
+ }
52250
53068
 
52251
53069
  function domainFromAttribute(attribute, scaleType) {
52252
53070
  if (scaleType === 'ordinal' || scaleType === 'point') {
@@ -52388,7 +53206,7 @@ function getTextPixelOffsetAccessor({
52388
53206
  /*!************************************!*\
52389
53207
  !*** ./src/api/maps-api-common.js ***!
52390
53208
  \************************************/
52391
- /*! exports provided: DEFAULT_USER_COMPONENT_IN_URL, DEFAULT_REGION_COMPONENT_IN_URL, API_VERSIONS, DEFAULT_MAPS_URL_FORMAT, MAP_TYPES, FORMATS, encodeParameter */
53209
+ /*! exports provided: DEFAULT_USER_COMPONENT_IN_URL, DEFAULT_REGION_COMPONENT_IN_URL, API_VERSIONS, DEFAULT_MAPS_URL_FORMAT, MAP_TYPES, FORMATS, TILE_FORMATS, encodeParameter */
52392
53210
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
52393
53211
 
52394
53212
  "use strict";
@@ -52399,6 +53217,7 @@ __webpack_require__.r(__webpack_exports__);
52399
53217
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAPS_URL_FORMAT", function() { return DEFAULT_MAPS_URL_FORMAT; });
52400
53218
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return MAP_TYPES; });
52401
53219
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return FORMATS; });
53220
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return TILE_FORMATS; });
52402
53221
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeParameter", function() { return encodeParameter; });
52403
53222
  const DEFAULT_USER_COMPONENT_IN_URL = '{user}';
52404
53223
  const DEFAULT_REGION_COMPONENT_IN_URL = '{region}';
@@ -52422,6 +53241,12 @@ const FORMATS = {
52422
53241
  NDJSON: 'ndjson',
52423
53242
  TILEJSON: 'tilejson',
52424
53243
  JSON: 'json'
53244
+ }; // AVAILABLE FORMATS FOR TILES
53245
+
53246
+ const TILE_FORMATS = {
53247
+ MVT: 'mvt',
53248
+ GEOJSON: 'geojson',
53249
+ BINARY: 'binary'
52425
53250
  };
52426
53251
  /**
52427
53252
  * Simple encode parameter
@@ -52975,7 +53800,7 @@ async function getData({
52975
53800
  });
52976
53801
  return layerData.data;
52977
53802
  }
52978
- /* global clearInterval, setInterval, URLSearchParams */
53803
+ /* global clearInterval, setInterval, URL */
52979
53804
 
52980
53805
  async function _fetchMapDataset(dataset, accessToken, credentials, clientId) {
52981
53806
  // First fetch metadata
@@ -52997,7 +53822,7 @@ async function _fetchMapDataset(dataset, accessToken, credentials, clientId) {
52997
53822
  clientId
52998
53823
  }); // Extract the last time the data changed
52999
53824
 
53000
- const cache = parseInt(new URLSearchParams(url).get('cache'), 10);
53825
+ const cache = parseInt(new URL(url).searchParams.get('cache'), 10);
53001
53826
 
53002
53827
  if (cache && dataset.cache === cache) {
53003
53828
  return false;
@@ -53033,6 +53858,9 @@ async function fetchMap({
53033
53858
  const localCreds = { ...(defaultCredentials.apiVersion === _maps_api_common__WEBPACK_IMPORTED_MODULE_1__["API_VERSIONS"].V3 && defaultCredentials),
53034
53859
  ...credentials
53035
53860
  };
53861
+ const {
53862
+ accessToken
53863
+ } = localCreds;
53036
53864
  _deck_gl_core__WEBPACK_IMPORTED_MODULE_3__["log"].assert(cartoMapId, `Must define CARTO map id: fetchMap({cartoMapId: 'XXXX-XXXX-XXXX'})`);
53037
53865
  _deck_gl_core__WEBPACK_IMPORTED_MODULE_3__["log"].assert(localCreds.apiVersion === _maps_api_common__WEBPACK_IMPORTED_MODULE_1__["API_VERSIONS"].V3, 'Method only available for v3');
53038
53866
  _deck_gl_core__WEBPACK_IMPORTED_MODULE_3__["log"].assert(localCreds.apiBaseUrl, 'Must define apiBaseUrl');
@@ -53049,7 +53877,8 @@ async function fetchMap({
53049
53877
 
53050
53878
  const url = `${localCreds.mapsUrl}/public/${cartoMapId}`;
53051
53879
  const map = await request({
53052
- url
53880
+ url,
53881
+ accessToken
53053
53882
  }); // Periodically check if the data has changed. Note that this
53054
53883
  // will not update when a map is published.
53055
53884
 
@@ -53127,12 +53956,6 @@ function parseMap(json) {
53127
53956
  visualChannels
53128
53957
  }) => {
53129
53958
  try {
53130
- _deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(type in _layer_map__WEBPACK_IMPORTED_MODULE_1__["LAYER_MAP"], `Unsupported layer type: ${type}`);
53131
- const {
53132
- Layer,
53133
- propMap,
53134
- defaultProps
53135
- } = _layer_map__WEBPACK_IMPORTED_MODULE_1__["LAYER_MAP"][type];
53136
53959
  const {
53137
53960
  dataId
53138
53961
  } = config;
@@ -53142,6 +53965,11 @@ function parseMap(json) {
53142
53965
  data
53143
53966
  } = dataset;
53144
53967
  _deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(data, `No data loaded for dataId: ${dataId}`);
53968
+ const {
53969
+ Layer,
53970
+ propMap,
53971
+ defaultProps
53972
+ } = Object(_layer_map__WEBPACK_IMPORTED_MODULE_1__["getLayer"])(type, config, dataset);
53145
53973
  return new Layer({
53146
53974
  id,
53147
53975
  data,
@@ -53399,7 +54227,7 @@ function buildMapsUrlFromBase(apiBaseUrl) {
53399
54227
  /*!**********************!*\
53400
54228
  !*** ./src/index.js ***!
53401
54229
  \**********************/
53402
- /*! exports provided: getDefaultCredentials, setDefaultCredentials, CartoLayer, BASEMAP, colorBins, colorCategories, colorContinuous, FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, _getDataV2, getData, _mapInstantiation */
54230
+ /*! exports provided: getDefaultCredentials, setDefaultCredentials, CartoLayer, _CartoDynamicTileLayer, BASEMAP, colorBins, colorCategories, colorContinuous, FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, _getDataV2, getData, _mapInstantiation */
53403
54231
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
53404
54232
 
53405
54233
  "use strict";
@@ -53412,34 +54240,40 @@ __webpack_require__.r(__webpack_exports__);
53412
54240
  /* harmony import */ var _layers_carto_layer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./layers/carto-layer */ "./src/layers/carto-layer.js");
53413
54241
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CartoLayer", function() { return _layers_carto_layer__WEBPACK_IMPORTED_MODULE_1__["default"]; });
53414
54242
 
53415
- /* harmony import */ var _basemap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./basemap */ "./src/basemap.js");
53416
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BASEMAP", function() { return _basemap__WEBPACK_IMPORTED_MODULE_2__["default"]; });
54243
+ /* harmony import */ var _layers_carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./layers/carto-dynamic-tile-layer */ "./src/layers/carto-dynamic-tile-layer.js");
54244
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_CartoDynamicTileLayer", function() { return _layers_carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_2__["default"]; });
54245
+
54246
+ /* harmony import */ var _basemap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./basemap */ "./src/basemap.js");
54247
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BASEMAP", function() { return _basemap__WEBPACK_IMPORTED_MODULE_3__["default"]; });
54248
+
54249
+ /* harmony import */ var _style_color_bins_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./style/color-bins-style */ "./src/style/color-bins-style.js");
54250
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorBins", function() { return _style_color_bins_style__WEBPACK_IMPORTED_MODULE_4__["default"]; });
54251
+
54252
+ /* harmony import */ var _style_color_categories_style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style/color-categories-style */ "./src/style/color-categories-style.js");
54253
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorCategories", function() { return _style_color_categories_style__WEBPACK_IMPORTED_MODULE_5__["default"]; });
53417
54254
 
53418
- /* harmony import */ var _style_color_bins_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style/color-bins-style */ "./src/style/color-bins-style.js");
53419
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorBins", function() { return _style_color_bins_style__WEBPACK_IMPORTED_MODULE_3__["default"]; });
54255
+ /* harmony import */ var _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style/color-continuous-style */ "./src/style/color-continuous-style.js");
54256
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorContinuous", function() { return _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_6__["default"]; });
53420
54257
 
53421
- /* harmony import */ var _style_color_categories_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./style/color-categories-style */ "./src/style/color-categories-style.js");
53422
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorCategories", function() { return _style_color_categories_style__WEBPACK_IMPORTED_MODULE_4__["default"]; });
54258
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./api */ "./src/api/index.js");
54259
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["FORMATS"]; });
53423
54260
 
53424
- /* harmony import */ var _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style/color-continuous-style */ "./src/style/color-continuous-style.js");
53425
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorContinuous", function() { return _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_5__["default"]; });
54261
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["TILE_FORMATS"]; });
53426
54262
 
53427
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./api */ "./src/api/index.js");
53428
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["FORMATS"]; });
54263
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["MAP_TYPES"]; });
53429
54264
 
53430
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["MAP_TYPES"]; });
54265
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["API_VERSIONS"]; });
53431
54266
 
53432
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["API_VERSIONS"]; });
54267
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchLayerData", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["fetchLayerData"]; });
53433
54268
 
53434
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchLayerData", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["fetchLayerData"]; });
54269
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchMap", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["fetchMap"]; });
53435
54270
 
53436
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchMap", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["fetchMap"]; });
54271
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_getDataV2", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["getDataV2"]; });
53437
54272
 
53438
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_getDataV2", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["getDataV2"]; });
54273
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getData", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["getData"]; });
53439
54274
 
53440
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getData", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["getData"]; });
54275
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_mapInstantiation", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["mapInstantiation"]; });
53441
54276
 
53442
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_mapInstantiation", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["mapInstantiation"]; });
53443
54277
 
53444
54278
 
53445
54279
 
@@ -53461,11 +54295,14 @@ __webpack_require__.r(__webpack_exports__);
53461
54295
  "use strict";
53462
54296
  __webpack_require__.r(__webpack_exports__);
53463
54297
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CartoDynamicTileLayer; });
53464
- /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
53465
- /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
53466
- /* harmony import */ var _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @deck.gl/extensions */ "../extensions/src/index.ts");
53467
- /* harmony import */ var _loaders_gl_gis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @loaders.gl/gis */ "../../node_modules/@loaders.gl/gis/dist/esm/index.js");
53468
- /* harmony import */ var _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../api/maps-api-common */ "./src/api/maps-api-common.js");
54298
+ /* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! pbf */ "../../node_modules/pbf/index.js");
54299
+ /* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(pbf__WEBPACK_IMPORTED_MODULE_0__);
54300
+ /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
54301
+ /* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_1__);
54302
+ /* harmony import */ var _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @deck.gl/extensions */ "../extensions/src/index.ts");
54303
+ /* harmony import */ var _loaders_gl_gis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @loaders.gl/gis */ "../../node_modules/@loaders.gl/gis/dist/esm/index.js");
54304
+ /* harmony import */ var _schema_carto_dynamic_tile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./schema/carto-dynamic-tile */ "./src/layers/schema/carto-dynamic-tile.js");
54305
+ /* harmony import */ var _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../api/maps-api-common */ "./src/api/maps-api-common.js");
53469
54306
  /* global TextDecoder */
53470
54307
 
53471
54308
 
@@ -53474,15 +54311,57 @@ __webpack_require__.r(__webpack_exports__);
53474
54311
 
53475
54312
 
53476
54313
 
54314
+
54315
+
53477
54316
  function parseJSON(arrayBuffer) {
53478
54317
  return JSON.parse(new TextDecoder().decode(arrayBuffer));
53479
54318
  }
53480
54319
 
54320
+ function parsePbf(buffer) {
54321
+ const pbf = new pbf__WEBPACK_IMPORTED_MODULE_0___default.a(buffer);
54322
+ const tile = _schema_carto_dynamic_tile__WEBPACK_IMPORTED_MODULE_4__["Tile"].read(pbf);
54323
+ return tile;
54324
+ }
54325
+
54326
+ function unpackProperties(properties) {
54327
+ if (!properties || !properties.length) {
54328
+ return [];
54329
+ }
54330
+
54331
+ return properties.map(item => {
54332
+ const currentRecord = {};
54333
+ item.data.forEach(({
54334
+ key,
54335
+ value
54336
+ }) => {
54337
+ currentRecord[key] = value;
54338
+ });
54339
+ return currentRecord;
54340
+ });
54341
+ }
54342
+
53481
54343
  function parseCartoDynamicTile(arrayBuffer, options) {
53482
54344
  if (!arrayBuffer) return null;
53483
54345
  const formatTiles = options && options.cartoDynamicTile && options.cartoDynamicTile.formatTiles;
53484
- if (formatTiles === 'geojson') return Object(_loaders_gl_gis__WEBPACK_IMPORTED_MODULE_2__["geojsonToBinary"])(parseJSON(arrayBuffer).features);
53485
- return null;
54346
+ if (formatTiles === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"].GEOJSON) return Object(_loaders_gl_gis__WEBPACK_IMPORTED_MODULE_3__["geojsonToBinary"])(parseJSON(arrayBuffer).features);
54347
+ const tile = parsePbf(arrayBuffer);
54348
+ const {
54349
+ points,
54350
+ lines,
54351
+ polygons
54352
+ } = tile;
54353
+ const data = {
54354
+ points: { ...points,
54355
+ properties: unpackProperties(points.properties)
54356
+ },
54357
+ lines: { ...lines,
54358
+ properties: unpackProperties(lines.properties)
54359
+ },
54360
+ polygons: { ...polygons,
54361
+ properties: unpackProperties(polygons.properties)
54362
+ }
54363
+ };
54364
+ return data;
53486
54365
  }
53487
54366
 
53488
54367
  const CartoDynamicTileLoader = {
@@ -53497,13 +54376,14 @@ const CartoDynamicTileLoader = {
53497
54376
  parseSync: parseCartoDynamicTile,
53498
54377
  options: {
53499
54378
  cartoDynamicTile: {
53500
- formatTiles: 'geojson'
54379
+ // TODO change to BINARY for 8.7 prod release
54380
+ formatTiles: _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"].GEOJSON
53501
54381
  }
53502
54382
  }
53503
54383
  };
53504
- class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"] {
54384
+ class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["MVTLayer"] {
53505
54385
  getTileData(tile) {
53506
- let url = Object(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["_getURLFromTemplate"])(this.state.data, tile);
54386
+ let url = Object(_deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["_getURLFromTemplate"])(this.state.data, tile);
53507
54387
 
53508
54388
  if (!url) {
53509
54389
  return Promise.reject('Invalid URL');
@@ -53522,9 +54402,12 @@ class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["
53522
54402
  };
53523
54403
 
53524
54404
  if (formatTiles) {
53525
- _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["log"].assert(['geojson'].includes(formatTiles), `Invalid value for formatTiles: ${formatTiles}`);
53526
- url += `&${Object(_api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["encodeParameter"])('formatTiles', formatTiles)}`;
53527
- loadOptions.cartoBinaryTile = {
54405
+ _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["log"].assert(Object.values(_api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"]).includes(formatTiles), `Invalid value for formatTiles: ${formatTiles}. Use value from TILE_FORMATS`); // eslint-disable-next-line no-undef
54406
+
54407
+ const newUrl = new URL(url);
54408
+ newUrl.searchParams.set('formatTiles', formatTiles);
54409
+ url = newUrl.toString();
54410
+ loadOptions.cartoDynamicTile = {
53528
54411
  formatTiles
53529
54412
  };
53530
54413
  }
@@ -53551,16 +54434,16 @@ class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["
53551
54434
  north
53552
54435
  }
53553
54436
  } = props.tile;
53554
- props.extensions = [new _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_1__["ClipExtension"]()];
54437
+ props.extensions = [new _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_2__["ClipExtension"](), ...(props.extensions || [])];
53555
54438
  props.clipBounds = [west, south, east, north];
53556
- const subLayer = new _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["GeoJsonLayer"]({ ...props
54439
+ const subLayer = new _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["GeoJsonLayer"]({ ...props
53557
54440
  });
53558
54441
  return subLayer;
53559
54442
  }
53560
54443
 
53561
54444
  }
53562
54445
  CartoDynamicTileLayer.layerName = 'CartoDynamicTileLayer';
53563
- CartoDynamicTileLayer.defaultProps = { ..._deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"].defaultProps,
54446
+ CartoDynamicTileLayer.defaultProps = { ..._deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["MVTLayer"].defaultProps,
53564
54447
  loaders: [CartoDynamicTileLoader]
53565
54448
  };
53566
54449
 
@@ -53618,6 +54501,8 @@ const defaultProps = {
53618
54501
  connection: null,
53619
54502
  // (String, optional): format of data
53620
54503
  format: null,
54504
+ // (String, optional): force format of data for tiles
54505
+ formatTiles: null,
53621
54506
  // (String, optional): clientId identifier used for internal tracing, place here a string to identify the client who is doing the request.
53622
54507
  clientId: null,
53623
54508
  // (String, optional): name of the `geo_column` in the CARTO platform. Use this override the default column ('geom'), from which the geometry information should be fetched.
@@ -53743,31 +54628,44 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
53743
54628
  }
53744
54629
  }
53745
54630
 
53746
- renderLayers() {
54631
+ _getRenderLayer() {
53747
54632
  const {
53748
54633
  data,
53749
54634
  format,
53750
54635
  apiVersion
53751
54636
  } = this.state;
54637
+
54638
+ if (apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V1 || apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V2) {
54639
+ return _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"];
54640
+ }
54641
+
54642
+ if (format === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["FORMATS"].TILEJSON) {
54643
+ /* global URL */
54644
+ const formatTiles = this.props.formatTiles || new URL(data.tiles[0]).searchParams.get('formatTiles') || _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["TILE_FORMATS"].MVT;
54645
+ return formatTiles === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["TILE_FORMATS"].MVT ? _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"] : _carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_1__["default"];
54646
+ } // It's a geojson layer
54647
+
54648
+
54649
+ return _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["GeoJsonLayer"];
54650
+ }
54651
+
54652
+ renderLayers() {
54653
+ const {
54654
+ data
54655
+ } = this.state;
53752
54656
  if (!data) return null;
53753
54657
  const {
53754
- type,
53755
54658
  updateTriggers
53756
54659
  } = this.props;
53757
- let layer;
53758
54660
 
53759
- if (apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V3 && type === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["MAP_TYPES"].TABLE && format === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["FORMATS"].TILEJSON) {
53760
- layer = _carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_1__["default"];
53761
- } else if (apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V1 || apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V2 || format === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["FORMATS"].TILEJSON) {
53762
- layer = _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"];
53763
- } else {
53764
- layer = _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["GeoJsonLayer"];
53765
- }
54661
+ const layer = this._getRenderLayer();
53766
54662
 
53767
54663
  const {
54664
+ formatTiles,
53768
54665
  uniqueIdProperty
53769
54666
  } = defaultProps;
53770
54667
  const props = {
54668
+ formatTiles,
53771
54669
  uniqueIdProperty,
53772
54670
  ...this.props
53773
54671
  };
@@ -53786,6 +54684,222 @@ CartoLayer.defaultProps = defaultProps;
53786
54684
 
53787
54685
  /***/ }),
53788
54686
 
54687
+ /***/ "./src/layers/schema/carto-dynamic-tile.js":
54688
+ /*!*************************************************!*\
54689
+ !*** ./src/layers/schema/carto-dynamic-tile.js ***!
54690
+ \*************************************************/
54691
+ /*! exports provided: Tile */
54692
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
54693
+
54694
+ "use strict";
54695
+ __webpack_require__.r(__webpack_exports__);
54696
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tile", function() { return Tile; });
54697
+ // KeyValueObject ========================================
54698
+ const KeyValueObject = {};
54699
+
54700
+ KeyValueObject.read = function (pbf, end) {
54701
+ return pbf.readFields(KeyValueObject._readField, {
54702
+ key: '',
54703
+ value: ''
54704
+ }, end);
54705
+ };
54706
+
54707
+ KeyValueObject._readField = function (tag, obj, pbf) {
54708
+ if (tag === 1) obj.key = pbf.readString();else if (tag === 2) obj.value = pbf.readString();
54709
+ }; // Properties ========================================
54710
+
54711
+
54712
+ const Properties = {};
54713
+
54714
+ Properties.read = function (pbf, end) {
54715
+ return pbf.readFields(Properties._readField, {
54716
+ data: []
54717
+ }, end);
54718
+ };
54719
+
54720
+ Properties._readField = function (tag, obj, pbf) {
54721
+ if (tag === 1) obj.data.push(KeyValueObject.read(pbf, pbf.readVarint() + pbf.pos));
54722
+ }; // Doubles ========================================
54723
+
54724
+
54725
+ const Doubles = {};
54726
+
54727
+ Doubles.read = function (pbf, end) {
54728
+ // TODO perhaps we can do better and directly map from the source
54729
+ // ArrayBuffer using ArrayBuffer.slice()
54730
+ const {
54731
+ value,
54732
+ size
54733
+ } = pbf.readFields(Doubles._readField, {
54734
+ value: [],
54735
+ size: 0
54736
+ }, end);
54737
+ return {
54738
+ value: new Float32Array(value),
54739
+ size
54740
+ };
54741
+ };
54742
+
54743
+ Doubles._readField = function (tag, obj, pbf) {
54744
+ if (tag === 1) pbf.readPackedDouble(obj.value);else if (tag === 2) obj.size = pbf.readVarint(true);
54745
+ }; // Ints ========================================
54746
+
54747
+
54748
+ const Ints = {};
54749
+
54750
+ Ints.read = function (pbf, end) {
54751
+ const {
54752
+ value,
54753
+ size
54754
+ } = pbf.readFields(Ints._readField, {
54755
+ value: [],
54756
+ size: 0
54757
+ }, end);
54758
+ return {
54759
+ value: new Uint32Array(value),
54760
+ size
54761
+ };
54762
+ };
54763
+
54764
+ Ints._readField = function (tag, obj, pbf) {
54765
+ if (tag === 1) pbf.readPackedVarint(obj.value);else if (tag === 2) obj.size = pbf.readVarint(true);
54766
+ }; // NumericProp ========================================
54767
+
54768
+
54769
+ const NumericProp = {};
54770
+
54771
+ NumericProp.read = function (pbf, end) {
54772
+ return pbf.readFields(NumericProp._readField, {
54773
+ value: []
54774
+ }, end);
54775
+ };
54776
+
54777
+ NumericProp._readField = function (tag, obj, pbf) {
54778
+ if (tag === 1) pbf.readPackedDouble(obj.value);
54779
+ }; // NumericPropKeyValue ========================================
54780
+
54781
+
54782
+ const NumericPropKeyValue = {};
54783
+
54784
+ NumericPropKeyValue.read = function (pbf, end) {
54785
+ return pbf.readFields(NumericPropKeyValue._readField, {
54786
+ key: '',
54787
+ value: null
54788
+ }, end);
54789
+ };
54790
+
54791
+ NumericPropKeyValue._readField = function (tag, obj, pbf) {
54792
+ if (tag === 1) obj.key = pbf.readString();else if (tag === 2) obj.value = NumericProp.read(pbf, pbf.readVarint() + pbf.pos);
54793
+ }; // NumericProp._FieldEntry1 ========================================
54794
+
54795
+
54796
+ NumericProp._FieldEntry1 = {};
54797
+
54798
+ NumericProp._FieldEntry1.read = function (pbf, end) {
54799
+ return pbf.readFields(NumericProp._FieldEntry1._readField, {
54800
+ key: '',
54801
+ value: 0
54802
+ }, end);
54803
+ };
54804
+
54805
+ NumericProp._FieldEntry1._readField = function (tag, obj, pbf) {
54806
+ if (tag === 1) obj.key = pbf.readString();else if (tag === 2) obj.value = pbf.readDouble();
54807
+ }; // StringProp ========================================
54808
+
54809
+
54810
+ const StringProp = {};
54811
+
54812
+ StringProp.read = function (pbf, end) {
54813
+ return pbf.readFields(StringProp._readField, {
54814
+ value: []
54815
+ }, end);
54816
+ };
54817
+
54818
+ StringProp._readField = function (tag, obj, pbf) {
54819
+ if (tag === 1) obj.value.push(pbf.readString());
54820
+ }; // Points ========================================
54821
+
54822
+
54823
+ const Points = {};
54824
+
54825
+ Points.read = function (pbf, end) {
54826
+ return pbf.readFields(Points._readField, {
54827
+ positions: null,
54828
+ globalFeatureIds: null,
54829
+ featureIds: null,
54830
+ properties: [],
54831
+ numericProps: {}
54832
+ }, end);
54833
+ };
54834
+
54835
+ Points._readField = function (tag, obj, pbf) {
54836
+ if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 4) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));else if (tag === 5) {
54837
+ const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
54838
+ obj.numericProps[entry.key] = entry.value;
54839
+ }
54840
+ }; // Lines ========================================
54841
+
54842
+
54843
+ const Lines = {};
54844
+
54845
+ Lines.read = function (pbf, end) {
54846
+ return pbf.readFields(Lines._readField, {
54847
+ positions: null,
54848
+ pathIndices: null,
54849
+ globalFeatureIds: null,
54850
+ featureIds: null,
54851
+ properties: [],
54852
+ numericProps: {}
54853
+ }, end);
54854
+ };
54855
+
54856
+ Lines._readField = function (tag, obj, pbf) {
54857
+ if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.pathIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 4) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 5) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));else if (tag === 6) {
54858
+ const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
54859
+ obj.numericProps[entry.key] = entry.value;
54860
+ }
54861
+ }; // Polygons ========================================
54862
+
54863
+
54864
+ const Polygons = {};
54865
+
54866
+ Polygons.read = function (pbf, end) {
54867
+ return pbf.readFields(Polygons._readField, {
54868
+ positions: null,
54869
+ polygonIndices: null,
54870
+ globalFeatureIds: null,
54871
+ featureIds: null,
54872
+ primitivePolygonIndices: null,
54873
+ triangles: null,
54874
+ properties: [],
54875
+ numericProps: {}
54876
+ }, end);
54877
+ };
54878
+
54879
+ Polygons._readField = function (tag, obj, pbf) {
54880
+ if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.polygonIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 4) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 5) obj.primitivePolygonIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 6) obj.triangles = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 7) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));else if (tag === 8) {
54881
+ const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
54882
+ obj.numericProps[entry.key] = entry.value;
54883
+ }
54884
+ }; // Tile ========================================
54885
+
54886
+
54887
+ const Tile = {};
54888
+
54889
+ Tile.read = function (pbf, end) {
54890
+ return pbf.readFields(Tile._readField, {
54891
+ points: null,
54892
+ lines: null,
54893
+ polygons: null
54894
+ }, end);
54895
+ };
54896
+
54897
+ Tile._readField = function (tag, obj, pbf) {
54898
+ if (tag === 1) obj.points = Points.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.lines = Lines.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.polygons = Polygons.read(pbf, pbf.readVarint() + pbf.pos);
54899
+ };
54900
+
54901
+ /***/ }),
54902
+
53789
54903
  /***/ "./src/style/color-bins-style.js":
53790
54904
  /*!***************************************!*\
53791
54905
  !*** ./src/style/color-bins-style.js ***!