@deck.gl/carto 9.0.23 → 9.0.25
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/api/layer-map.d.ts +4 -6
- package/dist/api/layer-map.d.ts.map +1 -1
- package/dist/api/layer-map.js +16 -17
- package/dist/cartoRasterTile-worker.js +1 -1
- package/dist/cartoSpatialTile-worker.js +1 -1
- package/dist/cartoVectorTile-worker.js +1 -1
- package/dist/dist.dev.js +1631 -1195
- package/dist/index.cjs +798 -512
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/layers/cluster-tile-layer.d.ts +41 -0
- package/dist/layers/cluster-tile-layer.d.ts.map +1 -0
- package/dist/layers/cluster-tile-layer.js +116 -0
- package/dist/layers/cluster-utils.d.ts +30 -0
- package/dist/layers/cluster-utils.d.ts.map +1 -0
- package/dist/layers/cluster-utils.js +122 -0
- package/dist/layers/raster-layer.d.ts +21 -1
- package/dist/layers/raster-layer.d.ts.map +1 -1
- package/dist/layers/raster-layer.js +31 -1
- package/dist/layers/raster-tile-layer.d.ts +2 -2
- package/dist/layers/raster-tile-layer.d.ts.map +1 -1
- package/dist/layers/raster-tile-layer.js +2 -2
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist/layers/spatial-index-tile-layer.d.ts +2 -5
- package/dist/layers/spatial-index-tile-layer.d.ts.map +1 -1
- package/dist/layers/vector-tile-layer.d.ts.map +1 -1
- package/dist/layers/vector-tile-layer.js +10 -2
- package/dist/sources/h3-query-source.d.ts +2 -2
- package/dist/sources/h3-query-source.d.ts.map +1 -1
- package/dist/sources/h3-query-source.js +4 -1
- package/dist/sources/h3-table-source.d.ts +2 -2
- package/dist/sources/h3-table-source.d.ts.map +1 -1
- package/dist/sources/h3-table-source.js +4 -1
- package/dist/sources/quadbin-query-source.d.ts +2 -2
- package/dist/sources/quadbin-query-source.d.ts.map +1 -1
- package/dist/sources/quadbin-query-source.js +4 -1
- package/dist/sources/quadbin-table-source.d.ts +2 -2
- package/dist/sources/quadbin-table-source.d.ts.map +1 -1
- package/dist/sources/quadbin-table-source.js +4 -1
- package/dist/style/color-bins-style.d.ts +1 -2
- package/dist/style/color-bins-style.d.ts.map +1 -1
- package/dist/style/color-categories-style.d.ts +1 -2
- package/dist/style/color-categories-style.d.ts.map +1 -1
- package/dist/style/color-continuous-style.d.ts +1 -2
- package/dist/style/color-continuous-style.d.ts.map +1 -1
- package/dist/style/palette.d.ts +1 -1
- package/dist/style/palette.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -0
- package/dist.min.js +10 -10
- package/package.json +2 -2
- package/src/api/layer-map.ts +30 -29
- package/src/index.ts +3 -0
- package/src/layers/cluster-tile-layer.ts +218 -0
- package/src/layers/cluster-utils.ts +160 -0
- package/src/layers/raster-layer.ts +45 -2
- package/src/layers/raster-tile-layer.ts +3 -3
- package/src/layers/spatial-index-tile-layer.ts +2 -2
- package/src/layers/vector-tile-layer.ts +11 -2
- package/src/sources/h3-query-source.ts +11 -2
- package/src/sources/h3-table-source.ts +11 -2
- package/src/sources/quadbin-query-source.ts +11 -2
- package/src/sources/quadbin-table-source.ts +11 -2
- package/src/style/color-bins-style.ts +2 -2
- package/src/style/color-categories-style.ts +2 -2
- package/src/style/color-continuous-style.ts +2 -2
- package/src/style/palette.ts +1 -2
- package/src/utils.ts +8 -0
package/dist/dist.dev.js
CHANGED
|
@@ -41,9 +41,9 @@ var __exports__ = (() => {
|
|
|
41
41
|
));
|
|
42
42
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
43
43
|
|
|
44
|
-
// external-global-plugin:@deck.gl/
|
|
45
|
-
var
|
|
46
|
-
"external-global-plugin:@deck.gl/
|
|
44
|
+
// external-global-plugin:@deck.gl/layers
|
|
45
|
+
var require_layers = __commonJS({
|
|
46
|
+
"external-global-plugin:@deck.gl/layers"(exports, module) {
|
|
47
47
|
module.exports = globalThis.deck;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
@@ -55,116 +55,442 @@ var __exports__ = (() => {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
// external-global-plugin
|
|
59
|
-
var
|
|
60
|
-
"external-global-plugin
|
|
61
|
-
module.exports = globalThis.
|
|
58
|
+
// external-global-plugin:@loaders.gl/core
|
|
59
|
+
var require_core = __commonJS({
|
|
60
|
+
"external-global-plugin:@loaders.gl/core"(exports, module) {
|
|
61
|
+
module.exports = globalThis.loaders;
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
// external-global-plugin:@
|
|
65
|
+
// external-global-plugin:@deck.gl/core
|
|
66
66
|
var require_core2 = __commonJS({
|
|
67
|
-
"external-global-plugin:@
|
|
68
|
-
module.exports = globalThis.
|
|
67
|
+
"external-global-plugin:@deck.gl/core"(exports, module) {
|
|
68
|
+
module.exports = globalThis.deck;
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
// ../../node_modules/
|
|
73
|
-
var
|
|
74
|
-
"../../node_modules/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
// ../../node_modules/tilebelt/index.js
|
|
73
|
+
var require_tilebelt = __commonJS({
|
|
74
|
+
"../../node_modules/tilebelt/index.js"(exports, module) {
|
|
75
|
+
var d2r = Math.PI / 180;
|
|
76
|
+
var r2d = 180 / Math.PI;
|
|
77
|
+
function tileToBBOX(tile) {
|
|
78
|
+
var e = tile2lon(tile[0] + 1, tile[2]);
|
|
79
|
+
var w = tile2lon(tile[0], tile[2]);
|
|
80
|
+
var s = tile2lat(tile[1] + 1, tile[2]);
|
|
81
|
+
var n = tile2lat(tile[1], tile[2]);
|
|
82
|
+
return [w, s, e, n];
|
|
83
|
+
}
|
|
84
|
+
function tileToGeoJSON(tile) {
|
|
85
|
+
var bbox = tileToBBOX(tile);
|
|
86
|
+
var poly = {
|
|
87
|
+
type: "Polygon",
|
|
88
|
+
coordinates: [
|
|
89
|
+
[
|
|
90
|
+
[bbox[0], bbox[1]],
|
|
91
|
+
[bbox[0], bbox[3]],
|
|
92
|
+
[bbox[2], bbox[3]],
|
|
93
|
+
[bbox[2], bbox[1]],
|
|
94
|
+
[bbox[0], bbox[1]]
|
|
95
|
+
]
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
return poly;
|
|
99
|
+
}
|
|
100
|
+
function tile2lon(x, z) {
|
|
101
|
+
return x / Math.pow(2, z) * 360 - 180;
|
|
102
|
+
}
|
|
103
|
+
function tile2lat(y, z) {
|
|
104
|
+
var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);
|
|
105
|
+
return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
|
|
106
|
+
}
|
|
107
|
+
function pointToTile(lon, lat, z) {
|
|
108
|
+
var tile = pointToTileFraction(lon, lat, z);
|
|
109
|
+
tile[0] = Math.floor(tile[0]);
|
|
110
|
+
tile[1] = Math.floor(tile[1]);
|
|
111
|
+
return tile;
|
|
112
|
+
}
|
|
113
|
+
function getChildren(tile) {
|
|
114
|
+
return [
|
|
115
|
+
[tile[0] * 2, tile[1] * 2, tile[2] + 1],
|
|
116
|
+
[tile[0] * 2 + 1, tile[1] * 2, tile[2] + 1],
|
|
117
|
+
[tile[0] * 2 + 1, tile[1] * 2 + 1, tile[2] + 1],
|
|
118
|
+
[tile[0] * 2, tile[1] * 2 + 1, tile[2] + 1]
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
function getParent(tile) {
|
|
122
|
+
if (tile[0] % 2 === 0 && tile[1] % 2 === 0) {
|
|
123
|
+
return [tile[0] / 2, tile[1] / 2, tile[2] - 1];
|
|
124
|
+
} else if (tile[0] % 2 === 0 && !tile[1] % 2 === 0) {
|
|
125
|
+
return [tile[0] / 2, (tile[1] - 1) / 2, tile[2] - 1];
|
|
126
|
+
} else if (!tile[0] % 2 === 0 && tile[1] % 2 === 0) {
|
|
127
|
+
return [(tile[0] - 1) / 2, tile[1] / 2, tile[2] - 1];
|
|
128
|
+
} else {
|
|
129
|
+
return [(tile[0] - 1) / 2, (tile[1] - 1) / 2, tile[2] - 1];
|
|
89
130
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
131
|
+
}
|
|
132
|
+
function getSiblings(tile) {
|
|
133
|
+
return getChildren(getParent(tile));
|
|
134
|
+
}
|
|
135
|
+
function hasSiblings(tile, tiles2) {
|
|
136
|
+
var siblings = getSiblings(tile);
|
|
137
|
+
for (var i = 0; i < siblings.length; i++) {
|
|
138
|
+
if (!hasTile(tiles2, siblings[i]))
|
|
139
|
+
return false;
|
|
94
140
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
e = e - eBias;
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
function hasTile(tiles2, tile) {
|
|
144
|
+
for (var i = 0; i < tiles2.length; i++) {
|
|
145
|
+
if (tilesEqual(tiles2[i], tile))
|
|
146
|
+
return true;
|
|
102
147
|
}
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
} else {
|
|
119
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
120
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
121
|
-
e--;
|
|
122
|
-
c *= 2;
|
|
123
|
-
}
|
|
124
|
-
if (e + eBias >= 1) {
|
|
125
|
-
value += rt / c;
|
|
126
|
-
} else {
|
|
127
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
128
|
-
}
|
|
129
|
-
if (value * c >= 2) {
|
|
130
|
-
e++;
|
|
131
|
-
c /= 2;
|
|
132
|
-
}
|
|
133
|
-
if (e + eBias >= eMax) {
|
|
134
|
-
m = 0;
|
|
135
|
-
e = eMax;
|
|
136
|
-
} else if (e + eBias >= 1) {
|
|
137
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
138
|
-
e = e + eBias;
|
|
139
|
-
} else {
|
|
140
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
141
|
-
e = 0;
|
|
142
|
-
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
function tilesEqual(tile1, tile2) {
|
|
151
|
+
return tile1[0] === tile2[0] && tile1[1] === tile2[1] && tile1[2] === tile2[2];
|
|
152
|
+
}
|
|
153
|
+
function tileToQuadkey(tile) {
|
|
154
|
+
var index2 = "";
|
|
155
|
+
for (var z = tile[2]; z > 0; z--) {
|
|
156
|
+
var b = 0;
|
|
157
|
+
var mask = 1 << z - 1;
|
|
158
|
+
if ((tile[0] & mask) !== 0)
|
|
159
|
+
b++;
|
|
160
|
+
if ((tile[1] & mask) !== 0)
|
|
161
|
+
b += 2;
|
|
162
|
+
index2 += b.toString();
|
|
143
163
|
}
|
|
144
|
-
|
|
164
|
+
return index2;
|
|
165
|
+
}
|
|
166
|
+
function quadkeyToTile(quadkey) {
|
|
167
|
+
var x = 0;
|
|
168
|
+
var y = 0;
|
|
169
|
+
var z = quadkey.length;
|
|
170
|
+
for (var i = z; i > 0; i--) {
|
|
171
|
+
var mask = 1 << i - 1;
|
|
172
|
+
switch (quadkey[z - i]) {
|
|
173
|
+
case "0":
|
|
174
|
+
break;
|
|
175
|
+
case "1":
|
|
176
|
+
x |= mask;
|
|
177
|
+
break;
|
|
178
|
+
case "2":
|
|
179
|
+
y |= mask;
|
|
180
|
+
break;
|
|
181
|
+
case "3":
|
|
182
|
+
x |= mask;
|
|
183
|
+
y |= mask;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
145
186
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
187
|
+
return [x, y, z];
|
|
188
|
+
}
|
|
189
|
+
function bboxToTile(bboxCoords) {
|
|
190
|
+
var min2 = pointToTile(bboxCoords[0], bboxCoords[1], 32);
|
|
191
|
+
var max2 = pointToTile(bboxCoords[2], bboxCoords[3], 32);
|
|
192
|
+
var bbox = [min2[0], min2[1], max2[0], max2[1]];
|
|
193
|
+
var z = getBboxZoom(bbox);
|
|
194
|
+
if (z === 0)
|
|
195
|
+
return [0, 0, 0];
|
|
196
|
+
var x = bbox[0] >>> 32 - z;
|
|
197
|
+
var y = bbox[1] >>> 32 - z;
|
|
198
|
+
return [x, y, z];
|
|
199
|
+
}
|
|
200
|
+
function getBboxZoom(bbox) {
|
|
201
|
+
var MAX_ZOOM = 28;
|
|
202
|
+
for (var z = 0; z < MAX_ZOOM; z++) {
|
|
203
|
+
var mask = 1 << 32 - (z + 1);
|
|
204
|
+
if ((bbox[0] & mask) != (bbox[2] & mask) || (bbox[1] & mask) != (bbox[3] & mask)) {
|
|
205
|
+
return z;
|
|
206
|
+
}
|
|
149
207
|
}
|
|
150
|
-
|
|
208
|
+
return MAX_ZOOM;
|
|
209
|
+
}
|
|
210
|
+
function pointToTileFraction(lon, lat, z) {
|
|
211
|
+
var sin = Math.sin(lat * d2r), z2 = Math.pow(2, z), x = z2 * (lon / 360 + 0.5), y = z2 * (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);
|
|
212
|
+
return [x, y, z];
|
|
213
|
+
}
|
|
214
|
+
module.exports = {
|
|
215
|
+
tileToGeoJSON,
|
|
216
|
+
tileToBBOX,
|
|
217
|
+
getChildren,
|
|
218
|
+
getParent,
|
|
219
|
+
getSiblings,
|
|
220
|
+
hasTile,
|
|
221
|
+
hasSiblings,
|
|
222
|
+
tilesEqual,
|
|
223
|
+
tileToQuadkey,
|
|
224
|
+
quadkeyToTile,
|
|
225
|
+
pointToTile,
|
|
226
|
+
bboxToTile,
|
|
227
|
+
pointToTileFraction
|
|
151
228
|
};
|
|
152
229
|
}
|
|
153
230
|
});
|
|
154
231
|
|
|
155
|
-
// ../../node_modules/
|
|
156
|
-
var
|
|
157
|
-
"../../node_modules/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
232
|
+
// ../../node_modules/@mapbox/tile-cover/index.js
|
|
233
|
+
var require_tile_cover = __commonJS({
|
|
234
|
+
"../../node_modules/@mapbox/tile-cover/index.js"(exports) {
|
|
235
|
+
var tilebelt = require_tilebelt();
|
|
236
|
+
exports.geojson = function(geom, limits) {
|
|
237
|
+
return {
|
|
238
|
+
type: "FeatureCollection",
|
|
239
|
+
features: getTiles(geom, limits).map(tileToFeature)
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
function tileToFeature(t) {
|
|
243
|
+
return {
|
|
244
|
+
type: "Feature",
|
|
245
|
+
geometry: tilebelt.tileToGeoJSON(t),
|
|
246
|
+
properties: {}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
exports.tiles = getTiles;
|
|
250
|
+
exports.indexes = function(geom, limits) {
|
|
251
|
+
return getTiles(geom, limits).map(tilebelt.tileToQuadkey);
|
|
252
|
+
};
|
|
253
|
+
function getTiles(geom, limits) {
|
|
254
|
+
var i, tile, coords = geom.coordinates, maxZoom = limits.max_zoom, tileHash = {}, tiles2 = [];
|
|
255
|
+
if (geom.type === "Point") {
|
|
256
|
+
return [tilebelt.pointToTile(coords[0], coords[1], maxZoom)];
|
|
257
|
+
} else if (geom.type === "MultiPoint") {
|
|
258
|
+
for (i = 0; i < coords.length; i++) {
|
|
259
|
+
tile = tilebelt.pointToTile(coords[i][0], coords[i][1], maxZoom);
|
|
260
|
+
tileHash[toID(tile[0], tile[1], tile[2])] = true;
|
|
261
|
+
}
|
|
262
|
+
} else if (geom.type === "LineString") {
|
|
263
|
+
lineCover(tileHash, coords, maxZoom);
|
|
264
|
+
} else if (geom.type === "MultiLineString") {
|
|
265
|
+
for (i = 0; i < coords.length; i++) {
|
|
266
|
+
lineCover(tileHash, coords[i], maxZoom);
|
|
267
|
+
}
|
|
268
|
+
} else if (geom.type === "Polygon") {
|
|
269
|
+
polygonCover(tileHash, tiles2, coords, maxZoom);
|
|
270
|
+
} else if (geom.type === "MultiPolygon") {
|
|
271
|
+
for (i = 0; i < coords.length; i++) {
|
|
272
|
+
polygonCover(tileHash, tiles2, coords[i], maxZoom);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
throw new Error("Geometry type not implemented");
|
|
276
|
+
}
|
|
277
|
+
if (limits.min_zoom !== maxZoom) {
|
|
278
|
+
var len = tiles2.length;
|
|
279
|
+
appendHashTiles(tileHash, tiles2);
|
|
280
|
+
for (i = 0; i < len; i++) {
|
|
281
|
+
var t = tiles2[i];
|
|
282
|
+
tileHash[toID(t[0], t[1], t[2])] = true;
|
|
283
|
+
}
|
|
284
|
+
return mergeTiles(tileHash, tiles2, limits);
|
|
285
|
+
}
|
|
286
|
+
appendHashTiles(tileHash, tiles2);
|
|
287
|
+
return tiles2;
|
|
288
|
+
}
|
|
289
|
+
function mergeTiles(tileHash, tiles2, limits) {
|
|
290
|
+
var mergedTiles = [];
|
|
291
|
+
for (var z = limits.max_zoom; z > limits.min_zoom; z--) {
|
|
292
|
+
var parentTileHash = {};
|
|
293
|
+
var parentTiles = [];
|
|
294
|
+
for (var i = 0; i < tiles2.length; i++) {
|
|
295
|
+
var t = tiles2[i];
|
|
296
|
+
if (t[0] % 2 === 0 && t[1] % 2 === 0) {
|
|
297
|
+
var id22 = toID(t[0] + 1, t[1], z), id32 = toID(t[0], t[1] + 1, z), id4 = toID(t[0] + 1, t[1] + 1, z);
|
|
298
|
+
if (tileHash[id22] && tileHash[id32] && tileHash[id4]) {
|
|
299
|
+
tileHash[toID(t[0], t[1], t[2])] = false;
|
|
300
|
+
tileHash[id22] = false;
|
|
301
|
+
tileHash[id32] = false;
|
|
302
|
+
tileHash[id4] = false;
|
|
303
|
+
var parentTile = [t[0] / 2, t[1] / 2, z - 1];
|
|
304
|
+
if (z - 1 === limits.min_zoom)
|
|
305
|
+
mergedTiles.push(parentTile);
|
|
306
|
+
else {
|
|
307
|
+
parentTileHash[toID(t[0] / 2, t[1] / 2, z - 1)] = true;
|
|
308
|
+
parentTiles.push(parentTile);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
for (i = 0; i < tiles2.length; i++) {
|
|
314
|
+
t = tiles2[i];
|
|
315
|
+
if (tileHash[toID(t[0], t[1], t[2])])
|
|
316
|
+
mergedTiles.push(t);
|
|
317
|
+
}
|
|
318
|
+
tileHash = parentTileHash;
|
|
319
|
+
tiles2 = parentTiles;
|
|
320
|
+
}
|
|
321
|
+
return mergedTiles;
|
|
322
|
+
}
|
|
323
|
+
function polygonCover(tileHash, tileArray, geom, zoom) {
|
|
324
|
+
var intersections = [];
|
|
325
|
+
for (var i = 0; i < geom.length; i++) {
|
|
326
|
+
var ring = [];
|
|
327
|
+
lineCover(tileHash, geom[i], zoom, ring);
|
|
328
|
+
for (var j = 0, len = ring.length, k = len - 1; j < len; k = j++) {
|
|
329
|
+
var m = (j + 1) % len;
|
|
330
|
+
var y = ring[j][1];
|
|
331
|
+
if ((y > ring[k][1] || y > ring[m][1]) && (y < ring[k][1] || y < ring[m][1]) && y !== ring[m][1])
|
|
332
|
+
intersections.push(ring[j]);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
intersections.sort(compareTiles);
|
|
336
|
+
for (i = 0; i < intersections.length; i += 2) {
|
|
337
|
+
y = intersections[i][1];
|
|
338
|
+
for (var x = intersections[i][0] + 1; x < intersections[i + 1][0]; x++) {
|
|
339
|
+
var id4 = toID(x, y, zoom);
|
|
340
|
+
if (!tileHash[id4]) {
|
|
341
|
+
tileArray.push([x, y, zoom]);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function compareTiles(a, b) {
|
|
347
|
+
return a[1] - b[1] || a[0] - b[0];
|
|
348
|
+
}
|
|
349
|
+
function lineCover(tileHash, coords, maxZoom, ring) {
|
|
350
|
+
var prevX, prevY;
|
|
351
|
+
for (var i = 0; i < coords.length - 1; i++) {
|
|
352
|
+
var start = tilebelt.pointToTileFraction(coords[i][0], coords[i][1], maxZoom), stop = tilebelt.pointToTileFraction(coords[i + 1][0], coords[i + 1][1], maxZoom), x0 = start[0], y0 = start[1], x1 = stop[0], y1 = stop[1], dx = x1 - x0, dy = y1 - y0;
|
|
353
|
+
if (dy === 0 && dx === 0)
|
|
354
|
+
continue;
|
|
355
|
+
var sx = dx > 0 ? 1 : -1, sy = dy > 0 ? 1 : -1, x = Math.floor(x0), y = Math.floor(y0), tMaxX = dx === 0 ? Infinity : Math.abs(((dx > 0 ? 1 : 0) + x - x0) / dx), tMaxY = dy === 0 ? Infinity : Math.abs(((dy > 0 ? 1 : 0) + y - y0) / dy), tdx = Math.abs(sx / dx), tdy = Math.abs(sy / dy);
|
|
356
|
+
if (x !== prevX || y !== prevY) {
|
|
357
|
+
tileHash[toID(x, y, maxZoom)] = true;
|
|
358
|
+
if (ring && y !== prevY)
|
|
359
|
+
ring.push([x, y]);
|
|
360
|
+
prevX = x;
|
|
361
|
+
prevY = y;
|
|
362
|
+
}
|
|
363
|
+
while (tMaxX < 1 || tMaxY < 1) {
|
|
364
|
+
if (tMaxX < tMaxY) {
|
|
365
|
+
tMaxX += tdx;
|
|
366
|
+
x += sx;
|
|
367
|
+
} else {
|
|
368
|
+
tMaxY += tdy;
|
|
369
|
+
y += sy;
|
|
370
|
+
}
|
|
371
|
+
tileHash[toID(x, y, maxZoom)] = true;
|
|
372
|
+
if (ring && y !== prevY)
|
|
373
|
+
ring.push([x, y]);
|
|
374
|
+
prevX = x;
|
|
375
|
+
prevY = y;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (ring && y === ring[0][1])
|
|
379
|
+
ring.pop();
|
|
380
|
+
}
|
|
381
|
+
function appendHashTiles(hash, tiles2) {
|
|
382
|
+
var keys = Object.keys(hash);
|
|
383
|
+
for (var i = 0; i < keys.length; i++) {
|
|
384
|
+
tiles2.push(fromID(+keys[i]));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function toID(x, y, z) {
|
|
388
|
+
var dim = 2 * (1 << z);
|
|
389
|
+
return (dim * y + x) * 32 + z;
|
|
390
|
+
}
|
|
391
|
+
function fromID(id4) {
|
|
392
|
+
var z = id4 % 32, dim = 2 * (1 << z), xy = (id4 - z) / 32, x = xy % dim, y = (xy - x) / dim % dim;
|
|
393
|
+
return [x, y, z];
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// ../../node_modules/ieee754/index.js
|
|
399
|
+
var require_ieee754 = __commonJS({
|
|
400
|
+
"../../node_modules/ieee754/index.js"(exports) {
|
|
401
|
+
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
402
|
+
var e, m;
|
|
403
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
404
|
+
var eMax = (1 << eLen) - 1;
|
|
405
|
+
var eBias = eMax >> 1;
|
|
406
|
+
var nBits = -7;
|
|
407
|
+
var i = isLE ? nBytes - 1 : 0;
|
|
408
|
+
var d = isLE ? -1 : 1;
|
|
409
|
+
var s = buffer[offset + i];
|
|
410
|
+
i += d;
|
|
411
|
+
e = s & (1 << -nBits) - 1;
|
|
412
|
+
s >>= -nBits;
|
|
413
|
+
nBits += eLen;
|
|
414
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
415
|
+
}
|
|
416
|
+
m = e & (1 << -nBits) - 1;
|
|
417
|
+
e >>= -nBits;
|
|
418
|
+
nBits += mLen;
|
|
419
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
420
|
+
}
|
|
421
|
+
if (e === 0) {
|
|
422
|
+
e = 1 - eBias;
|
|
423
|
+
} else if (e === eMax) {
|
|
424
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
425
|
+
} else {
|
|
426
|
+
m = m + Math.pow(2, mLen);
|
|
427
|
+
e = e - eBias;
|
|
428
|
+
}
|
|
429
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
430
|
+
};
|
|
431
|
+
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
432
|
+
var e, m, c;
|
|
433
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
434
|
+
var eMax = (1 << eLen) - 1;
|
|
435
|
+
var eBias = eMax >> 1;
|
|
436
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
437
|
+
var i = isLE ? 0 : nBytes - 1;
|
|
438
|
+
var d = isLE ? 1 : -1;
|
|
439
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
440
|
+
value = Math.abs(value);
|
|
441
|
+
if (isNaN(value) || value === Infinity) {
|
|
442
|
+
m = isNaN(value) ? 1 : 0;
|
|
443
|
+
e = eMax;
|
|
444
|
+
} else {
|
|
445
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
446
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
447
|
+
e--;
|
|
448
|
+
c *= 2;
|
|
449
|
+
}
|
|
450
|
+
if (e + eBias >= 1) {
|
|
451
|
+
value += rt / c;
|
|
452
|
+
} else {
|
|
453
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
454
|
+
}
|
|
455
|
+
if (value * c >= 2) {
|
|
456
|
+
e++;
|
|
457
|
+
c /= 2;
|
|
458
|
+
}
|
|
459
|
+
if (e + eBias >= eMax) {
|
|
460
|
+
m = 0;
|
|
461
|
+
e = eMax;
|
|
462
|
+
} else if (e + eBias >= 1) {
|
|
463
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
464
|
+
e = e + eBias;
|
|
465
|
+
} else {
|
|
466
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
467
|
+
e = 0;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
471
|
+
}
|
|
472
|
+
e = e << mLen | m;
|
|
473
|
+
eLen += mLen;
|
|
474
|
+
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
475
|
+
}
|
|
476
|
+
buffer[offset + i - d] |= s * 128;
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
// ../../node_modules/pbf/index.js
|
|
482
|
+
var require_pbf = __commonJS({
|
|
483
|
+
"../../node_modules/pbf/index.js"(exports, module) {
|
|
484
|
+
"use strict";
|
|
485
|
+
module.exports = Pbf;
|
|
486
|
+
var ieee754 = require_ieee754();
|
|
487
|
+
function Pbf(buf) {
|
|
488
|
+
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
|
|
489
|
+
this.pos = 0;
|
|
490
|
+
this.type = 0;
|
|
491
|
+
this.length = this.buf.length;
|
|
492
|
+
}
|
|
493
|
+
Pbf.Varint = 0;
|
|
168
494
|
Pbf.Fixed64 = 1;
|
|
169
495
|
Pbf.Bytes = 2;
|
|
170
496
|
Pbf.Fixed32 = 5;
|
|
@@ -592,549 +918,223 @@ var __exports__ = (() => {
|
|
|
592
918
|
var low, high;
|
|
593
919
|
if (val >= 0) {
|
|
594
920
|
low = val % 4294967296 | 0;
|
|
595
|
-
high = val / 4294967296 | 0;
|
|
596
|
-
} else {
|
|
597
|
-
low = ~(-val % 4294967296);
|
|
598
|
-
high = ~(-val / 4294967296);
|
|
599
|
-
if (low ^ 4294967295) {
|
|
600
|
-
low = low + 1 | 0;
|
|
601
|
-
} else {
|
|
602
|
-
low = 0;
|
|
603
|
-
high = high + 1 | 0;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
|
|
607
|
-
throw new Error("Given varint doesn't fit into 10 bytes");
|
|
608
|
-
}
|
|
609
|
-
pbf.realloc(10);
|
|
610
|
-
writeBigVarintLow(low, high, pbf);
|
|
611
|
-
writeBigVarintHigh(high, pbf);
|
|
612
|
-
}
|
|
613
|
-
function writeBigVarintLow(low, high, pbf) {
|
|
614
|
-
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
615
|
-
low >>>= 7;
|
|
616
|
-
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
617
|
-
low >>>= 7;
|
|
618
|
-
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
619
|
-
low >>>= 7;
|
|
620
|
-
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
621
|
-
low >>>= 7;
|
|
622
|
-
pbf.buf[pbf.pos] = low & 127;
|
|
623
|
-
}
|
|
624
|
-
function writeBigVarintHigh(high, pbf) {
|
|
625
|
-
var lsb = (high & 7) << 4;
|
|
626
|
-
pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
|
|
627
|
-
if (!high)
|
|
628
|
-
return;
|
|
629
|
-
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
630
|
-
if (!high)
|
|
631
|
-
return;
|
|
632
|
-
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
633
|
-
if (!high)
|
|
634
|
-
return;
|
|
635
|
-
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
636
|
-
if (!high)
|
|
637
|
-
return;
|
|
638
|
-
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
639
|
-
if (!high)
|
|
640
|
-
return;
|
|
641
|
-
pbf.buf[pbf.pos++] = high & 127;
|
|
642
|
-
}
|
|
643
|
-
function makeRoomForExtraLength(startPos, len, pbf) {
|
|
644
|
-
var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
|
|
645
|
-
pbf.realloc(extraLen);
|
|
646
|
-
for (var i = pbf.pos - 1; i >= startPos; i--)
|
|
647
|
-
pbf.buf[i + extraLen] = pbf.buf[i];
|
|
648
|
-
}
|
|
649
|
-
function writePackedVarint(arr, pbf) {
|
|
650
|
-
for (var i = 0; i < arr.length; i++)
|
|
651
|
-
pbf.writeVarint(arr[i]);
|
|
652
|
-
}
|
|
653
|
-
function writePackedSVarint(arr, pbf) {
|
|
654
|
-
for (var i = 0; i < arr.length; i++)
|
|
655
|
-
pbf.writeSVarint(arr[i]);
|
|
656
|
-
}
|
|
657
|
-
function writePackedFloat(arr, pbf) {
|
|
658
|
-
for (var i = 0; i < arr.length; i++)
|
|
659
|
-
pbf.writeFloat(arr[i]);
|
|
660
|
-
}
|
|
661
|
-
function writePackedDouble(arr, pbf) {
|
|
662
|
-
for (var i = 0; i < arr.length; i++)
|
|
663
|
-
pbf.writeDouble(arr[i]);
|
|
664
|
-
}
|
|
665
|
-
function writePackedBoolean(arr, pbf) {
|
|
666
|
-
for (var i = 0; i < arr.length; i++)
|
|
667
|
-
pbf.writeBoolean(arr[i]);
|
|
668
|
-
}
|
|
669
|
-
function writePackedFixed32(arr, pbf) {
|
|
670
|
-
for (var i = 0; i < arr.length; i++)
|
|
671
|
-
pbf.writeFixed32(arr[i]);
|
|
672
|
-
}
|
|
673
|
-
function writePackedSFixed32(arr, pbf) {
|
|
674
|
-
for (var i = 0; i < arr.length; i++)
|
|
675
|
-
pbf.writeSFixed32(arr[i]);
|
|
676
|
-
}
|
|
677
|
-
function writePackedFixed64(arr, pbf) {
|
|
678
|
-
for (var i = 0; i < arr.length; i++)
|
|
679
|
-
pbf.writeFixed64(arr[i]);
|
|
680
|
-
}
|
|
681
|
-
function writePackedSFixed64(arr, pbf) {
|
|
682
|
-
for (var i = 0; i < arr.length; i++)
|
|
683
|
-
pbf.writeSFixed64(arr[i]);
|
|
684
|
-
}
|
|
685
|
-
function readUInt32(buf, pos) {
|
|
686
|
-
return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
|
|
687
|
-
}
|
|
688
|
-
function writeInt32(buf, val, pos) {
|
|
689
|
-
buf[pos] = val;
|
|
690
|
-
buf[pos + 1] = val >>> 8;
|
|
691
|
-
buf[pos + 2] = val >>> 16;
|
|
692
|
-
buf[pos + 3] = val >>> 24;
|
|
693
|
-
}
|
|
694
|
-
function readInt32(buf, pos) {
|
|
695
|
-
return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
|
|
696
|
-
}
|
|
697
|
-
function readUtf8(buf, pos, end) {
|
|
698
|
-
var str = "";
|
|
699
|
-
var i = pos;
|
|
700
|
-
while (i < end) {
|
|
701
|
-
var b0 = buf[i];
|
|
702
|
-
var c = null;
|
|
703
|
-
var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
|
|
704
|
-
if (i + bytesPerSequence > end)
|
|
705
|
-
break;
|
|
706
|
-
var b1, b2, b3;
|
|
707
|
-
if (bytesPerSequence === 1) {
|
|
708
|
-
if (b0 < 128) {
|
|
709
|
-
c = b0;
|
|
710
|
-
}
|
|
711
|
-
} else if (bytesPerSequence === 2) {
|
|
712
|
-
b1 = buf[i + 1];
|
|
713
|
-
if ((b1 & 192) === 128) {
|
|
714
|
-
c = (b0 & 31) << 6 | b1 & 63;
|
|
715
|
-
if (c <= 127) {
|
|
716
|
-
c = null;
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
} else if (bytesPerSequence === 3) {
|
|
720
|
-
b1 = buf[i + 1];
|
|
721
|
-
b2 = buf[i + 2];
|
|
722
|
-
if ((b1 & 192) === 128 && (b2 & 192) === 128) {
|
|
723
|
-
c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
|
|
724
|
-
if (c <= 2047 || c >= 55296 && c <= 57343) {
|
|
725
|
-
c = null;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
} else if (bytesPerSequence === 4) {
|
|
729
|
-
b1 = buf[i + 1];
|
|
730
|
-
b2 = buf[i + 2];
|
|
731
|
-
b3 = buf[i + 3];
|
|
732
|
-
if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
|
|
733
|
-
c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
|
|
734
|
-
if (c <= 65535 || c >= 1114112) {
|
|
735
|
-
c = null;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
if (c === null) {
|
|
740
|
-
c = 65533;
|
|
741
|
-
bytesPerSequence = 1;
|
|
742
|
-
} else if (c > 65535) {
|
|
743
|
-
c -= 65536;
|
|
744
|
-
str += String.fromCharCode(c >>> 10 & 1023 | 55296);
|
|
745
|
-
c = 56320 | c & 1023;
|
|
746
|
-
}
|
|
747
|
-
str += String.fromCharCode(c);
|
|
748
|
-
i += bytesPerSequence;
|
|
749
|
-
}
|
|
750
|
-
return str;
|
|
751
|
-
}
|
|
752
|
-
function readUtf8TextDecoder(buf, pos, end) {
|
|
753
|
-
return utf8TextDecoder.decode(buf.subarray(pos, end));
|
|
754
|
-
}
|
|
755
|
-
function writeUtf8(buf, str, pos) {
|
|
756
|
-
for (var i = 0, c, lead; i < str.length; i++) {
|
|
757
|
-
c = str.charCodeAt(i);
|
|
758
|
-
if (c > 55295 && c < 57344) {
|
|
759
|
-
if (lead) {
|
|
760
|
-
if (c < 56320) {
|
|
761
|
-
buf[pos++] = 239;
|
|
762
|
-
buf[pos++] = 191;
|
|
763
|
-
buf[pos++] = 189;
|
|
764
|
-
lead = c;
|
|
765
|
-
continue;
|
|
766
|
-
} else {
|
|
767
|
-
c = lead - 55296 << 10 | c - 56320 | 65536;
|
|
768
|
-
lead = null;
|
|
769
|
-
}
|
|
770
|
-
} else {
|
|
771
|
-
if (c > 56319 || i + 1 === str.length) {
|
|
772
|
-
buf[pos++] = 239;
|
|
773
|
-
buf[pos++] = 191;
|
|
774
|
-
buf[pos++] = 189;
|
|
775
|
-
} else {
|
|
776
|
-
lead = c;
|
|
777
|
-
}
|
|
778
|
-
continue;
|
|
779
|
-
}
|
|
780
|
-
} else if (lead) {
|
|
781
|
-
buf[pos++] = 239;
|
|
782
|
-
buf[pos++] = 191;
|
|
783
|
-
buf[pos++] = 189;
|
|
784
|
-
lead = null;
|
|
785
|
-
}
|
|
786
|
-
if (c < 128) {
|
|
787
|
-
buf[pos++] = c;
|
|
788
|
-
} else {
|
|
789
|
-
if (c < 2048) {
|
|
790
|
-
buf[pos++] = c >> 6 | 192;
|
|
791
|
-
} else {
|
|
792
|
-
if (c < 65536) {
|
|
793
|
-
buf[pos++] = c >> 12 | 224;
|
|
794
|
-
} else {
|
|
795
|
-
buf[pos++] = c >> 18 | 240;
|
|
796
|
-
buf[pos++] = c >> 12 & 63 | 128;
|
|
797
|
-
}
|
|
798
|
-
buf[pos++] = c >> 6 & 63 | 128;
|
|
799
|
-
}
|
|
800
|
-
buf[pos++] = c & 63 | 128;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
return pos;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
|
|
808
|
-
// ../../node_modules/tilebelt/index.js
|
|
809
|
-
var require_tilebelt = __commonJS({
|
|
810
|
-
"../../node_modules/tilebelt/index.js"(exports, module) {
|
|
811
|
-
var d2r = Math.PI / 180;
|
|
812
|
-
var r2d = 180 / Math.PI;
|
|
813
|
-
function tileToBBOX(tile) {
|
|
814
|
-
var e = tile2lon(tile[0] + 1, tile[2]);
|
|
815
|
-
var w = tile2lon(tile[0], tile[2]);
|
|
816
|
-
var s = tile2lat(tile[1] + 1, tile[2]);
|
|
817
|
-
var n = tile2lat(tile[1], tile[2]);
|
|
818
|
-
return [w, s, e, n];
|
|
819
|
-
}
|
|
820
|
-
function tileToGeoJSON(tile) {
|
|
821
|
-
var bbox = tileToBBOX(tile);
|
|
822
|
-
var poly = {
|
|
823
|
-
type: "Polygon",
|
|
824
|
-
coordinates: [
|
|
825
|
-
[
|
|
826
|
-
[bbox[0], bbox[1]],
|
|
827
|
-
[bbox[0], bbox[3]],
|
|
828
|
-
[bbox[2], bbox[3]],
|
|
829
|
-
[bbox[2], bbox[1]],
|
|
830
|
-
[bbox[0], bbox[1]]
|
|
831
|
-
]
|
|
832
|
-
]
|
|
833
|
-
};
|
|
834
|
-
return poly;
|
|
835
|
-
}
|
|
836
|
-
function tile2lon(x, z) {
|
|
837
|
-
return x / Math.pow(2, z) * 360 - 180;
|
|
921
|
+
high = val / 4294967296 | 0;
|
|
922
|
+
} else {
|
|
923
|
+
low = ~(-val % 4294967296);
|
|
924
|
+
high = ~(-val / 4294967296);
|
|
925
|
+
if (low ^ 4294967295) {
|
|
926
|
+
low = low + 1 | 0;
|
|
927
|
+
} else {
|
|
928
|
+
low = 0;
|
|
929
|
+
high = high + 1 | 0;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
|
|
933
|
+
throw new Error("Given varint doesn't fit into 10 bytes");
|
|
934
|
+
}
|
|
935
|
+
pbf.realloc(10);
|
|
936
|
+
writeBigVarintLow(low, high, pbf);
|
|
937
|
+
writeBigVarintHigh(high, pbf);
|
|
838
938
|
}
|
|
839
|
-
function
|
|
840
|
-
|
|
841
|
-
|
|
939
|
+
function writeBigVarintLow(low, high, pbf) {
|
|
940
|
+
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
941
|
+
low >>>= 7;
|
|
942
|
+
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
943
|
+
low >>>= 7;
|
|
944
|
+
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
945
|
+
low >>>= 7;
|
|
946
|
+
pbf.buf[pbf.pos++] = low & 127 | 128;
|
|
947
|
+
low >>>= 7;
|
|
948
|
+
pbf.buf[pbf.pos] = low & 127;
|
|
842
949
|
}
|
|
843
|
-
function
|
|
844
|
-
var
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
950
|
+
function writeBigVarintHigh(high, pbf) {
|
|
951
|
+
var lsb = (high & 7) << 4;
|
|
952
|
+
pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
|
|
953
|
+
if (!high)
|
|
954
|
+
return;
|
|
955
|
+
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
956
|
+
if (!high)
|
|
957
|
+
return;
|
|
958
|
+
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
959
|
+
if (!high)
|
|
960
|
+
return;
|
|
961
|
+
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
962
|
+
if (!high)
|
|
963
|
+
return;
|
|
964
|
+
pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
|
|
965
|
+
if (!high)
|
|
966
|
+
return;
|
|
967
|
+
pbf.buf[pbf.pos++] = high & 127;
|
|
848
968
|
}
|
|
849
|
-
function
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
[
|
|
854
|
-
[tile[0] * 2, tile[1] * 2 + 1, tile[2] + 1]
|
|
855
|
-
];
|
|
969
|
+
function makeRoomForExtraLength(startPos, len, pbf) {
|
|
970
|
+
var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
|
|
971
|
+
pbf.realloc(extraLen);
|
|
972
|
+
for (var i = pbf.pos - 1; i >= startPos; i--)
|
|
973
|
+
pbf.buf[i + extraLen] = pbf.buf[i];
|
|
856
974
|
}
|
|
857
|
-
function
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
} else if (tile[0] % 2 === 0 && !tile[1] % 2 === 0) {
|
|
861
|
-
return [tile[0] / 2, (tile[1] - 1) / 2, tile[2] - 1];
|
|
862
|
-
} else if (!tile[0] % 2 === 0 && tile[1] % 2 === 0) {
|
|
863
|
-
return [(tile[0] - 1) / 2, tile[1] / 2, tile[2] - 1];
|
|
864
|
-
} else {
|
|
865
|
-
return [(tile[0] - 1) / 2, (tile[1] - 1) / 2, tile[2] - 1];
|
|
866
|
-
}
|
|
975
|
+
function writePackedVarint(arr, pbf) {
|
|
976
|
+
for (var i = 0; i < arr.length; i++)
|
|
977
|
+
pbf.writeVarint(arr[i]);
|
|
867
978
|
}
|
|
868
|
-
function
|
|
869
|
-
|
|
979
|
+
function writePackedSVarint(arr, pbf) {
|
|
980
|
+
for (var i = 0; i < arr.length; i++)
|
|
981
|
+
pbf.writeSVarint(arr[i]);
|
|
870
982
|
}
|
|
871
|
-
function
|
|
872
|
-
var
|
|
873
|
-
|
|
874
|
-
if (!hasTile(tiles2, siblings[i]))
|
|
875
|
-
return false;
|
|
876
|
-
}
|
|
877
|
-
return true;
|
|
983
|
+
function writePackedFloat(arr, pbf) {
|
|
984
|
+
for (var i = 0; i < arr.length; i++)
|
|
985
|
+
pbf.writeFloat(arr[i]);
|
|
878
986
|
}
|
|
879
|
-
function
|
|
880
|
-
for (var i = 0; i <
|
|
881
|
-
|
|
882
|
-
return true;
|
|
883
|
-
}
|
|
884
|
-
return false;
|
|
987
|
+
function writePackedDouble(arr, pbf) {
|
|
988
|
+
for (var i = 0; i < arr.length; i++)
|
|
989
|
+
pbf.writeDouble(arr[i]);
|
|
885
990
|
}
|
|
886
|
-
function
|
|
887
|
-
|
|
991
|
+
function writePackedBoolean(arr, pbf) {
|
|
992
|
+
for (var i = 0; i < arr.length; i++)
|
|
993
|
+
pbf.writeBoolean(arr[i]);
|
|
888
994
|
}
|
|
889
|
-
function
|
|
890
|
-
var
|
|
891
|
-
|
|
892
|
-
var b = 0;
|
|
893
|
-
var mask = 1 << z - 1;
|
|
894
|
-
if ((tile[0] & mask) !== 0)
|
|
895
|
-
b++;
|
|
896
|
-
if ((tile[1] & mask) !== 0)
|
|
897
|
-
b += 2;
|
|
898
|
-
index2 += b.toString();
|
|
899
|
-
}
|
|
900
|
-
return index2;
|
|
995
|
+
function writePackedFixed32(arr, pbf) {
|
|
996
|
+
for (var i = 0; i < arr.length; i++)
|
|
997
|
+
pbf.writeFixed32(arr[i]);
|
|
901
998
|
}
|
|
902
|
-
function
|
|
903
|
-
var
|
|
904
|
-
|
|
905
|
-
var z = quadkey.length;
|
|
906
|
-
for (var i = z; i > 0; i--) {
|
|
907
|
-
var mask = 1 << i - 1;
|
|
908
|
-
switch (quadkey[z - i]) {
|
|
909
|
-
case "0":
|
|
910
|
-
break;
|
|
911
|
-
case "1":
|
|
912
|
-
x |= mask;
|
|
913
|
-
break;
|
|
914
|
-
case "2":
|
|
915
|
-
y |= mask;
|
|
916
|
-
break;
|
|
917
|
-
case "3":
|
|
918
|
-
x |= mask;
|
|
919
|
-
y |= mask;
|
|
920
|
-
break;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
return [x, y, z];
|
|
999
|
+
function writePackedSFixed32(arr, pbf) {
|
|
1000
|
+
for (var i = 0; i < arr.length; i++)
|
|
1001
|
+
pbf.writeSFixed32(arr[i]);
|
|
924
1002
|
}
|
|
925
|
-
function
|
|
926
|
-
var
|
|
927
|
-
|
|
928
|
-
var bbox = [min2[0], min2[1], max2[0], max2[1]];
|
|
929
|
-
var z = getBboxZoom(bbox);
|
|
930
|
-
if (z === 0)
|
|
931
|
-
return [0, 0, 0];
|
|
932
|
-
var x = bbox[0] >>> 32 - z;
|
|
933
|
-
var y = bbox[1] >>> 32 - z;
|
|
934
|
-
return [x, y, z];
|
|
1003
|
+
function writePackedFixed64(arr, pbf) {
|
|
1004
|
+
for (var i = 0; i < arr.length; i++)
|
|
1005
|
+
pbf.writeFixed64(arr[i]);
|
|
935
1006
|
}
|
|
936
|
-
function
|
|
937
|
-
var
|
|
938
|
-
|
|
939
|
-
var mask = 1 << 32 - (z + 1);
|
|
940
|
-
if ((bbox[0] & mask) != (bbox[2] & mask) || (bbox[1] & mask) != (bbox[3] & mask)) {
|
|
941
|
-
return z;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
return MAX_ZOOM;
|
|
1007
|
+
function writePackedSFixed64(arr, pbf) {
|
|
1008
|
+
for (var i = 0; i < arr.length; i++)
|
|
1009
|
+
pbf.writeSFixed64(arr[i]);
|
|
945
1010
|
}
|
|
946
|
-
function
|
|
947
|
-
|
|
948
|
-
return [x, y, z];
|
|
1011
|
+
function readUInt32(buf, pos) {
|
|
1012
|
+
return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
|
|
949
1013
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
getSiblings,
|
|
956
|
-
hasTile,
|
|
957
|
-
hasSiblings,
|
|
958
|
-
tilesEqual,
|
|
959
|
-
tileToQuadkey,
|
|
960
|
-
quadkeyToTile,
|
|
961
|
-
pointToTile,
|
|
962
|
-
bboxToTile,
|
|
963
|
-
pointToTileFraction
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
|
|
968
|
-
// ../../node_modules/@mapbox/tile-cover/index.js
|
|
969
|
-
var require_tile_cover = __commonJS({
|
|
970
|
-
"../../node_modules/@mapbox/tile-cover/index.js"(exports) {
|
|
971
|
-
var tilebelt = require_tilebelt();
|
|
972
|
-
exports.geojson = function(geom, limits) {
|
|
973
|
-
return {
|
|
974
|
-
type: "FeatureCollection",
|
|
975
|
-
features: getTiles(geom, limits).map(tileToFeature)
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
function tileToFeature(t) {
|
|
979
|
-
return {
|
|
980
|
-
type: "Feature",
|
|
981
|
-
geometry: tilebelt.tileToGeoJSON(t),
|
|
982
|
-
properties: {}
|
|
983
|
-
};
|
|
1014
|
+
function writeInt32(buf, val, pos) {
|
|
1015
|
+
buf[pos] = val;
|
|
1016
|
+
buf[pos + 1] = val >>> 8;
|
|
1017
|
+
buf[pos + 2] = val >>> 16;
|
|
1018
|
+
buf[pos + 3] = val >>> 24;
|
|
984
1019
|
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
return getTiles(geom, limits).map(tilebelt.tileToQuadkey);
|
|
988
|
-
};
|
|
989
|
-
function getTiles(geom, limits) {
|
|
990
|
-
var i, tile, coords = geom.coordinates, maxZoom = limits.max_zoom, tileHash = {}, tiles2 = [];
|
|
991
|
-
if (geom.type === "Point") {
|
|
992
|
-
return [tilebelt.pointToTile(coords[0], coords[1], maxZoom)];
|
|
993
|
-
} else if (geom.type === "MultiPoint") {
|
|
994
|
-
for (i = 0; i < coords.length; i++) {
|
|
995
|
-
tile = tilebelt.pointToTile(coords[i][0], coords[i][1], maxZoom);
|
|
996
|
-
tileHash[toID(tile[0], tile[1], tile[2])] = true;
|
|
997
|
-
}
|
|
998
|
-
} else if (geom.type === "LineString") {
|
|
999
|
-
lineCover(tileHash, coords, maxZoom);
|
|
1000
|
-
} else if (geom.type === "MultiLineString") {
|
|
1001
|
-
for (i = 0; i < coords.length; i++) {
|
|
1002
|
-
lineCover(tileHash, coords[i], maxZoom);
|
|
1003
|
-
}
|
|
1004
|
-
} else if (geom.type === "Polygon") {
|
|
1005
|
-
polygonCover(tileHash, tiles2, coords, maxZoom);
|
|
1006
|
-
} else if (geom.type === "MultiPolygon") {
|
|
1007
|
-
for (i = 0; i < coords.length; i++) {
|
|
1008
|
-
polygonCover(tileHash, tiles2, coords[i], maxZoom);
|
|
1009
|
-
}
|
|
1010
|
-
} else {
|
|
1011
|
-
throw new Error("Geometry type not implemented");
|
|
1012
|
-
}
|
|
1013
|
-
if (limits.min_zoom !== maxZoom) {
|
|
1014
|
-
var len = tiles2.length;
|
|
1015
|
-
appendHashTiles(tileHash, tiles2);
|
|
1016
|
-
for (i = 0; i < len; i++) {
|
|
1017
|
-
var t = tiles2[i];
|
|
1018
|
-
tileHash[toID(t[0], t[1], t[2])] = true;
|
|
1019
|
-
}
|
|
1020
|
-
return mergeTiles(tileHash, tiles2, limits);
|
|
1021
|
-
}
|
|
1022
|
-
appendHashTiles(tileHash, tiles2);
|
|
1023
|
-
return tiles2;
|
|
1020
|
+
function readInt32(buf, pos) {
|
|
1021
|
+
return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
|
|
1024
1022
|
}
|
|
1025
|
-
function
|
|
1026
|
-
var
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
var
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
}
|
|
1023
|
+
function readUtf8(buf, pos, end) {
|
|
1024
|
+
var str = "";
|
|
1025
|
+
var i = pos;
|
|
1026
|
+
while (i < end) {
|
|
1027
|
+
var b0 = buf[i];
|
|
1028
|
+
var c = null;
|
|
1029
|
+
var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
|
|
1030
|
+
if (i + bytesPerSequence > end)
|
|
1031
|
+
break;
|
|
1032
|
+
var b1, b2, b3;
|
|
1033
|
+
if (bytesPerSequence === 1) {
|
|
1034
|
+
if (b0 < 128) {
|
|
1035
|
+
c = b0;
|
|
1036
|
+
}
|
|
1037
|
+
} else if (bytesPerSequence === 2) {
|
|
1038
|
+
b1 = buf[i + 1];
|
|
1039
|
+
if ((b1 & 192) === 128) {
|
|
1040
|
+
c = (b0 & 31) << 6 | b1 & 63;
|
|
1041
|
+
if (c <= 127) {
|
|
1042
|
+
c = null;
|
|
1046
1043
|
}
|
|
1047
1044
|
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
if (
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1057
|
-
return mergedTiles;
|
|
1058
|
-
}
|
|
1059
|
-
function polygonCover(tileHash, tileArray, geom, zoom) {
|
|
1060
|
-
var intersections = [];
|
|
1061
|
-
for (var i = 0; i < geom.length; i++) {
|
|
1062
|
-
var ring = [];
|
|
1063
|
-
lineCover(tileHash, geom[i], zoom, ring);
|
|
1064
|
-
for (var j = 0, len = ring.length, k = len - 1; j < len; k = j++) {
|
|
1065
|
-
var m = (j + 1) % len;
|
|
1066
|
-
var y = ring[j][1];
|
|
1067
|
-
if ((y > ring[k][1] || y > ring[m][1]) && (y < ring[k][1] || y < ring[m][1]) && y !== ring[m][1])
|
|
1068
|
-
intersections.push(ring[j]);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
intersections.sort(compareTiles);
|
|
1072
|
-
for (i = 0; i < intersections.length; i += 2) {
|
|
1073
|
-
y = intersections[i][1];
|
|
1074
|
-
for (var x = intersections[i][0] + 1; x < intersections[i + 1][0]; x++) {
|
|
1075
|
-
var id4 = toID(x, y, zoom);
|
|
1076
|
-
if (!tileHash[id4]) {
|
|
1077
|
-
tileArray.push([x, y, zoom]);
|
|
1045
|
+
} else if (bytesPerSequence === 3) {
|
|
1046
|
+
b1 = buf[i + 1];
|
|
1047
|
+
b2 = buf[i + 2];
|
|
1048
|
+
if ((b1 & 192) === 128 && (b2 & 192) === 128) {
|
|
1049
|
+
c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
|
|
1050
|
+
if (c <= 2047 || c >= 55296 && c <= 57343) {
|
|
1051
|
+
c = null;
|
|
1052
|
+
}
|
|
1078
1053
|
}
|
|
1054
|
+
} else if (bytesPerSequence === 4) {
|
|
1055
|
+
b1 = buf[i + 1];
|
|
1056
|
+
b2 = buf[i + 2];
|
|
1057
|
+
b3 = buf[i + 3];
|
|
1058
|
+
if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
|
|
1059
|
+
c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
|
|
1060
|
+
if (c <= 65535 || c >= 1114112) {
|
|
1061
|
+
c = null;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (c === null) {
|
|
1066
|
+
c = 65533;
|
|
1067
|
+
bytesPerSequence = 1;
|
|
1068
|
+
} else if (c > 65535) {
|
|
1069
|
+
c -= 65536;
|
|
1070
|
+
str += String.fromCharCode(c >>> 10 & 1023 | 55296);
|
|
1071
|
+
c = 56320 | c & 1023;
|
|
1079
1072
|
}
|
|
1073
|
+
str += String.fromCharCode(c);
|
|
1074
|
+
i += bytesPerSequence;
|
|
1080
1075
|
}
|
|
1076
|
+
return str;
|
|
1081
1077
|
}
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1078
|
+
function readUtf8TextDecoder(buf, pos, end) {
|
|
1079
|
+
return utf8TextDecoder.decode(buf.subarray(pos, end));
|
|
1084
1080
|
}
|
|
1085
|
-
function
|
|
1086
|
-
var
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1081
|
+
function writeUtf8(buf, str, pos) {
|
|
1082
|
+
for (var i = 0, c, lead; i < str.length; i++) {
|
|
1083
|
+
c = str.charCodeAt(i);
|
|
1084
|
+
if (c > 55295 && c < 57344) {
|
|
1085
|
+
if (lead) {
|
|
1086
|
+
if (c < 56320) {
|
|
1087
|
+
buf[pos++] = 239;
|
|
1088
|
+
buf[pos++] = 191;
|
|
1089
|
+
buf[pos++] = 189;
|
|
1090
|
+
lead = c;
|
|
1091
|
+
continue;
|
|
1092
|
+
} else {
|
|
1093
|
+
c = lead - 55296 << 10 | c - 56320 | 65536;
|
|
1094
|
+
lead = null;
|
|
1095
|
+
}
|
|
1096
|
+
} else {
|
|
1097
|
+
if (c > 56319 || i + 1 === str.length) {
|
|
1098
|
+
buf[pos++] = 239;
|
|
1099
|
+
buf[pos++] = 191;
|
|
1100
|
+
buf[pos++] = 189;
|
|
1101
|
+
} else {
|
|
1102
|
+
lead = c;
|
|
1103
|
+
}
|
|
1104
|
+
continue;
|
|
1105
|
+
}
|
|
1106
|
+
} else if (lead) {
|
|
1107
|
+
buf[pos++] = 239;
|
|
1108
|
+
buf[pos++] = 191;
|
|
1109
|
+
buf[pos++] = 189;
|
|
1110
|
+
lead = null;
|
|
1098
1111
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1112
|
+
if (c < 128) {
|
|
1113
|
+
buf[pos++] = c;
|
|
1114
|
+
} else {
|
|
1115
|
+
if (c < 2048) {
|
|
1116
|
+
buf[pos++] = c >> 6 | 192;
|
|
1103
1117
|
} else {
|
|
1104
|
-
|
|
1105
|
-
|
|
1118
|
+
if (c < 65536) {
|
|
1119
|
+
buf[pos++] = c >> 12 | 224;
|
|
1120
|
+
} else {
|
|
1121
|
+
buf[pos++] = c >> 18 | 240;
|
|
1122
|
+
buf[pos++] = c >> 12 & 63 | 128;
|
|
1123
|
+
}
|
|
1124
|
+
buf[pos++] = c >> 6 & 63 | 128;
|
|
1106
1125
|
}
|
|
1107
|
-
|
|
1108
|
-
if (ring && y !== prevY)
|
|
1109
|
-
ring.push([x, y]);
|
|
1110
|
-
prevX = x;
|
|
1111
|
-
prevY = y;
|
|
1126
|
+
buf[pos++] = c & 63 | 128;
|
|
1112
1127
|
}
|
|
1113
1128
|
}
|
|
1114
|
-
|
|
1115
|
-
ring.pop();
|
|
1116
|
-
}
|
|
1117
|
-
function appendHashTiles(hash, tiles2) {
|
|
1118
|
-
var keys = Object.keys(hash);
|
|
1119
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1120
|
-
tiles2.push(fromID(+keys[i]));
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
function toID(x, y, z) {
|
|
1124
|
-
var dim = 2 * (1 << z);
|
|
1125
|
-
return (dim * y + x) * 32 + z;
|
|
1126
|
-
}
|
|
1127
|
-
function fromID(id4) {
|
|
1128
|
-
var z = id4 % 32, dim = 2 * (1 << z), xy = (id4 - z) / 32, x = xy % dim, y = (xy - x) / dim % dim;
|
|
1129
|
-
return [x, y, z];
|
|
1129
|
+
return pos;
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
});
|
|
1133
1133
|
|
|
1134
|
-
// external-global-plugin
|
|
1135
|
-
var
|
|
1136
|
-
"external-global-plugin
|
|
1137
|
-
module.exports = globalThis.
|
|
1134
|
+
// external-global-plugin:h3-js
|
|
1135
|
+
var require_h3_js = __commonJS({
|
|
1136
|
+
"external-global-plugin:h3-js"(exports, module) {
|
|
1137
|
+
module.exports = globalThis.h3 || {};
|
|
1138
1138
|
}
|
|
1139
1139
|
});
|
|
1140
1140
|
|
|
@@ -6992,6 +6992,7 @@ var __exports__ = (() => {
|
|
|
6992
6992
|
CARTO_LAYERS: () => CARTO_LAYERS,
|
|
6993
6993
|
CARTO_SOURCES: () => CARTO_SOURCES,
|
|
6994
6994
|
CartoAPIError: () => CartoAPIError,
|
|
6995
|
+
ClusterTileLayer: () => ClusterTileLayer,
|
|
6995
6996
|
H3TileLayer: () => H3TileLayer,
|
|
6996
6997
|
HeatmapTileLayer: () => heatmap_tile_layer_default,
|
|
6997
6998
|
QuadbinTileLayer: () => QuadbinTileLayer,
|
|
@@ -7024,252 +7025,420 @@ var __exports__ = (() => {
|
|
|
7024
7025
|
vectorTilesetSource: () => vectorTilesetSource
|
|
7025
7026
|
});
|
|
7026
7027
|
|
|
7027
|
-
// src/layers/
|
|
7028
|
-
var
|
|
7029
|
-
var
|
|
7028
|
+
// src/layers/cluster-tile-layer.ts
|
|
7029
|
+
var import_layers = __toESM(require_layers(), 1);
|
|
7030
|
+
var import_geo_layers2 = __toESM(require_geo_layers(), 1);
|
|
7031
|
+
var import_core4 = __toESM(require_core(), 1);
|
|
7030
7032
|
|
|
7031
|
-
//
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
if (longitudeSpan > 180) {
|
|
7058
|
-
const nSegments = Math.ceil(longitudeSpan / 180);
|
|
7059
|
-
let h3Indices = [];
|
|
7060
|
-
for (let s = 0; s < nSegments; s++) {
|
|
7061
|
-
const segmentWest = west + s * 180;
|
|
7062
|
-
const segmentEast = Math.min(segmentWest + 179.9999999, east);
|
|
7063
|
-
h3Indices = h3Indices.concat(
|
|
7064
|
-
getHexagonsInBoundingBox({ west: segmentWest, north, east: segmentEast, south }, resolution)
|
|
7065
|
-
);
|
|
7033
|
+
// ../../node_modules/@loaders.gl/gis/dist/lib/binary-features/binary-to-geojson.js
|
|
7034
|
+
function binaryToGeojson(data, options) {
|
|
7035
|
+
const globalFeatureId = options?.globalFeatureId;
|
|
7036
|
+
if (globalFeatureId !== void 0) {
|
|
7037
|
+
return getSingleFeature(data, globalFeatureId);
|
|
7038
|
+
}
|
|
7039
|
+
return parseFeatures(data, options?.type);
|
|
7040
|
+
}
|
|
7041
|
+
function getSingleFeature(data, globalFeatureId) {
|
|
7042
|
+
const dataArray = normalizeInput(data);
|
|
7043
|
+
for (const data2 of dataArray) {
|
|
7044
|
+
let lastIndex = 0;
|
|
7045
|
+
let lastValue = data2.featureIds.value[0];
|
|
7046
|
+
for (let i = 0; i < data2.featureIds.value.length; i++) {
|
|
7047
|
+
const currValue = data2.featureIds.value[i];
|
|
7048
|
+
if (currValue === lastValue) {
|
|
7049
|
+
continue;
|
|
7050
|
+
}
|
|
7051
|
+
if (globalFeatureId === data2.globalFeatureIds.value[lastIndex]) {
|
|
7052
|
+
return parseFeature(data2, lastIndex, i);
|
|
7053
|
+
}
|
|
7054
|
+
lastIndex = i;
|
|
7055
|
+
lastValue = currValue;
|
|
7056
|
+
}
|
|
7057
|
+
if (globalFeatureId === data2.globalFeatureIds.value[lastIndex]) {
|
|
7058
|
+
return parseFeature(data2, lastIndex, data2.featureIds.value.length);
|
|
7066
7059
|
}
|
|
7067
|
-
return [...new Set(h3Indices)];
|
|
7068
7060
|
}
|
|
7069
|
-
|
|
7070
|
-
[north, east],
|
|
7071
|
-
[south, east],
|
|
7072
|
-
[south, west],
|
|
7073
|
-
[north, west],
|
|
7074
|
-
[north, east]
|
|
7075
|
-
];
|
|
7076
|
-
return (0, import_h3_js.polygonToCells)(polygon, resolution);
|
|
7061
|
+
throw new Error(`featureId:${globalFeatureId} not found`);
|
|
7077
7062
|
}
|
|
7078
|
-
function
|
|
7079
|
-
const
|
|
7080
|
-
|
|
7081
|
-
const longitudes = coordinates.map((c) => c[1]);
|
|
7082
|
-
const west = Math.min(...longitudes);
|
|
7083
|
-
const south = Math.min(...latitudes);
|
|
7084
|
-
const east = Math.max(...longitudes);
|
|
7085
|
-
const north = Math.max(...latitudes);
|
|
7086
|
-
return { west, south, east, north };
|
|
7063
|
+
function parseFeatures(data, type) {
|
|
7064
|
+
const dataArray = normalizeInput(data, type);
|
|
7065
|
+
return parseFeatureCollection(dataArray);
|
|
7087
7066
|
}
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7067
|
+
function binaryToGeometry(data, startIndex, endIndex) {
|
|
7068
|
+
switch (data.type) {
|
|
7069
|
+
case "Point":
|
|
7070
|
+
return pointToGeoJson(data, startIndex, endIndex);
|
|
7071
|
+
case "LineString":
|
|
7072
|
+
return lineStringToGeoJson(data, startIndex, endIndex);
|
|
7073
|
+
case "Polygon":
|
|
7074
|
+
return polygonToGeoJson(data, startIndex, endIndex);
|
|
7075
|
+
default:
|
|
7076
|
+
const unexpectedInput = data;
|
|
7077
|
+
throw new Error(`Unsupported geometry type: ${unexpectedInput?.type}`);
|
|
7078
|
+
}
|
|
7094
7079
|
}
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7080
|
+
function normalizeInput(data, type) {
|
|
7081
|
+
const features = [];
|
|
7082
|
+
if (data.points) {
|
|
7083
|
+
data.points.type = "Point";
|
|
7084
|
+
features.push(data.points);
|
|
7085
|
+
}
|
|
7086
|
+
if (data.lines) {
|
|
7087
|
+
data.lines.type = "LineString";
|
|
7088
|
+
features.push(data.lines);
|
|
7089
|
+
}
|
|
7090
|
+
if (data.polygons) {
|
|
7091
|
+
data.polygons.type = "Polygon";
|
|
7092
|
+
features.push(data.polygons);
|
|
7093
|
+
}
|
|
7094
|
+
return features;
|
|
7095
|
+
}
|
|
7096
|
+
function parseFeatureCollection(dataArray) {
|
|
7097
|
+
const features = [];
|
|
7098
|
+
for (const data of dataArray) {
|
|
7099
|
+
if (data.featureIds.value.length === 0) {
|
|
7100
|
+
continue;
|
|
7105
7101
|
}
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7102
|
+
let lastIndex = 0;
|
|
7103
|
+
let lastValue = data.featureIds.value[0];
|
|
7104
|
+
for (let i = 0; i < data.featureIds.value.length; i++) {
|
|
7105
|
+
const currValue = data.featureIds.value[i];
|
|
7106
|
+
if (currValue === lastValue) {
|
|
7107
|
+
continue;
|
|
7108
|
+
}
|
|
7109
|
+
features.push(parseFeature(data, lastIndex, i));
|
|
7110
|
+
lastIndex = i;
|
|
7111
|
+
lastValue = currValue;
|
|
7113
7112
|
}
|
|
7114
|
-
|
|
7113
|
+
features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
|
|
7115
7114
|
}
|
|
7116
|
-
|
|
7117
|
-
|
|
7115
|
+
return features;
|
|
7116
|
+
}
|
|
7117
|
+
function parseFeature(data, startIndex, endIndex) {
|
|
7118
|
+
const geometry = binaryToGeometry(data, startIndex, endIndex);
|
|
7119
|
+
const properties = parseProperties(data, startIndex, endIndex);
|
|
7120
|
+
const fields = parseFields(data, startIndex, endIndex);
|
|
7121
|
+
return { type: "Feature", geometry, properties, ...fields };
|
|
7122
|
+
}
|
|
7123
|
+
function parseFields(data, startIndex = 0, endIndex) {
|
|
7124
|
+
return data.fields && data.fields[data.featureIds.value[startIndex]];
|
|
7125
|
+
}
|
|
7126
|
+
function parseProperties(data, startIndex = 0, endIndex) {
|
|
7127
|
+
const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
|
|
7128
|
+
for (const key in data.numericProps) {
|
|
7129
|
+
properties[key] = data.numericProps[key].value[startIndex];
|
|
7118
7130
|
}
|
|
7119
|
-
|
|
7120
|
-
|
|
7131
|
+
return properties;
|
|
7132
|
+
}
|
|
7133
|
+
function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
|
|
7134
|
+
const { positions } = data;
|
|
7135
|
+
const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
|
|
7136
|
+
const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
|
|
7137
|
+
const multi = polygonIndices.length > 2;
|
|
7138
|
+
if (!multi) {
|
|
7139
|
+
const coordinates2 = [];
|
|
7140
|
+
for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
|
|
7141
|
+
const startRingIndex = primitivePolygonIndices[i];
|
|
7142
|
+
const endRingIndex = primitivePolygonIndices[i + 1];
|
|
7143
|
+
const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
|
|
7144
|
+
coordinates2.push(ringCoordinates);
|
|
7145
|
+
}
|
|
7146
|
+
return { type: "Polygon", coordinates: coordinates2 };
|
|
7121
7147
|
}
|
|
7122
|
-
|
|
7123
|
-
|
|
7148
|
+
const coordinates = [];
|
|
7149
|
+
for (let i = 0; i < polygonIndices.length - 1; i++) {
|
|
7150
|
+
const startPolygonIndex = polygonIndices[i];
|
|
7151
|
+
const endPolygonIndex = polygonIndices[i + 1];
|
|
7152
|
+
const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
|
|
7153
|
+
coordinates.push(polygonCoordinates);
|
|
7124
7154
|
}
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7155
|
+
return { type: "MultiPolygon", coordinates };
|
|
7156
|
+
}
|
|
7157
|
+
function lineStringToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
|
|
7158
|
+
const { positions } = data;
|
|
7159
|
+
const pathIndices = data.pathIndices.value.filter((x) => x >= startIndex && x <= endIndex);
|
|
7160
|
+
const multi = pathIndices.length > 2;
|
|
7161
|
+
if (!multi) {
|
|
7162
|
+
const coordinates2 = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
|
|
7163
|
+
return { type: "LineString", coordinates: coordinates2 };
|
|
7129
7164
|
}
|
|
7130
|
-
|
|
7165
|
+
const coordinates = [];
|
|
7166
|
+
for (let i = 0; i < pathIndices.length - 1; i++) {
|
|
7167
|
+
const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
|
|
7168
|
+
coordinates.push(ringCoordinates);
|
|
7169
|
+
}
|
|
7170
|
+
return { type: "MultiLineString", coordinates };
|
|
7171
|
+
}
|
|
7172
|
+
function pointToGeoJson(data, startIndex, endIndex) {
|
|
7173
|
+
const { positions } = data;
|
|
7174
|
+
const coordinates = ringToGeoJson(positions, startIndex, endIndex);
|
|
7175
|
+
const multi = coordinates.length > 1;
|
|
7176
|
+
if (multi) {
|
|
7177
|
+
return { type: "MultiPoint", coordinates };
|
|
7178
|
+
}
|
|
7179
|
+
return { type: "Point", coordinates: coordinates[0] };
|
|
7180
|
+
}
|
|
7181
|
+
function ringToGeoJson(positions, startIndex, endIndex) {
|
|
7182
|
+
startIndex = startIndex || 0;
|
|
7183
|
+
endIndex = endIndex || positions.value.length / positions.size;
|
|
7184
|
+
const ringCoordinates = [];
|
|
7185
|
+
for (let j = startIndex; j < endIndex; j++) {
|
|
7186
|
+
const coord = Array();
|
|
7187
|
+
for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
|
|
7188
|
+
coord.push(Number(positions.value[k]));
|
|
7189
|
+
}
|
|
7190
|
+
ringCoordinates.push(coord);
|
|
7191
|
+
}
|
|
7192
|
+
return ringCoordinates;
|
|
7193
|
+
}
|
|
7131
7194
|
|
|
7132
|
-
// src/layers/
|
|
7133
|
-
var
|
|
7195
|
+
// src/layers/cluster-tile-layer.ts
|
|
7196
|
+
var import_core5 = __toESM(require_core2(), 1);
|
|
7134
7197
|
|
|
7135
|
-
//
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7198
|
+
// ../../node_modules/quadbin/dist/esm/index.js
|
|
7199
|
+
var import_tile_cover = __toESM(require_tile_cover(), 1);
|
|
7200
|
+
var B = [
|
|
7201
|
+
0x5555555555555555n,
|
|
7202
|
+
0x3333333333333333n,
|
|
7203
|
+
0x0f0f0f0f0f0f0f0fn,
|
|
7204
|
+
0x00ff00ff00ff00ffn,
|
|
7205
|
+
0x0000ffff0000ffffn,
|
|
7206
|
+
0x00000000ffffffffn
|
|
7207
|
+
];
|
|
7208
|
+
var S = [0n, 1n, 2n, 4n, 8n, 16n];
|
|
7209
|
+
function hexToBigInt(hex2) {
|
|
7210
|
+
return BigInt(`0x${hex2}`);
|
|
7141
7211
|
}
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
uint64: BigUint64Array,
|
|
7149
|
-
int8: Int8Array,
|
|
7150
|
-
int16: Int16Array,
|
|
7151
|
-
int32: Int32Array,
|
|
7152
|
-
int64: BigInt64Array,
|
|
7153
|
-
float32: Float32Array,
|
|
7154
|
-
float64: Float64Array
|
|
7155
|
-
};
|
|
7156
|
-
var BandReader = class {
|
|
7157
|
-
static read(pbf, end) {
|
|
7158
|
-
return pbf.readFields(BandReader._readField, { name: "", type: "", data: null }, end);
|
|
7212
|
+
function bigIntToHex(index2) {
|
|
7213
|
+
return index2.toString(16);
|
|
7214
|
+
}
|
|
7215
|
+
function tileToCell(tile) {
|
|
7216
|
+
if (tile.z < 0 || tile.z > 26) {
|
|
7217
|
+
throw new Error("Wrong zoom");
|
|
7159
7218
|
}
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
throw Error(`Invalid data type: ${obj.type}`);
|
|
7169
|
-
}
|
|
7170
|
-
obj.data = {};
|
|
7171
|
-
readPackedTypedArray(TypedArray, pbf, obj.data);
|
|
7172
|
-
}
|
|
7219
|
+
const z = BigInt(tile.z);
|
|
7220
|
+
let x = BigInt(tile.x) << 32n - z;
|
|
7221
|
+
let y = BigInt(tile.y) << 32n - z;
|
|
7222
|
+
for (let i = 0; i < 5; i++) {
|
|
7223
|
+
const s = S[5 - i];
|
|
7224
|
+
const b = B[4 - i];
|
|
7225
|
+
x = (x | x << s) & b;
|
|
7226
|
+
y = (y | y << s) & b;
|
|
7173
7227
|
}
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7228
|
+
const quadbin = 0x4000000000000000n | 1n << 59n | z << 52n | (x | y << 1n) >> 12n | 0xfffffffffffffn >> z * 2n;
|
|
7229
|
+
return quadbin;
|
|
7230
|
+
}
|
|
7231
|
+
function cellToTile(quadbin) {
|
|
7232
|
+
const mode = quadbin >> 59n & 7n;
|
|
7233
|
+
const modeDep = quadbin >> 57n & 3n;
|
|
7234
|
+
const z = quadbin >> 52n & 0x1fn;
|
|
7235
|
+
const q = (quadbin & 0xfffffffffffffn) << 12n;
|
|
7236
|
+
if (mode !== 1n && modeDep !== 0n) {
|
|
7237
|
+
throw new Error("Wrong mode");
|
|
7178
7238
|
}
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7239
|
+
let x = q;
|
|
7240
|
+
let y = q >> 1n;
|
|
7241
|
+
for (let i = 0; i < 6; i++) {
|
|
7242
|
+
const s = S[i];
|
|
7243
|
+
const b = B[i];
|
|
7244
|
+
x = (x | x >> s) & b;
|
|
7245
|
+
y = (y | y >> s) & b;
|
|
7184
7246
|
}
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
var import_pbf = __toESM(require_pbf(), 1);
|
|
7189
|
-
function parsePbf(buffer, TileReader5) {
|
|
7190
|
-
const pbf = new import_pbf.default(buffer);
|
|
7191
|
-
const tile = TileReader5.read(pbf);
|
|
7192
|
-
return tile;
|
|
7247
|
+
x = x >> 32n - z;
|
|
7248
|
+
y = y >> 32n - z;
|
|
7249
|
+
return { z: Number(z), x: Number(x), y: Number(y) };
|
|
7193
7250
|
}
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
var import_core = __toESM(require_core(), 1);
|
|
7197
|
-
function assert(condition, message) {
|
|
7198
|
-
import_core.log.assert(condition, message);
|
|
7251
|
+
function getResolution(quadbin) {
|
|
7252
|
+
return quadbin >> 52n & 0x1fn;
|
|
7199
7253
|
}
|
|
7200
|
-
function
|
|
7201
|
-
const
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7254
|
+
function cellToParent(quadbin) {
|
|
7255
|
+
const zparent = getResolution(quadbin) - 1n;
|
|
7256
|
+
const parent = quadbin & ~(0x1fn << 52n) | zparent << 52n | 0xfffffffffffffn >> zparent * 2n;
|
|
7257
|
+
return parent;
|
|
7258
|
+
}
|
|
7259
|
+
|
|
7260
|
+
// src/layers/cluster-utils.ts
|
|
7261
|
+
function aggregateTile(tile, aggregationLevels, properties = [], getPosition, getWeight) {
|
|
7262
|
+
if (!tile.content)
|
|
7263
|
+
return;
|
|
7264
|
+
if (!tile.userData)
|
|
7265
|
+
tile.userData = {};
|
|
7266
|
+
if (tile.userData[aggregationLevels])
|
|
7267
|
+
return;
|
|
7268
|
+
const out = {};
|
|
7269
|
+
for (const cell of tile.content) {
|
|
7270
|
+
let id4 = cell.id;
|
|
7271
|
+
const position = typeof getPosition === "function" ? getPosition(cell, {}) : getPosition;
|
|
7272
|
+
for (let i = 0; i < aggregationLevels - 1; i++) {
|
|
7273
|
+
id4 = cellToParent(id4);
|
|
7274
|
+
}
|
|
7275
|
+
const parentId = Number(id4);
|
|
7276
|
+
if (!(parentId in out)) {
|
|
7277
|
+
out[parentId] = { id: id4, count: 0, position: [0, 0] };
|
|
7278
|
+
for (const { name, aggregation } of properties) {
|
|
7279
|
+
if (aggregation === "any") {
|
|
7280
|
+
out[parentId][name] = cell.properties[name];
|
|
7281
|
+
} else {
|
|
7282
|
+
out[parentId][name] = 0;
|
|
7283
|
+
}
|
|
7206
7284
|
}
|
|
7207
|
-
return target[property];
|
|
7208
|
-
},
|
|
7209
|
-
has(target, property) {
|
|
7210
|
-
return property in numericProps || property in target;
|
|
7211
7285
|
}
|
|
7212
|
-
|
|
7286
|
+
const prevTotalW = out[parentId].count;
|
|
7287
|
+
out[parentId].count += typeof getWeight === "function" ? getWeight(cell, {}) : getWeight;
|
|
7288
|
+
const totalW = out[parentId].count;
|
|
7289
|
+
const W = totalW - prevTotalW;
|
|
7290
|
+
out[parentId].position[0] = (prevTotalW * out[parentId].position[0] + W * position[0]) / totalW;
|
|
7291
|
+
out[parentId].position[1] = (prevTotalW * out[parentId].position[1] + W * position[1]) / totalW;
|
|
7292
|
+
for (const { name, aggregation } of properties) {
|
|
7293
|
+
const prevValue = out[parentId][name];
|
|
7294
|
+
const value = cell.properties[name];
|
|
7295
|
+
if (aggregation === "average") {
|
|
7296
|
+
out[parentId][name] = (prevTotalW * prevValue + W * value) / totalW;
|
|
7297
|
+
} else if (aggregation === "count" || aggregation === "sum") {
|
|
7298
|
+
out[parentId][name] = prevValue + value;
|
|
7299
|
+
} else if (aggregation === "max") {
|
|
7300
|
+
out[parentId][name] = Math.max(prevValue, value);
|
|
7301
|
+
} else if (aggregation === "min") {
|
|
7302
|
+
out[parentId][name] = Math.min(prevValue, value);
|
|
7303
|
+
}
|
|
7304
|
+
}
|
|
7305
|
+
}
|
|
7306
|
+
tile.userData[aggregationLevels] = Object.values(out);
|
|
7213
7307
|
}
|
|
7214
|
-
function
|
|
7215
|
-
|
|
7308
|
+
function extractAggregationProperties(tile) {
|
|
7309
|
+
const properties = [];
|
|
7310
|
+
const validAggregations = ["any", "average", "count", "min", "max", "sum"];
|
|
7311
|
+
for (const name of Object.keys(tile.content[0].properties)) {
|
|
7312
|
+
let aggregation = name.split("_").pop().toLowerCase();
|
|
7313
|
+
if (!validAggregations.includes(aggregation)) {
|
|
7314
|
+
aggregation = "any";
|
|
7315
|
+
}
|
|
7316
|
+
properties.push({ name, aggregation });
|
|
7317
|
+
}
|
|
7318
|
+
return properties;
|
|
7216
7319
|
}
|
|
7217
|
-
function
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7320
|
+
function computeAggregationStats(data, properties) {
|
|
7321
|
+
const stats = {};
|
|
7322
|
+
for (const { name, aggregation } of properties) {
|
|
7323
|
+
stats[name] = { min: Infinity, max: -Infinity };
|
|
7324
|
+
if (aggregation !== "any") {
|
|
7325
|
+
for (const d of data) {
|
|
7326
|
+
stats[name].min = Math.min(stats[name].min, d[name]);
|
|
7327
|
+
stats[name].max = Math.max(stats[name].max, d[name]);
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
7221
7330
|
}
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7331
|
+
return stats;
|
|
7332
|
+
}
|
|
7333
|
+
var EMPTY_UINT16ARRAY = new Uint16Array();
|
|
7334
|
+
var EMPTY_BINARY_PROPS = {
|
|
7335
|
+
positions: { value: new Float32Array(), size: 2 },
|
|
7336
|
+
properties: [],
|
|
7337
|
+
numericProps: {},
|
|
7338
|
+
featureIds: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
7339
|
+
globalFeatureIds: { value: EMPTY_UINT16ARRAY, size: 1 }
|
|
7340
|
+
};
|
|
7341
|
+
function clustersToBinary(data) {
|
|
7342
|
+
const positions = new Float32Array(data.length * 2);
|
|
7343
|
+
const featureIds = new Uint16Array(data.length);
|
|
7344
|
+
for (let i = 0; i < data.length; i++) {
|
|
7345
|
+
positions.set(data[i].position, 2 * i);
|
|
7346
|
+
featureIds[i] = i;
|
|
7347
|
+
}
|
|
7348
|
+
return {
|
|
7349
|
+
shape: "binary-feature-collection",
|
|
7350
|
+
points: {
|
|
7351
|
+
type: "Point",
|
|
7352
|
+
positions: { value: positions, size: 2 },
|
|
7353
|
+
properties: data,
|
|
7354
|
+
numericProps: {},
|
|
7355
|
+
featureIds: { value: featureIds, size: 1 },
|
|
7356
|
+
globalFeatureIds: { value: featureIds, size: 1 }
|
|
7357
|
+
},
|
|
7358
|
+
lines: {
|
|
7359
|
+
type: "LineString",
|
|
7360
|
+
pathIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
7361
|
+
...EMPTY_BINARY_PROPS
|
|
7362
|
+
},
|
|
7363
|
+
polygons: {
|
|
7364
|
+
type: "Polygon",
|
|
7365
|
+
polygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
7366
|
+
primitivePolygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
7367
|
+
...EMPTY_BINARY_PROPS
|
|
7227
7368
|
}
|
|
7228
|
-
return unknown;
|
|
7229
|
-
};
|
|
7230
|
-
scale.copy = () => {
|
|
7231
|
-
const scaleCopy = scaleIdentity();
|
|
7232
|
-
scaleCopy.unknown(unknown);
|
|
7233
|
-
return scaleCopy;
|
|
7234
7369
|
};
|
|
7235
|
-
return scale;
|
|
7236
7370
|
}
|
|
7237
|
-
var isObject = (x) => x !== null && typeof x === "object";
|
|
7238
|
-
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
7239
7371
|
|
|
7240
|
-
// src/
|
|
7241
|
-
var
|
|
7242
|
-
var
|
|
7243
|
-
var
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
var
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7372
|
+
// src/constants.ts
|
|
7373
|
+
var DEFAULT_TILE_SIZE = 512;
|
|
7374
|
+
var DEFAULT_TILE_RESOLUTION = 0.5;
|
|
7375
|
+
var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
7376
|
+
var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
7377
|
+
|
|
7378
|
+
// src/layers/quadbin-tileset-2d.ts
|
|
7379
|
+
var import_geo_layers = __toESM(require_geo_layers(), 1);
|
|
7380
|
+
var QuadbinTileset2D = class extends import_geo_layers._Tileset2D {
|
|
7381
|
+
getTileIndices(opts) {
|
|
7382
|
+
return super.getTileIndices(opts).map(tileToCell).map((q) => ({ q, i: bigIntToHex(q) }));
|
|
7383
|
+
}
|
|
7384
|
+
getTileId({ q, i }) {
|
|
7385
|
+
return i || bigIntToHex(q);
|
|
7386
|
+
}
|
|
7387
|
+
getTileMetadata({ q }) {
|
|
7388
|
+
return super.getTileMetadata(cellToTile(q));
|
|
7389
|
+
}
|
|
7390
|
+
getTileZoom({ q }) {
|
|
7391
|
+
return Number(getResolution(q));
|
|
7392
|
+
}
|
|
7393
|
+
getParentIndex({ q }) {
|
|
7394
|
+
return { q: cellToParent(q) };
|
|
7395
|
+
}
|
|
7396
|
+
};
|
|
7397
|
+
|
|
7398
|
+
// ../../node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js
|
|
7399
|
+
var PI = Math.PI;
|
|
7400
|
+
var PI_4 = PI / 4;
|
|
7401
|
+
var DEGREES_TO_RADIANS = PI / 180;
|
|
7402
|
+
var RADIANS_TO_DEGREES = 180 / PI;
|
|
7403
|
+
var TILE_SIZE = 512;
|
|
7404
|
+
function worldToLngLat(xy) {
|
|
7405
|
+
const [x, y] = xy;
|
|
7406
|
+
const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
|
|
7407
|
+
const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
|
|
7408
|
+
return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
|
|
7409
|
+
}
|
|
7410
|
+
|
|
7411
|
+
// ../../node_modules/@math.gl/web-mercator/dist/get-bounds.js
|
|
7412
|
+
var DEGREES_TO_RADIANS2 = Math.PI / 180;
|
|
7413
|
+
|
|
7414
|
+
// src/layers/quadbin-utils.ts
|
|
7415
|
+
var TILE_SIZE2 = 512;
|
|
7416
|
+
function quadbinToOffset(quadbin) {
|
|
7417
|
+
const { x, y, z } = cellToTile(quadbin);
|
|
7418
|
+
const scale = TILE_SIZE2 / (1 << z);
|
|
7419
|
+
return [x * scale, TILE_SIZE2 - y * scale, scale];
|
|
7420
|
+
}
|
|
7421
|
+
function quadbinToWorldBounds(quadbin, coverage) {
|
|
7422
|
+
const [xOffset, yOffset, scale] = quadbinToOffset(quadbin);
|
|
7423
|
+
return [
|
|
7424
|
+
[xOffset, yOffset],
|
|
7425
|
+
[xOffset + coverage * scale, yOffset - coverage * scale]
|
|
7426
|
+
];
|
|
7427
|
+
}
|
|
7428
|
+
function getQuadbinPolygon(quadbin, coverage = 1) {
|
|
7429
|
+
const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);
|
|
7430
|
+
const [w, n] = worldToLngLat(topLeft);
|
|
7431
|
+
const [e, s] = worldToLngLat(bottomRight);
|
|
7432
|
+
return [e, n, e, s, w, s, w, n, e, n];
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7435
|
+
// src/layers/schema/fast-pbf.ts
|
|
7436
|
+
function readPackedTypedArray(TypedArray, pbf, obj) {
|
|
7437
|
+
const end = pbf.type === 2 ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
|
|
7438
|
+
obj.value = new TypedArray(pbf.buf.buffer.slice(pbf.pos, end));
|
|
7439
|
+
pbf.pos = end;
|
|
7440
|
+
return obj.value;
|
|
7271
7441
|
}
|
|
7272
|
-
var carto_raster_tile_loader_default = CartoRasterTileLoader;
|
|
7273
7442
|
|
|
7274
7443
|
// src/layers/schema/carto-tile.ts
|
|
7275
7444
|
var KeyValueObjectReader = class {
|
|
@@ -7452,9 +7621,9 @@ var __exports__ = (() => {
|
|
|
7452
7621
|
obj.fields.push(FieldsReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
7453
7622
|
}
|
|
7454
7623
|
};
|
|
7455
|
-
var
|
|
7624
|
+
var TileReader = class {
|
|
7456
7625
|
static read(pbf, end) {
|
|
7457
|
-
return pbf.readFields(
|
|
7626
|
+
return pbf.readFields(TileReader._readField, { points: null, lines: null, polygons: null }, end);
|
|
7458
7627
|
}
|
|
7459
7628
|
static _readField(tag, obj, pbf) {
|
|
7460
7629
|
if (tag === 1)
|
|
@@ -7466,176 +7635,519 @@ var __exports__ = (() => {
|
|
|
7466
7635
|
}
|
|
7467
7636
|
};
|
|
7468
7637
|
|
|
7469
|
-
// src/layers/schema/carto-spatial-tile.ts
|
|
7470
|
-
var IndicesReader = class {
|
|
7471
|
-
static read(pbf, end) {
|
|
7472
|
-
return pbf.readFields(IndicesReader._readField, { value: [] }, end);
|
|
7473
|
-
}
|
|
7474
|
-
static _readField(tag, obj, pbf) {
|
|
7475
|
-
if (tag === 1)
|
|
7476
|
-
readPackedTypedArray(BigUint64Array, pbf, obj);
|
|
7477
|
-
}
|
|
7638
|
+
// src/layers/schema/carto-spatial-tile.ts
|
|
7639
|
+
var IndicesReader = class {
|
|
7640
|
+
static read(pbf, end) {
|
|
7641
|
+
return pbf.readFields(IndicesReader._readField, { value: [] }, end);
|
|
7642
|
+
}
|
|
7643
|
+
static _readField(tag, obj, pbf) {
|
|
7644
|
+
if (tag === 1)
|
|
7645
|
+
readPackedTypedArray(BigUint64Array, pbf, obj);
|
|
7646
|
+
}
|
|
7647
|
+
};
|
|
7648
|
+
var CellsReader = class {
|
|
7649
|
+
static read(pbf, end) {
|
|
7650
|
+
return pbf.readFields(
|
|
7651
|
+
CellsReader._readField,
|
|
7652
|
+
{ indices: null, properties: [], numericProps: {} },
|
|
7653
|
+
end
|
|
7654
|
+
);
|
|
7655
|
+
}
|
|
7656
|
+
static _readField(tag, obj, pbf) {
|
|
7657
|
+
if (tag === 1)
|
|
7658
|
+
obj.indices = IndicesReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
7659
|
+
else if (tag === 2)
|
|
7660
|
+
obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
7661
|
+
else if (tag === 3) {
|
|
7662
|
+
const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
7663
|
+
obj.numericProps[entry.key] = entry.value;
|
|
7664
|
+
}
|
|
7665
|
+
}
|
|
7666
|
+
};
|
|
7667
|
+
var TileReader2 = class {
|
|
7668
|
+
static read(pbf, end) {
|
|
7669
|
+
return pbf.readFields(TileReader2._readField, { scheme: 0, cells: null }, end);
|
|
7670
|
+
}
|
|
7671
|
+
static _readField(tag, obj, pbf) {
|
|
7672
|
+
if (tag === 1)
|
|
7673
|
+
obj.scheme = pbf.readVarint();
|
|
7674
|
+
else if (tag === 2)
|
|
7675
|
+
obj.cells = CellsReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
7676
|
+
}
|
|
7677
|
+
};
|
|
7678
|
+
|
|
7679
|
+
// src/layers/schema/tile-loader-utils.ts
|
|
7680
|
+
var import_pbf = __toESM(require_pbf(), 1);
|
|
7681
|
+
function parsePbf(buffer, TileReader5) {
|
|
7682
|
+
const pbf = new import_pbf.default(buffer);
|
|
7683
|
+
const tile = TileReader5.read(pbf);
|
|
7684
|
+
return tile;
|
|
7685
|
+
}
|
|
7686
|
+
|
|
7687
|
+
// src/utils.ts
|
|
7688
|
+
var import_core = __toESM(require_core2(), 1);
|
|
7689
|
+
function assert2(condition, message) {
|
|
7690
|
+
import_core.log.assert(condition, message);
|
|
7691
|
+
}
|
|
7692
|
+
function createBinaryProxy(data, index2) {
|
|
7693
|
+
const { properties, numericProps } = data;
|
|
7694
|
+
return new Proxy(properties[index2] || {}, {
|
|
7695
|
+
get(target, property) {
|
|
7696
|
+
if (property in numericProps) {
|
|
7697
|
+
return numericProps[property].value[index2];
|
|
7698
|
+
}
|
|
7699
|
+
return target[property];
|
|
7700
|
+
},
|
|
7701
|
+
has(target, property) {
|
|
7702
|
+
return property in numericProps || property in target;
|
|
7703
|
+
},
|
|
7704
|
+
ownKeys(target) {
|
|
7705
|
+
return [...Object.keys(numericProps), ...Reflect.ownKeys(target)];
|
|
7706
|
+
},
|
|
7707
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
7708
|
+
return { enumerable: true, configurable: true };
|
|
7709
|
+
}
|
|
7710
|
+
});
|
|
7711
|
+
}
|
|
7712
|
+
function getWorkerUrl(id4, version) {
|
|
7713
|
+
return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id4}-worker.js`;
|
|
7714
|
+
}
|
|
7715
|
+
function scaleIdentity() {
|
|
7716
|
+
let unknown;
|
|
7717
|
+
function scale(x) {
|
|
7718
|
+
return x === null ? unknown : x;
|
|
7719
|
+
}
|
|
7720
|
+
scale.invert = scale;
|
|
7721
|
+
scale.domain = scale.range = (d) => d;
|
|
7722
|
+
scale.unknown = (u) => {
|
|
7723
|
+
if (u) {
|
|
7724
|
+
unknown = u;
|
|
7725
|
+
}
|
|
7726
|
+
return unknown;
|
|
7727
|
+
};
|
|
7728
|
+
scale.copy = () => {
|
|
7729
|
+
const scaleCopy = scaleIdentity();
|
|
7730
|
+
scaleCopy.unknown(unknown);
|
|
7731
|
+
return scaleCopy;
|
|
7732
|
+
};
|
|
7733
|
+
return scale;
|
|
7734
|
+
}
|
|
7735
|
+
var isObject = (x) => x !== null && typeof x === "object";
|
|
7736
|
+
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
7737
|
+
|
|
7738
|
+
// src/layers/schema/spatialjson-utils.ts
|
|
7739
|
+
function binaryToSpatialjson(binary) {
|
|
7740
|
+
const { cells, scheme } = binary;
|
|
7741
|
+
const count = cells.indices.value.length;
|
|
7742
|
+
const spatial = [];
|
|
7743
|
+
for (let i = 0; i < count; i++) {
|
|
7744
|
+
const id4 = scheme === "h3" ? bigIntToHex(cells.indices.value[i]) : cells.indices.value[i];
|
|
7745
|
+
const properties = { ...cells.properties[i] };
|
|
7746
|
+
for (const key of Object.keys(cells.numericProps)) {
|
|
7747
|
+
properties[key] = cells.numericProps[key].value[i];
|
|
7748
|
+
}
|
|
7749
|
+
spatial.push({ id: id4, properties });
|
|
7750
|
+
}
|
|
7751
|
+
return spatial;
|
|
7752
|
+
}
|
|
7753
|
+
|
|
7754
|
+
// src/layers/schema/carto-spatial-tile-loader.ts
|
|
7755
|
+
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
7756
|
+
var id = "cartoSpatialTile";
|
|
7757
|
+
var DEFAULT_OPTIONS = {
|
|
7758
|
+
cartoSpatialTile: {
|
|
7759
|
+
scheme: "quadbin",
|
|
7760
|
+
workerUrl: getWorkerUrl(id, VERSION)
|
|
7761
|
+
}
|
|
7762
|
+
};
|
|
7763
|
+
var CartoSpatialTileLoader = {
|
|
7764
|
+
name: "CARTO Spatial Tile",
|
|
7765
|
+
version: VERSION,
|
|
7766
|
+
id,
|
|
7767
|
+
module: "carto",
|
|
7768
|
+
extensions: ["pbf"],
|
|
7769
|
+
mimeTypes: ["application/vnd.carto-spatial-tile"],
|
|
7770
|
+
category: "geometry",
|
|
7771
|
+
parse: async (arrayBuffer, options) => parseCartoSpatialTile(arrayBuffer, options),
|
|
7772
|
+
parseSync: parseCartoSpatialTile,
|
|
7773
|
+
worker: true,
|
|
7774
|
+
options: DEFAULT_OPTIONS
|
|
7775
|
+
};
|
|
7776
|
+
function parseCartoSpatialTile(arrayBuffer, options) {
|
|
7777
|
+
if (!arrayBuffer)
|
|
7778
|
+
return null;
|
|
7779
|
+
const tile = parsePbf(arrayBuffer, TileReader2);
|
|
7780
|
+
const { cells } = tile;
|
|
7781
|
+
const scheme = options?.cartoSpatialTile?.scheme;
|
|
7782
|
+
const data = { cells, scheme };
|
|
7783
|
+
return binaryToSpatialjson(data);
|
|
7784
|
+
}
|
|
7785
|
+
var carto_spatial_tile_loader_default = CartoSpatialTileLoader;
|
|
7786
|
+
|
|
7787
|
+
// src/layers/utils.ts
|
|
7788
|
+
var import_core2 = __toESM(require_core2(), 1);
|
|
7789
|
+
var import_core3 = __toESM(require_core2(), 1);
|
|
7790
|
+
function injectAccessToken(loadOptions, accessToken) {
|
|
7791
|
+
if (!loadOptions?.fetch?.headers?.Authorization) {
|
|
7792
|
+
loadOptions.fetch = {
|
|
7793
|
+
...loadOptions.fetch,
|
|
7794
|
+
headers: { ...loadOptions.fetch?.headers, Authorization: `Bearer ${accessToken}` }
|
|
7795
|
+
};
|
|
7796
|
+
}
|
|
7797
|
+
}
|
|
7798
|
+
function mergeBoundaryData(geometry, properties) {
|
|
7799
|
+
const mapping = {};
|
|
7800
|
+
for (const { geoid, ...rest } of properties.properties) {
|
|
7801
|
+
if (geoid in mapping) {
|
|
7802
|
+
import_core2.log.warn("Duplicate geoid key in boundary mapping, using first occurance")();
|
|
7803
|
+
} else {
|
|
7804
|
+
mapping[geoid] = rest;
|
|
7805
|
+
}
|
|
7806
|
+
}
|
|
7807
|
+
for (const type of ["points", "lines", "polygons"]) {
|
|
7808
|
+
const geom = geometry[type];
|
|
7809
|
+
if (geom.positions.value.length === 0) {
|
|
7810
|
+
continue;
|
|
7811
|
+
}
|
|
7812
|
+
geom.properties = geom.properties.map(({ geoid }) => mapping[geoid]);
|
|
7813
|
+
const { positions, globalFeatureIds } = geom;
|
|
7814
|
+
let indices = null;
|
|
7815
|
+
if (type === "lines")
|
|
7816
|
+
indices = geom.pathIndices.value;
|
|
7817
|
+
if (type === "polygons")
|
|
7818
|
+
indices = geom.polygonIndices.value;
|
|
7819
|
+
const length = positions.value.length / positions.size;
|
|
7820
|
+
for (const key in properties.numericProps) {
|
|
7821
|
+
const sourceProp = properties.numericProps[key].value;
|
|
7822
|
+
const TypedArray = sourceProp.constructor;
|
|
7823
|
+
const destProp = new TypedArray(length);
|
|
7824
|
+
geom.numericProps[key] = { value: destProp, size: 1 };
|
|
7825
|
+
if (!indices) {
|
|
7826
|
+
for (let i = 0; i < length; i++) {
|
|
7827
|
+
const featureId = globalFeatureIds.value[i];
|
|
7828
|
+
destProp[i] = sourceProp[featureId];
|
|
7829
|
+
}
|
|
7830
|
+
} else {
|
|
7831
|
+
for (let i = 0; i < indices.length - 1; i++) {
|
|
7832
|
+
const startIndex = indices[i];
|
|
7833
|
+
const endIndex = indices[i + 1];
|
|
7834
|
+
const featureId = globalFeatureIds.value[startIndex];
|
|
7835
|
+
destProp.fill(sourceProp[featureId], startIndex, endIndex);
|
|
7836
|
+
}
|
|
7837
|
+
}
|
|
7838
|
+
}
|
|
7839
|
+
}
|
|
7840
|
+
return geometry;
|
|
7841
|
+
}
|
|
7842
|
+
var TilejsonPropType = {
|
|
7843
|
+
type: "object",
|
|
7844
|
+
value: null,
|
|
7845
|
+
validate: (value, propType) => propType.optional && value === null || typeof value === "object" && Array.isArray(value.tiles) && value.tiles.every((url) => typeof url === "string"),
|
|
7846
|
+
equal: (value1, value2) => {
|
|
7847
|
+
return (0, import_core3._deepEqual)(value1, value2, 2);
|
|
7848
|
+
},
|
|
7849
|
+
async: true
|
|
7850
|
+
};
|
|
7851
|
+
|
|
7852
|
+
// src/layers/cluster-tile-layer.ts
|
|
7853
|
+
(0, import_core4.registerLoaders)([carto_spatial_tile_loader_default]);
|
|
7854
|
+
var defaultProps = {
|
|
7855
|
+
data: TilejsonPropType,
|
|
7856
|
+
clusterLevel: { type: "number", value: 5, min: 1 },
|
|
7857
|
+
getPosition: {
|
|
7858
|
+
type: "accessor",
|
|
7859
|
+
value: ({ id: id4 }) => getQuadbinPolygon(id4, 0.5).slice(2, 4)
|
|
7860
|
+
},
|
|
7861
|
+
getWeight: { type: "accessor", value: 1 },
|
|
7862
|
+
refinementStrategy: "no-overlap",
|
|
7863
|
+
tileSize: DEFAULT_TILE_SIZE
|
|
7478
7864
|
};
|
|
7479
|
-
var
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7865
|
+
var ClusterGeoJsonLayer = class extends import_geo_layers2.TileLayer {
|
|
7866
|
+
renderLayers() {
|
|
7867
|
+
const visibleTiles = this.state.tileset?.tiles.filter((tile) => {
|
|
7868
|
+
return tile.isLoaded && tile.content && this.state.tileset.isTileVisible(tile);
|
|
7869
|
+
});
|
|
7870
|
+
if (!visibleTiles?.length) {
|
|
7871
|
+
return null;
|
|
7872
|
+
}
|
|
7873
|
+
visibleTiles.sort((a, b) => b.zoom - a.zoom);
|
|
7874
|
+
const { zoom } = this.context.viewport;
|
|
7875
|
+
const { clusterLevel, getPosition, getWeight } = this.props;
|
|
7876
|
+
const properties = extractAggregationProperties(visibleTiles[0]);
|
|
7877
|
+
const data = [];
|
|
7878
|
+
for (const tile of visibleTiles) {
|
|
7879
|
+
const overZoom = Math.round(zoom - tile.zoom);
|
|
7880
|
+
const aggregationLevels = Math.round(clusterLevel) - overZoom;
|
|
7881
|
+
aggregateTile(tile, aggregationLevels, properties, getPosition, getWeight);
|
|
7882
|
+
data.push(...tile.userData[aggregationLevels]);
|
|
7883
|
+
}
|
|
7884
|
+
data.sort((a, b) => Number(b.count - a.count));
|
|
7885
|
+
const clusterIds = data?.map((tile) => tile.id);
|
|
7886
|
+
const needsUpdate = !(0, import_core5._deepEqual)(clusterIds, this.state.clusterIds, 1);
|
|
7887
|
+
this.setState({ clusterIds });
|
|
7888
|
+
if (needsUpdate) {
|
|
7889
|
+
const stats = computeAggregationStats(data, properties);
|
|
7890
|
+
for (const d of data) {
|
|
7891
|
+
d.stats = stats;
|
|
7892
|
+
}
|
|
7893
|
+
this.setState({ data: clustersToBinary(data) });
|
|
7894
|
+
}
|
|
7895
|
+
const props = {
|
|
7896
|
+
...this.props,
|
|
7897
|
+
id: "clusters",
|
|
7898
|
+
data: this.state.data,
|
|
7899
|
+
dataComparator: (data2, oldData) => {
|
|
7900
|
+
const newIds = data2?.points?.properties?.map((tile) => tile.id);
|
|
7901
|
+
const oldIds = oldData?.points?.properties?.map((tile) => tile.id);
|
|
7902
|
+
return (0, import_core5._deepEqual)(newIds, oldIds, 1);
|
|
7903
|
+
}
|
|
7904
|
+
};
|
|
7905
|
+
return new import_layers.GeoJsonLayer(this.getSubLayerProps(props));
|
|
7906
|
+
}
|
|
7907
|
+
getPickingInfo(params) {
|
|
7908
|
+
const info = params.info;
|
|
7909
|
+
if (info.index !== -1) {
|
|
7910
|
+
const { data } = params.sourceLayer.props;
|
|
7911
|
+
info.object = binaryToGeojson(data, {
|
|
7912
|
+
globalFeatureId: info.index
|
|
7913
|
+
});
|
|
7914
|
+
}
|
|
7915
|
+
return info;
|
|
7486
7916
|
}
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
else if (tag === 2)
|
|
7491
|
-
obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
7492
|
-
else if (tag === 3) {
|
|
7493
|
-
const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
7494
|
-
obj.numericProps[entry.key] = entry.value;
|
|
7917
|
+
_updateAutoHighlight(info) {
|
|
7918
|
+
for (const layer of this.getSubLayers()) {
|
|
7919
|
+
layer.updateAutoHighlight(info);
|
|
7495
7920
|
}
|
|
7496
7921
|
}
|
|
7922
|
+
filterSubLayer() {
|
|
7923
|
+
return true;
|
|
7924
|
+
}
|
|
7497
7925
|
};
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7926
|
+
ClusterGeoJsonLayer.layerName = "ClusterGeoJsonLayer";
|
|
7927
|
+
ClusterGeoJsonLayer.defaultProps = defaultProps;
|
|
7928
|
+
var ClusterTileLayer = class extends import_core5.CompositeLayer {
|
|
7929
|
+
getLoadOptions() {
|
|
7930
|
+
const loadOptions = super.getLoadOptions() || {};
|
|
7931
|
+
const tileJSON = this.props.data;
|
|
7932
|
+
injectAccessToken(loadOptions, tileJSON.accessToken);
|
|
7933
|
+
loadOptions.cartoSpatialTile = { ...loadOptions.cartoSpatialTile, scheme: "quadbin" };
|
|
7934
|
+
return loadOptions;
|
|
7501
7935
|
}
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7936
|
+
renderLayers() {
|
|
7937
|
+
const tileJSON = this.props.data;
|
|
7938
|
+
if (!tileJSON)
|
|
7939
|
+
return null;
|
|
7940
|
+
const { tiles: data, maxresolution: maxZoom } = tileJSON;
|
|
7941
|
+
return [
|
|
7942
|
+
new ClusterGeoJsonLayer(this.props, {
|
|
7943
|
+
id: `cluster-geojson-layer-${this.props.id}`,
|
|
7944
|
+
data,
|
|
7945
|
+
TilesetClass: QuadbinTileset2D,
|
|
7946
|
+
maxZoom,
|
|
7947
|
+
loadOptions: this.getLoadOptions()
|
|
7948
|
+
})
|
|
7949
|
+
];
|
|
7507
7950
|
}
|
|
7508
7951
|
};
|
|
7952
|
+
ClusterTileLayer.layerName = "ClusterTileLayer";
|
|
7953
|
+
ClusterTileLayer.defaultProps = defaultProps;
|
|
7509
7954
|
|
|
7510
|
-
//
|
|
7511
|
-
var
|
|
7512
|
-
var
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7955
|
+
// src/layers/h3-tile-layer.ts
|
|
7956
|
+
var import_core7 = __toESM(require_core2(), 1);
|
|
7957
|
+
var import_geo_layers5 = __toESM(require_geo_layers(), 1);
|
|
7958
|
+
|
|
7959
|
+
// src/layers/h3-tileset-2d.ts
|
|
7960
|
+
var import_geo_layers3 = __toESM(require_geo_layers(), 1);
|
|
7961
|
+
var import_h3_js = __toESM(require_h3_js(), 1);
|
|
7962
|
+
var MAX_LATITUDE2 = 85.051128;
|
|
7963
|
+
function padBoundingBox({ west, north, east, south }, resolution) {
|
|
7964
|
+
const corners = [
|
|
7965
|
+
[north, east],
|
|
7966
|
+
[south, east],
|
|
7967
|
+
[south, west],
|
|
7968
|
+
[north, west]
|
|
7969
|
+
];
|
|
7970
|
+
const cornerCells = corners.map((c) => (0, import_h3_js.latLngToCell)(c[0], c[1], resolution));
|
|
7971
|
+
const cornerEdgeLengths = cornerCells.map(
|
|
7972
|
+
(c) => Math.max(...(0, import_h3_js.originToDirectedEdges)(c).map((e) => (0, import_h3_js.edgeLength)(e, import_h3_js.UNITS.rads))) * 180 / Math.PI
|
|
7973
|
+
);
|
|
7974
|
+
const bufferLat = Math.max(...cornerEdgeLengths);
|
|
7975
|
+
const bufferLon = Math.min(180, bufferLat / Math.cos((north + south) / 2 * Math.PI / 180));
|
|
7976
|
+
return {
|
|
7977
|
+
north: Math.min(north + bufferLat, MAX_LATITUDE2),
|
|
7978
|
+
east: east + bufferLon,
|
|
7979
|
+
south: Math.max(south - bufferLat, -MAX_LATITUDE2),
|
|
7980
|
+
west: west - bufferLon
|
|
7981
|
+
};
|
|
7523
7982
|
}
|
|
7524
|
-
function
|
|
7525
|
-
|
|
7983
|
+
function getHexagonsInBoundingBox({ west, north, east, south }, resolution) {
|
|
7984
|
+
const longitudeSpan = Math.abs(east - west);
|
|
7985
|
+
if (longitudeSpan > 180) {
|
|
7986
|
+
const nSegments = Math.ceil(longitudeSpan / 180);
|
|
7987
|
+
let h3Indices = [];
|
|
7988
|
+
for (let s = 0; s < nSegments; s++) {
|
|
7989
|
+
const segmentWest = west + s * 180;
|
|
7990
|
+
const segmentEast = Math.min(segmentWest + 179.9999999, east);
|
|
7991
|
+
h3Indices = h3Indices.concat(
|
|
7992
|
+
getHexagonsInBoundingBox({ west: segmentWest, north, east: segmentEast, south }, resolution)
|
|
7993
|
+
);
|
|
7994
|
+
}
|
|
7995
|
+
return [...new Set(h3Indices)];
|
|
7996
|
+
}
|
|
7997
|
+
const polygon = [
|
|
7998
|
+
[north, east],
|
|
7999
|
+
[south, east],
|
|
8000
|
+
[south, west],
|
|
8001
|
+
[north, west],
|
|
8002
|
+
[north, east]
|
|
8003
|
+
];
|
|
8004
|
+
return (0, import_h3_js.polygonToCells)(polygon, resolution);
|
|
7526
8005
|
}
|
|
7527
|
-
function
|
|
7528
|
-
|
|
7529
|
-
|
|
8006
|
+
function tileToBoundingBox(index2) {
|
|
8007
|
+
const coordinates = (0, import_h3_js.cellToBoundary)(index2);
|
|
8008
|
+
const latitudes = coordinates.map((c) => c[0]);
|
|
8009
|
+
const longitudes = coordinates.map((c) => c[1]);
|
|
8010
|
+
const west = Math.min(...longitudes);
|
|
8011
|
+
const south = Math.min(...latitudes);
|
|
8012
|
+
const east = Math.max(...longitudes);
|
|
8013
|
+
const north = Math.max(...latitudes);
|
|
8014
|
+
return { west, south, east, north };
|
|
8015
|
+
}
|
|
8016
|
+
var BIAS = 2;
|
|
8017
|
+
function getHexagonResolution(viewport, tileSize) {
|
|
8018
|
+
const zoomOffset = Math.log2(tileSize / 512);
|
|
8019
|
+
const hexagonScaleFactor = 2 / 3 * (viewport.zoom - zoomOffset);
|
|
8020
|
+
const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
|
|
8021
|
+
return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
|
|
8022
|
+
}
|
|
8023
|
+
var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
|
|
8024
|
+
getTileIndices({ viewport, minZoom, maxZoom }) {
|
|
8025
|
+
if (viewport.latitude === void 0)
|
|
8026
|
+
return [];
|
|
8027
|
+
const [west, south, east, north] = viewport.getBounds();
|
|
8028
|
+
const { tileSize } = this.opts;
|
|
8029
|
+
let z = getHexagonResolution(viewport, tileSize);
|
|
8030
|
+
let indices;
|
|
8031
|
+
if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
|
|
8032
|
+
return [];
|
|
8033
|
+
}
|
|
8034
|
+
if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
|
|
8035
|
+
z = maxZoom;
|
|
8036
|
+
const center = (0, import_h3_js.latLngToCell)(viewport.latitude, viewport.longitude, maxZoom);
|
|
8037
|
+
indices = (0, import_h3_js.gridDisk)(center, 1);
|
|
8038
|
+
} else {
|
|
8039
|
+
const paddedBounds = padBoundingBox({ west, north, east, south }, z);
|
|
8040
|
+
indices = getHexagonsInBoundingBox(paddedBounds, z);
|
|
8041
|
+
}
|
|
8042
|
+
return indices.map((i) => ({ i }));
|
|
7530
8043
|
}
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
let y = BigInt(tile.y) << 32n - z;
|
|
7534
|
-
for (let i = 0; i < 5; i++) {
|
|
7535
|
-
const s = S[5 - i];
|
|
7536
|
-
const b = B[4 - i];
|
|
7537
|
-
x = (x | x << s) & b;
|
|
7538
|
-
y = (y | y << s) & b;
|
|
8044
|
+
getTileId({ i }) {
|
|
8045
|
+
return i;
|
|
7539
8046
|
}
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
}
|
|
7543
|
-
function cellToTile(quadbin) {
|
|
7544
|
-
const mode = quadbin >> 59n & 7n;
|
|
7545
|
-
const modeDep = quadbin >> 57n & 3n;
|
|
7546
|
-
const z = quadbin >> 52n & 0x1fn;
|
|
7547
|
-
const q = (quadbin & 0xfffffffffffffn) << 12n;
|
|
7548
|
-
if (mode !== 1n && modeDep !== 0n) {
|
|
7549
|
-
throw new Error("Wrong mode");
|
|
8047
|
+
getTileMetadata({ i }) {
|
|
8048
|
+
return { bbox: tileToBoundingBox(i) };
|
|
7550
8049
|
}
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
for (let i = 0; i < 6; i++) {
|
|
7554
|
-
const s = S[i];
|
|
7555
|
-
const b = B[i];
|
|
7556
|
-
x = (x | x >> s) & b;
|
|
7557
|
-
y = (y | y >> s) & b;
|
|
8050
|
+
getTileZoom({ i }) {
|
|
8051
|
+
return (0, import_h3_js.getResolution)(i);
|
|
7558
8052
|
}
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
}
|
|
7566
|
-
function cellToParent2(quadbin) {
|
|
7567
|
-
const zparent = getResolution2(quadbin) - 1n;
|
|
7568
|
-
const parent = quadbin & ~(0x1fn << 52n) | zparent << 52n | 0xfffffffffffffn >> zparent * 2n;
|
|
7569
|
-
return parent;
|
|
7570
|
-
}
|
|
8053
|
+
getParentIndex(index2) {
|
|
8054
|
+
const resolution = (0, import_h3_js.getResolution)(index2.i);
|
|
8055
|
+
const i = (0, import_h3_js.cellToParent)(index2.i, resolution - 1);
|
|
8056
|
+
return { i };
|
|
8057
|
+
}
|
|
8058
|
+
};
|
|
7571
8059
|
|
|
7572
|
-
// src/layers/
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
8060
|
+
// src/layers/spatial-index-tile-layer.ts
|
|
8061
|
+
var import_core6 = __toESM(require_core(), 1);
|
|
8062
|
+
|
|
8063
|
+
// src/layers/schema/carto-raster-tile.ts
|
|
8064
|
+
var ARRAY_TYPES = {
|
|
8065
|
+
uint8: Uint8Array,
|
|
8066
|
+
uint16: Uint16Array,
|
|
8067
|
+
uint32: Uint32Array,
|
|
8068
|
+
uint64: BigUint64Array,
|
|
8069
|
+
int8: Int8Array,
|
|
8070
|
+
int16: Int16Array,
|
|
8071
|
+
int32: Int32Array,
|
|
8072
|
+
int64: BigInt64Array,
|
|
8073
|
+
float32: Float32Array,
|
|
8074
|
+
float64: Float64Array
|
|
8075
|
+
};
|
|
8076
|
+
var BandReader = class {
|
|
8077
|
+
static read(pbf, end) {
|
|
8078
|
+
return pbf.readFields(BandReader._readField, { name: "", type: "", data: null }, end);
|
|
8079
|
+
}
|
|
8080
|
+
static _readField(tag, obj, pbf) {
|
|
8081
|
+
if (tag === 1)
|
|
8082
|
+
obj.name = pbf.readString();
|
|
8083
|
+
else if (tag === 2)
|
|
8084
|
+
obj.type = pbf.readString();
|
|
8085
|
+
else if (tag === 3) {
|
|
8086
|
+
const TypedArray = ARRAY_TYPES[obj.type];
|
|
8087
|
+
if (!TypedArray) {
|
|
8088
|
+
throw Error(`Invalid data type: ${obj.type}`);
|
|
8089
|
+
}
|
|
8090
|
+
obj.data = {};
|
|
8091
|
+
readPackedTypedArray(TypedArray, pbf, obj.data);
|
|
7582
8092
|
}
|
|
7583
|
-
spatial.push({ id: id4, properties });
|
|
7584
8093
|
}
|
|
7585
|
-
|
|
7586
|
-
|
|
8094
|
+
};
|
|
8095
|
+
var TileReader3 = class {
|
|
8096
|
+
static read(pbf, end) {
|
|
8097
|
+
return pbf.readFields(TileReader3._readField, { blockSize: 0, bands: [] }, end);
|
|
8098
|
+
}
|
|
8099
|
+
static _readField(tag, obj, pbf) {
|
|
8100
|
+
if (tag === 1)
|
|
8101
|
+
obj.blockSize = pbf.readVarint();
|
|
8102
|
+
else if (tag === 2)
|
|
8103
|
+
obj.bands.push(BandReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
8104
|
+
}
|
|
8105
|
+
};
|
|
7587
8106
|
|
|
7588
|
-
// src/layers/schema/carto-
|
|
8107
|
+
// src/layers/schema/carto-raster-tile-loader.ts
|
|
7589
8108
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
7590
|
-
var id2 = "
|
|
8109
|
+
var id2 = "cartoRasterTile";
|
|
7591
8110
|
var DEFAULT_OPTIONS2 = {
|
|
7592
|
-
|
|
7593
|
-
scheme: "quadbin",
|
|
8111
|
+
cartoRasterTile: {
|
|
7594
8112
|
workerUrl: getWorkerUrl(id2, VERSION2)
|
|
7595
8113
|
}
|
|
7596
8114
|
};
|
|
7597
|
-
var
|
|
7598
|
-
name: "CARTO
|
|
8115
|
+
var CartoRasterTileLoader = {
|
|
8116
|
+
name: "CARTO Raster Tile",
|
|
7599
8117
|
version: VERSION2,
|
|
7600
8118
|
id: id2,
|
|
7601
8119
|
module: "carto",
|
|
7602
8120
|
extensions: ["pbf"],
|
|
7603
|
-
mimeTypes: ["application/vnd.carto-
|
|
8121
|
+
mimeTypes: ["application/vnd.carto-raster-tile"],
|
|
7604
8122
|
category: "geometry",
|
|
7605
|
-
parse: async (arrayBuffer, options) =>
|
|
7606
|
-
parseSync:
|
|
8123
|
+
parse: async (arrayBuffer, options) => parseCartoRasterTile(arrayBuffer, options),
|
|
8124
|
+
parseSync: parseCartoRasterTile,
|
|
7607
8125
|
worker: true,
|
|
7608
8126
|
options: DEFAULT_OPTIONS2
|
|
7609
8127
|
};
|
|
7610
|
-
function
|
|
8128
|
+
function parseCartoRasterTile(arrayBuffer, options) {
|
|
7611
8129
|
if (!arrayBuffer)
|
|
7612
8130
|
return null;
|
|
7613
|
-
const
|
|
7614
|
-
const
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
8131
|
+
const { bands, blockSize } = parsePbf(arrayBuffer, TileReader3);
|
|
8132
|
+
const numericProps = {};
|
|
8133
|
+
for (let i = 0; i < bands.length; i++) {
|
|
8134
|
+
const { name, data } = bands[i];
|
|
8135
|
+
numericProps[name] = data;
|
|
8136
|
+
}
|
|
8137
|
+
return { blockSize, cells: { numericProps, properties: [] } };
|
|
7618
8138
|
}
|
|
7619
|
-
var
|
|
7620
|
-
|
|
7621
|
-
// src/layers/spatial-index-tile-layer.ts
|
|
7622
|
-
var import_geo_layers2 = __toESM(require_geo_layers(), 1);
|
|
7623
|
-
|
|
7624
|
-
// src/constants.ts
|
|
7625
|
-
var DEFAULT_TILE_SIZE = 512;
|
|
7626
|
-
var DEFAULT_TILE_RESOLUTION = 0.5;
|
|
7627
|
-
var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
7628
|
-
var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
8139
|
+
var carto_raster_tile_loader_default = CartoRasterTileLoader;
|
|
7629
8140
|
|
|
7630
8141
|
// src/layers/spatial-index-tile-layer.ts
|
|
7631
|
-
(
|
|
8142
|
+
var import_geo_layers4 = __toESM(require_geo_layers(), 1);
|
|
8143
|
+
(0, import_core6.registerLoaders)([carto_raster_tile_loader_default, carto_spatial_tile_loader_default]);
|
|
7632
8144
|
function isFeatureIdDefined(value) {
|
|
7633
8145
|
return value !== void 0 && value !== null && value !== "";
|
|
7634
8146
|
}
|
|
7635
|
-
var
|
|
8147
|
+
var defaultProps2 = {
|
|
7636
8148
|
tileSize: DEFAULT_TILE_SIZE
|
|
7637
8149
|
};
|
|
7638
|
-
var SpatialIndexTileLayer = class extends
|
|
8150
|
+
var SpatialIndexTileLayer = class extends import_geo_layers4.TileLayer {
|
|
7639
8151
|
_updateAutoHighlight(info) {
|
|
7640
8152
|
const { hoveredFeatureId } = this.state;
|
|
7641
8153
|
const hoveredFeature = info.object;
|
|
@@ -7683,72 +8195,7 @@ var __exports__ = (() => {
|
|
|
7683
8195
|
}
|
|
7684
8196
|
};
|
|
7685
8197
|
SpatialIndexTileLayer.layerName = "SpatialIndexTileLayer";
|
|
7686
|
-
SpatialIndexTileLayer.defaultProps =
|
|
7687
|
-
|
|
7688
|
-
// src/layers/utils.ts
|
|
7689
|
-
var import_core3 = __toESM(require_core(), 1);
|
|
7690
|
-
var import_core4 = __toESM(require_core(), 1);
|
|
7691
|
-
function injectAccessToken(loadOptions, accessToken) {
|
|
7692
|
-
if (!loadOptions?.fetch?.headers?.Authorization) {
|
|
7693
|
-
loadOptions.fetch = {
|
|
7694
|
-
...loadOptions.fetch,
|
|
7695
|
-
headers: { ...loadOptions.fetch?.headers, Authorization: `Bearer ${accessToken}` }
|
|
7696
|
-
};
|
|
7697
|
-
}
|
|
7698
|
-
}
|
|
7699
|
-
function mergeBoundaryData(geometry, properties) {
|
|
7700
|
-
const mapping = {};
|
|
7701
|
-
for (const { geoid, ...rest } of properties.properties) {
|
|
7702
|
-
if (geoid in mapping) {
|
|
7703
|
-
import_core3.log.warn("Duplicate geoid key in boundary mapping, using first occurance")();
|
|
7704
|
-
} else {
|
|
7705
|
-
mapping[geoid] = rest;
|
|
7706
|
-
}
|
|
7707
|
-
}
|
|
7708
|
-
for (const type of ["points", "lines", "polygons"]) {
|
|
7709
|
-
const geom = geometry[type];
|
|
7710
|
-
if (geom.positions.value.length === 0) {
|
|
7711
|
-
continue;
|
|
7712
|
-
}
|
|
7713
|
-
geom.properties = geom.properties.map(({ geoid }) => mapping[geoid]);
|
|
7714
|
-
const { positions, globalFeatureIds } = geom;
|
|
7715
|
-
let indices = null;
|
|
7716
|
-
if (type === "lines")
|
|
7717
|
-
indices = geom.pathIndices.value;
|
|
7718
|
-
if (type === "polygons")
|
|
7719
|
-
indices = geom.polygonIndices.value;
|
|
7720
|
-
const length = positions.value.length / positions.size;
|
|
7721
|
-
for (const key in properties.numericProps) {
|
|
7722
|
-
const sourceProp = properties.numericProps[key].value;
|
|
7723
|
-
const TypedArray = sourceProp.constructor;
|
|
7724
|
-
const destProp = new TypedArray(length);
|
|
7725
|
-
geom.numericProps[key] = { value: destProp, size: 1 };
|
|
7726
|
-
if (!indices) {
|
|
7727
|
-
for (let i = 0; i < length; i++) {
|
|
7728
|
-
const featureId = globalFeatureIds.value[i];
|
|
7729
|
-
destProp[i] = sourceProp[featureId];
|
|
7730
|
-
}
|
|
7731
|
-
} else {
|
|
7732
|
-
for (let i = 0; i < indices.length - 1; i++) {
|
|
7733
|
-
const startIndex = indices[i];
|
|
7734
|
-
const endIndex = indices[i + 1];
|
|
7735
|
-
const featureId = globalFeatureIds.value[startIndex];
|
|
7736
|
-
destProp.fill(sourceProp[featureId], startIndex, endIndex);
|
|
7737
|
-
}
|
|
7738
|
-
}
|
|
7739
|
-
}
|
|
7740
|
-
}
|
|
7741
|
-
return geometry;
|
|
7742
|
-
}
|
|
7743
|
-
var TilejsonPropType = {
|
|
7744
|
-
type: "object",
|
|
7745
|
-
value: null,
|
|
7746
|
-
validate: (value, propType) => propType.optional && value === null || typeof value === "object" && Array.isArray(value.tiles) && value.tiles.every((url) => typeof url === "string"),
|
|
7747
|
-
equal: (value1, value2) => {
|
|
7748
|
-
return (0, import_core4._deepEqual)(value1, value2, 2);
|
|
7749
|
-
},
|
|
7750
|
-
async: true
|
|
7751
|
-
};
|
|
8198
|
+
SpatialIndexTileLayer.defaultProps = defaultProps2;
|
|
7752
8199
|
|
|
7753
8200
|
// src/layers/h3-tile-layer.ts
|
|
7754
8201
|
var renderSubLayers = (props) => {
|
|
@@ -7756,19 +8203,19 @@ var __exports__ = (() => {
|
|
|
7756
8203
|
const { index: index2 } = props.tile;
|
|
7757
8204
|
if (!data || !data.length)
|
|
7758
8205
|
return null;
|
|
7759
|
-
return new
|
|
8206
|
+
return new import_geo_layers5.H3HexagonLayer(props, {
|
|
7760
8207
|
getHexagon: (d) => d.id,
|
|
7761
8208
|
centerHexagon: index2,
|
|
7762
8209
|
highPrecision: true
|
|
7763
8210
|
});
|
|
7764
8211
|
};
|
|
7765
|
-
var
|
|
8212
|
+
var defaultProps3 = {
|
|
7766
8213
|
data: TilejsonPropType,
|
|
7767
8214
|
tileSize: DEFAULT_TILE_SIZE
|
|
7768
8215
|
};
|
|
7769
|
-
var H3TileLayer = class extends
|
|
8216
|
+
var H3TileLayer = class extends import_core7.CompositeLayer {
|
|
7770
8217
|
initializeState() {
|
|
7771
|
-
|
|
8218
|
+
import_geo_layers5.H3HexagonLayer._checkH3Lib();
|
|
7772
8219
|
}
|
|
7773
8220
|
getLoadOptions() {
|
|
7774
8221
|
const loadOptions = super.getLoadOptions() || {};
|
|
@@ -7809,11 +8256,11 @@ var __exports__ = (() => {
|
|
|
7809
8256
|
}
|
|
7810
8257
|
};
|
|
7811
8258
|
H3TileLayer.layerName = "H3TileLayer";
|
|
7812
|
-
H3TileLayer.defaultProps =
|
|
8259
|
+
H3TileLayer.defaultProps = defaultProps3;
|
|
7813
8260
|
|
|
7814
8261
|
// src/layers/heatmap-tile-layer.ts
|
|
7815
|
-
var
|
|
7816
|
-
var
|
|
8262
|
+
var import_core10 = __toESM(require_core2(), 1);
|
|
8263
|
+
var import_layers2 = __toESM(require_layers(), 1);
|
|
7817
8264
|
|
|
7818
8265
|
// src/layers/heatmap.ts
|
|
7819
8266
|
var glsl = (s) => `${s}`;
|
|
@@ -7990,7 +8437,7 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
7990
8437
|
};
|
|
7991
8438
|
|
|
7992
8439
|
// src/layers/post-process-utils.ts
|
|
7993
|
-
var
|
|
8440
|
+
var import_core8 = __toESM(require_core2(), 1);
|
|
7994
8441
|
var TEXTURE_PROPS = {
|
|
7995
8442
|
format: "rgba8unorm",
|
|
7996
8443
|
mipmaps: false,
|
|
@@ -8007,7 +8454,7 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
8007
8454
|
}
|
|
8008
8455
|
return layer;
|
|
8009
8456
|
}
|
|
8010
|
-
var DrawCallbackLayer = class extends
|
|
8457
|
+
var DrawCallbackLayer = class extends import_core8.Layer {
|
|
8011
8458
|
initializeState() {
|
|
8012
8459
|
this.id = `draw-callback-${getPostProcessLayer(this).props.id}`;
|
|
8013
8460
|
}
|
|
@@ -8039,7 +8486,7 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
8039
8486
|
initializeState(context) {
|
|
8040
8487
|
super.initializeState(context);
|
|
8041
8488
|
this._createTextures();
|
|
8042
|
-
this.internalState.postProcess = new
|
|
8489
|
+
this.internalState.postProcess = new import_core8.PostProcessEffect(effect, this.props);
|
|
8043
8490
|
this.internalState.postProcess.setup(context);
|
|
8044
8491
|
}
|
|
8045
8492
|
updateState(params) {
|
|
@@ -8104,53 +8551,14 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
8104
8551
|
}
|
|
8105
8552
|
|
|
8106
8553
|
// src/layers/quadbin-tile-layer.ts
|
|
8107
|
-
var
|
|
8108
|
-
|
|
8109
|
-
// src/layers/quadbin-layer.ts
|
|
8110
|
-
var import_geo_layers4 = __toESM(require_geo_layers(), 1);
|
|
8111
|
-
|
|
8112
|
-
// ../../node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js
|
|
8113
|
-
var PI = Math.PI;
|
|
8114
|
-
var PI_4 = PI / 4;
|
|
8115
|
-
var DEGREES_TO_RADIANS = PI / 180;
|
|
8116
|
-
var RADIANS_TO_DEGREES = 180 / PI;
|
|
8117
|
-
var TILE_SIZE = 512;
|
|
8118
|
-
function worldToLngLat(xy) {
|
|
8119
|
-
const [x, y] = xy;
|
|
8120
|
-
const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
|
|
8121
|
-
const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
|
|
8122
|
-
return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
|
|
8123
|
-
}
|
|
8124
|
-
|
|
8125
|
-
// ../../node_modules/@math.gl/web-mercator/dist/get-bounds.js
|
|
8126
|
-
var DEGREES_TO_RADIANS2 = Math.PI / 180;
|
|
8127
|
-
|
|
8128
|
-
// src/layers/quadbin-utils.ts
|
|
8129
|
-
var TILE_SIZE2 = 512;
|
|
8130
|
-
function quadbinToOffset(quadbin) {
|
|
8131
|
-
const { x, y, z } = cellToTile(quadbin);
|
|
8132
|
-
const scale = TILE_SIZE2 / (1 << z);
|
|
8133
|
-
return [x * scale, TILE_SIZE2 - y * scale, scale];
|
|
8134
|
-
}
|
|
8135
|
-
function quadbinToWorldBounds(quadbin, coverage) {
|
|
8136
|
-
const [xOffset, yOffset, scale] = quadbinToOffset(quadbin);
|
|
8137
|
-
return [
|
|
8138
|
-
[xOffset, yOffset],
|
|
8139
|
-
[xOffset + coverage * scale, yOffset - coverage * scale]
|
|
8140
|
-
];
|
|
8141
|
-
}
|
|
8142
|
-
function getQuadbinPolygon(quadbin, coverage = 1) {
|
|
8143
|
-
const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);
|
|
8144
|
-
const [w, n] = worldToLngLat(topLeft);
|
|
8145
|
-
const [e, s] = worldToLngLat(bottomRight);
|
|
8146
|
-
return [e, n, e, s, w, s, w, n, e, n];
|
|
8147
|
-
}
|
|
8554
|
+
var import_core9 = __toESM(require_core2(), 1);
|
|
8148
8555
|
|
|
8149
8556
|
// src/layers/quadbin-layer.ts
|
|
8150
|
-
var
|
|
8557
|
+
var import_geo_layers6 = __toESM(require_geo_layers(), 1);
|
|
8558
|
+
var defaultProps4 = {
|
|
8151
8559
|
getQuadbin: { type: "accessor", value: (d) => d.quadbin }
|
|
8152
8560
|
};
|
|
8153
|
-
var QuadbinLayer = class extends
|
|
8561
|
+
var QuadbinLayer = class extends import_geo_layers6._GeoCellLayer {
|
|
8154
8562
|
indexToBounds() {
|
|
8155
8563
|
const { data, extruded, getQuadbin } = this.props;
|
|
8156
8564
|
const coverage = extruded ? 0.99 : 1;
|
|
@@ -8164,27 +8572,7 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
8164
8572
|
}
|
|
8165
8573
|
};
|
|
8166
8574
|
QuadbinLayer.layerName = "QuadbinLayer";
|
|
8167
|
-
QuadbinLayer.defaultProps =
|
|
8168
|
-
|
|
8169
|
-
// src/layers/quadbin-tileset-2d.ts
|
|
8170
|
-
var import_geo_layers5 = __toESM(require_geo_layers(), 1);
|
|
8171
|
-
var QuadbinTileset2D = class extends import_geo_layers5._Tileset2D {
|
|
8172
|
-
getTileIndices(opts) {
|
|
8173
|
-
return super.getTileIndices(opts).map(tileToCell).map((q) => ({ q, i: bigIntToHex(q) }));
|
|
8174
|
-
}
|
|
8175
|
-
getTileId({ q, i }) {
|
|
8176
|
-
return i || bigIntToHex(q);
|
|
8177
|
-
}
|
|
8178
|
-
getTileMetadata({ q }) {
|
|
8179
|
-
return super.getTileMetadata(cellToTile(q));
|
|
8180
|
-
}
|
|
8181
|
-
getTileZoom({ q }) {
|
|
8182
|
-
return Number(getResolution2(q));
|
|
8183
|
-
}
|
|
8184
|
-
getParentIndex({ q }) {
|
|
8185
|
-
return { q: cellToParent2(q) };
|
|
8186
|
-
}
|
|
8187
|
-
};
|
|
8575
|
+
QuadbinLayer.defaultProps = defaultProps4;
|
|
8188
8576
|
|
|
8189
8577
|
// src/layers/quadbin-tile-layer.ts
|
|
8190
8578
|
var renderSubLayers2 = (props) => {
|
|
@@ -8196,11 +8584,11 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
8196
8584
|
getQuadbin: isBigInt ? (d) => d.id : (d) => hexToBigInt(d.id)
|
|
8197
8585
|
});
|
|
8198
8586
|
};
|
|
8199
|
-
var
|
|
8587
|
+
var defaultProps5 = {
|
|
8200
8588
|
data: TilejsonPropType,
|
|
8201
8589
|
tileSize: DEFAULT_TILE_SIZE
|
|
8202
8590
|
};
|
|
8203
|
-
var QuadbinTileLayer = class extends
|
|
8591
|
+
var QuadbinTileLayer = class extends import_core9.CompositeLayer {
|
|
8204
8592
|
getLoadOptions() {
|
|
8205
8593
|
const loadOptions = super.getLoadOptions() || {};
|
|
8206
8594
|
const tileJSON = this.props.data;
|
|
@@ -8226,14 +8614,14 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
8226
8614
|
}
|
|
8227
8615
|
};
|
|
8228
8616
|
QuadbinTileLayer.layerName = "QuadbinTileLayer";
|
|
8229
|
-
QuadbinTileLayer.defaultProps =
|
|
8617
|
+
QuadbinTileLayer.defaultProps = defaultProps5;
|
|
8230
8618
|
|
|
8231
8619
|
// src/layers/heatmap-tile-layer.ts
|
|
8232
8620
|
function unitDensityForCell(cell) {
|
|
8233
|
-
const cellResolution = Number(
|
|
8621
|
+
const cellResolution = Number(getResolution(cell));
|
|
8234
8622
|
return Math.pow(4, cellResolution);
|
|
8235
8623
|
}
|
|
8236
|
-
var RTTSolidPolygonLayer = class extends RTTModifier(
|
|
8624
|
+
var RTTSolidPolygonLayer = class extends RTTModifier(import_layers2.SolidPolygonLayer) {
|
|
8237
8625
|
getShaders(type) {
|
|
8238
8626
|
const shaders = super.getShaders(type);
|
|
8239
8627
|
shaders.inject = {
|
|
@@ -8273,7 +8661,7 @@ uniform float densityFactor;
|
|
|
8273
8661
|
};
|
|
8274
8662
|
RTTSolidPolygonLayer.layerName = "RTTSolidPolygonLayer";
|
|
8275
8663
|
var PostProcessQuadbinTileLayer = PostProcessModifier(QuadbinTileLayer, heatmap);
|
|
8276
|
-
var
|
|
8664
|
+
var defaultProps6 = {
|
|
8277
8665
|
data: TilejsonPropType,
|
|
8278
8666
|
getWeight: { type: "accessor", value: 1 },
|
|
8279
8667
|
onMaxDensityChange: { type: "function", optional: true, value: null },
|
|
@@ -8281,7 +8669,7 @@ uniform float densityFactor;
|
|
|
8281
8669
|
intensity: { type: "number", value: 1 },
|
|
8282
8670
|
radiusPixels: { type: "number", min: 0, max: 100, value: 20 }
|
|
8283
8671
|
};
|
|
8284
|
-
var HeatmapTileLayer = class extends
|
|
8672
|
+
var HeatmapTileLayer = class extends import_core10.CompositeLayer {
|
|
8285
8673
|
initializeState() {
|
|
8286
8674
|
this.state = {
|
|
8287
8675
|
isLoaded: false,
|
|
@@ -8390,14 +8778,14 @@ uniform float densityFactor;
|
|
|
8390
8778
|
}
|
|
8391
8779
|
};
|
|
8392
8780
|
HeatmapTileLayer.layerName = "HeatmapTileLayer";
|
|
8393
|
-
HeatmapTileLayer.defaultProps =
|
|
8781
|
+
HeatmapTileLayer.defaultProps = defaultProps6;
|
|
8394
8782
|
var heatmap_tile_layer_default = HeatmapTileLayer;
|
|
8395
8783
|
|
|
8396
8784
|
// src/layers/point-label-layer.ts
|
|
8397
|
-
var
|
|
8398
|
-
var
|
|
8785
|
+
var import_core11 = __toESM(require_core2(), 1);
|
|
8786
|
+
var import_layers3 = __toESM(require_layers(), 1);
|
|
8399
8787
|
var [LEFT, TOP, RIGHT, BOTTOM] = [0, 1, 2, 3];
|
|
8400
|
-
var EnhancedTextBackgroundLayer = class extends
|
|
8788
|
+
var EnhancedTextBackgroundLayer = class extends import_layers3._TextBackgroundLayer {
|
|
8401
8789
|
getShaders() {
|
|
8402
8790
|
const shaders = super.getShaders();
|
|
8403
8791
|
let vs = shaders.vs;
|
|
@@ -8410,7 +8798,7 @@ uniform float densityFactor;
|
|
|
8410
8798
|
}
|
|
8411
8799
|
};
|
|
8412
8800
|
EnhancedTextBackgroundLayer.layerName = "EnhancedTextBackgroundLayer";
|
|
8413
|
-
var EnhancedTextLayer = class extends
|
|
8801
|
+
var EnhancedTextLayer = class extends import_layers3.TextLayer {
|
|
8414
8802
|
filterSubLayer({ layer, renderPass }) {
|
|
8415
8803
|
const background = layer.id.includes("primary-background");
|
|
8416
8804
|
if (renderPass === "collision") {
|
|
@@ -8420,12 +8808,12 @@ uniform float densityFactor;
|
|
|
8420
8808
|
}
|
|
8421
8809
|
};
|
|
8422
8810
|
EnhancedTextLayer.layerName = "EnhancedTextLayer";
|
|
8423
|
-
var
|
|
8424
|
-
...
|
|
8811
|
+
var defaultProps7 = {
|
|
8812
|
+
...import_layers3.TextLayer.defaultProps,
|
|
8425
8813
|
getRadius: { type: "accessor", value: 1 },
|
|
8426
8814
|
radiusScale: { type: "number", min: 0, value: 1 }
|
|
8427
8815
|
};
|
|
8428
|
-
var PointLabelLayer = class extends
|
|
8816
|
+
var PointLabelLayer = class extends import_core11.CompositeLayer {
|
|
8429
8817
|
calculatePixelOffset(secondary) {
|
|
8430
8818
|
const {
|
|
8431
8819
|
getTextAnchor: anchor,
|
|
@@ -8561,14 +8949,14 @@ uniform float densityFactor;
|
|
|
8561
8949
|
}
|
|
8562
8950
|
};
|
|
8563
8951
|
PointLabelLayer.layerName = "PointLabelLayer";
|
|
8564
|
-
PointLabelLayer.defaultProps =
|
|
8952
|
+
PointLabelLayer.defaultProps = defaultProps7;
|
|
8565
8953
|
|
|
8566
8954
|
// src/layers/raster-tile-layer.ts
|
|
8567
|
-
var
|
|
8955
|
+
var import_core13 = __toESM(require_core2(), 1);
|
|
8568
8956
|
|
|
8569
8957
|
// src/layers/raster-layer.ts
|
|
8570
|
-
var
|
|
8571
|
-
var
|
|
8958
|
+
var import_core12 = __toESM(require_core2(), 1);
|
|
8959
|
+
var import_layers4 = __toESM(require_layers(), 1);
|
|
8572
8960
|
|
|
8573
8961
|
// src/layers/raster-layer-vertex.glsl.ts
|
|
8574
8962
|
var raster_layer_vertex_glsl_default = `#version 300 es
|
|
@@ -8670,8 +9058,8 @@ void main(void) {
|
|
|
8670
9058
|
`;
|
|
8671
9059
|
|
|
8672
9060
|
// src/layers/raster-layer.ts
|
|
8673
|
-
var
|
|
8674
|
-
...
|
|
9061
|
+
var defaultProps8 = {
|
|
9062
|
+
...import_layers4.ColumnLayer.defaultProps,
|
|
8675
9063
|
extruded: false,
|
|
8676
9064
|
diskResolution: 4,
|
|
8677
9065
|
vertices: [
|
|
@@ -8681,7 +9069,7 @@ void main(void) {
|
|
|
8681
9069
|
[-0.5, 0.5]
|
|
8682
9070
|
]
|
|
8683
9071
|
};
|
|
8684
|
-
var RasterColumnLayer = class extends
|
|
9072
|
+
var RasterColumnLayer = class extends import_layers4.ColumnLayer {
|
|
8685
9073
|
getShaders() {
|
|
8686
9074
|
const shaders = super.getShaders();
|
|
8687
9075
|
const data = this.props.data;
|
|
@@ -8714,7 +9102,7 @@ void main(void) {
|
|
|
8714
9102
|
}
|
|
8715
9103
|
};
|
|
8716
9104
|
RasterColumnLayer.layerName = "RasterColumnLayer";
|
|
8717
|
-
var RasterLayer = class extends
|
|
9105
|
+
var RasterLayer = class extends import_core12.CompositeLayer {
|
|
8718
9106
|
renderLayers() {
|
|
8719
9107
|
const {
|
|
8720
9108
|
data,
|
|
@@ -8731,6 +9119,7 @@ void main(void) {
|
|
|
8731
9119
|
const [xOffset, yOffset, scale] = quadbinToOffset(tileIndex);
|
|
8732
9120
|
const offset = [xOffset, yOffset, scale / blockSize];
|
|
8733
9121
|
const CellLayer = this.getSubLayerClass("column", RasterColumnLayer);
|
|
9122
|
+
const { highlightedObjectIndex, highlightColor } = this.state;
|
|
8734
9123
|
return new CellLayer(
|
|
8735
9124
|
this.props,
|
|
8736
9125
|
this.getSubLayerProps({
|
|
@@ -8746,7 +9135,9 @@ void main(void) {
|
|
|
8746
9135
|
data,
|
|
8747
9136
|
length: blockSize * blockSize
|
|
8748
9137
|
},
|
|
8749
|
-
offset
|
|
9138
|
+
offset,
|
|
9139
|
+
highlightedObjectIndex,
|
|
9140
|
+
highlightColor
|
|
8750
9141
|
}
|
|
8751
9142
|
);
|
|
8752
9143
|
}
|
|
@@ -8761,22 +9152,50 @@ void main(void) {
|
|
|
8761
9152
|
return accessor({ properties: proxy }, info);
|
|
8762
9153
|
};
|
|
8763
9154
|
}
|
|
9155
|
+
getPickingInfo(params) {
|
|
9156
|
+
const info = super.getPickingInfo(params);
|
|
9157
|
+
if (info.index !== -1) {
|
|
9158
|
+
info.object = this.getSubLayerAccessor((x) => x)(void 0, {
|
|
9159
|
+
data: this.props,
|
|
9160
|
+
index: info.index
|
|
9161
|
+
});
|
|
9162
|
+
}
|
|
9163
|
+
return info;
|
|
9164
|
+
}
|
|
9165
|
+
_updateAutoHighlight(info) {
|
|
9166
|
+
const { highlightedObjectIndex } = this.state;
|
|
9167
|
+
let newHighlightedObjectIndex = -1;
|
|
9168
|
+
if (info.index !== -1) {
|
|
9169
|
+
newHighlightedObjectIndex = info.index;
|
|
9170
|
+
}
|
|
9171
|
+
if (highlightedObjectIndex !== newHighlightedObjectIndex) {
|
|
9172
|
+
let { highlightColor } = this.props;
|
|
9173
|
+
if (typeof highlightColor === "function") {
|
|
9174
|
+
highlightColor = highlightColor(info);
|
|
9175
|
+
}
|
|
9176
|
+
this.setState({
|
|
9177
|
+
highlightColor,
|
|
9178
|
+
highlightedObjectIndex: newHighlightedObjectIndex
|
|
9179
|
+
});
|
|
9180
|
+
}
|
|
9181
|
+
}
|
|
8764
9182
|
};
|
|
8765
9183
|
RasterLayer.layerName = "RasterLayer";
|
|
8766
|
-
RasterLayer.defaultProps =
|
|
9184
|
+
RasterLayer.defaultProps = defaultProps8;
|
|
8767
9185
|
|
|
8768
9186
|
// src/layers/raster-tile-layer.ts
|
|
9187
|
+
var import_geo_layers7 = __toESM(require_geo_layers(), 1);
|
|
8769
9188
|
var renderSubLayers3 = (props) => {
|
|
8770
9189
|
const tileIndex = props.tile?.index?.q;
|
|
8771
9190
|
if (!tileIndex)
|
|
8772
9191
|
return null;
|
|
8773
9192
|
return new RasterLayer(props, { tileIndex });
|
|
8774
9193
|
};
|
|
8775
|
-
var
|
|
9194
|
+
var defaultProps9 = {
|
|
8776
9195
|
data: TilejsonPropType,
|
|
8777
9196
|
tileSize: DEFAULT_TILE_SIZE
|
|
8778
9197
|
};
|
|
8779
|
-
var RasterTileLayer = class extends
|
|
9198
|
+
var RasterTileLayer = class extends import_core13.CompositeLayer {
|
|
8780
9199
|
getLoadOptions() {
|
|
8781
9200
|
const loadOptions = super.getLoadOptions() || {};
|
|
8782
9201
|
const tileJSON = this.props.data;
|
|
@@ -8789,7 +9208,7 @@ void main(void) {
|
|
|
8789
9208
|
return null;
|
|
8790
9209
|
const { tiles: data, minzoom: minZoom, maxzoom: maxZoom } = tileJSON;
|
|
8791
9210
|
return [
|
|
8792
|
-
new
|
|
9211
|
+
new import_geo_layers7.TileLayer(this.props, {
|
|
8793
9212
|
id: `raster-tile-layer-${this.props.id}`,
|
|
8794
9213
|
data,
|
|
8795
9214
|
TilesetClass: QuadbinTileset2D,
|
|
@@ -8802,10 +9221,10 @@ void main(void) {
|
|
|
8802
9221
|
}
|
|
8803
9222
|
};
|
|
8804
9223
|
RasterTileLayer.layerName = "RasterTileLayer";
|
|
8805
|
-
RasterTileLayer.defaultProps =
|
|
9224
|
+
RasterTileLayer.defaultProps = defaultProps9;
|
|
8806
9225
|
|
|
8807
9226
|
// src/layers/vector-tile-layer.ts
|
|
8808
|
-
var
|
|
9227
|
+
var import_core14 = __toESM(require_core(), 1);
|
|
8809
9228
|
|
|
8810
9229
|
// src/layers/schema/carto-properties-tile.ts
|
|
8811
9230
|
var TileReader4 = class {
|
|
@@ -8897,7 +9316,7 @@ void main(void) {
|
|
|
8897
9316
|
function parseCartoVectorTile(arrayBuffer, options) {
|
|
8898
9317
|
if (!arrayBuffer)
|
|
8899
9318
|
return null;
|
|
8900
|
-
const tile = parsePbf(arrayBuffer,
|
|
9319
|
+
const tile = parsePbf(arrayBuffer, TileReader);
|
|
8901
9320
|
if (tile.polygons && !tile.polygons.triangles) {
|
|
8902
9321
|
triangulate(tile.polygons);
|
|
8903
9322
|
}
|
|
@@ -8907,16 +9326,16 @@ void main(void) {
|
|
|
8907
9326
|
|
|
8908
9327
|
// src/layers/vector-tile-layer.ts
|
|
8909
9328
|
var import_extensions = __toESM(require_extensions(), 1);
|
|
8910
|
-
var
|
|
8911
|
-
var
|
|
8912
|
-
(0,
|
|
8913
|
-
var
|
|
8914
|
-
...
|
|
9329
|
+
var import_geo_layers8 = __toESM(require_geo_layers(), 1);
|
|
9330
|
+
var import_layers5 = __toESM(require_layers(), 1);
|
|
9331
|
+
(0, import_core14.registerLoaders)([carto_properties_tile_loader_default, carto_vector_tile_loader_default]);
|
|
9332
|
+
var defaultProps10 = {
|
|
9333
|
+
...import_geo_layers8.MVTLayer.defaultProps,
|
|
8915
9334
|
data: TilejsonPropType,
|
|
8916
9335
|
dataComparator: TilejsonPropType.equal,
|
|
8917
9336
|
tileSize: DEFAULT_TILE_SIZE
|
|
8918
9337
|
};
|
|
8919
|
-
var VectorTileLayer = class extends
|
|
9338
|
+
var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
8920
9339
|
constructor(...propObjects) {
|
|
8921
9340
|
super(...propObjects);
|
|
8922
9341
|
}
|
|
@@ -8943,7 +9362,7 @@ void main(void) {
|
|
|
8943
9362
|
async getTileData(tile) {
|
|
8944
9363
|
const tileJSON = this.props.data;
|
|
8945
9364
|
const { tiles: tiles2, properties_tiles } = tileJSON;
|
|
8946
|
-
const url = (0,
|
|
9365
|
+
const url = (0, import_geo_layers8._getURLFromTemplate)(tiles2, tile);
|
|
8947
9366
|
if (!url) {
|
|
8948
9367
|
return Promise.reject("Invalid URL");
|
|
8949
9368
|
}
|
|
@@ -8954,7 +9373,7 @@ void main(void) {
|
|
|
8954
9373
|
if (!properties_tiles) {
|
|
8955
9374
|
return await geometryFetch;
|
|
8956
9375
|
}
|
|
8957
|
-
const propertiesUrl = (0,
|
|
9376
|
+
const propertiesUrl = (0, import_geo_layers8._getURLFromTemplate)(properties_tiles, tile);
|
|
8958
9377
|
if (!propertiesUrl) {
|
|
8959
9378
|
return Promise.reject("Invalid properties URL");
|
|
8960
9379
|
}
|
|
@@ -8978,13 +9397,20 @@ void main(void) {
|
|
|
8978
9397
|
}
|
|
8979
9398
|
const tileBbox = props.tile.bbox;
|
|
8980
9399
|
const { west, south, east, north } = tileBbox;
|
|
9400
|
+
const clipProps = {
|
|
9401
|
+
extensions: [new import_extensions.ClipExtension(), ...props.extensions || []],
|
|
9402
|
+
clipBounds: [west, south, east, north]
|
|
9403
|
+
};
|
|
8981
9404
|
const subLayerProps = {
|
|
8982
9405
|
...props,
|
|
8983
9406
|
autoHighlight: false,
|
|
8984
|
-
|
|
8985
|
-
|
|
9407
|
+
_subLayerProps: {
|
|
9408
|
+
"polygons-fill": clipProps,
|
|
9409
|
+
"polygons-stroke": clipProps,
|
|
9410
|
+
linestrings: clipProps
|
|
9411
|
+
}
|
|
8986
9412
|
};
|
|
8987
|
-
const subLayer = new
|
|
9413
|
+
const subLayer = new import_layers5.GeoJsonLayer(subLayerProps);
|
|
8988
9414
|
return subLayer;
|
|
8989
9415
|
}
|
|
8990
9416
|
_isWGS84() {
|
|
@@ -8994,7 +9420,7 @@ void main(void) {
|
|
|
8994
9420
|
}
|
|
8995
9421
|
};
|
|
8996
9422
|
VectorTileLayer.layerName = "VectorTileLayer";
|
|
8997
|
-
VectorTileLayer.defaultProps =
|
|
9423
|
+
VectorTileLayer.defaultProps = defaultProps10;
|
|
8998
9424
|
|
|
8999
9425
|
// src/api/carto-api-error.ts
|
|
9000
9426
|
var CartoAPIError = class extends Error {
|
|
@@ -10893,9 +11319,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
10893
11319
|
};
|
|
10894
11320
|
return scale;
|
|
10895
11321
|
}
|
|
10896
|
-
function
|
|
11322
|
+
function log4() {
|
|
10897
11323
|
const scale = loggish(transformer()).domain([1, 10]);
|
|
10898
|
-
scale.copy = () => copy(scale,
|
|
11324
|
+
scale.copy = () => copy(scale, log4()).base(scale.base());
|
|
10899
11325
|
initRange.apply(scale, arguments);
|
|
10900
11326
|
return scale;
|
|
10901
11327
|
}
|
|
@@ -12435,7 +12861,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12435
12861
|
function getPalette(name, numCategories) {
|
|
12436
12862
|
const palette = cartocolor_exports[name];
|
|
12437
12863
|
let paletteIndex = numCategories;
|
|
12438
|
-
|
|
12864
|
+
assert2(palette, `Palette "${name}" not found. Expected a CARTOColors string`);
|
|
12439
12865
|
const palettesColorVariants = Object.keys(palette).filter((p) => p !== "tags").map(Number);
|
|
12440
12866
|
const longestPaletteIndex = Math.max(...palettesColorVariants);
|
|
12441
12867
|
const smallestPaletteIndex = Math.min(...palettesColorVariants);
|
|
@@ -12474,7 +12900,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12474
12900
|
return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16), 255];
|
|
12475
12901
|
}
|
|
12476
12902
|
result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex2);
|
|
12477
|
-
|
|
12903
|
+
assert2(result, `Hexadecimal color "${hex2}" was not parsed correctly`);
|
|
12478
12904
|
return [
|
|
12479
12905
|
parseInt(result[1], 16),
|
|
12480
12906
|
parseInt(result[2], 16),
|
|
@@ -12486,8 +12912,8 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12486
12912
|
// src/style/utils.ts
|
|
12487
12913
|
var ALLOWED_ATTR_TYPES = Object.freeze(["function", "string"]);
|
|
12488
12914
|
function getAttrValue(attr, d) {
|
|
12489
|
-
|
|
12490
|
-
|
|
12915
|
+
assert2(typeof d === "object", 'Expected "data" to be an object');
|
|
12916
|
+
assert2(ALLOWED_ATTR_TYPES.includes(typeof attr), 'Expected "attr" to be a function or string');
|
|
12491
12917
|
if (typeof attr === "function") {
|
|
12492
12918
|
return attr(d);
|
|
12493
12919
|
}
|
|
@@ -12501,7 +12927,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12501
12927
|
colors = DEFAULT_PALETTE,
|
|
12502
12928
|
nullColor = NULL_COLOR
|
|
12503
12929
|
}) {
|
|
12504
|
-
|
|
12930
|
+
assert2(Array.isArray(domain), 'Expected "domain" to be an array of numbers');
|
|
12505
12931
|
const palette = typeof colors === "string" ? getPalette(colors, domain.length + 1) : colors;
|
|
12506
12932
|
const color2 = threshold().domain(domain).range(palette);
|
|
12507
12933
|
return (d) => {
|
|
@@ -12518,7 +12944,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12518
12944
|
nullColor = NULL_COLOR,
|
|
12519
12945
|
othersColor = OTHERS_COLOR
|
|
12520
12946
|
}) {
|
|
12521
|
-
|
|
12947
|
+
assert2(Array.isArray(domain), 'Expected "domain" to be an array of numbers or strings');
|
|
12522
12948
|
const colorsByCategory = {};
|
|
12523
12949
|
const palette = typeof colors === "string" ? getPalette(colors, domain.length) : colors;
|
|
12524
12950
|
for (const [i, c] of domain.entries()) {
|
|
@@ -12537,7 +12963,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12537
12963
|
colors = DEFAULT_PALETTE,
|
|
12538
12964
|
nullColor = NULL_COLOR
|
|
12539
12965
|
}) {
|
|
12540
|
-
|
|
12966
|
+
assert2(Array.isArray(domain), 'Expected "domain" to be an array of numbers');
|
|
12541
12967
|
const palette = typeof colors === "string" ? getPalette(colors, domain.length) : colors;
|
|
12542
12968
|
const color2 = linear2().domain(domain).range(palette);
|
|
12543
12969
|
return (d) => {
|
|
@@ -12592,10 +13018,10 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12592
13018
|
}
|
|
12593
13019
|
|
|
12594
13020
|
// src/api/request-with-parameters.ts
|
|
12595
|
-
var
|
|
13021
|
+
var import_core15 = __toESM(require_core2(), 1);
|
|
12596
13022
|
var DEFAULT_PARAMETERS = {
|
|
12597
13023
|
v: V3_MINOR_VERSION,
|
|
12598
|
-
deckglVersion:
|
|
13024
|
+
deckglVersion: import_core15.VERSION
|
|
12599
13025
|
};
|
|
12600
13026
|
var DEFAULT_HEADERS = {
|
|
12601
13027
|
Accept: "application/json",
|
|
@@ -12757,7 +13183,8 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12757
13183
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
12758
13184
|
sqlQuery,
|
|
12759
13185
|
spatialDataColumn = "h3",
|
|
12760
|
-
queryParameters
|
|
13186
|
+
queryParameters,
|
|
13187
|
+
filters
|
|
12761
13188
|
} = options;
|
|
12762
13189
|
const urlParameters = {
|
|
12763
13190
|
aggregationExp,
|
|
@@ -12771,6 +13198,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12771
13198
|
if (queryParameters) {
|
|
12772
13199
|
urlParameters.queryParameters = queryParameters;
|
|
12773
13200
|
}
|
|
13201
|
+
if (filters) {
|
|
13202
|
+
urlParameters.filters = filters;
|
|
13203
|
+
}
|
|
12774
13204
|
return baseSource("query", options, urlParameters);
|
|
12775
13205
|
};
|
|
12776
13206
|
|
|
@@ -12780,7 +13210,8 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12780
13210
|
aggregationExp,
|
|
12781
13211
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
12782
13212
|
spatialDataColumn = "h3",
|
|
12783
|
-
tableName
|
|
13213
|
+
tableName,
|
|
13214
|
+
filters
|
|
12784
13215
|
} = options;
|
|
12785
13216
|
const urlParameters = {
|
|
12786
13217
|
aggregationExp,
|
|
@@ -12791,6 +13222,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12791
13222
|
if (aggregationResLevel) {
|
|
12792
13223
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
12793
13224
|
}
|
|
13225
|
+
if (filters) {
|
|
13226
|
+
urlParameters.filters = filters;
|
|
13227
|
+
}
|
|
12794
13228
|
return baseSource("table", options, urlParameters);
|
|
12795
13229
|
};
|
|
12796
13230
|
|
|
@@ -12818,7 +13252,8 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12818
13252
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
12819
13253
|
sqlQuery,
|
|
12820
13254
|
spatialDataColumn = "quadbin",
|
|
12821
|
-
queryParameters
|
|
13255
|
+
queryParameters,
|
|
13256
|
+
filters
|
|
12822
13257
|
} = options;
|
|
12823
13258
|
const urlParameters = {
|
|
12824
13259
|
aggregationExp,
|
|
@@ -12832,6 +13267,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12832
13267
|
if (queryParameters) {
|
|
12833
13268
|
urlParameters.queryParameters = queryParameters;
|
|
12834
13269
|
}
|
|
13270
|
+
if (filters) {
|
|
13271
|
+
urlParameters.filters = filters;
|
|
13272
|
+
}
|
|
12835
13273
|
return baseSource("query", options, urlParameters);
|
|
12836
13274
|
};
|
|
12837
13275
|
|
|
@@ -12841,7 +13279,8 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12841
13279
|
aggregationExp,
|
|
12842
13280
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
12843
13281
|
spatialDataColumn = "quadbin",
|
|
12844
|
-
tableName
|
|
13282
|
+
tableName,
|
|
13283
|
+
filters
|
|
12845
13284
|
} = options;
|
|
12846
13285
|
const urlParameters = {
|
|
12847
13286
|
aggregationExp,
|
|
@@ -12852,6 +13291,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12852
13291
|
if (aggregationResLevel) {
|
|
12853
13292
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
12854
13293
|
}
|
|
13294
|
+
if (filters) {
|
|
13295
|
+
urlParameters.filters = filters;
|
|
13296
|
+
}
|
|
12855
13297
|
return baseSource("table", options, urlParameters);
|
|
12856
13298
|
};
|
|
12857
13299
|
|
|
@@ -12922,17 +13364,17 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12922
13364
|
};
|
|
12923
13365
|
|
|
12924
13366
|
// src/api/parse-map.ts
|
|
12925
|
-
var
|
|
13367
|
+
var import_core16 = __toESM(require_core2(), 1);
|
|
12926
13368
|
|
|
12927
13369
|
// src/api/layer-map.ts
|
|
12928
13370
|
var import_moment_timezone = __toESM(require_moment_timezone2(), 1);
|
|
12929
13371
|
var import_aggregation_layers = __toESM(require_aggregation_layers(), 1);
|
|
12930
|
-
var
|
|
12931
|
-
var
|
|
13372
|
+
var import_layers6 = __toESM(require_layers(), 1);
|
|
13373
|
+
var import_geo_layers9 = __toESM(require_geo_layers(), 1);
|
|
12932
13374
|
var SCALE_FUNCS = {
|
|
12933
13375
|
linear: linear2,
|
|
12934
13376
|
ordinal,
|
|
12935
|
-
log:
|
|
13377
|
+
log: log4,
|
|
12936
13378
|
point,
|
|
12937
13379
|
quantile: quantile2,
|
|
12938
13380
|
quantize,
|
|
@@ -12962,6 +13404,15 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12962
13404
|
stddev: deviation,
|
|
12963
13405
|
variance
|
|
12964
13406
|
};
|
|
13407
|
+
var TILE_LAYER_TYPE_TO_LAYER = {
|
|
13408
|
+
clusterTile: ClusterTileLayer,
|
|
13409
|
+
h3: H3TileLayer,
|
|
13410
|
+
heatmapTile: heatmap_tile_layer_default,
|
|
13411
|
+
mvt: VectorTileLayer,
|
|
13412
|
+
quadbin: QuadbinTileLayer,
|
|
13413
|
+
raster: RasterTileLayer,
|
|
13414
|
+
tileset: VectorTileLayer
|
|
13415
|
+
};
|
|
12965
13416
|
var hexToRGBA = (c) => {
|
|
12966
13417
|
const { r, g, b, opacity } = rgb(c);
|
|
12967
13418
|
return [r, g, b, 255 * opacity];
|
|
@@ -13000,7 +13451,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13000
13451
|
elevationPercentile: ["elevationLowerPercentile", "elevationUpperPercentile"],
|
|
13001
13452
|
percentile: ["lowerPercentile", "upperPercentile"]
|
|
13002
13453
|
};
|
|
13003
|
-
var
|
|
13454
|
+
var defaultProps11 = {
|
|
13004
13455
|
lineMiterLimit: 2,
|
|
13005
13456
|
lineWidthUnits: "pixels",
|
|
13006
13457
|
pointRadiusUnits: "pixels",
|
|
@@ -13015,15 +13466,15 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13015
13466
|
if (config.visConfig?.customMarkers) {
|
|
13016
13467
|
basePropMap = mergePropMaps(sharedPropMap, customMarkersPropsMap);
|
|
13017
13468
|
}
|
|
13018
|
-
if (type
|
|
13019
|
-
return getTileLayer(dataset, basePropMap);
|
|
13469
|
+
if (TILE_LAYER_TYPE_TO_LAYER[type]) {
|
|
13470
|
+
return getTileLayer(dataset, basePropMap, type);
|
|
13020
13471
|
}
|
|
13021
13472
|
const geoColumn = dataset?.geoColumn;
|
|
13022
13473
|
const getPosition = (d) => d[geoColumn].coordinates;
|
|
13023
13474
|
const hexagonId = config.columns?.hex_id;
|
|
13024
13475
|
const layerTypeDefs = {
|
|
13025
13476
|
point: {
|
|
13026
|
-
Layer:
|
|
13477
|
+
Layer: import_layers6.GeoJsonLayer,
|
|
13027
13478
|
propMap: {
|
|
13028
13479
|
columns: {
|
|
13029
13480
|
altitude: (x) => ({ parameters: { depthTest: Boolean(x) } })
|
|
@@ -13032,7 +13483,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13032
13483
|
}
|
|
13033
13484
|
},
|
|
13034
13485
|
geojson: {
|
|
13035
|
-
Layer:
|
|
13486
|
+
Layer: import_layers6.GeoJsonLayer
|
|
13036
13487
|
},
|
|
13037
13488
|
grid: {
|
|
13038
13489
|
Layer: import_aggregation_layers.CPUGridLayer,
|
|
@@ -13050,42 +13501,26 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13050
13501
|
defaultProps: { getPosition }
|
|
13051
13502
|
},
|
|
13052
13503
|
hexagonId: {
|
|
13053
|
-
Layer:
|
|
13504
|
+
Layer: import_geo_layers9.H3HexagonLayer,
|
|
13054
13505
|
propMap: { visConfig: { coverage: "coverage" } },
|
|
13055
13506
|
defaultProps: { getHexagon: (d) => d[hexagonId], stroked: false }
|
|
13056
13507
|
}
|
|
13057
13508
|
};
|
|
13058
13509
|
const layer = layerTypeDefs[type];
|
|
13059
|
-
|
|
13510
|
+
assert2(layer, `Unsupported layer type: ${type}`);
|
|
13060
13511
|
return {
|
|
13061
13512
|
...layer,
|
|
13062
13513
|
propMap: mergePropMaps(basePropMap, layer.propMap),
|
|
13063
|
-
defaultProps: { ...
|
|
13514
|
+
defaultProps: { ...defaultProps11, ...layer.defaultProps }
|
|
13064
13515
|
};
|
|
13065
13516
|
}
|
|
13066
|
-
function
|
|
13067
|
-
|
|
13068
|
-
return RasterTileLayer;
|
|
13069
|
-
}
|
|
13070
|
-
if (scheme === "h3") {
|
|
13071
|
-
return H3TileLayer;
|
|
13072
|
-
}
|
|
13073
|
-
if (scheme === "quadbin") {
|
|
13074
|
-
return QuadbinTileLayer;
|
|
13075
|
-
}
|
|
13076
|
-
return VectorTileLayer;
|
|
13077
|
-
}
|
|
13078
|
-
function getTileLayer(dataset, basePropMap) {
|
|
13079
|
-
const {
|
|
13080
|
-
aggregationExp,
|
|
13081
|
-
aggregationResLevel,
|
|
13082
|
-
data: { scheme }
|
|
13083
|
-
} = dataset;
|
|
13517
|
+
function getTileLayer(dataset, basePropMap, type) {
|
|
13518
|
+
const { aggregationExp, aggregationResLevel } = dataset;
|
|
13084
13519
|
return {
|
|
13085
|
-
Layer:
|
|
13520
|
+
Layer: TILE_LAYER_TYPE_TO_LAYER[type] || VectorTileLayer,
|
|
13086
13521
|
propMap: basePropMap,
|
|
13087
13522
|
defaultProps: {
|
|
13088
|
-
...
|
|
13523
|
+
...defaultProps11,
|
|
13089
13524
|
...aggregationExp && { aggregationExp },
|
|
13090
13525
|
...aggregationResLevel && { aggregationResLevel },
|
|
13091
13526
|
uniqueIdProperty: "geoid"
|
|
@@ -13284,7 +13719,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13284
13719
|
var collisionFilterExtension = new import_extensions2.CollisionFilterExtension();
|
|
13285
13720
|
function parseMap(json) {
|
|
13286
13721
|
const { keplerMapConfig, datasets, token } = json;
|
|
13287
|
-
|
|
13722
|
+
assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
|
|
13288
13723
|
const { mapState, mapStyle } = keplerMapConfig.config;
|
|
13289
13724
|
const { layers, layerBlending, interactionConfig } = keplerMapConfig.config.visState;
|
|
13290
13725
|
return {
|
|
@@ -13300,15 +13735,15 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13300
13735
|
try {
|
|
13301
13736
|
const { dataId } = config;
|
|
13302
13737
|
const dataset = datasets.find((d) => d.id === dataId);
|
|
13303
|
-
|
|
13738
|
+
assert2(dataset, `No dataset matching dataId: ${dataId}`);
|
|
13304
13739
|
const { data } = dataset;
|
|
13305
|
-
|
|
13306
|
-
const { Layer:
|
|
13740
|
+
assert2(data, `No data loaded for dataId: ${dataId}`);
|
|
13741
|
+
const { Layer: Layer10, propMap, defaultProps: defaultProps12 } = getLayer(type, config, dataset);
|
|
13307
13742
|
const styleProps = createStyleProps(config, propMap);
|
|
13308
|
-
return new
|
|
13743
|
+
return new Layer10({
|
|
13309
13744
|
id: id4,
|
|
13310
13745
|
data,
|
|
13311
|
-
...
|
|
13746
|
+
...defaultProps12,
|
|
13312
13747
|
...createInteractionProps(interactionConfig),
|
|
13313
13748
|
...styleProps,
|
|
13314
13749
|
...createChannelProps(id4, type, config, visualChannels, data),
|
|
@@ -13316,7 +13751,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13316
13751
|
...createLoadOptions(token)
|
|
13317
13752
|
});
|
|
13318
13753
|
} catch (e) {
|
|
13319
|
-
|
|
13754
|
+
import_core16.log.error(e.message)();
|
|
13320
13755
|
return void 0;
|
|
13321
13756
|
}
|
|
13322
13757
|
})
|
|
@@ -13759,12 +14194,12 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13759
14194
|
autoRefresh,
|
|
13760
14195
|
onNewData
|
|
13761
14196
|
}) {
|
|
13762
|
-
|
|
13763
|
-
|
|
14197
|
+
assert2(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
|
|
14198
|
+
assert2(apiBaseUrl, "Must define apiBaseUrl");
|
|
13764
14199
|
if (autoRefresh || onNewData) {
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
14200
|
+
assert2(onNewData, "Must define `onNewData` when using autoRefresh");
|
|
14201
|
+
assert2(typeof onNewData === "function", "`onNewData` must be a function");
|
|
14202
|
+
assert2(
|
|
13768
14203
|
typeof autoRefresh === "number" && autoRefresh > 0,
|
|
13769
14204
|
"`autoRefresh` must be a positive number"
|
|
13770
14205
|
);
|
|
@@ -13852,6 +14287,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13852
14287
|
|
|
13853
14288
|
// src/index.ts
|
|
13854
14289
|
var CARTO_LAYERS = {
|
|
14290
|
+
ClusterTileLayer,
|
|
13855
14291
|
H3TileLayer,
|
|
13856
14292
|
HeatmapTileLayer: heatmap_tile_layer_default,
|
|
13857
14293
|
_PointLabelLayer: PointLabelLayer,
|
|
@@ -13876,9 +14312,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13876
14312
|
|
|
13877
14313
|
// ../layers/bundle/peer-dependency.ts
|
|
13878
14314
|
var peer_dependency_exports = {};
|
|
13879
|
-
var
|
|
14315
|
+
var import_layers7 = __toESM(require_layers(), 1);
|
|
13880
14316
|
__reExport(peer_dependency_exports, __toESM(require_layers(), 1));
|
|
13881
|
-
if (!
|
|
14317
|
+
if (!import_layers7.GeoJsonLayer) {
|
|
13882
14318
|
throw new Error("@deck.gl/layers is not found");
|
|
13883
14319
|
}
|
|
13884
14320
|
|