@deck.gl/carto 9.0.23 → 9.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +1982 -1606
- package/dist/index.cjs +747 -517
- 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/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/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.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/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/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ __export(dist_exports, {
|
|
|
30
30
|
CARTO_LAYERS: () => CARTO_LAYERS,
|
|
31
31
|
CARTO_SOURCES: () => CARTO_SOURCES,
|
|
32
32
|
CartoAPIError: () => CartoAPIError,
|
|
33
|
+
ClusterTileLayer: () => ClusterTileLayer,
|
|
33
34
|
H3TileLayer: () => H3TileLayer,
|
|
34
35
|
HeatmapTileLayer: () => heatmap_tile_layer_default,
|
|
35
36
|
QuadbinTileLayer: () => QuadbinTileLayer,
|
|
@@ -63,109 +64,175 @@ __export(dist_exports, {
|
|
|
63
64
|
});
|
|
64
65
|
module.exports = __toCommonJS(dist_exports);
|
|
65
66
|
|
|
66
|
-
// dist/layers/
|
|
67
|
+
// dist/layers/cluster-tile-layer.js
|
|
68
|
+
var import_layers = require("@deck.gl/layers");
|
|
69
|
+
var import_geo_layers2 = require("@deck.gl/geo-layers");
|
|
70
|
+
var import_core4 = require("@loaders.gl/core");
|
|
71
|
+
var import_gis = require("@loaders.gl/gis");
|
|
67
72
|
var import_core5 = require("@deck.gl/core");
|
|
68
|
-
var import_geo_layers3 = require("@deck.gl/geo-layers");
|
|
69
73
|
|
|
70
|
-
// dist/layers/
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
74
|
+
// dist/layers/cluster-utils.js
|
|
75
|
+
var import_quadbin = require("quadbin");
|
|
76
|
+
function aggregateTile(tile, aggregationLevels, properties = [], getPosition, getWeight) {
|
|
77
|
+
if (!tile.content)
|
|
78
|
+
return;
|
|
79
|
+
if (!tile.userData)
|
|
80
|
+
tile.userData = {};
|
|
81
|
+
if (tile.userData[aggregationLevels])
|
|
82
|
+
return;
|
|
83
|
+
const out = {};
|
|
84
|
+
for (const cell of tile.content) {
|
|
85
|
+
let id4 = cell.id;
|
|
86
|
+
const position = typeof getPosition === "function" ? getPosition(cell, {}) : getPosition;
|
|
87
|
+
for (let i = 0; i < aggregationLevels - 1; i++) {
|
|
88
|
+
id4 = (0, import_quadbin.cellToParent)(id4);
|
|
89
|
+
}
|
|
90
|
+
const parentId = Number(id4);
|
|
91
|
+
if (!(parentId in out)) {
|
|
92
|
+
out[parentId] = { id: id4, count: 0, position: [0, 0] };
|
|
93
|
+
for (const { name, aggregation } of properties) {
|
|
94
|
+
if (aggregation === "any") {
|
|
95
|
+
out[parentId][name] = cell.properties[name];
|
|
96
|
+
} else {
|
|
97
|
+
out[parentId][name] = 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const prevTotalW = out[parentId].count;
|
|
102
|
+
out[parentId].count += typeof getWeight === "function" ? getWeight(cell, {}) : getWeight;
|
|
103
|
+
const totalW = out[parentId].count;
|
|
104
|
+
const W = totalW - prevTotalW;
|
|
105
|
+
out[parentId].position[0] = (prevTotalW * out[parentId].position[0] + W * position[0]) / totalW;
|
|
106
|
+
out[parentId].position[1] = (prevTotalW * out[parentId].position[1] + W * position[1]) / totalW;
|
|
107
|
+
for (const { name, aggregation } of properties) {
|
|
108
|
+
const prevValue = out[parentId][name];
|
|
109
|
+
const value = cell.properties[name];
|
|
110
|
+
if (aggregation === "average") {
|
|
111
|
+
out[parentId][name] = (prevTotalW * prevValue + W * value) / totalW;
|
|
112
|
+
} else if (aggregation === "count" || aggregation === "sum") {
|
|
113
|
+
out[parentId][name] = prevValue + value;
|
|
114
|
+
} else if (aggregation === "max") {
|
|
115
|
+
out[parentId][name] = Math.max(prevValue, value);
|
|
116
|
+
} else if (aggregation === "min") {
|
|
117
|
+
out[parentId][name] = Math.min(prevValue, value);
|
|
118
|
+
}
|
|
101
119
|
}
|
|
102
|
-
return [...new Set(h3Indices)];
|
|
103
120
|
}
|
|
104
|
-
|
|
105
|
-
[north, east],
|
|
106
|
-
[south, east],
|
|
107
|
-
[south, west],
|
|
108
|
-
[north, west],
|
|
109
|
-
[north, east]
|
|
110
|
-
];
|
|
111
|
-
return (0, import_h3_js.polygonToCells)(polygon, resolution);
|
|
112
|
-
}
|
|
113
|
-
function tileToBoundingBox(index) {
|
|
114
|
-
const coordinates = (0, import_h3_js.cellToBoundary)(index);
|
|
115
|
-
const latitudes = coordinates.map((c) => c[0]);
|
|
116
|
-
const longitudes = coordinates.map((c) => c[1]);
|
|
117
|
-
const west = Math.min(...longitudes);
|
|
118
|
-
const south = Math.min(...latitudes);
|
|
119
|
-
const east = Math.max(...longitudes);
|
|
120
|
-
const north = Math.max(...latitudes);
|
|
121
|
-
return { west, south, east, north };
|
|
121
|
+
tile.userData[aggregationLevels] = Object.values(out);
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
function extractAggregationProperties(tile) {
|
|
124
|
+
const properties = [];
|
|
125
|
+
const validAggregations = ["any", "average", "count", "min", "max", "sum"];
|
|
126
|
+
for (const name of Object.keys(tile.content[0].properties)) {
|
|
127
|
+
let aggregation = name.split("_").pop().toLowerCase();
|
|
128
|
+
if (!validAggregations.includes(aggregation)) {
|
|
129
|
+
aggregation = "any";
|
|
130
|
+
}
|
|
131
|
+
properties.push({ name, aggregation });
|
|
132
|
+
}
|
|
133
|
+
return properties;
|
|
129
134
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return [];
|
|
135
|
+
function computeAggregationStats(data, properties) {
|
|
136
|
+
const stats = {};
|
|
137
|
+
for (const { name, aggregation } of properties) {
|
|
138
|
+
stats[name] = { min: Infinity, max: -Infinity };
|
|
139
|
+
if (aggregation !== "any") {
|
|
140
|
+
for (const d of data) {
|
|
141
|
+
stats[name].min = Math.min(stats[name].min, d[name]);
|
|
142
|
+
stats[name].max = Math.max(stats[name].max, d[name]);
|
|
143
|
+
}
|
|
140
144
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
}
|
|
146
|
+
return stats;
|
|
147
|
+
}
|
|
148
|
+
var EMPTY_UINT16ARRAY = new Uint16Array();
|
|
149
|
+
var EMPTY_BINARY_PROPS = {
|
|
150
|
+
positions: { value: new Float32Array(), size: 2 },
|
|
151
|
+
properties: [],
|
|
152
|
+
numericProps: {},
|
|
153
|
+
featureIds: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
154
|
+
globalFeatureIds: { value: EMPTY_UINT16ARRAY, size: 1 }
|
|
155
|
+
};
|
|
156
|
+
function clustersToBinary(data) {
|
|
157
|
+
const positions = new Float32Array(data.length * 2);
|
|
158
|
+
const featureIds = new Uint16Array(data.length);
|
|
159
|
+
for (let i = 0; i < data.length; i++) {
|
|
160
|
+
positions.set(data[i].position, 2 * i);
|
|
161
|
+
featureIds[i] = i;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
shape: "binary-feature-collection",
|
|
165
|
+
points: {
|
|
166
|
+
type: "Point",
|
|
167
|
+
positions: { value: positions, size: 2 },
|
|
168
|
+
properties: data,
|
|
169
|
+
numericProps: {},
|
|
170
|
+
featureIds: { value: featureIds, size: 1 },
|
|
171
|
+
globalFeatureIds: { value: featureIds, size: 1 }
|
|
172
|
+
},
|
|
173
|
+
lines: {
|
|
174
|
+
type: "LineString",
|
|
175
|
+
pathIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
176
|
+
...EMPTY_BINARY_PROPS
|
|
177
|
+
},
|
|
178
|
+
polygons: {
|
|
179
|
+
type: "Polygon",
|
|
180
|
+
polygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
181
|
+
primitivePolygonIndices: { value: EMPTY_UINT16ARRAY, size: 1 },
|
|
182
|
+
...EMPTY_BINARY_PROPS
|
|
148
183
|
}
|
|
149
|
-
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// dist/constants.js
|
|
188
|
+
var DEFAULT_TILE_SIZE = 512;
|
|
189
|
+
var DEFAULT_TILE_RESOLUTION = 0.5;
|
|
190
|
+
var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
191
|
+
var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
192
|
+
|
|
193
|
+
// dist/layers/quadbin-tileset-2d.js
|
|
194
|
+
var import_geo_layers = require("@deck.gl/geo-layers");
|
|
195
|
+
var import_quadbin2 = require("quadbin");
|
|
196
|
+
var QuadbinTileset2D = class extends import_geo_layers._Tileset2D {
|
|
197
|
+
getTileIndices(opts) {
|
|
198
|
+
return super.getTileIndices(opts).map(import_quadbin2.tileToCell).map((q) => ({ q, i: (0, import_quadbin2.bigIntToHex)(q) }));
|
|
150
199
|
}
|
|
151
|
-
getTileId({ i }) {
|
|
152
|
-
return i;
|
|
200
|
+
getTileId({ q, i }) {
|
|
201
|
+
return i || (0, import_quadbin2.bigIntToHex)(q);
|
|
153
202
|
}
|
|
154
|
-
getTileMetadata({
|
|
155
|
-
return
|
|
203
|
+
getTileMetadata({ q }) {
|
|
204
|
+
return super.getTileMetadata((0, import_quadbin2.cellToTile)(q));
|
|
156
205
|
}
|
|
157
|
-
getTileZoom({
|
|
158
|
-
return (0,
|
|
206
|
+
getTileZoom({ q }) {
|
|
207
|
+
return Number((0, import_quadbin2.getResolution)(q));
|
|
159
208
|
}
|
|
160
|
-
getParentIndex(
|
|
161
|
-
|
|
162
|
-
const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
|
|
163
|
-
return { i };
|
|
209
|
+
getParentIndex({ q }) {
|
|
210
|
+
return { q: (0, import_quadbin2.cellToParent)(q) };
|
|
164
211
|
}
|
|
165
212
|
};
|
|
166
213
|
|
|
167
|
-
// dist/layers/
|
|
168
|
-
var
|
|
214
|
+
// dist/layers/quadbin-utils.js
|
|
215
|
+
var import_web_mercator = require("@math.gl/web-mercator");
|
|
216
|
+
var import_quadbin3 = require("quadbin");
|
|
217
|
+
var TILE_SIZE = 512;
|
|
218
|
+
function quadbinToOffset(quadbin) {
|
|
219
|
+
const { x, y, z } = (0, import_quadbin3.cellToTile)(quadbin);
|
|
220
|
+
const scale = TILE_SIZE / (1 << z);
|
|
221
|
+
return [x * scale, TILE_SIZE - y * scale, scale];
|
|
222
|
+
}
|
|
223
|
+
function quadbinToWorldBounds(quadbin, coverage) {
|
|
224
|
+
const [xOffset, yOffset, scale] = quadbinToOffset(quadbin);
|
|
225
|
+
return [
|
|
226
|
+
[xOffset, yOffset],
|
|
227
|
+
[xOffset + coverage * scale, yOffset - coverage * scale]
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
function getQuadbinPolygon(quadbin, coverage = 1) {
|
|
231
|
+
const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);
|
|
232
|
+
const [w, n] = (0, import_web_mercator.worldToLngLat)(topLeft);
|
|
233
|
+
const [e, s] = (0, import_web_mercator.worldToLngLat)(bottomRight);
|
|
234
|
+
return [e, n, e, s, w, s, w, n, e, n];
|
|
235
|
+
}
|
|
169
236
|
|
|
170
237
|
// dist/layers/schema/fast-pbf.js
|
|
171
238
|
function readPackedTypedArray(TypedArray, pbf, obj) {
|
|
@@ -175,182 +242,51 @@ function readPackedTypedArray(TypedArray, pbf, obj) {
|
|
|
175
242
|
return obj.value;
|
|
176
243
|
}
|
|
177
244
|
|
|
178
|
-
// dist/layers/schema/carto-
|
|
179
|
-
var
|
|
180
|
-
uint8: Uint8Array,
|
|
181
|
-
uint16: Uint16Array,
|
|
182
|
-
uint32: Uint32Array,
|
|
183
|
-
uint64: BigUint64Array,
|
|
184
|
-
int8: Int8Array,
|
|
185
|
-
int16: Int16Array,
|
|
186
|
-
int32: Int32Array,
|
|
187
|
-
int64: BigInt64Array,
|
|
188
|
-
float32: Float32Array,
|
|
189
|
-
float64: Float64Array
|
|
190
|
-
};
|
|
191
|
-
var BandReader = class {
|
|
245
|
+
// dist/layers/schema/carto-tile.js
|
|
246
|
+
var KeyValueObjectReader = class {
|
|
192
247
|
static read(pbf, end) {
|
|
193
|
-
return pbf.readFields(
|
|
248
|
+
return pbf.readFields(KeyValueObjectReader._readField, { key: "", value: null }, end);
|
|
194
249
|
}
|
|
195
250
|
static _readField(tag, obj, pbf) {
|
|
196
251
|
if (tag === 1)
|
|
197
|
-
obj.
|
|
252
|
+
obj.key = pbf.readString();
|
|
198
253
|
else if (tag === 2)
|
|
199
|
-
obj.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
254
|
+
obj.value = pbf.readString();
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var PropertiesReader = class {
|
|
258
|
+
static read(pbf, end) {
|
|
259
|
+
return pbf.readFields(PropertiesReader._readField, {}, end);
|
|
260
|
+
}
|
|
261
|
+
static _readField(tag, obj, pbf) {
|
|
262
|
+
if (tag === 1) {
|
|
263
|
+
const { key, value } = KeyValueObjectReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
264
|
+
obj[key] = value;
|
|
207
265
|
}
|
|
208
266
|
}
|
|
209
267
|
};
|
|
210
|
-
var
|
|
268
|
+
var DoublesReader = class {
|
|
211
269
|
static read(pbf, end) {
|
|
212
|
-
|
|
270
|
+
const { value, size } = pbf.readFields(DoublesReader._readField, { value: [], size: 0 }, end);
|
|
271
|
+
return { value, size };
|
|
213
272
|
}
|
|
214
273
|
static _readField(tag, obj, pbf) {
|
|
215
274
|
if (tag === 1)
|
|
216
|
-
|
|
275
|
+
readPackedTypedArray(Float64Array, pbf, obj);
|
|
217
276
|
else if (tag === 2)
|
|
218
|
-
obj.
|
|
277
|
+
obj.size = pbf.readVarint(true);
|
|
219
278
|
}
|
|
220
279
|
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const pbf = new import_pbf.default(buffer);
|
|
226
|
-
const tile = TileReader5.read(pbf);
|
|
227
|
-
return tile;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// dist/utils.js
|
|
231
|
-
var import_core = require("@deck.gl/core");
|
|
232
|
-
function assert(condition, message) {
|
|
233
|
-
import_core.log.assert(condition, message);
|
|
234
|
-
}
|
|
235
|
-
function createBinaryProxy(data, index) {
|
|
236
|
-
const { properties, numericProps } = data;
|
|
237
|
-
return new Proxy(properties[index] || {}, {
|
|
238
|
-
get(target, property) {
|
|
239
|
-
if (property in numericProps) {
|
|
240
|
-
return numericProps[property].value[index];
|
|
241
|
-
}
|
|
242
|
-
return target[property];
|
|
243
|
-
},
|
|
244
|
-
has(target, property) {
|
|
245
|
-
return property in numericProps || property in target;
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
function getWorkerUrl(id4, version) {
|
|
250
|
-
return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id4}-worker.js`;
|
|
251
|
-
}
|
|
252
|
-
function scaleIdentity() {
|
|
253
|
-
let unknown;
|
|
254
|
-
function scale(x) {
|
|
255
|
-
return x === null ? unknown : x;
|
|
280
|
+
var IntsReader = class {
|
|
281
|
+
static read(pbf, end) {
|
|
282
|
+
const { value, size } = pbf.readFields(IntsReader._readField, { value: [], size: 0 }, end);
|
|
283
|
+
return { value: new Uint32Array(value), size };
|
|
256
284
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
return unknown;
|
|
264
|
-
};
|
|
265
|
-
scale.copy = () => {
|
|
266
|
-
const scaleCopy = scaleIdentity();
|
|
267
|
-
scaleCopy.unknown(unknown);
|
|
268
|
-
return scaleCopy;
|
|
269
|
-
};
|
|
270
|
-
return scale;
|
|
271
|
-
}
|
|
272
|
-
var isObject = (x) => x !== null && typeof x === "object";
|
|
273
|
-
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
274
|
-
|
|
275
|
-
// dist/layers/schema/carto-raster-tile-loader.js
|
|
276
|
-
var VERSION = true ? "9.0.23" : "latest";
|
|
277
|
-
var id = "cartoRasterTile";
|
|
278
|
-
var DEFAULT_OPTIONS = {
|
|
279
|
-
cartoRasterTile: {
|
|
280
|
-
workerUrl: getWorkerUrl(id, VERSION)
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
var CartoRasterTileLoader = {
|
|
284
|
-
name: "CARTO Raster Tile",
|
|
285
|
-
version: VERSION,
|
|
286
|
-
id,
|
|
287
|
-
module: "carto",
|
|
288
|
-
extensions: ["pbf"],
|
|
289
|
-
mimeTypes: ["application/vnd.carto-raster-tile"],
|
|
290
|
-
category: "geometry",
|
|
291
|
-
parse: async (arrayBuffer, options) => parseCartoRasterTile(arrayBuffer, options),
|
|
292
|
-
parseSync: parseCartoRasterTile,
|
|
293
|
-
worker: true,
|
|
294
|
-
options: DEFAULT_OPTIONS
|
|
295
|
-
};
|
|
296
|
-
function parseCartoRasterTile(arrayBuffer, options) {
|
|
297
|
-
if (!arrayBuffer)
|
|
298
|
-
return null;
|
|
299
|
-
const { bands, blockSize } = parsePbf(arrayBuffer, TileReader);
|
|
300
|
-
const numericProps = {};
|
|
301
|
-
for (let i = 0; i < bands.length; i++) {
|
|
302
|
-
const { name, data } = bands[i];
|
|
303
|
-
numericProps[name] = data;
|
|
304
|
-
}
|
|
305
|
-
return { blockSize, cells: { numericProps, properties: [] } };
|
|
306
|
-
}
|
|
307
|
-
var carto_raster_tile_loader_default = CartoRasterTileLoader;
|
|
308
|
-
|
|
309
|
-
// dist/layers/schema/carto-tile.js
|
|
310
|
-
var KeyValueObjectReader = class {
|
|
311
|
-
static read(pbf, end) {
|
|
312
|
-
return pbf.readFields(KeyValueObjectReader._readField, { key: "", value: null }, end);
|
|
313
|
-
}
|
|
314
|
-
static _readField(tag, obj, pbf) {
|
|
315
|
-
if (tag === 1)
|
|
316
|
-
obj.key = pbf.readString();
|
|
317
|
-
else if (tag === 2)
|
|
318
|
-
obj.value = pbf.readString();
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
var PropertiesReader = class {
|
|
322
|
-
static read(pbf, end) {
|
|
323
|
-
return pbf.readFields(PropertiesReader._readField, {}, end);
|
|
324
|
-
}
|
|
325
|
-
static _readField(tag, obj, pbf) {
|
|
326
|
-
if (tag === 1) {
|
|
327
|
-
const { key, value } = KeyValueObjectReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
328
|
-
obj[key] = value;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
var DoublesReader = class {
|
|
333
|
-
static read(pbf, end) {
|
|
334
|
-
const { value, size } = pbf.readFields(DoublesReader._readField, { value: [], size: 0 }, end);
|
|
335
|
-
return { value, size };
|
|
336
|
-
}
|
|
337
|
-
static _readField(tag, obj, pbf) {
|
|
338
|
-
if (tag === 1)
|
|
339
|
-
readPackedTypedArray(Float64Array, pbf, obj);
|
|
340
|
-
else if (tag === 2)
|
|
341
|
-
obj.size = pbf.readVarint(true);
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
var IntsReader = class {
|
|
345
|
-
static read(pbf, end) {
|
|
346
|
-
const { value, size } = pbf.readFields(IntsReader._readField, { value: [], size: 0 }, end);
|
|
347
|
-
return { value: new Uint32Array(value), size };
|
|
348
|
-
}
|
|
349
|
-
static _readField(tag, obj, pbf) {
|
|
350
|
-
if (tag === 1)
|
|
351
|
-
pbf.readPackedVarint(obj.value);
|
|
352
|
-
else if (tag === 2)
|
|
353
|
-
obj.size = pbf.readVarint(true);
|
|
285
|
+
static _readField(tag, obj, pbf) {
|
|
286
|
+
if (tag === 1)
|
|
287
|
+
pbf.readPackedVarint(obj.value);
|
|
288
|
+
else if (tag === 2)
|
|
289
|
+
obj.size = pbf.readVarint(true);
|
|
354
290
|
}
|
|
355
291
|
};
|
|
356
292
|
var FieldsReader = class {
|
|
@@ -475,9 +411,9 @@ var PolygonsReader = class {
|
|
|
475
411
|
obj.fields.push(FieldsReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
476
412
|
}
|
|
477
413
|
};
|
|
478
|
-
var
|
|
414
|
+
var TileReader = class {
|
|
479
415
|
static read(pbf, end) {
|
|
480
|
-
return pbf.readFields(
|
|
416
|
+
return pbf.readFields(TileReader._readField, { points: null, lines: null, polygons: null }, end);
|
|
481
417
|
}
|
|
482
418
|
static _readField(tag, obj, pbf) {
|
|
483
419
|
if (tag === 1)
|
|
@@ -489,112 +425,520 @@ var TileReader2 = class {
|
|
|
489
425
|
}
|
|
490
426
|
};
|
|
491
427
|
|
|
492
|
-
// dist/layers/schema/carto-spatial-tile.js
|
|
493
|
-
var IndicesReader = class {
|
|
494
|
-
static read(pbf, end) {
|
|
495
|
-
return pbf.readFields(IndicesReader._readField, { value: [] }, end);
|
|
496
|
-
}
|
|
497
|
-
static _readField(tag, obj, pbf) {
|
|
498
|
-
if (tag === 1)
|
|
499
|
-
readPackedTypedArray(BigUint64Array, pbf, obj);
|
|
500
|
-
}
|
|
428
|
+
// dist/layers/schema/carto-spatial-tile.js
|
|
429
|
+
var IndicesReader = class {
|
|
430
|
+
static read(pbf, end) {
|
|
431
|
+
return pbf.readFields(IndicesReader._readField, { value: [] }, end);
|
|
432
|
+
}
|
|
433
|
+
static _readField(tag, obj, pbf) {
|
|
434
|
+
if (tag === 1)
|
|
435
|
+
readPackedTypedArray(BigUint64Array, pbf, obj);
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
var CellsReader = class {
|
|
439
|
+
static read(pbf, end) {
|
|
440
|
+
return pbf.readFields(CellsReader._readField, { indices: null, properties: [], numericProps: {} }, end);
|
|
441
|
+
}
|
|
442
|
+
static _readField(tag, obj, pbf) {
|
|
443
|
+
if (tag === 1)
|
|
444
|
+
obj.indices = IndicesReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
445
|
+
else if (tag === 2)
|
|
446
|
+
obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
447
|
+
else if (tag === 3) {
|
|
448
|
+
const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
449
|
+
obj.numericProps[entry.key] = entry.value;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
var TileReader2 = class {
|
|
454
|
+
static read(pbf, end) {
|
|
455
|
+
return pbf.readFields(TileReader2._readField, { scheme: 0, cells: null }, end);
|
|
456
|
+
}
|
|
457
|
+
static _readField(tag, obj, pbf) {
|
|
458
|
+
if (tag === 1)
|
|
459
|
+
obj.scheme = pbf.readVarint();
|
|
460
|
+
else if (tag === 2)
|
|
461
|
+
obj.cells = CellsReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// dist/layers/schema/tile-loader-utils.js
|
|
466
|
+
var import_pbf = __toESM(require("pbf"), 1);
|
|
467
|
+
function parsePbf(buffer, TileReader5) {
|
|
468
|
+
const pbf = new import_pbf.default(buffer);
|
|
469
|
+
const tile = TileReader5.read(pbf);
|
|
470
|
+
return tile;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// dist/utils.js
|
|
474
|
+
var import_core = require("@deck.gl/core");
|
|
475
|
+
function assert(condition, message) {
|
|
476
|
+
import_core.log.assert(condition, message);
|
|
477
|
+
}
|
|
478
|
+
function createBinaryProxy(data, index) {
|
|
479
|
+
const { properties, numericProps } = data;
|
|
480
|
+
return new Proxy(properties[index] || {}, {
|
|
481
|
+
get(target, property) {
|
|
482
|
+
if (property in numericProps) {
|
|
483
|
+
return numericProps[property].value[index];
|
|
484
|
+
}
|
|
485
|
+
return target[property];
|
|
486
|
+
},
|
|
487
|
+
has(target, property) {
|
|
488
|
+
return property in numericProps || property in target;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
function getWorkerUrl(id4, version) {
|
|
493
|
+
return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id4}-worker.js`;
|
|
494
|
+
}
|
|
495
|
+
function scaleIdentity() {
|
|
496
|
+
let unknown;
|
|
497
|
+
function scale(x) {
|
|
498
|
+
return x === null ? unknown : x;
|
|
499
|
+
}
|
|
500
|
+
scale.invert = scale;
|
|
501
|
+
scale.domain = scale.range = (d) => d;
|
|
502
|
+
scale.unknown = (u) => {
|
|
503
|
+
if (u) {
|
|
504
|
+
unknown = u;
|
|
505
|
+
}
|
|
506
|
+
return unknown;
|
|
507
|
+
};
|
|
508
|
+
scale.copy = () => {
|
|
509
|
+
const scaleCopy = scaleIdentity();
|
|
510
|
+
scaleCopy.unknown(unknown);
|
|
511
|
+
return scaleCopy;
|
|
512
|
+
};
|
|
513
|
+
return scale;
|
|
514
|
+
}
|
|
515
|
+
var isObject = (x) => x !== null && typeof x === "object";
|
|
516
|
+
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
517
|
+
|
|
518
|
+
// dist/layers/schema/spatialjson-utils.js
|
|
519
|
+
var import_quadbin4 = require("quadbin");
|
|
520
|
+
function binaryToSpatialjson(binary) {
|
|
521
|
+
const { cells, scheme } = binary;
|
|
522
|
+
const count = cells.indices.value.length;
|
|
523
|
+
const spatial = [];
|
|
524
|
+
for (let i = 0; i < count; i++) {
|
|
525
|
+
const id4 = scheme === "h3" ? (0, import_quadbin4.bigIntToHex)(cells.indices.value[i]) : cells.indices.value[i];
|
|
526
|
+
const properties = { ...cells.properties[i] };
|
|
527
|
+
for (const key of Object.keys(cells.numericProps)) {
|
|
528
|
+
properties[key] = cells.numericProps[key].value[i];
|
|
529
|
+
}
|
|
530
|
+
spatial.push({ id: id4, properties });
|
|
531
|
+
}
|
|
532
|
+
return spatial;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// dist/layers/schema/carto-spatial-tile-loader.js
|
|
536
|
+
var VERSION = true ? "9.0.24" : "latest";
|
|
537
|
+
var id = "cartoSpatialTile";
|
|
538
|
+
var DEFAULT_OPTIONS = {
|
|
539
|
+
cartoSpatialTile: {
|
|
540
|
+
scheme: "quadbin",
|
|
541
|
+
workerUrl: getWorkerUrl(id, VERSION)
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
var CartoSpatialTileLoader = {
|
|
545
|
+
name: "CARTO Spatial Tile",
|
|
546
|
+
version: VERSION,
|
|
547
|
+
id,
|
|
548
|
+
module: "carto",
|
|
549
|
+
extensions: ["pbf"],
|
|
550
|
+
mimeTypes: ["application/vnd.carto-spatial-tile"],
|
|
551
|
+
category: "geometry",
|
|
552
|
+
parse: async (arrayBuffer, options) => parseCartoSpatialTile(arrayBuffer, options),
|
|
553
|
+
parseSync: parseCartoSpatialTile,
|
|
554
|
+
worker: true,
|
|
555
|
+
options: DEFAULT_OPTIONS
|
|
556
|
+
};
|
|
557
|
+
function parseCartoSpatialTile(arrayBuffer, options) {
|
|
558
|
+
var _a;
|
|
559
|
+
if (!arrayBuffer)
|
|
560
|
+
return null;
|
|
561
|
+
const tile = parsePbf(arrayBuffer, TileReader2);
|
|
562
|
+
const { cells } = tile;
|
|
563
|
+
const scheme = (_a = options == null ? void 0 : options.cartoSpatialTile) == null ? void 0 : _a.scheme;
|
|
564
|
+
const data = { cells, scheme };
|
|
565
|
+
return binaryToSpatialjson(data);
|
|
566
|
+
}
|
|
567
|
+
var carto_spatial_tile_loader_default = CartoSpatialTileLoader;
|
|
568
|
+
|
|
569
|
+
// dist/layers/utils.js
|
|
570
|
+
var import_core2 = require("@deck.gl/core");
|
|
571
|
+
var import_core3 = require("@deck.gl/core");
|
|
572
|
+
function injectAccessToken(loadOptions, accessToken) {
|
|
573
|
+
var _a, _b, _c;
|
|
574
|
+
if (!((_b = (_a = loadOptions == null ? void 0 : loadOptions.fetch) == null ? void 0 : _a.headers) == null ? void 0 : _b.Authorization)) {
|
|
575
|
+
loadOptions.fetch = {
|
|
576
|
+
...loadOptions.fetch,
|
|
577
|
+
headers: { ...(_c = loadOptions.fetch) == null ? void 0 : _c.headers, Authorization: `Bearer ${accessToken}` }
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function mergeBoundaryData(geometry, properties) {
|
|
582
|
+
const mapping = {};
|
|
583
|
+
for (const { geoid, ...rest } of properties.properties) {
|
|
584
|
+
if (geoid in mapping) {
|
|
585
|
+
import_core2.log.warn("Duplicate geoid key in boundary mapping, using first occurance")();
|
|
586
|
+
} else {
|
|
587
|
+
mapping[geoid] = rest;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
for (const type of ["points", "lines", "polygons"]) {
|
|
591
|
+
const geom = geometry[type];
|
|
592
|
+
if (geom.positions.value.length === 0) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
geom.properties = geom.properties.map(({ geoid }) => mapping[geoid]);
|
|
596
|
+
const { positions, globalFeatureIds } = geom;
|
|
597
|
+
let indices = null;
|
|
598
|
+
if (type === "lines")
|
|
599
|
+
indices = geom.pathIndices.value;
|
|
600
|
+
if (type === "polygons")
|
|
601
|
+
indices = geom.polygonIndices.value;
|
|
602
|
+
const length = positions.value.length / positions.size;
|
|
603
|
+
for (const key in properties.numericProps) {
|
|
604
|
+
const sourceProp = properties.numericProps[key].value;
|
|
605
|
+
const TypedArray = sourceProp.constructor;
|
|
606
|
+
const destProp = new TypedArray(length);
|
|
607
|
+
geom.numericProps[key] = { value: destProp, size: 1 };
|
|
608
|
+
if (!indices) {
|
|
609
|
+
for (let i = 0; i < length; i++) {
|
|
610
|
+
const featureId = globalFeatureIds.value[i];
|
|
611
|
+
destProp[i] = sourceProp[featureId];
|
|
612
|
+
}
|
|
613
|
+
} else {
|
|
614
|
+
for (let i = 0; i < indices.length - 1; i++) {
|
|
615
|
+
const startIndex = indices[i];
|
|
616
|
+
const endIndex = indices[i + 1];
|
|
617
|
+
const featureId = globalFeatureIds.value[startIndex];
|
|
618
|
+
destProp.fill(sourceProp[featureId], startIndex, endIndex);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return geometry;
|
|
624
|
+
}
|
|
625
|
+
var TilejsonPropType = {
|
|
626
|
+
type: "object",
|
|
627
|
+
value: null,
|
|
628
|
+
validate: (value, propType) => propType.optional && value === null || typeof value === "object" && Array.isArray(value.tiles) && value.tiles.every((url) => typeof url === "string"),
|
|
629
|
+
equal: (value1, value2) => {
|
|
630
|
+
return (0, import_core3._deepEqual)(value1, value2, 2);
|
|
631
|
+
},
|
|
632
|
+
async: true
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// dist/layers/cluster-tile-layer.js
|
|
636
|
+
(0, import_core4.registerLoaders)([carto_spatial_tile_loader_default]);
|
|
637
|
+
var defaultProps = {
|
|
638
|
+
data: TilejsonPropType,
|
|
639
|
+
clusterLevel: { type: "number", value: 5, min: 1 },
|
|
640
|
+
getPosition: {
|
|
641
|
+
type: "accessor",
|
|
642
|
+
value: ({ id: id4 }) => getQuadbinPolygon(id4, 0.5).slice(2, 4)
|
|
643
|
+
},
|
|
644
|
+
getWeight: { type: "accessor", value: 1 },
|
|
645
|
+
refinementStrategy: "no-overlap",
|
|
646
|
+
tileSize: DEFAULT_TILE_SIZE
|
|
647
|
+
};
|
|
648
|
+
var _ClusterGeoJsonLayer = class extends import_geo_layers2.TileLayer {
|
|
649
|
+
renderLayers() {
|
|
650
|
+
var _a;
|
|
651
|
+
const visibleTiles = (_a = this.state.tileset) == null ? void 0 : _a.tiles.filter((tile) => {
|
|
652
|
+
return tile.isLoaded && tile.content && this.state.tileset.isTileVisible(tile);
|
|
653
|
+
});
|
|
654
|
+
if (!(visibleTiles == null ? void 0 : visibleTiles.length)) {
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
visibleTiles.sort((a, b) => b.zoom - a.zoom);
|
|
658
|
+
const { zoom } = this.context.viewport;
|
|
659
|
+
const { clusterLevel, getPosition, getWeight } = this.props;
|
|
660
|
+
const properties = extractAggregationProperties(visibleTiles[0]);
|
|
661
|
+
const data = [];
|
|
662
|
+
for (const tile of visibleTiles) {
|
|
663
|
+
const overZoom = Math.round(zoom - tile.zoom);
|
|
664
|
+
const aggregationLevels = Math.round(clusterLevel) - overZoom;
|
|
665
|
+
aggregateTile(tile, aggregationLevels, properties, getPosition, getWeight);
|
|
666
|
+
data.push(...tile.userData[aggregationLevels]);
|
|
667
|
+
}
|
|
668
|
+
data.sort((a, b) => Number(b.count - a.count));
|
|
669
|
+
const clusterIds = data == null ? void 0 : data.map((tile) => tile.id);
|
|
670
|
+
const needsUpdate = !(0, import_core5._deepEqual)(clusterIds, this.state.clusterIds, 1);
|
|
671
|
+
this.setState({ clusterIds });
|
|
672
|
+
if (needsUpdate) {
|
|
673
|
+
const stats = computeAggregationStats(data, properties);
|
|
674
|
+
for (const d of data) {
|
|
675
|
+
d.stats = stats;
|
|
676
|
+
}
|
|
677
|
+
this.setState({ data: clustersToBinary(data) });
|
|
678
|
+
}
|
|
679
|
+
const props = {
|
|
680
|
+
...this.props,
|
|
681
|
+
id: "clusters",
|
|
682
|
+
data: this.state.data,
|
|
683
|
+
dataComparator: (data2, oldData) => {
|
|
684
|
+
var _a2, _b, _c, _d;
|
|
685
|
+
const newIds = (_b = (_a2 = data2 == null ? void 0 : data2.points) == null ? void 0 : _a2.properties) == null ? void 0 : _b.map((tile) => tile.id);
|
|
686
|
+
const oldIds = (_d = (_c = oldData == null ? void 0 : oldData.points) == null ? void 0 : _c.properties) == null ? void 0 : _d.map((tile) => tile.id);
|
|
687
|
+
return (0, import_core5._deepEqual)(newIds, oldIds, 1);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
return new import_layers.GeoJsonLayer(this.getSubLayerProps(props));
|
|
691
|
+
}
|
|
692
|
+
getPickingInfo(params) {
|
|
693
|
+
const info = params.info;
|
|
694
|
+
if (info.index !== -1) {
|
|
695
|
+
const { data } = params.sourceLayer.props;
|
|
696
|
+
info.object = (0, import_gis.binaryToGeojson)(data, {
|
|
697
|
+
globalFeatureId: info.index
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
return info;
|
|
701
|
+
}
|
|
702
|
+
_updateAutoHighlight(info) {
|
|
703
|
+
for (const layer of this.getSubLayers()) {
|
|
704
|
+
layer.updateAutoHighlight(info);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
filterSubLayer() {
|
|
708
|
+
return true;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
var ClusterGeoJsonLayer = _ClusterGeoJsonLayer;
|
|
712
|
+
(() => {
|
|
713
|
+
_ClusterGeoJsonLayer.layerName = "ClusterGeoJsonLayer";
|
|
714
|
+
})();
|
|
715
|
+
(() => {
|
|
716
|
+
_ClusterGeoJsonLayer.defaultProps = defaultProps;
|
|
717
|
+
})();
|
|
718
|
+
var _ClusterTileLayer = class extends import_core5.CompositeLayer {
|
|
719
|
+
getLoadOptions() {
|
|
720
|
+
const loadOptions = super.getLoadOptions() || {};
|
|
721
|
+
const tileJSON = this.props.data;
|
|
722
|
+
injectAccessToken(loadOptions, tileJSON.accessToken);
|
|
723
|
+
loadOptions.cartoSpatialTile = { ...loadOptions.cartoSpatialTile, scheme: "quadbin" };
|
|
724
|
+
return loadOptions;
|
|
725
|
+
}
|
|
726
|
+
renderLayers() {
|
|
727
|
+
const tileJSON = this.props.data;
|
|
728
|
+
if (!tileJSON)
|
|
729
|
+
return null;
|
|
730
|
+
const { tiles: data, maxresolution: maxZoom } = tileJSON;
|
|
731
|
+
return [
|
|
732
|
+
new ClusterGeoJsonLayer(this.props, {
|
|
733
|
+
id: `cluster-geojson-layer-${this.props.id}`,
|
|
734
|
+
data,
|
|
735
|
+
TilesetClass: QuadbinTileset2D,
|
|
736
|
+
maxZoom,
|
|
737
|
+
loadOptions: this.getLoadOptions()
|
|
738
|
+
})
|
|
739
|
+
];
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var ClusterTileLayer = _ClusterTileLayer;
|
|
743
|
+
(() => {
|
|
744
|
+
_ClusterTileLayer.layerName = "ClusterTileLayer";
|
|
745
|
+
})();
|
|
746
|
+
(() => {
|
|
747
|
+
_ClusterTileLayer.defaultProps = defaultProps;
|
|
748
|
+
})();
|
|
749
|
+
|
|
750
|
+
// dist/layers/h3-tile-layer.js
|
|
751
|
+
var import_core7 = require("@deck.gl/core");
|
|
752
|
+
var import_geo_layers5 = require("@deck.gl/geo-layers");
|
|
753
|
+
|
|
754
|
+
// dist/layers/h3-tileset-2d.js
|
|
755
|
+
var import_geo_layers3 = require("@deck.gl/geo-layers");
|
|
756
|
+
var import_h3_js = require("h3-js");
|
|
757
|
+
var MAX_LATITUDE = 85.051128;
|
|
758
|
+
function padBoundingBox({ west, north, east, south }, resolution) {
|
|
759
|
+
const corners = [
|
|
760
|
+
[north, east],
|
|
761
|
+
[south, east],
|
|
762
|
+
[south, west],
|
|
763
|
+
[north, west]
|
|
764
|
+
];
|
|
765
|
+
const cornerCells = corners.map((c) => (0, import_h3_js.latLngToCell)(c[0], c[1], resolution));
|
|
766
|
+
const cornerEdgeLengths = cornerCells.map((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);
|
|
767
|
+
const bufferLat = Math.max(...cornerEdgeLengths);
|
|
768
|
+
const bufferLon = Math.min(180, bufferLat / Math.cos((north + south) / 2 * Math.PI / 180));
|
|
769
|
+
return {
|
|
770
|
+
north: Math.min(north + bufferLat, MAX_LATITUDE),
|
|
771
|
+
east: east + bufferLon,
|
|
772
|
+
south: Math.max(south - bufferLat, -MAX_LATITUDE),
|
|
773
|
+
west: west - bufferLon
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function getHexagonsInBoundingBox({ west, north, east, south }, resolution) {
|
|
777
|
+
const longitudeSpan = Math.abs(east - west);
|
|
778
|
+
if (longitudeSpan > 180) {
|
|
779
|
+
const nSegments = Math.ceil(longitudeSpan / 180);
|
|
780
|
+
let h3Indices = [];
|
|
781
|
+
for (let s = 0; s < nSegments; s++) {
|
|
782
|
+
const segmentWest = west + s * 180;
|
|
783
|
+
const segmentEast = Math.min(segmentWest + 179.9999999, east);
|
|
784
|
+
h3Indices = h3Indices.concat(getHexagonsInBoundingBox({ west: segmentWest, north, east: segmentEast, south }, resolution));
|
|
785
|
+
}
|
|
786
|
+
return [...new Set(h3Indices)];
|
|
787
|
+
}
|
|
788
|
+
const polygon = [
|
|
789
|
+
[north, east],
|
|
790
|
+
[south, east],
|
|
791
|
+
[south, west],
|
|
792
|
+
[north, west],
|
|
793
|
+
[north, east]
|
|
794
|
+
];
|
|
795
|
+
return (0, import_h3_js.polygonToCells)(polygon, resolution);
|
|
796
|
+
}
|
|
797
|
+
function tileToBoundingBox(index) {
|
|
798
|
+
const coordinates = (0, import_h3_js.cellToBoundary)(index);
|
|
799
|
+
const latitudes = coordinates.map((c) => c[0]);
|
|
800
|
+
const longitudes = coordinates.map((c) => c[1]);
|
|
801
|
+
const west = Math.min(...longitudes);
|
|
802
|
+
const south = Math.min(...latitudes);
|
|
803
|
+
const east = Math.max(...longitudes);
|
|
804
|
+
const north = Math.max(...latitudes);
|
|
805
|
+
return { west, south, east, north };
|
|
806
|
+
}
|
|
807
|
+
var BIAS = 2;
|
|
808
|
+
function getHexagonResolution(viewport, tileSize) {
|
|
809
|
+
const zoomOffset = Math.log2(tileSize / 512);
|
|
810
|
+
const hexagonScaleFactor = 2 / 3 * (viewport.zoom - zoomOffset);
|
|
811
|
+
const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
|
|
812
|
+
return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
|
|
813
|
+
}
|
|
814
|
+
var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
|
|
815
|
+
getTileIndices({ viewport, minZoom, maxZoom }) {
|
|
816
|
+
if (viewport.latitude === void 0)
|
|
817
|
+
return [];
|
|
818
|
+
const [west, south, east, north] = viewport.getBounds();
|
|
819
|
+
const { tileSize } = this.opts;
|
|
820
|
+
let z = getHexagonResolution(viewport, tileSize);
|
|
821
|
+
let indices;
|
|
822
|
+
if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
|
|
823
|
+
return [];
|
|
824
|
+
}
|
|
825
|
+
if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
|
|
826
|
+
z = maxZoom;
|
|
827
|
+
const center = (0, import_h3_js.latLngToCell)(viewport.latitude, viewport.longitude, maxZoom);
|
|
828
|
+
indices = (0, import_h3_js.gridDisk)(center, 1);
|
|
829
|
+
} else {
|
|
830
|
+
const paddedBounds = padBoundingBox({ west, north, east, south }, z);
|
|
831
|
+
indices = getHexagonsInBoundingBox(paddedBounds, z);
|
|
832
|
+
}
|
|
833
|
+
return indices.map((i) => ({ i }));
|
|
834
|
+
}
|
|
835
|
+
getTileId({ i }) {
|
|
836
|
+
return i;
|
|
837
|
+
}
|
|
838
|
+
getTileMetadata({ i }) {
|
|
839
|
+
return { bbox: tileToBoundingBox(i) };
|
|
840
|
+
}
|
|
841
|
+
getTileZoom({ i }) {
|
|
842
|
+
return (0, import_h3_js.getResolution)(i);
|
|
843
|
+
}
|
|
844
|
+
getParentIndex(index) {
|
|
845
|
+
const resolution = (0, import_h3_js.getResolution)(index.i);
|
|
846
|
+
const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
|
|
847
|
+
return { i };
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
// dist/layers/spatial-index-tile-layer.js
|
|
852
|
+
var import_core6 = require("@loaders.gl/core");
|
|
853
|
+
|
|
854
|
+
// dist/layers/schema/carto-raster-tile.js
|
|
855
|
+
var ARRAY_TYPES = {
|
|
856
|
+
uint8: Uint8Array,
|
|
857
|
+
uint16: Uint16Array,
|
|
858
|
+
uint32: Uint32Array,
|
|
859
|
+
uint64: BigUint64Array,
|
|
860
|
+
int8: Int8Array,
|
|
861
|
+
int16: Int16Array,
|
|
862
|
+
int32: Int32Array,
|
|
863
|
+
int64: BigInt64Array,
|
|
864
|
+
float32: Float32Array,
|
|
865
|
+
float64: Float64Array
|
|
501
866
|
};
|
|
502
|
-
var
|
|
867
|
+
var BandReader = class {
|
|
503
868
|
static read(pbf, end) {
|
|
504
|
-
return pbf.readFields(
|
|
869
|
+
return pbf.readFields(BandReader._readField, { name: "", type: "", data: null }, end);
|
|
505
870
|
}
|
|
506
871
|
static _readField(tag, obj, pbf) {
|
|
507
872
|
if (tag === 1)
|
|
508
|
-
obj.
|
|
873
|
+
obj.name = pbf.readString();
|
|
509
874
|
else if (tag === 2)
|
|
510
|
-
obj.
|
|
875
|
+
obj.type = pbf.readString();
|
|
511
876
|
else if (tag === 3) {
|
|
512
|
-
const
|
|
513
|
-
|
|
877
|
+
const TypedArray = ARRAY_TYPES[obj.type];
|
|
878
|
+
if (!TypedArray) {
|
|
879
|
+
throw Error(`Invalid data type: ${obj.type}`);
|
|
880
|
+
}
|
|
881
|
+
obj.data = {};
|
|
882
|
+
readPackedTypedArray(TypedArray, pbf, obj.data);
|
|
514
883
|
}
|
|
515
884
|
}
|
|
516
885
|
};
|
|
517
886
|
var TileReader3 = class {
|
|
518
887
|
static read(pbf, end) {
|
|
519
|
-
return pbf.readFields(TileReader3._readField, {
|
|
888
|
+
return pbf.readFields(TileReader3._readField, { blockSize: 0, bands: [] }, end);
|
|
520
889
|
}
|
|
521
890
|
static _readField(tag, obj, pbf) {
|
|
522
891
|
if (tag === 1)
|
|
523
|
-
obj.
|
|
892
|
+
obj.blockSize = pbf.readVarint();
|
|
524
893
|
else if (tag === 2)
|
|
525
|
-
obj.
|
|
894
|
+
obj.bands.push(BandReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
526
895
|
}
|
|
527
896
|
};
|
|
528
897
|
|
|
529
|
-
// dist/layers/schema/
|
|
530
|
-
var
|
|
531
|
-
|
|
532
|
-
const { cells, scheme } = binary;
|
|
533
|
-
const count = cells.indices.value.length;
|
|
534
|
-
const spatial = [];
|
|
535
|
-
for (let i = 0; i < count; i++) {
|
|
536
|
-
const id4 = scheme === "h3" ? (0, import_quadbin.bigIntToHex)(cells.indices.value[i]) : cells.indices.value[i];
|
|
537
|
-
const properties = { ...cells.properties[i] };
|
|
538
|
-
for (const key of Object.keys(cells.numericProps)) {
|
|
539
|
-
properties[key] = cells.numericProps[key].value[i];
|
|
540
|
-
}
|
|
541
|
-
spatial.push({ id: id4, properties });
|
|
542
|
-
}
|
|
543
|
-
return spatial;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// dist/layers/schema/carto-spatial-tile-loader.js
|
|
547
|
-
var VERSION2 = true ? "9.0.23" : "latest";
|
|
548
|
-
var id2 = "cartoSpatialTile";
|
|
898
|
+
// dist/layers/schema/carto-raster-tile-loader.js
|
|
899
|
+
var VERSION2 = true ? "9.0.24" : "latest";
|
|
900
|
+
var id2 = "cartoRasterTile";
|
|
549
901
|
var DEFAULT_OPTIONS2 = {
|
|
550
|
-
|
|
551
|
-
scheme: "quadbin",
|
|
902
|
+
cartoRasterTile: {
|
|
552
903
|
workerUrl: getWorkerUrl(id2, VERSION2)
|
|
553
904
|
}
|
|
554
905
|
};
|
|
555
|
-
var
|
|
556
|
-
name: "CARTO
|
|
906
|
+
var CartoRasterTileLoader = {
|
|
907
|
+
name: "CARTO Raster Tile",
|
|
557
908
|
version: VERSION2,
|
|
558
909
|
id: id2,
|
|
559
910
|
module: "carto",
|
|
560
911
|
extensions: ["pbf"],
|
|
561
|
-
mimeTypes: ["application/vnd.carto-
|
|
912
|
+
mimeTypes: ["application/vnd.carto-raster-tile"],
|
|
562
913
|
category: "geometry",
|
|
563
|
-
parse: async (arrayBuffer, options) =>
|
|
564
|
-
parseSync:
|
|
914
|
+
parse: async (arrayBuffer, options) => parseCartoRasterTile(arrayBuffer, options),
|
|
915
|
+
parseSync: parseCartoRasterTile,
|
|
565
916
|
worker: true,
|
|
566
917
|
options: DEFAULT_OPTIONS2
|
|
567
918
|
};
|
|
568
|
-
function
|
|
569
|
-
var _a;
|
|
919
|
+
function parseCartoRasterTile(arrayBuffer, options) {
|
|
570
920
|
if (!arrayBuffer)
|
|
571
921
|
return null;
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
922
|
+
const { bands, blockSize } = parsePbf(arrayBuffer, TileReader3);
|
|
923
|
+
const numericProps = {};
|
|
924
|
+
for (let i = 0; i < bands.length; i++) {
|
|
925
|
+
const { name, data } = bands[i];
|
|
926
|
+
numericProps[name] = data;
|
|
927
|
+
}
|
|
928
|
+
return { blockSize, cells: { numericProps, properties: [] } };
|
|
577
929
|
}
|
|
578
|
-
var
|
|
579
|
-
|
|
580
|
-
// dist/layers/spatial-index-tile-layer.js
|
|
581
|
-
var import_geo_layers2 = require("@deck.gl/geo-layers");
|
|
582
|
-
|
|
583
|
-
// dist/constants.js
|
|
584
|
-
var DEFAULT_TILE_SIZE = 512;
|
|
585
|
-
var DEFAULT_TILE_RESOLUTION = 0.5;
|
|
586
|
-
var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
587
|
-
var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
930
|
+
var carto_raster_tile_loader_default = CartoRasterTileLoader;
|
|
588
931
|
|
|
589
932
|
// dist/layers/spatial-index-tile-layer.js
|
|
590
|
-
(
|
|
933
|
+
var import_geo_layers4 = require("@deck.gl/geo-layers");
|
|
934
|
+
(0, import_core6.registerLoaders)([carto_raster_tile_loader_default, carto_spatial_tile_loader_default]);
|
|
591
935
|
function isFeatureIdDefined(value) {
|
|
592
936
|
return value !== void 0 && value !== null && value !== "";
|
|
593
937
|
}
|
|
594
|
-
var
|
|
938
|
+
var defaultProps2 = {
|
|
595
939
|
tileSize: DEFAULT_TILE_SIZE
|
|
596
940
|
};
|
|
597
|
-
var _SpatialIndexTileLayer = class extends
|
|
941
|
+
var _SpatialIndexTileLayer = class extends import_geo_layers4.TileLayer {
|
|
598
942
|
_updateAutoHighlight(info) {
|
|
599
943
|
const { hoveredFeatureId } = this.state;
|
|
600
944
|
const hoveredFeature = info.object;
|
|
@@ -646,94 +990,28 @@ var SpatialIndexTileLayer = _SpatialIndexTileLayer;
|
|
|
646
990
|
_SpatialIndexTileLayer.layerName = "SpatialIndexTileLayer";
|
|
647
991
|
})();
|
|
648
992
|
(() => {
|
|
649
|
-
_SpatialIndexTileLayer.defaultProps =
|
|
993
|
+
_SpatialIndexTileLayer.defaultProps = defaultProps2;
|
|
650
994
|
})();
|
|
651
995
|
|
|
652
|
-
// dist/layers/utils.js
|
|
653
|
-
var import_core3 = require("@deck.gl/core");
|
|
654
|
-
var import_core4 = require("@deck.gl/core");
|
|
655
|
-
function injectAccessToken(loadOptions, accessToken) {
|
|
656
|
-
var _a, _b, _c;
|
|
657
|
-
if (!((_b = (_a = loadOptions == null ? void 0 : loadOptions.fetch) == null ? void 0 : _a.headers) == null ? void 0 : _b.Authorization)) {
|
|
658
|
-
loadOptions.fetch = {
|
|
659
|
-
...loadOptions.fetch,
|
|
660
|
-
headers: { ...(_c = loadOptions.fetch) == null ? void 0 : _c.headers, Authorization: `Bearer ${accessToken}` }
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
function mergeBoundaryData(geometry, properties) {
|
|
665
|
-
const mapping = {};
|
|
666
|
-
for (const { geoid, ...rest } of properties.properties) {
|
|
667
|
-
if (geoid in mapping) {
|
|
668
|
-
import_core3.log.warn("Duplicate geoid key in boundary mapping, using first occurance")();
|
|
669
|
-
} else {
|
|
670
|
-
mapping[geoid] = rest;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
for (const type of ["points", "lines", "polygons"]) {
|
|
674
|
-
const geom = geometry[type];
|
|
675
|
-
if (geom.positions.value.length === 0) {
|
|
676
|
-
continue;
|
|
677
|
-
}
|
|
678
|
-
geom.properties = geom.properties.map(({ geoid }) => mapping[geoid]);
|
|
679
|
-
const { positions, globalFeatureIds } = geom;
|
|
680
|
-
let indices = null;
|
|
681
|
-
if (type === "lines")
|
|
682
|
-
indices = geom.pathIndices.value;
|
|
683
|
-
if (type === "polygons")
|
|
684
|
-
indices = geom.polygonIndices.value;
|
|
685
|
-
const length = positions.value.length / positions.size;
|
|
686
|
-
for (const key in properties.numericProps) {
|
|
687
|
-
const sourceProp = properties.numericProps[key].value;
|
|
688
|
-
const TypedArray = sourceProp.constructor;
|
|
689
|
-
const destProp = new TypedArray(length);
|
|
690
|
-
geom.numericProps[key] = { value: destProp, size: 1 };
|
|
691
|
-
if (!indices) {
|
|
692
|
-
for (let i = 0; i < length; i++) {
|
|
693
|
-
const featureId = globalFeatureIds.value[i];
|
|
694
|
-
destProp[i] = sourceProp[featureId];
|
|
695
|
-
}
|
|
696
|
-
} else {
|
|
697
|
-
for (let i = 0; i < indices.length - 1; i++) {
|
|
698
|
-
const startIndex = indices[i];
|
|
699
|
-
const endIndex = indices[i + 1];
|
|
700
|
-
const featureId = globalFeatureIds.value[startIndex];
|
|
701
|
-
destProp.fill(sourceProp[featureId], startIndex, endIndex);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return geometry;
|
|
707
|
-
}
|
|
708
|
-
var TilejsonPropType = {
|
|
709
|
-
type: "object",
|
|
710
|
-
value: null,
|
|
711
|
-
validate: (value, propType) => propType.optional && value === null || typeof value === "object" && Array.isArray(value.tiles) && value.tiles.every((url) => typeof url === "string"),
|
|
712
|
-
equal: (value1, value2) => {
|
|
713
|
-
return (0, import_core4._deepEqual)(value1, value2, 2);
|
|
714
|
-
},
|
|
715
|
-
async: true
|
|
716
|
-
};
|
|
717
|
-
|
|
718
996
|
// dist/layers/h3-tile-layer.js
|
|
719
997
|
var renderSubLayers = (props) => {
|
|
720
998
|
const { data } = props;
|
|
721
999
|
const { index } = props.tile;
|
|
722
1000
|
if (!data || !data.length)
|
|
723
1001
|
return null;
|
|
724
|
-
return new
|
|
1002
|
+
return new import_geo_layers5.H3HexagonLayer(props, {
|
|
725
1003
|
getHexagon: (d) => d.id,
|
|
726
1004
|
centerHexagon: index,
|
|
727
1005
|
highPrecision: true
|
|
728
1006
|
});
|
|
729
1007
|
};
|
|
730
|
-
var
|
|
1008
|
+
var defaultProps3 = {
|
|
731
1009
|
data: TilejsonPropType,
|
|
732
1010
|
tileSize: DEFAULT_TILE_SIZE
|
|
733
1011
|
};
|
|
734
|
-
var _H3TileLayer = class extends
|
|
1012
|
+
var _H3TileLayer = class extends import_core7.CompositeLayer {
|
|
735
1013
|
initializeState() {
|
|
736
|
-
|
|
1014
|
+
import_geo_layers5.H3HexagonLayer._checkH3Lib();
|
|
737
1015
|
}
|
|
738
1016
|
getLoadOptions() {
|
|
739
1017
|
const loadOptions = super.getLoadOptions() || {};
|
|
@@ -772,13 +1050,13 @@ var H3TileLayer = _H3TileLayer;
|
|
|
772
1050
|
_H3TileLayer.layerName = "H3TileLayer";
|
|
773
1051
|
})();
|
|
774
1052
|
(() => {
|
|
775
|
-
_H3TileLayer.defaultProps =
|
|
1053
|
+
_H3TileLayer.defaultProps = defaultProps3;
|
|
776
1054
|
})();
|
|
777
1055
|
|
|
778
1056
|
// dist/layers/heatmap-tile-layer.js
|
|
779
|
-
var
|
|
780
|
-
var
|
|
781
|
-
var
|
|
1057
|
+
var import_quadbin6 = require("quadbin");
|
|
1058
|
+
var import_core10 = require("@deck.gl/core");
|
|
1059
|
+
var import_layers2 = require("@deck.gl/layers");
|
|
782
1060
|
|
|
783
1061
|
// dist/layers/heatmap.js
|
|
784
1062
|
var fs = `uniform heatmapUniforms {
|
|
@@ -917,7 +1195,7 @@ var heatmap = {
|
|
|
917
1195
|
};
|
|
918
1196
|
|
|
919
1197
|
// dist/layers/post-process-utils.js
|
|
920
|
-
var
|
|
1198
|
+
var import_core8 = require("@deck.gl/core");
|
|
921
1199
|
var TEXTURE_PROPS = {
|
|
922
1200
|
format: "rgba8unorm",
|
|
923
1201
|
mipmaps: false,
|
|
@@ -934,7 +1212,7 @@ function getPostProcessLayer(layer) {
|
|
|
934
1212
|
}
|
|
935
1213
|
return layer;
|
|
936
1214
|
}
|
|
937
|
-
var _DrawCallbackLayer = class extends
|
|
1215
|
+
var _DrawCallbackLayer = class extends import_core8.Layer {
|
|
938
1216
|
initializeState() {
|
|
939
1217
|
this.id = `draw-callback-${getPostProcessLayer(this).props.id}`;
|
|
940
1218
|
}
|
|
@@ -971,7 +1249,7 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
971
1249
|
initializeState(context) {
|
|
972
1250
|
super.initializeState(context);
|
|
973
1251
|
this._createTextures();
|
|
974
|
-
this.internalState.postProcess = new
|
|
1252
|
+
this.internalState.postProcess = new import_core8.PostProcessEffect(effect, this.props);
|
|
975
1253
|
this.internalState.postProcess.setup(context);
|
|
976
1254
|
}
|
|
977
1255
|
updateState(params) {
|
|
@@ -1038,39 +1316,14 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
1038
1316
|
}
|
|
1039
1317
|
|
|
1040
1318
|
// dist/layers/quadbin-tile-layer.js
|
|
1041
|
-
var
|
|
1042
|
-
|
|
1043
|
-
// dist/layers/quadbin-layer.js
|
|
1044
|
-
var import_geo_layers4 = require("@deck.gl/geo-layers");
|
|
1045
|
-
|
|
1046
|
-
// dist/layers/quadbin-utils.js
|
|
1047
|
-
var import_web_mercator = require("@math.gl/web-mercator");
|
|
1048
|
-
var import_quadbin2 = require("quadbin");
|
|
1049
|
-
var TILE_SIZE = 512;
|
|
1050
|
-
function quadbinToOffset(quadbin) {
|
|
1051
|
-
const { x, y, z } = (0, import_quadbin2.cellToTile)(quadbin);
|
|
1052
|
-
const scale = TILE_SIZE / (1 << z);
|
|
1053
|
-
return [x * scale, TILE_SIZE - y * scale, scale];
|
|
1054
|
-
}
|
|
1055
|
-
function quadbinToWorldBounds(quadbin, coverage) {
|
|
1056
|
-
const [xOffset, yOffset, scale] = quadbinToOffset(quadbin);
|
|
1057
|
-
return [
|
|
1058
|
-
[xOffset, yOffset],
|
|
1059
|
-
[xOffset + coverage * scale, yOffset - coverage * scale]
|
|
1060
|
-
];
|
|
1061
|
-
}
|
|
1062
|
-
function getQuadbinPolygon(quadbin, coverage = 1) {
|
|
1063
|
-
const [topLeft, bottomRight] = quadbinToWorldBounds(quadbin, coverage);
|
|
1064
|
-
const [w, n] = (0, import_web_mercator.worldToLngLat)(topLeft);
|
|
1065
|
-
const [e, s] = (0, import_web_mercator.worldToLngLat)(bottomRight);
|
|
1066
|
-
return [e, n, e, s, w, s, w, n, e, n];
|
|
1067
|
-
}
|
|
1319
|
+
var import_core9 = require("@deck.gl/core");
|
|
1068
1320
|
|
|
1069
1321
|
// dist/layers/quadbin-layer.js
|
|
1070
|
-
var
|
|
1322
|
+
var import_geo_layers6 = require("@deck.gl/geo-layers");
|
|
1323
|
+
var defaultProps4 = {
|
|
1071
1324
|
getQuadbin: { type: "accessor", value: (d) => d.quadbin }
|
|
1072
1325
|
};
|
|
1073
|
-
var _QuadbinLayer = class extends
|
|
1326
|
+
var _QuadbinLayer = class extends import_geo_layers6._GeoCellLayer {
|
|
1074
1327
|
indexToBounds() {
|
|
1075
1328
|
const { data, extruded, getQuadbin } = this.props;
|
|
1076
1329
|
const coverage = extruded ? 0.99 : 1;
|
|
@@ -1088,46 +1341,25 @@ var QuadbinLayer = _QuadbinLayer;
|
|
|
1088
1341
|
_QuadbinLayer.layerName = "QuadbinLayer";
|
|
1089
1342
|
})();
|
|
1090
1343
|
(() => {
|
|
1091
|
-
_QuadbinLayer.defaultProps =
|
|
1344
|
+
_QuadbinLayer.defaultProps = defaultProps4;
|
|
1092
1345
|
})();
|
|
1093
1346
|
|
|
1094
|
-
// dist/layers/quadbin-tileset-2d.js
|
|
1095
|
-
var import_geo_layers5 = require("@deck.gl/geo-layers");
|
|
1096
|
-
var import_quadbin3 = require("quadbin");
|
|
1097
|
-
var QuadbinTileset2D = class extends import_geo_layers5._Tileset2D {
|
|
1098
|
-
getTileIndices(opts) {
|
|
1099
|
-
return super.getTileIndices(opts).map(import_quadbin3.tileToCell).map((q) => ({ q, i: (0, import_quadbin3.bigIntToHex)(q) }));
|
|
1100
|
-
}
|
|
1101
|
-
getTileId({ q, i }) {
|
|
1102
|
-
return i || (0, import_quadbin3.bigIntToHex)(q);
|
|
1103
|
-
}
|
|
1104
|
-
getTileMetadata({ q }) {
|
|
1105
|
-
return super.getTileMetadata((0, import_quadbin3.cellToTile)(q));
|
|
1106
|
-
}
|
|
1107
|
-
getTileZoom({ q }) {
|
|
1108
|
-
return Number((0, import_quadbin3.getResolution)(q));
|
|
1109
|
-
}
|
|
1110
|
-
getParentIndex({ q }) {
|
|
1111
|
-
return { q: (0, import_quadbin3.cellToParent)(q) };
|
|
1112
|
-
}
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
1347
|
// dist/layers/quadbin-tile-layer.js
|
|
1116
|
-
var
|
|
1348
|
+
var import_quadbin5 = require("quadbin");
|
|
1117
1349
|
var renderSubLayers2 = (props) => {
|
|
1118
1350
|
const { data } = props;
|
|
1119
1351
|
if (!data || !data.length)
|
|
1120
1352
|
return null;
|
|
1121
1353
|
const isBigInt = typeof data[0].id === "bigint";
|
|
1122
1354
|
return new QuadbinLayer(props, {
|
|
1123
|
-
getQuadbin: isBigInt ? (d) => d.id : (d) => (0,
|
|
1355
|
+
getQuadbin: isBigInt ? (d) => d.id : (d) => (0, import_quadbin5.hexToBigInt)(d.id)
|
|
1124
1356
|
});
|
|
1125
1357
|
};
|
|
1126
|
-
var
|
|
1358
|
+
var defaultProps5 = {
|
|
1127
1359
|
data: TilejsonPropType,
|
|
1128
1360
|
tileSize: DEFAULT_TILE_SIZE
|
|
1129
1361
|
};
|
|
1130
|
-
var _QuadbinTileLayer = class extends
|
|
1362
|
+
var _QuadbinTileLayer = class extends import_core9.CompositeLayer {
|
|
1131
1363
|
getLoadOptions() {
|
|
1132
1364
|
const loadOptions = super.getLoadOptions() || {};
|
|
1133
1365
|
const tileJSON = this.props.data;
|
|
@@ -1157,15 +1389,15 @@ var QuadbinTileLayer = _QuadbinTileLayer;
|
|
|
1157
1389
|
_QuadbinTileLayer.layerName = "QuadbinTileLayer";
|
|
1158
1390
|
})();
|
|
1159
1391
|
(() => {
|
|
1160
|
-
_QuadbinTileLayer.defaultProps =
|
|
1392
|
+
_QuadbinTileLayer.defaultProps = defaultProps5;
|
|
1161
1393
|
})();
|
|
1162
1394
|
|
|
1163
1395
|
// dist/layers/heatmap-tile-layer.js
|
|
1164
1396
|
function unitDensityForCell(cell) {
|
|
1165
|
-
const cellResolution = Number((0,
|
|
1397
|
+
const cellResolution = Number((0, import_quadbin6.getResolution)(cell));
|
|
1166
1398
|
return Math.pow(4, cellResolution);
|
|
1167
1399
|
}
|
|
1168
|
-
var _RTTSolidPolygonLayer = class extends RTTModifier(
|
|
1400
|
+
var _RTTSolidPolygonLayer = class extends RTTModifier(import_layers2.SolidPolygonLayer) {
|
|
1169
1401
|
getShaders(type) {
|
|
1170
1402
|
const shaders = super.getShaders(type);
|
|
1171
1403
|
shaders.inject = {
|
|
@@ -1208,7 +1440,7 @@ var RTTSolidPolygonLayer = _RTTSolidPolygonLayer;
|
|
|
1208
1440
|
_RTTSolidPolygonLayer.layerName = "RTTSolidPolygonLayer";
|
|
1209
1441
|
})();
|
|
1210
1442
|
var PostProcessQuadbinTileLayer = PostProcessModifier(QuadbinTileLayer, heatmap);
|
|
1211
|
-
var
|
|
1443
|
+
var defaultProps6 = {
|
|
1212
1444
|
data: TilejsonPropType,
|
|
1213
1445
|
getWeight: { type: "accessor", value: 1 },
|
|
1214
1446
|
onMaxDensityChange: { type: "function", optional: true, value: null },
|
|
@@ -1216,7 +1448,7 @@ var defaultProps5 = {
|
|
|
1216
1448
|
intensity: { type: "number", value: 1 },
|
|
1217
1449
|
radiusPixels: { type: "number", min: 0, max: 100, value: 20 }
|
|
1218
1450
|
};
|
|
1219
|
-
var _HeatmapTileLayer = class extends
|
|
1451
|
+
var _HeatmapTileLayer = class extends import_core10.CompositeLayer {
|
|
1220
1452
|
initializeState() {
|
|
1221
1453
|
this.state = {
|
|
1222
1454
|
isLoaded: false,
|
|
@@ -1313,15 +1545,15 @@ var HeatmapTileLayer = _HeatmapTileLayer;
|
|
|
1313
1545
|
_HeatmapTileLayer.layerName = "HeatmapTileLayer";
|
|
1314
1546
|
})();
|
|
1315
1547
|
(() => {
|
|
1316
|
-
_HeatmapTileLayer.defaultProps =
|
|
1548
|
+
_HeatmapTileLayer.defaultProps = defaultProps6;
|
|
1317
1549
|
})();
|
|
1318
1550
|
var heatmap_tile_layer_default = HeatmapTileLayer;
|
|
1319
1551
|
|
|
1320
1552
|
// dist/layers/point-label-layer.js
|
|
1321
|
-
var
|
|
1322
|
-
var
|
|
1553
|
+
var import_core11 = require("@deck.gl/core");
|
|
1554
|
+
var import_layers3 = require("@deck.gl/layers");
|
|
1323
1555
|
var [LEFT, TOP, RIGHT, BOTTOM] = [0, 1, 2, 3];
|
|
1324
|
-
var _EnhancedTextBackgroundLayer = class extends
|
|
1556
|
+
var _EnhancedTextBackgroundLayer = class extends import_layers3._TextBackgroundLayer {
|
|
1325
1557
|
getShaders() {
|
|
1326
1558
|
const shaders = super.getShaders();
|
|
1327
1559
|
let vs = shaders.vs;
|
|
@@ -1334,7 +1566,7 @@ var EnhancedTextBackgroundLayer = _EnhancedTextBackgroundLayer;
|
|
|
1334
1566
|
(() => {
|
|
1335
1567
|
_EnhancedTextBackgroundLayer.layerName = "EnhancedTextBackgroundLayer";
|
|
1336
1568
|
})();
|
|
1337
|
-
var _EnhancedTextLayer = class extends
|
|
1569
|
+
var _EnhancedTextLayer = class extends import_layers3.TextLayer {
|
|
1338
1570
|
filterSubLayer({ layer, renderPass }) {
|
|
1339
1571
|
const background = layer.id.includes("primary-background");
|
|
1340
1572
|
if (renderPass === "collision") {
|
|
@@ -1347,12 +1579,12 @@ var EnhancedTextLayer = _EnhancedTextLayer;
|
|
|
1347
1579
|
(() => {
|
|
1348
1580
|
_EnhancedTextLayer.layerName = "EnhancedTextLayer";
|
|
1349
1581
|
})();
|
|
1350
|
-
var
|
|
1351
|
-
...
|
|
1582
|
+
var defaultProps7 = {
|
|
1583
|
+
...import_layers3.TextLayer.defaultProps,
|
|
1352
1584
|
getRadius: { type: "accessor", value: 1 },
|
|
1353
1585
|
radiusScale: { type: "number", min: 0, value: 1 }
|
|
1354
1586
|
};
|
|
1355
|
-
var _PointLabelLayer = class extends
|
|
1587
|
+
var _PointLabelLayer = class extends import_core11.CompositeLayer {
|
|
1356
1588
|
calculatePixelOffset(secondary) {
|
|
1357
1589
|
const { getTextAnchor: anchor, getAlignmentBaseline: alignment, getRadius, getSecondaryText, radiusScale, secondarySizeScale, sizeScale } = this.props;
|
|
1358
1590
|
const xMult = anchor === "middle" ? 0 : anchor === "start" ? 1 : -1;
|
|
@@ -1458,15 +1690,15 @@ var PointLabelLayer = _PointLabelLayer;
|
|
|
1458
1690
|
_PointLabelLayer.layerName = "PointLabelLayer";
|
|
1459
1691
|
})();
|
|
1460
1692
|
(() => {
|
|
1461
|
-
_PointLabelLayer.defaultProps =
|
|
1693
|
+
_PointLabelLayer.defaultProps = defaultProps7;
|
|
1462
1694
|
})();
|
|
1463
1695
|
|
|
1464
1696
|
// dist/layers/raster-tile-layer.js
|
|
1465
|
-
var
|
|
1697
|
+
var import_core13 = require("@deck.gl/core");
|
|
1466
1698
|
|
|
1467
1699
|
// dist/layers/raster-layer.js
|
|
1468
|
-
var
|
|
1469
|
-
var
|
|
1700
|
+
var import_core12 = require("@deck.gl/core");
|
|
1701
|
+
var import_layers4 = require("@deck.gl/layers");
|
|
1470
1702
|
|
|
1471
1703
|
// dist/layers/raster-layer-vertex.glsl.js
|
|
1472
1704
|
var raster_layer_vertex_glsl_default = `#version 300 es
|
|
@@ -1538,8 +1770,8 @@ DECKGL_FILTER_COLOR(vColor, geometry);
|
|
|
1538
1770
|
`;
|
|
1539
1771
|
|
|
1540
1772
|
// dist/layers/raster-layer.js
|
|
1541
|
-
var
|
|
1542
|
-
...
|
|
1773
|
+
var defaultProps8 = {
|
|
1774
|
+
...import_layers4.ColumnLayer.defaultProps,
|
|
1543
1775
|
extruded: false,
|
|
1544
1776
|
diskResolution: 4,
|
|
1545
1777
|
vertices: [
|
|
@@ -1549,7 +1781,7 @@ var defaultProps7 = {
|
|
|
1549
1781
|
[-0.5, 0.5]
|
|
1550
1782
|
]
|
|
1551
1783
|
};
|
|
1552
|
-
var _RasterColumnLayer = class extends
|
|
1784
|
+
var _RasterColumnLayer = class extends import_layers4.ColumnLayer {
|
|
1553
1785
|
getShaders() {
|
|
1554
1786
|
const shaders = super.getShaders();
|
|
1555
1787
|
const data = this.props.data;
|
|
@@ -1585,7 +1817,7 @@ var RasterColumnLayer = _RasterColumnLayer;
|
|
|
1585
1817
|
(() => {
|
|
1586
1818
|
_RasterColumnLayer.layerName = "RasterColumnLayer";
|
|
1587
1819
|
})();
|
|
1588
|
-
var _RasterLayer = class extends
|
|
1820
|
+
var _RasterLayer = class extends import_core12.CompositeLayer {
|
|
1589
1821
|
renderLayers() {
|
|
1590
1822
|
const { data, getElevation, getFillColor, getLineColor, getLineWidth, tileIndex, updateTriggers } = this.props;
|
|
1591
1823
|
if (!data || !tileIndex)
|
|
@@ -1626,7 +1858,7 @@ var RasterLayer = _RasterLayer;
|
|
|
1626
1858
|
_RasterLayer.layerName = "RasterLayer";
|
|
1627
1859
|
})();
|
|
1628
1860
|
(() => {
|
|
1629
|
-
_RasterLayer.defaultProps =
|
|
1861
|
+
_RasterLayer.defaultProps = defaultProps8;
|
|
1630
1862
|
})();
|
|
1631
1863
|
|
|
1632
1864
|
// dist/layers/raster-tile-layer.js
|
|
@@ -1637,11 +1869,11 @@ var renderSubLayers3 = (props) => {
|
|
|
1637
1869
|
return null;
|
|
1638
1870
|
return new RasterLayer(props, { tileIndex });
|
|
1639
1871
|
};
|
|
1640
|
-
var
|
|
1872
|
+
var defaultProps9 = {
|
|
1641
1873
|
data: TilejsonPropType,
|
|
1642
1874
|
tileSize: DEFAULT_TILE_SIZE
|
|
1643
1875
|
};
|
|
1644
|
-
var _RasterTileLayer = class extends
|
|
1876
|
+
var _RasterTileLayer = class extends import_core13.CompositeLayer {
|
|
1645
1877
|
getLoadOptions() {
|
|
1646
1878
|
const loadOptions = super.getLoadOptions() || {};
|
|
1647
1879
|
const tileJSON = this.props.data;
|
|
@@ -1671,11 +1903,11 @@ var RasterTileLayer = _RasterTileLayer;
|
|
|
1671
1903
|
_RasterTileLayer.layerName = "RasterTileLayer";
|
|
1672
1904
|
})();
|
|
1673
1905
|
(() => {
|
|
1674
|
-
_RasterTileLayer.defaultProps =
|
|
1906
|
+
_RasterTileLayer.defaultProps = defaultProps9;
|
|
1675
1907
|
})();
|
|
1676
1908
|
|
|
1677
1909
|
// dist/layers/vector-tile-layer.js
|
|
1678
|
-
var
|
|
1910
|
+
var import_core14 = require("@loaders.gl/core");
|
|
1679
1911
|
|
|
1680
1912
|
// dist/layers/schema/carto-properties-tile.js
|
|
1681
1913
|
var TileReader4 = class {
|
|
@@ -1715,7 +1947,7 @@ var carto_properties_tile_loader_default = CartoPropertiesTileLoader;
|
|
|
1715
1947
|
|
|
1716
1948
|
// dist/layers/schema/carto-vector-tile-loader.js
|
|
1717
1949
|
var import_earcut = __toESM(require("earcut"), 1);
|
|
1718
|
-
var VERSION3 = true ? "9.0.
|
|
1950
|
+
var VERSION3 = true ? "9.0.24" : "latest";
|
|
1719
1951
|
var id3 = "cartoVectorTile";
|
|
1720
1952
|
var DEFAULT_OPTIONS3 = {
|
|
1721
1953
|
cartoVectorTile: {
|
|
@@ -1763,7 +1995,7 @@ function triangulate(polygons) {
|
|
|
1763
1995
|
function parseCartoVectorTile(arrayBuffer, options) {
|
|
1764
1996
|
if (!arrayBuffer)
|
|
1765
1997
|
return null;
|
|
1766
|
-
const tile = parsePbf(arrayBuffer,
|
|
1998
|
+
const tile = parsePbf(arrayBuffer, TileReader);
|
|
1767
1999
|
if (tile.polygons && !tile.polygons.triangles) {
|
|
1768
2000
|
triangulate(tile.polygons);
|
|
1769
2001
|
}
|
|
@@ -1773,16 +2005,16 @@ var carto_vector_tile_loader_default = CartoVectorTileLoader;
|
|
|
1773
2005
|
|
|
1774
2006
|
// dist/layers/vector-tile-layer.js
|
|
1775
2007
|
var import_extensions = require("@deck.gl/extensions");
|
|
1776
|
-
var
|
|
1777
|
-
var
|
|
1778
|
-
(0,
|
|
1779
|
-
var
|
|
1780
|
-
...
|
|
2008
|
+
var import_geo_layers7 = require("@deck.gl/geo-layers");
|
|
2009
|
+
var import_layers5 = require("@deck.gl/layers");
|
|
2010
|
+
(0, import_core14.registerLoaders)([carto_properties_tile_loader_default, carto_vector_tile_loader_default]);
|
|
2011
|
+
var defaultProps10 = {
|
|
2012
|
+
...import_geo_layers7.MVTLayer.defaultProps,
|
|
1781
2013
|
data: TilejsonPropType,
|
|
1782
2014
|
dataComparator: TilejsonPropType.equal,
|
|
1783
2015
|
tileSize: DEFAULT_TILE_SIZE
|
|
1784
2016
|
};
|
|
1785
|
-
var _VectorTileLayer = class extends
|
|
2017
|
+
var _VectorTileLayer = class extends import_geo_layers7.MVTLayer {
|
|
1786
2018
|
constructor(...propObjects) {
|
|
1787
2019
|
super(...propObjects);
|
|
1788
2020
|
}
|
|
@@ -1809,7 +2041,7 @@ var _VectorTileLayer = class extends import_geo_layers6.MVTLayer {
|
|
|
1809
2041
|
async getTileData(tile) {
|
|
1810
2042
|
const tileJSON = this.props.data;
|
|
1811
2043
|
const { tiles, properties_tiles } = tileJSON;
|
|
1812
|
-
const url = (0,
|
|
2044
|
+
const url = (0, import_geo_layers7._getURLFromTemplate)(tiles, tile);
|
|
1813
2045
|
if (!url) {
|
|
1814
2046
|
return Promise.reject("Invalid URL");
|
|
1815
2047
|
}
|
|
@@ -1820,7 +2052,7 @@ var _VectorTileLayer = class extends import_geo_layers6.MVTLayer {
|
|
|
1820
2052
|
if (!properties_tiles) {
|
|
1821
2053
|
return await geometryFetch;
|
|
1822
2054
|
}
|
|
1823
|
-
const propertiesUrl = (0,
|
|
2055
|
+
const propertiesUrl = (0, import_geo_layers7._getURLFromTemplate)(properties_tiles, tile);
|
|
1824
2056
|
if (!propertiesUrl) {
|
|
1825
2057
|
return Promise.reject("Invalid properties URL");
|
|
1826
2058
|
}
|
|
@@ -1850,7 +2082,7 @@ var _VectorTileLayer = class extends import_geo_layers6.MVTLayer {
|
|
|
1850
2082
|
extensions: [new import_extensions.ClipExtension(), ...props.extensions || []],
|
|
1851
2083
|
clipBounds: [west, south, east, north]
|
|
1852
2084
|
};
|
|
1853
|
-
const subLayer = new
|
|
2085
|
+
const subLayer = new import_layers5.GeoJsonLayer(subLayerProps);
|
|
1854
2086
|
return subLayer;
|
|
1855
2087
|
}
|
|
1856
2088
|
_isWGS84() {
|
|
@@ -1864,7 +2096,7 @@ var VectorTileLayer = _VectorTileLayer;
|
|
|
1864
2096
|
_VectorTileLayer.layerName = "VectorTileLayer";
|
|
1865
2097
|
})();
|
|
1866
2098
|
(() => {
|
|
1867
|
-
_VectorTileLayer.defaultProps =
|
|
2099
|
+
_VectorTileLayer.defaultProps = defaultProps10;
|
|
1868
2100
|
})();
|
|
1869
2101
|
|
|
1870
2102
|
// dist/api/carto-api-error.js
|
|
@@ -2142,10 +2374,10 @@ function buildQueryUrl({ apiBaseUrl, connectionName }) {
|
|
|
2142
2374
|
}
|
|
2143
2375
|
|
|
2144
2376
|
// dist/api/request-with-parameters.js
|
|
2145
|
-
var
|
|
2377
|
+
var import_core15 = require("@deck.gl/core");
|
|
2146
2378
|
var DEFAULT_PARAMETERS = {
|
|
2147
2379
|
v: V3_MINOR_VERSION,
|
|
2148
|
-
deckglVersion:
|
|
2380
|
+
deckglVersion: import_core15.VERSION
|
|
2149
2381
|
};
|
|
2150
2382
|
var DEFAULT_HEADERS = {
|
|
2151
2383
|
Accept: "application/json",
|
|
@@ -2432,7 +2664,7 @@ var vectorTilesetSource = async function(options) {
|
|
|
2432
2664
|
};
|
|
2433
2665
|
|
|
2434
2666
|
// dist/api/parse-map.js
|
|
2435
|
-
var
|
|
2667
|
+
var import_core16 = require("@deck.gl/core");
|
|
2436
2668
|
|
|
2437
2669
|
// dist/api/layer-map.js
|
|
2438
2670
|
var import_d3_array = require("d3-array");
|
|
@@ -2441,8 +2673,8 @@ var import_d3_scale3 = require("d3-scale");
|
|
|
2441
2673
|
var import_d3_format = require("d3-format");
|
|
2442
2674
|
var import_moment_timezone = __toESM(require("moment-timezone"), 1);
|
|
2443
2675
|
var import_aggregation_layers = require("@deck.gl/aggregation-layers");
|
|
2444
|
-
var
|
|
2445
|
-
var
|
|
2676
|
+
var import_layers6 = require("@deck.gl/layers");
|
|
2677
|
+
var import_geo_layers8 = require("@deck.gl/geo-layers");
|
|
2446
2678
|
var SCALE_FUNCS = {
|
|
2447
2679
|
linear: import_d3_scale3.scaleLinear,
|
|
2448
2680
|
ordinal: import_d3_scale3.scaleOrdinal,
|
|
@@ -2476,6 +2708,15 @@ var AGGREGATION_FUNC = {
|
|
|
2476
2708
|
stddev: import_d3_array.deviation,
|
|
2477
2709
|
variance: import_d3_array.variance
|
|
2478
2710
|
};
|
|
2711
|
+
var TILE_LAYER_TYPE_TO_LAYER = {
|
|
2712
|
+
clusterTile: ClusterTileLayer,
|
|
2713
|
+
h3: H3TileLayer,
|
|
2714
|
+
heatmapTile: heatmap_tile_layer_default,
|
|
2715
|
+
mvt: VectorTileLayer,
|
|
2716
|
+
quadbin: QuadbinTileLayer,
|
|
2717
|
+
raster: RasterTileLayer,
|
|
2718
|
+
tileset: VectorTileLayer
|
|
2719
|
+
};
|
|
2479
2720
|
var hexToRGBA = (c) => {
|
|
2480
2721
|
const { r, g, b, opacity } = (0, import_d3_color.rgb)(c);
|
|
2481
2722
|
return [r, g, b, 255 * opacity];
|
|
@@ -2514,7 +2755,7 @@ var aggregationVisConfig = {
|
|
|
2514
2755
|
elevationPercentile: ["elevationLowerPercentile", "elevationUpperPercentile"],
|
|
2515
2756
|
percentile: ["lowerPercentile", "upperPercentile"]
|
|
2516
2757
|
};
|
|
2517
|
-
var
|
|
2758
|
+
var defaultProps11 = {
|
|
2518
2759
|
lineMiterLimit: 2,
|
|
2519
2760
|
lineWidthUnits: "pixels",
|
|
2520
2761
|
pointRadiusUnits: "pixels",
|
|
@@ -2530,15 +2771,15 @@ function getLayer(type, config, dataset) {
|
|
|
2530
2771
|
if ((_a = config.visConfig) == null ? void 0 : _a.customMarkers) {
|
|
2531
2772
|
basePropMap = mergePropMaps(sharedPropMap, customMarkersPropsMap);
|
|
2532
2773
|
}
|
|
2533
|
-
if (type
|
|
2534
|
-
return getTileLayer(dataset, basePropMap);
|
|
2774
|
+
if (TILE_LAYER_TYPE_TO_LAYER[type]) {
|
|
2775
|
+
return getTileLayer(dataset, basePropMap, type);
|
|
2535
2776
|
}
|
|
2536
2777
|
const geoColumn = dataset == null ? void 0 : dataset.geoColumn;
|
|
2537
2778
|
const getPosition = (d) => d[geoColumn].coordinates;
|
|
2538
2779
|
const hexagonId = (_b = config.columns) == null ? void 0 : _b.hex_id;
|
|
2539
2780
|
const layerTypeDefs = {
|
|
2540
2781
|
point: {
|
|
2541
|
-
Layer:
|
|
2782
|
+
Layer: import_layers6.GeoJsonLayer,
|
|
2542
2783
|
propMap: {
|
|
2543
2784
|
columns: {
|
|
2544
2785
|
altitude: (x) => ({ parameters: { depthTest: Boolean(x) } })
|
|
@@ -2547,7 +2788,7 @@ function getLayer(type, config, dataset) {
|
|
|
2547
2788
|
}
|
|
2548
2789
|
},
|
|
2549
2790
|
geojson: {
|
|
2550
|
-
Layer:
|
|
2791
|
+
Layer: import_layers6.GeoJsonLayer
|
|
2551
2792
|
},
|
|
2552
2793
|
grid: {
|
|
2553
2794
|
Layer: import_aggregation_layers.CPUGridLayer,
|
|
@@ -2565,7 +2806,7 @@ function getLayer(type, config, dataset) {
|
|
|
2565
2806
|
defaultProps: { getPosition }
|
|
2566
2807
|
},
|
|
2567
2808
|
hexagonId: {
|
|
2568
|
-
Layer:
|
|
2809
|
+
Layer: import_geo_layers8.H3HexagonLayer,
|
|
2569
2810
|
propMap: { visConfig: { coverage: "coverage" } },
|
|
2570
2811
|
defaultProps: { getHexagon: (d) => d[hexagonId], stroked: false }
|
|
2571
2812
|
}
|
|
@@ -2575,28 +2816,16 @@ function getLayer(type, config, dataset) {
|
|
|
2575
2816
|
return {
|
|
2576
2817
|
...layer,
|
|
2577
2818
|
propMap: mergePropMaps(basePropMap, layer.propMap),
|
|
2578
|
-
defaultProps: { ...
|
|
2819
|
+
defaultProps: { ...defaultProps11, ...layer.defaultProps }
|
|
2579
2820
|
};
|
|
2580
2821
|
}
|
|
2581
|
-
function
|
|
2582
|
-
|
|
2583
|
-
return RasterTileLayer;
|
|
2584
|
-
}
|
|
2585
|
-
if (scheme === "h3") {
|
|
2586
|
-
return H3TileLayer;
|
|
2587
|
-
}
|
|
2588
|
-
if (scheme === "quadbin") {
|
|
2589
|
-
return QuadbinTileLayer;
|
|
2590
|
-
}
|
|
2591
|
-
return VectorTileLayer;
|
|
2592
|
-
}
|
|
2593
|
-
function getTileLayer(dataset, basePropMap) {
|
|
2594
|
-
const { aggregationExp, aggregationResLevel, data: { scheme } } = dataset;
|
|
2822
|
+
function getTileLayer(dataset, basePropMap, type) {
|
|
2823
|
+
const { aggregationExp, aggregationResLevel } = dataset;
|
|
2595
2824
|
return {
|
|
2596
|
-
Layer:
|
|
2825
|
+
Layer: TILE_LAYER_TYPE_TO_LAYER[type] || VectorTileLayer,
|
|
2597
2826
|
propMap: basePropMap,
|
|
2598
2827
|
defaultProps: {
|
|
2599
|
-
...
|
|
2828
|
+
...defaultProps11,
|
|
2600
2829
|
...aggregationExp && { aggregationExp },
|
|
2601
2830
|
...aggregationResLevel && { aggregationResLevel },
|
|
2602
2831
|
uniqueIdProperty: "geoid"
|
|
@@ -2810,12 +3039,12 @@ function parseMap(json) {
|
|
|
2810
3039
|
assert(dataset, `No dataset matching dataId: ${dataId}`);
|
|
2811
3040
|
const { data } = dataset;
|
|
2812
3041
|
assert(data, `No data loaded for dataId: ${dataId}`);
|
|
2813
|
-
const { Layer: Layer2, propMap, defaultProps:
|
|
3042
|
+
const { Layer: Layer2, propMap, defaultProps: defaultProps12 } = getLayer(type, config, dataset);
|
|
2814
3043
|
const styleProps = createStyleProps(config, propMap);
|
|
2815
3044
|
return new Layer2({
|
|
2816
3045
|
id: id4,
|
|
2817
3046
|
data,
|
|
2818
|
-
...
|
|
3047
|
+
...defaultProps12,
|
|
2819
3048
|
...createInteractionProps(interactionConfig),
|
|
2820
3049
|
...styleProps,
|
|
2821
3050
|
...createChannelProps(id4, type, config, visualChannels, data),
|
|
@@ -2823,7 +3052,7 @@ function parseMap(json) {
|
|
|
2823
3052
|
...createLoadOptions(token)
|
|
2824
3053
|
});
|
|
2825
3054
|
} catch (e) {
|
|
2826
|
-
|
|
3055
|
+
import_core16.log.error(e.message)();
|
|
2827
3056
|
return void 0;
|
|
2828
3057
|
}
|
|
2829
3058
|
})
|
|
@@ -3300,6 +3529,7 @@ var query = async function(options) {
|
|
|
3300
3529
|
|
|
3301
3530
|
// dist/index.js
|
|
3302
3531
|
var CARTO_LAYERS = {
|
|
3532
|
+
ClusterTileLayer,
|
|
3303
3533
|
H3TileLayer,
|
|
3304
3534
|
HeatmapTileLayer: heatmap_tile_layer_default,
|
|
3305
3535
|
_PointLabelLayer: PointLabelLayer,
|