@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/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)
|
|
@@ -509,92 +445,506 @@ var CellsReader = class {
|
|
|
509
445
|
else if (tag === 2)
|
|
510
446
|
obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
511
447
|
else if (tag === 3) {
|
|
512
|
-
const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
513
|
-
obj.numericProps[entry.key] = entry.value;
|
|
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
|
+
ownKeys(target) {
|
|
491
|
+
return [...Object.keys(numericProps), ...Reflect.ownKeys(target)];
|
|
492
|
+
},
|
|
493
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
494
|
+
return { enumerable: true, configurable: true };
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function getWorkerUrl(id4, version) {
|
|
499
|
+
return `https://unpkg.com/@deck.gl/carto@${version}/dist/${id4}-worker.js`;
|
|
500
|
+
}
|
|
501
|
+
function scaleIdentity() {
|
|
502
|
+
let unknown;
|
|
503
|
+
function scale(x) {
|
|
504
|
+
return x === null ? unknown : x;
|
|
505
|
+
}
|
|
506
|
+
scale.invert = scale;
|
|
507
|
+
scale.domain = scale.range = (d) => d;
|
|
508
|
+
scale.unknown = (u) => {
|
|
509
|
+
if (u) {
|
|
510
|
+
unknown = u;
|
|
511
|
+
}
|
|
512
|
+
return unknown;
|
|
513
|
+
};
|
|
514
|
+
scale.copy = () => {
|
|
515
|
+
const scaleCopy = scaleIdentity();
|
|
516
|
+
scaleCopy.unknown(unknown);
|
|
517
|
+
return scaleCopy;
|
|
518
|
+
};
|
|
519
|
+
return scale;
|
|
520
|
+
}
|
|
521
|
+
var isObject = (x) => x !== null && typeof x === "object";
|
|
522
|
+
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
523
|
+
|
|
524
|
+
// dist/layers/schema/spatialjson-utils.js
|
|
525
|
+
var import_quadbin4 = require("quadbin");
|
|
526
|
+
function binaryToSpatialjson(binary) {
|
|
527
|
+
const { cells, scheme } = binary;
|
|
528
|
+
const count = cells.indices.value.length;
|
|
529
|
+
const spatial = [];
|
|
530
|
+
for (let i = 0; i < count; i++) {
|
|
531
|
+
const id4 = scheme === "h3" ? (0, import_quadbin4.bigIntToHex)(cells.indices.value[i]) : cells.indices.value[i];
|
|
532
|
+
const properties = { ...cells.properties[i] };
|
|
533
|
+
for (const key of Object.keys(cells.numericProps)) {
|
|
534
|
+
properties[key] = cells.numericProps[key].value[i];
|
|
535
|
+
}
|
|
536
|
+
spatial.push({ id: id4, properties });
|
|
537
|
+
}
|
|
538
|
+
return spatial;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// dist/layers/schema/carto-spatial-tile-loader.js
|
|
542
|
+
var VERSION = true ? "9.0.25" : "latest";
|
|
543
|
+
var id = "cartoSpatialTile";
|
|
544
|
+
var DEFAULT_OPTIONS = {
|
|
545
|
+
cartoSpatialTile: {
|
|
546
|
+
scheme: "quadbin",
|
|
547
|
+
workerUrl: getWorkerUrl(id, VERSION)
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
var CartoSpatialTileLoader = {
|
|
551
|
+
name: "CARTO Spatial Tile",
|
|
552
|
+
version: VERSION,
|
|
553
|
+
id,
|
|
554
|
+
module: "carto",
|
|
555
|
+
extensions: ["pbf"],
|
|
556
|
+
mimeTypes: ["application/vnd.carto-spatial-tile"],
|
|
557
|
+
category: "geometry",
|
|
558
|
+
parse: async (arrayBuffer, options) => parseCartoSpatialTile(arrayBuffer, options),
|
|
559
|
+
parseSync: parseCartoSpatialTile,
|
|
560
|
+
worker: true,
|
|
561
|
+
options: DEFAULT_OPTIONS
|
|
562
|
+
};
|
|
563
|
+
function parseCartoSpatialTile(arrayBuffer, options) {
|
|
564
|
+
var _a;
|
|
565
|
+
if (!arrayBuffer)
|
|
566
|
+
return null;
|
|
567
|
+
const tile = parsePbf(arrayBuffer, TileReader2);
|
|
568
|
+
const { cells } = tile;
|
|
569
|
+
const scheme = (_a = options == null ? void 0 : options.cartoSpatialTile) == null ? void 0 : _a.scheme;
|
|
570
|
+
const data = { cells, scheme };
|
|
571
|
+
return binaryToSpatialjson(data);
|
|
572
|
+
}
|
|
573
|
+
var carto_spatial_tile_loader_default = CartoSpatialTileLoader;
|
|
574
|
+
|
|
575
|
+
// dist/layers/utils.js
|
|
576
|
+
var import_core2 = require("@deck.gl/core");
|
|
577
|
+
var import_core3 = require("@deck.gl/core");
|
|
578
|
+
function injectAccessToken(loadOptions, accessToken) {
|
|
579
|
+
var _a, _b, _c;
|
|
580
|
+
if (!((_b = (_a = loadOptions == null ? void 0 : loadOptions.fetch) == null ? void 0 : _a.headers) == null ? void 0 : _b.Authorization)) {
|
|
581
|
+
loadOptions.fetch = {
|
|
582
|
+
...loadOptions.fetch,
|
|
583
|
+
headers: { ...(_c = loadOptions.fetch) == null ? void 0 : _c.headers, Authorization: `Bearer ${accessToken}` }
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
function mergeBoundaryData(geometry, properties) {
|
|
588
|
+
const mapping = {};
|
|
589
|
+
for (const { geoid, ...rest } of properties.properties) {
|
|
590
|
+
if (geoid in mapping) {
|
|
591
|
+
import_core2.log.warn("Duplicate geoid key in boundary mapping, using first occurance")();
|
|
592
|
+
} else {
|
|
593
|
+
mapping[geoid] = rest;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
for (const type of ["points", "lines", "polygons"]) {
|
|
597
|
+
const geom = geometry[type];
|
|
598
|
+
if (geom.positions.value.length === 0) {
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
geom.properties = geom.properties.map(({ geoid }) => mapping[geoid]);
|
|
602
|
+
const { positions, globalFeatureIds } = geom;
|
|
603
|
+
let indices = null;
|
|
604
|
+
if (type === "lines")
|
|
605
|
+
indices = geom.pathIndices.value;
|
|
606
|
+
if (type === "polygons")
|
|
607
|
+
indices = geom.polygonIndices.value;
|
|
608
|
+
const length = positions.value.length / positions.size;
|
|
609
|
+
for (const key in properties.numericProps) {
|
|
610
|
+
const sourceProp = properties.numericProps[key].value;
|
|
611
|
+
const TypedArray = sourceProp.constructor;
|
|
612
|
+
const destProp = new TypedArray(length);
|
|
613
|
+
geom.numericProps[key] = { value: destProp, size: 1 };
|
|
614
|
+
if (!indices) {
|
|
615
|
+
for (let i = 0; i < length; i++) {
|
|
616
|
+
const featureId = globalFeatureIds.value[i];
|
|
617
|
+
destProp[i] = sourceProp[featureId];
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
for (let i = 0; i < indices.length - 1; i++) {
|
|
621
|
+
const startIndex = indices[i];
|
|
622
|
+
const endIndex = indices[i + 1];
|
|
623
|
+
const featureId = globalFeatureIds.value[startIndex];
|
|
624
|
+
destProp.fill(sourceProp[featureId], startIndex, endIndex);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return geometry;
|
|
630
|
+
}
|
|
631
|
+
var TilejsonPropType = {
|
|
632
|
+
type: "object",
|
|
633
|
+
value: null,
|
|
634
|
+
validate: (value, propType) => propType.optional && value === null || typeof value === "object" && Array.isArray(value.tiles) && value.tiles.every((url) => typeof url === "string"),
|
|
635
|
+
equal: (value1, value2) => {
|
|
636
|
+
return (0, import_core3._deepEqual)(value1, value2, 2);
|
|
637
|
+
},
|
|
638
|
+
async: true
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
// dist/layers/cluster-tile-layer.js
|
|
642
|
+
(0, import_core4.registerLoaders)([carto_spatial_tile_loader_default]);
|
|
643
|
+
var defaultProps = {
|
|
644
|
+
data: TilejsonPropType,
|
|
645
|
+
clusterLevel: { type: "number", value: 5, min: 1 },
|
|
646
|
+
getPosition: {
|
|
647
|
+
type: "accessor",
|
|
648
|
+
value: ({ id: id4 }) => getQuadbinPolygon(id4, 0.5).slice(2, 4)
|
|
649
|
+
},
|
|
650
|
+
getWeight: { type: "accessor", value: 1 },
|
|
651
|
+
refinementStrategy: "no-overlap",
|
|
652
|
+
tileSize: DEFAULT_TILE_SIZE
|
|
653
|
+
};
|
|
654
|
+
var _ClusterGeoJsonLayer = class extends import_geo_layers2.TileLayer {
|
|
655
|
+
renderLayers() {
|
|
656
|
+
var _a;
|
|
657
|
+
const visibleTiles = (_a = this.state.tileset) == null ? void 0 : _a.tiles.filter((tile) => {
|
|
658
|
+
return tile.isLoaded && tile.content && this.state.tileset.isTileVisible(tile);
|
|
659
|
+
});
|
|
660
|
+
if (!(visibleTiles == null ? void 0 : visibleTiles.length)) {
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
visibleTiles.sort((a, b) => b.zoom - a.zoom);
|
|
664
|
+
const { zoom } = this.context.viewport;
|
|
665
|
+
const { clusterLevel, getPosition, getWeight } = this.props;
|
|
666
|
+
const properties = extractAggregationProperties(visibleTiles[0]);
|
|
667
|
+
const data = [];
|
|
668
|
+
for (const tile of visibleTiles) {
|
|
669
|
+
const overZoom = Math.round(zoom - tile.zoom);
|
|
670
|
+
const aggregationLevels = Math.round(clusterLevel) - overZoom;
|
|
671
|
+
aggregateTile(tile, aggregationLevels, properties, getPosition, getWeight);
|
|
672
|
+
data.push(...tile.userData[aggregationLevels]);
|
|
673
|
+
}
|
|
674
|
+
data.sort((a, b) => Number(b.count - a.count));
|
|
675
|
+
const clusterIds = data == null ? void 0 : data.map((tile) => tile.id);
|
|
676
|
+
const needsUpdate = !(0, import_core5._deepEqual)(clusterIds, this.state.clusterIds, 1);
|
|
677
|
+
this.setState({ clusterIds });
|
|
678
|
+
if (needsUpdate) {
|
|
679
|
+
const stats = computeAggregationStats(data, properties);
|
|
680
|
+
for (const d of data) {
|
|
681
|
+
d.stats = stats;
|
|
682
|
+
}
|
|
683
|
+
this.setState({ data: clustersToBinary(data) });
|
|
684
|
+
}
|
|
685
|
+
const props = {
|
|
686
|
+
...this.props,
|
|
687
|
+
id: "clusters",
|
|
688
|
+
data: this.state.data,
|
|
689
|
+
dataComparator: (data2, oldData) => {
|
|
690
|
+
var _a2, _b, _c, _d;
|
|
691
|
+
const newIds = (_b = (_a2 = data2 == null ? void 0 : data2.points) == null ? void 0 : _a2.properties) == null ? void 0 : _b.map((tile) => tile.id);
|
|
692
|
+
const oldIds = (_d = (_c = oldData == null ? void 0 : oldData.points) == null ? void 0 : _c.properties) == null ? void 0 : _d.map((tile) => tile.id);
|
|
693
|
+
return (0, import_core5._deepEqual)(newIds, oldIds, 1);
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
return new import_layers.GeoJsonLayer(this.getSubLayerProps(props));
|
|
697
|
+
}
|
|
698
|
+
getPickingInfo(params) {
|
|
699
|
+
const info = params.info;
|
|
700
|
+
if (info.index !== -1) {
|
|
701
|
+
const { data } = params.sourceLayer.props;
|
|
702
|
+
info.object = (0, import_gis.binaryToGeojson)(data, {
|
|
703
|
+
globalFeatureId: info.index
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
return info;
|
|
707
|
+
}
|
|
708
|
+
_updateAutoHighlight(info) {
|
|
709
|
+
for (const layer of this.getSubLayers()) {
|
|
710
|
+
layer.updateAutoHighlight(info);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
filterSubLayer() {
|
|
714
|
+
return true;
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
var ClusterGeoJsonLayer = _ClusterGeoJsonLayer;
|
|
718
|
+
(() => {
|
|
719
|
+
_ClusterGeoJsonLayer.layerName = "ClusterGeoJsonLayer";
|
|
720
|
+
})();
|
|
721
|
+
(() => {
|
|
722
|
+
_ClusterGeoJsonLayer.defaultProps = defaultProps;
|
|
723
|
+
})();
|
|
724
|
+
var _ClusterTileLayer = class extends import_core5.CompositeLayer {
|
|
725
|
+
getLoadOptions() {
|
|
726
|
+
const loadOptions = super.getLoadOptions() || {};
|
|
727
|
+
const tileJSON = this.props.data;
|
|
728
|
+
injectAccessToken(loadOptions, tileJSON.accessToken);
|
|
729
|
+
loadOptions.cartoSpatialTile = { ...loadOptions.cartoSpatialTile, scheme: "quadbin" };
|
|
730
|
+
return loadOptions;
|
|
731
|
+
}
|
|
732
|
+
renderLayers() {
|
|
733
|
+
const tileJSON = this.props.data;
|
|
734
|
+
if (!tileJSON)
|
|
735
|
+
return null;
|
|
736
|
+
const { tiles: data, maxresolution: maxZoom } = tileJSON;
|
|
737
|
+
return [
|
|
738
|
+
new ClusterGeoJsonLayer(this.props, {
|
|
739
|
+
id: `cluster-geojson-layer-${this.props.id}`,
|
|
740
|
+
data,
|
|
741
|
+
TilesetClass: QuadbinTileset2D,
|
|
742
|
+
maxZoom,
|
|
743
|
+
loadOptions: this.getLoadOptions()
|
|
744
|
+
})
|
|
745
|
+
];
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
var ClusterTileLayer = _ClusterTileLayer;
|
|
749
|
+
(() => {
|
|
750
|
+
_ClusterTileLayer.layerName = "ClusterTileLayer";
|
|
751
|
+
})();
|
|
752
|
+
(() => {
|
|
753
|
+
_ClusterTileLayer.defaultProps = defaultProps;
|
|
754
|
+
})();
|
|
755
|
+
|
|
756
|
+
// dist/layers/h3-tile-layer.js
|
|
757
|
+
var import_core7 = require("@deck.gl/core");
|
|
758
|
+
var import_geo_layers5 = require("@deck.gl/geo-layers");
|
|
759
|
+
|
|
760
|
+
// dist/layers/h3-tileset-2d.js
|
|
761
|
+
var import_geo_layers3 = require("@deck.gl/geo-layers");
|
|
762
|
+
var import_h3_js = require("h3-js");
|
|
763
|
+
var MAX_LATITUDE = 85.051128;
|
|
764
|
+
function padBoundingBox({ west, north, east, south }, resolution) {
|
|
765
|
+
const corners = [
|
|
766
|
+
[north, east],
|
|
767
|
+
[south, east],
|
|
768
|
+
[south, west],
|
|
769
|
+
[north, west]
|
|
770
|
+
];
|
|
771
|
+
const cornerCells = corners.map((c) => (0, import_h3_js.latLngToCell)(c[0], c[1], resolution));
|
|
772
|
+
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);
|
|
773
|
+
const bufferLat = Math.max(...cornerEdgeLengths);
|
|
774
|
+
const bufferLon = Math.min(180, bufferLat / Math.cos((north + south) / 2 * Math.PI / 180));
|
|
775
|
+
return {
|
|
776
|
+
north: Math.min(north + bufferLat, MAX_LATITUDE),
|
|
777
|
+
east: east + bufferLon,
|
|
778
|
+
south: Math.max(south - bufferLat, -MAX_LATITUDE),
|
|
779
|
+
west: west - bufferLon
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function getHexagonsInBoundingBox({ west, north, east, south }, resolution) {
|
|
783
|
+
const longitudeSpan = Math.abs(east - west);
|
|
784
|
+
if (longitudeSpan > 180) {
|
|
785
|
+
const nSegments = Math.ceil(longitudeSpan / 180);
|
|
786
|
+
let h3Indices = [];
|
|
787
|
+
for (let s = 0; s < nSegments; s++) {
|
|
788
|
+
const segmentWest = west + s * 180;
|
|
789
|
+
const segmentEast = Math.min(segmentWest + 179.9999999, east);
|
|
790
|
+
h3Indices = h3Indices.concat(getHexagonsInBoundingBox({ west: segmentWest, north, east: segmentEast, south }, resolution));
|
|
791
|
+
}
|
|
792
|
+
return [...new Set(h3Indices)];
|
|
793
|
+
}
|
|
794
|
+
const polygon = [
|
|
795
|
+
[north, east],
|
|
796
|
+
[south, east],
|
|
797
|
+
[south, west],
|
|
798
|
+
[north, west],
|
|
799
|
+
[north, east]
|
|
800
|
+
];
|
|
801
|
+
return (0, import_h3_js.polygonToCells)(polygon, resolution);
|
|
802
|
+
}
|
|
803
|
+
function tileToBoundingBox(index) {
|
|
804
|
+
const coordinates = (0, import_h3_js.cellToBoundary)(index);
|
|
805
|
+
const latitudes = coordinates.map((c) => c[0]);
|
|
806
|
+
const longitudes = coordinates.map((c) => c[1]);
|
|
807
|
+
const west = Math.min(...longitudes);
|
|
808
|
+
const south = Math.min(...latitudes);
|
|
809
|
+
const east = Math.max(...longitudes);
|
|
810
|
+
const north = Math.max(...latitudes);
|
|
811
|
+
return { west, south, east, north };
|
|
812
|
+
}
|
|
813
|
+
var BIAS = 2;
|
|
814
|
+
function getHexagonResolution(viewport, tileSize) {
|
|
815
|
+
const zoomOffset = Math.log2(tileSize / 512);
|
|
816
|
+
const hexagonScaleFactor = 2 / 3 * (viewport.zoom - zoomOffset);
|
|
817
|
+
const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
|
|
818
|
+
return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
|
|
819
|
+
}
|
|
820
|
+
var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
|
|
821
|
+
getTileIndices({ viewport, minZoom, maxZoom }) {
|
|
822
|
+
if (viewport.latitude === void 0)
|
|
823
|
+
return [];
|
|
824
|
+
const [west, south, east, north] = viewport.getBounds();
|
|
825
|
+
const { tileSize } = this.opts;
|
|
826
|
+
let z = getHexagonResolution(viewport, tileSize);
|
|
827
|
+
let indices;
|
|
828
|
+
if (typeof minZoom === "number" && Number.isFinite(minZoom) && z < minZoom) {
|
|
829
|
+
return [];
|
|
830
|
+
}
|
|
831
|
+
if (typeof maxZoom === "number" && Number.isFinite(maxZoom) && z > maxZoom) {
|
|
832
|
+
z = maxZoom;
|
|
833
|
+
const center = (0, import_h3_js.latLngToCell)(viewport.latitude, viewport.longitude, maxZoom);
|
|
834
|
+
indices = (0, import_h3_js.gridDisk)(center, 1);
|
|
835
|
+
} else {
|
|
836
|
+
const paddedBounds = padBoundingBox({ west, north, east, south }, z);
|
|
837
|
+
indices = getHexagonsInBoundingBox(paddedBounds, z);
|
|
838
|
+
}
|
|
839
|
+
return indices.map((i) => ({ i }));
|
|
840
|
+
}
|
|
841
|
+
getTileId({ i }) {
|
|
842
|
+
return i;
|
|
843
|
+
}
|
|
844
|
+
getTileMetadata({ i }) {
|
|
845
|
+
return { bbox: tileToBoundingBox(i) };
|
|
846
|
+
}
|
|
847
|
+
getTileZoom({ i }) {
|
|
848
|
+
return (0, import_h3_js.getResolution)(i);
|
|
849
|
+
}
|
|
850
|
+
getParentIndex(index) {
|
|
851
|
+
const resolution = (0, import_h3_js.getResolution)(index.i);
|
|
852
|
+
const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
|
|
853
|
+
return { i };
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
// dist/layers/spatial-index-tile-layer.js
|
|
858
|
+
var import_core6 = require("@loaders.gl/core");
|
|
859
|
+
|
|
860
|
+
// dist/layers/schema/carto-raster-tile.js
|
|
861
|
+
var ARRAY_TYPES = {
|
|
862
|
+
uint8: Uint8Array,
|
|
863
|
+
uint16: Uint16Array,
|
|
864
|
+
uint32: Uint32Array,
|
|
865
|
+
uint64: BigUint64Array,
|
|
866
|
+
int8: Int8Array,
|
|
867
|
+
int16: Int16Array,
|
|
868
|
+
int32: Int32Array,
|
|
869
|
+
int64: BigInt64Array,
|
|
870
|
+
float32: Float32Array,
|
|
871
|
+
float64: Float64Array
|
|
872
|
+
};
|
|
873
|
+
var BandReader = class {
|
|
874
|
+
static read(pbf, end) {
|
|
875
|
+
return pbf.readFields(BandReader._readField, { name: "", type: "", data: null }, end);
|
|
876
|
+
}
|
|
877
|
+
static _readField(tag, obj, pbf) {
|
|
878
|
+
if (tag === 1)
|
|
879
|
+
obj.name = pbf.readString();
|
|
880
|
+
else if (tag === 2)
|
|
881
|
+
obj.type = pbf.readString();
|
|
882
|
+
else if (tag === 3) {
|
|
883
|
+
const TypedArray = ARRAY_TYPES[obj.type];
|
|
884
|
+
if (!TypedArray) {
|
|
885
|
+
throw Error(`Invalid data type: ${obj.type}`);
|
|
886
|
+
}
|
|
887
|
+
obj.data = {};
|
|
888
|
+
readPackedTypedArray(TypedArray, pbf, obj.data);
|
|
514
889
|
}
|
|
515
890
|
}
|
|
516
891
|
};
|
|
517
892
|
var TileReader3 = class {
|
|
518
893
|
static read(pbf, end) {
|
|
519
|
-
return pbf.readFields(TileReader3._readField, {
|
|
894
|
+
return pbf.readFields(TileReader3._readField, { blockSize: 0, bands: [] }, end);
|
|
520
895
|
}
|
|
521
896
|
static _readField(tag, obj, pbf) {
|
|
522
897
|
if (tag === 1)
|
|
523
|
-
obj.
|
|
898
|
+
obj.blockSize = pbf.readVarint();
|
|
524
899
|
else if (tag === 2)
|
|
525
|
-
obj.
|
|
900
|
+
obj.bands.push(BandReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
526
901
|
}
|
|
527
902
|
};
|
|
528
903
|
|
|
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";
|
|
904
|
+
// dist/layers/schema/carto-raster-tile-loader.js
|
|
905
|
+
var VERSION2 = true ? "9.0.25" : "latest";
|
|
906
|
+
var id2 = "cartoRasterTile";
|
|
549
907
|
var DEFAULT_OPTIONS2 = {
|
|
550
|
-
|
|
551
|
-
scheme: "quadbin",
|
|
908
|
+
cartoRasterTile: {
|
|
552
909
|
workerUrl: getWorkerUrl(id2, VERSION2)
|
|
553
910
|
}
|
|
554
911
|
};
|
|
555
|
-
var
|
|
556
|
-
name: "CARTO
|
|
912
|
+
var CartoRasterTileLoader = {
|
|
913
|
+
name: "CARTO Raster Tile",
|
|
557
914
|
version: VERSION2,
|
|
558
915
|
id: id2,
|
|
559
916
|
module: "carto",
|
|
560
917
|
extensions: ["pbf"],
|
|
561
|
-
mimeTypes: ["application/vnd.carto-
|
|
918
|
+
mimeTypes: ["application/vnd.carto-raster-tile"],
|
|
562
919
|
category: "geometry",
|
|
563
|
-
parse: async (arrayBuffer, options) =>
|
|
564
|
-
parseSync:
|
|
920
|
+
parse: async (arrayBuffer, options) => parseCartoRasterTile(arrayBuffer, options),
|
|
921
|
+
parseSync: parseCartoRasterTile,
|
|
565
922
|
worker: true,
|
|
566
923
|
options: DEFAULT_OPTIONS2
|
|
567
924
|
};
|
|
568
|
-
function
|
|
569
|
-
var _a;
|
|
925
|
+
function parseCartoRasterTile(arrayBuffer, options) {
|
|
570
926
|
if (!arrayBuffer)
|
|
571
927
|
return null;
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
928
|
+
const { bands, blockSize } = parsePbf(arrayBuffer, TileReader3);
|
|
929
|
+
const numericProps = {};
|
|
930
|
+
for (let i = 0; i < bands.length; i++) {
|
|
931
|
+
const { name, data } = bands[i];
|
|
932
|
+
numericProps[name] = data;
|
|
933
|
+
}
|
|
934
|
+
return { blockSize, cells: { numericProps, properties: [] } };
|
|
577
935
|
}
|
|
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;
|
|
936
|
+
var carto_raster_tile_loader_default = CartoRasterTileLoader;
|
|
588
937
|
|
|
589
938
|
// dist/layers/spatial-index-tile-layer.js
|
|
590
|
-
(
|
|
939
|
+
var import_geo_layers4 = require("@deck.gl/geo-layers");
|
|
940
|
+
(0, import_core6.registerLoaders)([carto_raster_tile_loader_default, carto_spatial_tile_loader_default]);
|
|
591
941
|
function isFeatureIdDefined(value) {
|
|
592
942
|
return value !== void 0 && value !== null && value !== "";
|
|
593
943
|
}
|
|
594
|
-
var
|
|
944
|
+
var defaultProps2 = {
|
|
595
945
|
tileSize: DEFAULT_TILE_SIZE
|
|
596
946
|
};
|
|
597
|
-
var _SpatialIndexTileLayer = class extends
|
|
947
|
+
var _SpatialIndexTileLayer = class extends import_geo_layers4.TileLayer {
|
|
598
948
|
_updateAutoHighlight(info) {
|
|
599
949
|
const { hoveredFeatureId } = this.state;
|
|
600
950
|
const hoveredFeature = info.object;
|
|
@@ -646,94 +996,28 @@ var SpatialIndexTileLayer = _SpatialIndexTileLayer;
|
|
|
646
996
|
_SpatialIndexTileLayer.layerName = "SpatialIndexTileLayer";
|
|
647
997
|
})();
|
|
648
998
|
(() => {
|
|
649
|
-
_SpatialIndexTileLayer.defaultProps =
|
|
999
|
+
_SpatialIndexTileLayer.defaultProps = defaultProps2;
|
|
650
1000
|
})();
|
|
651
1001
|
|
|
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
1002
|
// dist/layers/h3-tile-layer.js
|
|
719
1003
|
var renderSubLayers = (props) => {
|
|
720
1004
|
const { data } = props;
|
|
721
1005
|
const { index } = props.tile;
|
|
722
1006
|
if (!data || !data.length)
|
|
723
1007
|
return null;
|
|
724
|
-
return new
|
|
1008
|
+
return new import_geo_layers5.H3HexagonLayer(props, {
|
|
725
1009
|
getHexagon: (d) => d.id,
|
|
726
1010
|
centerHexagon: index,
|
|
727
1011
|
highPrecision: true
|
|
728
1012
|
});
|
|
729
1013
|
};
|
|
730
|
-
var
|
|
1014
|
+
var defaultProps3 = {
|
|
731
1015
|
data: TilejsonPropType,
|
|
732
1016
|
tileSize: DEFAULT_TILE_SIZE
|
|
733
1017
|
};
|
|
734
|
-
var _H3TileLayer = class extends
|
|
1018
|
+
var _H3TileLayer = class extends import_core7.CompositeLayer {
|
|
735
1019
|
initializeState() {
|
|
736
|
-
|
|
1020
|
+
import_geo_layers5.H3HexagonLayer._checkH3Lib();
|
|
737
1021
|
}
|
|
738
1022
|
getLoadOptions() {
|
|
739
1023
|
const loadOptions = super.getLoadOptions() || {};
|
|
@@ -772,13 +1056,13 @@ var H3TileLayer = _H3TileLayer;
|
|
|
772
1056
|
_H3TileLayer.layerName = "H3TileLayer";
|
|
773
1057
|
})();
|
|
774
1058
|
(() => {
|
|
775
|
-
_H3TileLayer.defaultProps =
|
|
1059
|
+
_H3TileLayer.defaultProps = defaultProps3;
|
|
776
1060
|
})();
|
|
777
1061
|
|
|
778
1062
|
// dist/layers/heatmap-tile-layer.js
|
|
779
|
-
var
|
|
780
|
-
var
|
|
781
|
-
var
|
|
1063
|
+
var import_quadbin6 = require("quadbin");
|
|
1064
|
+
var import_core10 = require("@deck.gl/core");
|
|
1065
|
+
var import_layers2 = require("@deck.gl/layers");
|
|
782
1066
|
|
|
783
1067
|
// dist/layers/heatmap.js
|
|
784
1068
|
var fs = `uniform heatmapUniforms {
|
|
@@ -917,7 +1201,7 @@ var heatmap = {
|
|
|
917
1201
|
};
|
|
918
1202
|
|
|
919
1203
|
// dist/layers/post-process-utils.js
|
|
920
|
-
var
|
|
1204
|
+
var import_core8 = require("@deck.gl/core");
|
|
921
1205
|
var TEXTURE_PROPS = {
|
|
922
1206
|
format: "rgba8unorm",
|
|
923
1207
|
mipmaps: false,
|
|
@@ -934,7 +1218,7 @@ function getPostProcessLayer(layer) {
|
|
|
934
1218
|
}
|
|
935
1219
|
return layer;
|
|
936
1220
|
}
|
|
937
|
-
var _DrawCallbackLayer = class extends
|
|
1221
|
+
var _DrawCallbackLayer = class extends import_core8.Layer {
|
|
938
1222
|
initializeState() {
|
|
939
1223
|
this.id = `draw-callback-${getPostProcessLayer(this).props.id}`;
|
|
940
1224
|
}
|
|
@@ -971,7 +1255,7 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
971
1255
|
initializeState(context) {
|
|
972
1256
|
super.initializeState(context);
|
|
973
1257
|
this._createTextures();
|
|
974
|
-
this.internalState.postProcess = new
|
|
1258
|
+
this.internalState.postProcess = new import_core8.PostProcessEffect(effect, this.props);
|
|
975
1259
|
this.internalState.postProcess.setup(context);
|
|
976
1260
|
}
|
|
977
1261
|
updateState(params) {
|
|
@@ -1038,39 +1322,14 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
1038
1322
|
}
|
|
1039
1323
|
|
|
1040
1324
|
// 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
|
-
}
|
|
1325
|
+
var import_core9 = require("@deck.gl/core");
|
|
1068
1326
|
|
|
1069
1327
|
// dist/layers/quadbin-layer.js
|
|
1070
|
-
var
|
|
1328
|
+
var import_geo_layers6 = require("@deck.gl/geo-layers");
|
|
1329
|
+
var defaultProps4 = {
|
|
1071
1330
|
getQuadbin: { type: "accessor", value: (d) => d.quadbin }
|
|
1072
1331
|
};
|
|
1073
|
-
var _QuadbinLayer = class extends
|
|
1332
|
+
var _QuadbinLayer = class extends import_geo_layers6._GeoCellLayer {
|
|
1074
1333
|
indexToBounds() {
|
|
1075
1334
|
const { data, extruded, getQuadbin } = this.props;
|
|
1076
1335
|
const coverage = extruded ? 0.99 : 1;
|
|
@@ -1088,46 +1347,25 @@ var QuadbinLayer = _QuadbinLayer;
|
|
|
1088
1347
|
_QuadbinLayer.layerName = "QuadbinLayer";
|
|
1089
1348
|
})();
|
|
1090
1349
|
(() => {
|
|
1091
|
-
_QuadbinLayer.defaultProps =
|
|
1350
|
+
_QuadbinLayer.defaultProps = defaultProps4;
|
|
1092
1351
|
})();
|
|
1093
1352
|
|
|
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
1353
|
// dist/layers/quadbin-tile-layer.js
|
|
1116
|
-
var
|
|
1354
|
+
var import_quadbin5 = require("quadbin");
|
|
1117
1355
|
var renderSubLayers2 = (props) => {
|
|
1118
1356
|
const { data } = props;
|
|
1119
1357
|
if (!data || !data.length)
|
|
1120
1358
|
return null;
|
|
1121
1359
|
const isBigInt = typeof data[0].id === "bigint";
|
|
1122
1360
|
return new QuadbinLayer(props, {
|
|
1123
|
-
getQuadbin: isBigInt ? (d) => d.id : (d) => (0,
|
|
1361
|
+
getQuadbin: isBigInt ? (d) => d.id : (d) => (0, import_quadbin5.hexToBigInt)(d.id)
|
|
1124
1362
|
});
|
|
1125
1363
|
};
|
|
1126
|
-
var
|
|
1364
|
+
var defaultProps5 = {
|
|
1127
1365
|
data: TilejsonPropType,
|
|
1128
1366
|
tileSize: DEFAULT_TILE_SIZE
|
|
1129
1367
|
};
|
|
1130
|
-
var _QuadbinTileLayer = class extends
|
|
1368
|
+
var _QuadbinTileLayer = class extends import_core9.CompositeLayer {
|
|
1131
1369
|
getLoadOptions() {
|
|
1132
1370
|
const loadOptions = super.getLoadOptions() || {};
|
|
1133
1371
|
const tileJSON = this.props.data;
|
|
@@ -1157,15 +1395,15 @@ var QuadbinTileLayer = _QuadbinTileLayer;
|
|
|
1157
1395
|
_QuadbinTileLayer.layerName = "QuadbinTileLayer";
|
|
1158
1396
|
})();
|
|
1159
1397
|
(() => {
|
|
1160
|
-
_QuadbinTileLayer.defaultProps =
|
|
1398
|
+
_QuadbinTileLayer.defaultProps = defaultProps5;
|
|
1161
1399
|
})();
|
|
1162
1400
|
|
|
1163
1401
|
// dist/layers/heatmap-tile-layer.js
|
|
1164
1402
|
function unitDensityForCell(cell) {
|
|
1165
|
-
const cellResolution = Number((0,
|
|
1403
|
+
const cellResolution = Number((0, import_quadbin6.getResolution)(cell));
|
|
1166
1404
|
return Math.pow(4, cellResolution);
|
|
1167
1405
|
}
|
|
1168
|
-
var _RTTSolidPolygonLayer = class extends RTTModifier(
|
|
1406
|
+
var _RTTSolidPolygonLayer = class extends RTTModifier(import_layers2.SolidPolygonLayer) {
|
|
1169
1407
|
getShaders(type) {
|
|
1170
1408
|
const shaders = super.getShaders(type);
|
|
1171
1409
|
shaders.inject = {
|
|
@@ -1208,7 +1446,7 @@ var RTTSolidPolygonLayer = _RTTSolidPolygonLayer;
|
|
|
1208
1446
|
_RTTSolidPolygonLayer.layerName = "RTTSolidPolygonLayer";
|
|
1209
1447
|
})();
|
|
1210
1448
|
var PostProcessQuadbinTileLayer = PostProcessModifier(QuadbinTileLayer, heatmap);
|
|
1211
|
-
var
|
|
1449
|
+
var defaultProps6 = {
|
|
1212
1450
|
data: TilejsonPropType,
|
|
1213
1451
|
getWeight: { type: "accessor", value: 1 },
|
|
1214
1452
|
onMaxDensityChange: { type: "function", optional: true, value: null },
|
|
@@ -1216,7 +1454,7 @@ var defaultProps5 = {
|
|
|
1216
1454
|
intensity: { type: "number", value: 1 },
|
|
1217
1455
|
radiusPixels: { type: "number", min: 0, max: 100, value: 20 }
|
|
1218
1456
|
};
|
|
1219
|
-
var _HeatmapTileLayer = class extends
|
|
1457
|
+
var _HeatmapTileLayer = class extends import_core10.CompositeLayer {
|
|
1220
1458
|
initializeState() {
|
|
1221
1459
|
this.state = {
|
|
1222
1460
|
isLoaded: false,
|
|
@@ -1313,15 +1551,15 @@ var HeatmapTileLayer = _HeatmapTileLayer;
|
|
|
1313
1551
|
_HeatmapTileLayer.layerName = "HeatmapTileLayer";
|
|
1314
1552
|
})();
|
|
1315
1553
|
(() => {
|
|
1316
|
-
_HeatmapTileLayer.defaultProps =
|
|
1554
|
+
_HeatmapTileLayer.defaultProps = defaultProps6;
|
|
1317
1555
|
})();
|
|
1318
1556
|
var heatmap_tile_layer_default = HeatmapTileLayer;
|
|
1319
1557
|
|
|
1320
1558
|
// dist/layers/point-label-layer.js
|
|
1321
|
-
var
|
|
1322
|
-
var
|
|
1559
|
+
var import_core11 = require("@deck.gl/core");
|
|
1560
|
+
var import_layers3 = require("@deck.gl/layers");
|
|
1323
1561
|
var [LEFT, TOP, RIGHT, BOTTOM] = [0, 1, 2, 3];
|
|
1324
|
-
var _EnhancedTextBackgroundLayer = class extends
|
|
1562
|
+
var _EnhancedTextBackgroundLayer = class extends import_layers3._TextBackgroundLayer {
|
|
1325
1563
|
getShaders() {
|
|
1326
1564
|
const shaders = super.getShaders();
|
|
1327
1565
|
let vs = shaders.vs;
|
|
@@ -1334,7 +1572,7 @@ var EnhancedTextBackgroundLayer = _EnhancedTextBackgroundLayer;
|
|
|
1334
1572
|
(() => {
|
|
1335
1573
|
_EnhancedTextBackgroundLayer.layerName = "EnhancedTextBackgroundLayer";
|
|
1336
1574
|
})();
|
|
1337
|
-
var _EnhancedTextLayer = class extends
|
|
1575
|
+
var _EnhancedTextLayer = class extends import_layers3.TextLayer {
|
|
1338
1576
|
filterSubLayer({ layer, renderPass }) {
|
|
1339
1577
|
const background = layer.id.includes("primary-background");
|
|
1340
1578
|
if (renderPass === "collision") {
|
|
@@ -1347,12 +1585,12 @@ var EnhancedTextLayer = _EnhancedTextLayer;
|
|
|
1347
1585
|
(() => {
|
|
1348
1586
|
_EnhancedTextLayer.layerName = "EnhancedTextLayer";
|
|
1349
1587
|
})();
|
|
1350
|
-
var
|
|
1351
|
-
...
|
|
1588
|
+
var defaultProps7 = {
|
|
1589
|
+
...import_layers3.TextLayer.defaultProps,
|
|
1352
1590
|
getRadius: { type: "accessor", value: 1 },
|
|
1353
1591
|
radiusScale: { type: "number", min: 0, value: 1 }
|
|
1354
1592
|
};
|
|
1355
|
-
var _PointLabelLayer = class extends
|
|
1593
|
+
var _PointLabelLayer = class extends import_core11.CompositeLayer {
|
|
1356
1594
|
calculatePixelOffset(secondary) {
|
|
1357
1595
|
const { getTextAnchor: anchor, getAlignmentBaseline: alignment, getRadius, getSecondaryText, radiusScale, secondarySizeScale, sizeScale } = this.props;
|
|
1358
1596
|
const xMult = anchor === "middle" ? 0 : anchor === "start" ? 1 : -1;
|
|
@@ -1458,15 +1696,15 @@ var PointLabelLayer = _PointLabelLayer;
|
|
|
1458
1696
|
_PointLabelLayer.layerName = "PointLabelLayer";
|
|
1459
1697
|
})();
|
|
1460
1698
|
(() => {
|
|
1461
|
-
_PointLabelLayer.defaultProps =
|
|
1699
|
+
_PointLabelLayer.defaultProps = defaultProps7;
|
|
1462
1700
|
})();
|
|
1463
1701
|
|
|
1464
1702
|
// dist/layers/raster-tile-layer.js
|
|
1465
|
-
var
|
|
1703
|
+
var import_core13 = require("@deck.gl/core");
|
|
1466
1704
|
|
|
1467
1705
|
// dist/layers/raster-layer.js
|
|
1468
|
-
var
|
|
1469
|
-
var
|
|
1706
|
+
var import_core12 = require("@deck.gl/core");
|
|
1707
|
+
var import_layers4 = require("@deck.gl/layers");
|
|
1470
1708
|
|
|
1471
1709
|
// dist/layers/raster-layer-vertex.glsl.js
|
|
1472
1710
|
var raster_layer_vertex_glsl_default = `#version 300 es
|
|
@@ -1538,8 +1776,8 @@ DECKGL_FILTER_COLOR(vColor, geometry);
|
|
|
1538
1776
|
`;
|
|
1539
1777
|
|
|
1540
1778
|
// dist/layers/raster-layer.js
|
|
1541
|
-
var
|
|
1542
|
-
...
|
|
1779
|
+
var defaultProps8 = {
|
|
1780
|
+
...import_layers4.ColumnLayer.defaultProps,
|
|
1543
1781
|
extruded: false,
|
|
1544
1782
|
diskResolution: 4,
|
|
1545
1783
|
vertices: [
|
|
@@ -1549,7 +1787,7 @@ var defaultProps7 = {
|
|
|
1549
1787
|
[-0.5, 0.5]
|
|
1550
1788
|
]
|
|
1551
1789
|
};
|
|
1552
|
-
var _RasterColumnLayer = class extends
|
|
1790
|
+
var _RasterColumnLayer = class extends import_layers4.ColumnLayer {
|
|
1553
1791
|
getShaders() {
|
|
1554
1792
|
const shaders = super.getShaders();
|
|
1555
1793
|
const data = this.props.data;
|
|
@@ -1585,7 +1823,7 @@ var RasterColumnLayer = _RasterColumnLayer;
|
|
|
1585
1823
|
(() => {
|
|
1586
1824
|
_RasterColumnLayer.layerName = "RasterColumnLayer";
|
|
1587
1825
|
})();
|
|
1588
|
-
var _RasterLayer = class extends
|
|
1826
|
+
var _RasterLayer = class extends import_core12.CompositeLayer {
|
|
1589
1827
|
renderLayers() {
|
|
1590
1828
|
const { data, getElevation, getFillColor, getLineColor, getLineWidth, tileIndex, updateTriggers } = this.props;
|
|
1591
1829
|
if (!data || !tileIndex)
|
|
@@ -1594,6 +1832,7 @@ var _RasterLayer = class extends import_core10.CompositeLayer {
|
|
|
1594
1832
|
const [xOffset, yOffset, scale] = quadbinToOffset(tileIndex);
|
|
1595
1833
|
const offset = [xOffset, yOffset, scale / blockSize];
|
|
1596
1834
|
const CellLayer = this.getSubLayerClass("column", RasterColumnLayer);
|
|
1835
|
+
const { highlightedObjectIndex, highlightColor } = this.state;
|
|
1597
1836
|
return new CellLayer(this.props, this.getSubLayerProps({
|
|
1598
1837
|
id: "cell",
|
|
1599
1838
|
updateTriggers,
|
|
@@ -1606,7 +1845,9 @@ var _RasterLayer = class extends import_core10.CompositeLayer {
|
|
|
1606
1845
|
data,
|
|
1607
1846
|
length: blockSize * blockSize
|
|
1608
1847
|
},
|
|
1609
|
-
offset
|
|
1848
|
+
offset,
|
|
1849
|
+
highlightedObjectIndex,
|
|
1850
|
+
highlightColor
|
|
1610
1851
|
});
|
|
1611
1852
|
}
|
|
1612
1853
|
getSubLayerAccessor(accessor) {
|
|
@@ -1620,16 +1861,44 @@ var _RasterLayer = class extends import_core10.CompositeLayer {
|
|
|
1620
1861
|
return accessor({ properties: proxy }, info);
|
|
1621
1862
|
};
|
|
1622
1863
|
}
|
|
1864
|
+
getPickingInfo(params) {
|
|
1865
|
+
const info = super.getPickingInfo(params);
|
|
1866
|
+
if (info.index !== -1) {
|
|
1867
|
+
info.object = this.getSubLayerAccessor((x) => x)(void 0, {
|
|
1868
|
+
data: this.props,
|
|
1869
|
+
index: info.index
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
return info;
|
|
1873
|
+
}
|
|
1874
|
+
_updateAutoHighlight(info) {
|
|
1875
|
+
const { highlightedObjectIndex } = this.state;
|
|
1876
|
+
let newHighlightedObjectIndex = -1;
|
|
1877
|
+
if (info.index !== -1) {
|
|
1878
|
+
newHighlightedObjectIndex = info.index;
|
|
1879
|
+
}
|
|
1880
|
+
if (highlightedObjectIndex !== newHighlightedObjectIndex) {
|
|
1881
|
+
let { highlightColor } = this.props;
|
|
1882
|
+
if (typeof highlightColor === "function") {
|
|
1883
|
+
highlightColor = highlightColor(info);
|
|
1884
|
+
}
|
|
1885
|
+
this.setState({
|
|
1886
|
+
highlightColor,
|
|
1887
|
+
highlightedObjectIndex: newHighlightedObjectIndex
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1623
1891
|
};
|
|
1624
1892
|
var RasterLayer = _RasterLayer;
|
|
1625
1893
|
(() => {
|
|
1626
1894
|
_RasterLayer.layerName = "RasterLayer";
|
|
1627
1895
|
})();
|
|
1628
1896
|
(() => {
|
|
1629
|
-
_RasterLayer.defaultProps =
|
|
1897
|
+
_RasterLayer.defaultProps = defaultProps8;
|
|
1630
1898
|
})();
|
|
1631
1899
|
|
|
1632
1900
|
// dist/layers/raster-tile-layer.js
|
|
1901
|
+
var import_geo_layers7 = require("@deck.gl/geo-layers");
|
|
1633
1902
|
var renderSubLayers3 = (props) => {
|
|
1634
1903
|
var _a, _b;
|
|
1635
1904
|
const tileIndex = (_b = (_a = props.tile) == null ? void 0 : _a.index) == null ? void 0 : _b.q;
|
|
@@ -1637,11 +1906,11 @@ var renderSubLayers3 = (props) => {
|
|
|
1637
1906
|
return null;
|
|
1638
1907
|
return new RasterLayer(props, { tileIndex });
|
|
1639
1908
|
};
|
|
1640
|
-
var
|
|
1909
|
+
var defaultProps9 = {
|
|
1641
1910
|
data: TilejsonPropType,
|
|
1642
1911
|
tileSize: DEFAULT_TILE_SIZE
|
|
1643
1912
|
};
|
|
1644
|
-
var _RasterTileLayer = class extends
|
|
1913
|
+
var _RasterTileLayer = class extends import_core13.CompositeLayer {
|
|
1645
1914
|
getLoadOptions() {
|
|
1646
1915
|
const loadOptions = super.getLoadOptions() || {};
|
|
1647
1916
|
const tileJSON = this.props.data;
|
|
@@ -1654,7 +1923,7 @@ var _RasterTileLayer = class extends import_core11.CompositeLayer {
|
|
|
1654
1923
|
return null;
|
|
1655
1924
|
const { tiles: data, minzoom: minZoom, maxzoom: maxZoom } = tileJSON;
|
|
1656
1925
|
return [
|
|
1657
|
-
new
|
|
1926
|
+
new import_geo_layers7.TileLayer(this.props, {
|
|
1658
1927
|
id: `raster-tile-layer-${this.props.id}`,
|
|
1659
1928
|
data,
|
|
1660
1929
|
TilesetClass: QuadbinTileset2D,
|
|
@@ -1671,11 +1940,11 @@ var RasterTileLayer = _RasterTileLayer;
|
|
|
1671
1940
|
_RasterTileLayer.layerName = "RasterTileLayer";
|
|
1672
1941
|
})();
|
|
1673
1942
|
(() => {
|
|
1674
|
-
_RasterTileLayer.defaultProps =
|
|
1943
|
+
_RasterTileLayer.defaultProps = defaultProps9;
|
|
1675
1944
|
})();
|
|
1676
1945
|
|
|
1677
1946
|
// dist/layers/vector-tile-layer.js
|
|
1678
|
-
var
|
|
1947
|
+
var import_core14 = require("@loaders.gl/core");
|
|
1679
1948
|
|
|
1680
1949
|
// dist/layers/schema/carto-properties-tile.js
|
|
1681
1950
|
var TileReader4 = class {
|
|
@@ -1715,7 +1984,7 @@ var carto_properties_tile_loader_default = CartoPropertiesTileLoader;
|
|
|
1715
1984
|
|
|
1716
1985
|
// dist/layers/schema/carto-vector-tile-loader.js
|
|
1717
1986
|
var import_earcut = __toESM(require("earcut"), 1);
|
|
1718
|
-
var VERSION3 = true ? "9.0.
|
|
1987
|
+
var VERSION3 = true ? "9.0.25" : "latest";
|
|
1719
1988
|
var id3 = "cartoVectorTile";
|
|
1720
1989
|
var DEFAULT_OPTIONS3 = {
|
|
1721
1990
|
cartoVectorTile: {
|
|
@@ -1763,7 +2032,7 @@ function triangulate(polygons) {
|
|
|
1763
2032
|
function parseCartoVectorTile(arrayBuffer, options) {
|
|
1764
2033
|
if (!arrayBuffer)
|
|
1765
2034
|
return null;
|
|
1766
|
-
const tile = parsePbf(arrayBuffer,
|
|
2035
|
+
const tile = parsePbf(arrayBuffer, TileReader);
|
|
1767
2036
|
if (tile.polygons && !tile.polygons.triangles) {
|
|
1768
2037
|
triangulate(tile.polygons);
|
|
1769
2038
|
}
|
|
@@ -1773,16 +2042,16 @@ var carto_vector_tile_loader_default = CartoVectorTileLoader;
|
|
|
1773
2042
|
|
|
1774
2043
|
// dist/layers/vector-tile-layer.js
|
|
1775
2044
|
var import_extensions = require("@deck.gl/extensions");
|
|
1776
|
-
var
|
|
1777
|
-
var
|
|
1778
|
-
(0,
|
|
1779
|
-
var
|
|
1780
|
-
...
|
|
2045
|
+
var import_geo_layers8 = require("@deck.gl/geo-layers");
|
|
2046
|
+
var import_layers5 = require("@deck.gl/layers");
|
|
2047
|
+
(0, import_core14.registerLoaders)([carto_properties_tile_loader_default, carto_vector_tile_loader_default]);
|
|
2048
|
+
var defaultProps10 = {
|
|
2049
|
+
...import_geo_layers8.MVTLayer.defaultProps,
|
|
1781
2050
|
data: TilejsonPropType,
|
|
1782
2051
|
dataComparator: TilejsonPropType.equal,
|
|
1783
2052
|
tileSize: DEFAULT_TILE_SIZE
|
|
1784
2053
|
};
|
|
1785
|
-
var _VectorTileLayer = class extends
|
|
2054
|
+
var _VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
1786
2055
|
constructor(...propObjects) {
|
|
1787
2056
|
super(...propObjects);
|
|
1788
2057
|
}
|
|
@@ -1809,7 +2078,7 @@ var _VectorTileLayer = class extends import_geo_layers6.MVTLayer {
|
|
|
1809
2078
|
async getTileData(tile) {
|
|
1810
2079
|
const tileJSON = this.props.data;
|
|
1811
2080
|
const { tiles, properties_tiles } = tileJSON;
|
|
1812
|
-
const url = (0,
|
|
2081
|
+
const url = (0, import_geo_layers8._getURLFromTemplate)(tiles, tile);
|
|
1813
2082
|
if (!url) {
|
|
1814
2083
|
return Promise.reject("Invalid URL");
|
|
1815
2084
|
}
|
|
@@ -1820,7 +2089,7 @@ var _VectorTileLayer = class extends import_geo_layers6.MVTLayer {
|
|
|
1820
2089
|
if (!properties_tiles) {
|
|
1821
2090
|
return await geometryFetch;
|
|
1822
2091
|
}
|
|
1823
|
-
const propertiesUrl = (0,
|
|
2092
|
+
const propertiesUrl = (0, import_geo_layers8._getURLFromTemplate)(properties_tiles, tile);
|
|
1824
2093
|
if (!propertiesUrl) {
|
|
1825
2094
|
return Promise.reject("Invalid properties URL");
|
|
1826
2095
|
}
|
|
@@ -1844,13 +2113,20 @@ var _VectorTileLayer = class extends import_geo_layers6.MVTLayer {
|
|
|
1844
2113
|
}
|
|
1845
2114
|
const tileBbox = props.tile.bbox;
|
|
1846
2115
|
const { west, south, east, north } = tileBbox;
|
|
2116
|
+
const clipProps = {
|
|
2117
|
+
extensions: [new import_extensions.ClipExtension(), ...props.extensions || []],
|
|
2118
|
+
clipBounds: [west, south, east, north]
|
|
2119
|
+
};
|
|
1847
2120
|
const subLayerProps = {
|
|
1848
2121
|
...props,
|
|
1849
2122
|
autoHighlight: false,
|
|
1850
|
-
|
|
1851
|
-
|
|
2123
|
+
_subLayerProps: {
|
|
2124
|
+
"polygons-fill": clipProps,
|
|
2125
|
+
"polygons-stroke": clipProps,
|
|
2126
|
+
linestrings: clipProps
|
|
2127
|
+
}
|
|
1852
2128
|
};
|
|
1853
|
-
const subLayer = new
|
|
2129
|
+
const subLayer = new import_layers5.GeoJsonLayer(subLayerProps);
|
|
1854
2130
|
return subLayer;
|
|
1855
2131
|
}
|
|
1856
2132
|
_isWGS84() {
|
|
@@ -1864,7 +2140,7 @@ var VectorTileLayer = _VectorTileLayer;
|
|
|
1864
2140
|
_VectorTileLayer.layerName = "VectorTileLayer";
|
|
1865
2141
|
})();
|
|
1866
2142
|
(() => {
|
|
1867
|
-
_VectorTileLayer.defaultProps =
|
|
2143
|
+
_VectorTileLayer.defaultProps = defaultProps10;
|
|
1868
2144
|
})();
|
|
1869
2145
|
|
|
1870
2146
|
// dist/api/carto-api-error.js
|
|
@@ -2142,10 +2418,10 @@ function buildQueryUrl({ apiBaseUrl, connectionName }) {
|
|
|
2142
2418
|
}
|
|
2143
2419
|
|
|
2144
2420
|
// dist/api/request-with-parameters.js
|
|
2145
|
-
var
|
|
2421
|
+
var import_core15 = require("@deck.gl/core");
|
|
2146
2422
|
var DEFAULT_PARAMETERS = {
|
|
2147
2423
|
v: V3_MINOR_VERSION,
|
|
2148
|
-
deckglVersion:
|
|
2424
|
+
deckglVersion: import_core15.VERSION
|
|
2149
2425
|
};
|
|
2150
2426
|
var DEFAULT_HEADERS = {
|
|
2151
2427
|
Accept: "application/json",
|
|
@@ -2297,7 +2573,7 @@ var boundaryTableSource = async function(options) {
|
|
|
2297
2573
|
|
|
2298
2574
|
// dist/sources/h3-query-source.js
|
|
2299
2575
|
var h3QuerySource = async function(options) {
|
|
2300
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, sqlQuery, spatialDataColumn = "h3", queryParameters } = options;
|
|
2576
|
+
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, sqlQuery, spatialDataColumn = "h3", queryParameters, filters } = options;
|
|
2301
2577
|
const urlParameters = {
|
|
2302
2578
|
aggregationExp,
|
|
2303
2579
|
spatialDataColumn,
|
|
@@ -2310,12 +2586,15 @@ var h3QuerySource = async function(options) {
|
|
|
2310
2586
|
if (queryParameters) {
|
|
2311
2587
|
urlParameters.queryParameters = queryParameters;
|
|
2312
2588
|
}
|
|
2589
|
+
if (filters) {
|
|
2590
|
+
urlParameters.filters = filters;
|
|
2591
|
+
}
|
|
2313
2592
|
return baseSource("query", options, urlParameters);
|
|
2314
2593
|
};
|
|
2315
2594
|
|
|
2316
2595
|
// dist/sources/h3-table-source.js
|
|
2317
2596
|
var h3TableSource = async function(options) {
|
|
2318
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, spatialDataColumn = "h3", tableName } = options;
|
|
2597
|
+
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, spatialDataColumn = "h3", tableName, filters } = options;
|
|
2319
2598
|
const urlParameters = {
|
|
2320
2599
|
aggregationExp,
|
|
2321
2600
|
name: tableName,
|
|
@@ -2325,6 +2604,9 @@ var h3TableSource = async function(options) {
|
|
|
2325
2604
|
if (aggregationResLevel) {
|
|
2326
2605
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
2327
2606
|
}
|
|
2607
|
+
if (filters) {
|
|
2608
|
+
urlParameters.filters = filters;
|
|
2609
|
+
}
|
|
2328
2610
|
return baseSource("table", options, urlParameters);
|
|
2329
2611
|
};
|
|
2330
2612
|
|
|
@@ -2347,7 +2629,7 @@ var rasterSource = async function(options) {
|
|
|
2347
2629
|
|
|
2348
2630
|
// dist/sources/quadbin-query-source.js
|
|
2349
2631
|
var quadbinQuerySource = async function(options) {
|
|
2350
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, sqlQuery, spatialDataColumn = "quadbin", queryParameters } = options;
|
|
2632
|
+
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, sqlQuery, spatialDataColumn = "quadbin", queryParameters, filters } = options;
|
|
2351
2633
|
const urlParameters = {
|
|
2352
2634
|
aggregationExp,
|
|
2353
2635
|
q: sqlQuery,
|
|
@@ -2360,12 +2642,15 @@ var quadbinQuerySource = async function(options) {
|
|
|
2360
2642
|
if (queryParameters) {
|
|
2361
2643
|
urlParameters.queryParameters = queryParameters;
|
|
2362
2644
|
}
|
|
2645
|
+
if (filters) {
|
|
2646
|
+
urlParameters.filters = filters;
|
|
2647
|
+
}
|
|
2363
2648
|
return baseSource("query", options, urlParameters);
|
|
2364
2649
|
};
|
|
2365
2650
|
|
|
2366
2651
|
// dist/sources/quadbin-table-source.js
|
|
2367
2652
|
var quadbinTableSource = async function(options) {
|
|
2368
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, spatialDataColumn = "quadbin", tableName } = options;
|
|
2653
|
+
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, spatialDataColumn = "quadbin", tableName, filters } = options;
|
|
2369
2654
|
const urlParameters = {
|
|
2370
2655
|
aggregationExp,
|
|
2371
2656
|
name: tableName,
|
|
@@ -2375,6 +2660,9 @@ var quadbinTableSource = async function(options) {
|
|
|
2375
2660
|
if (aggregationResLevel) {
|
|
2376
2661
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
2377
2662
|
}
|
|
2663
|
+
if (filters) {
|
|
2664
|
+
urlParameters.filters = filters;
|
|
2665
|
+
}
|
|
2378
2666
|
return baseSource("table", options, urlParameters);
|
|
2379
2667
|
};
|
|
2380
2668
|
|
|
@@ -2432,7 +2720,7 @@ var vectorTilesetSource = async function(options) {
|
|
|
2432
2720
|
};
|
|
2433
2721
|
|
|
2434
2722
|
// dist/api/parse-map.js
|
|
2435
|
-
var
|
|
2723
|
+
var import_core16 = require("@deck.gl/core");
|
|
2436
2724
|
|
|
2437
2725
|
// dist/api/layer-map.js
|
|
2438
2726
|
var import_d3_array = require("d3-array");
|
|
@@ -2441,8 +2729,8 @@ var import_d3_scale3 = require("d3-scale");
|
|
|
2441
2729
|
var import_d3_format = require("d3-format");
|
|
2442
2730
|
var import_moment_timezone = __toESM(require("moment-timezone"), 1);
|
|
2443
2731
|
var import_aggregation_layers = require("@deck.gl/aggregation-layers");
|
|
2444
|
-
var
|
|
2445
|
-
var
|
|
2732
|
+
var import_layers6 = require("@deck.gl/layers");
|
|
2733
|
+
var import_geo_layers9 = require("@deck.gl/geo-layers");
|
|
2446
2734
|
var SCALE_FUNCS = {
|
|
2447
2735
|
linear: import_d3_scale3.scaleLinear,
|
|
2448
2736
|
ordinal: import_d3_scale3.scaleOrdinal,
|
|
@@ -2476,6 +2764,15 @@ var AGGREGATION_FUNC = {
|
|
|
2476
2764
|
stddev: import_d3_array.deviation,
|
|
2477
2765
|
variance: import_d3_array.variance
|
|
2478
2766
|
};
|
|
2767
|
+
var TILE_LAYER_TYPE_TO_LAYER = {
|
|
2768
|
+
clusterTile: ClusterTileLayer,
|
|
2769
|
+
h3: H3TileLayer,
|
|
2770
|
+
heatmapTile: heatmap_tile_layer_default,
|
|
2771
|
+
mvt: VectorTileLayer,
|
|
2772
|
+
quadbin: QuadbinTileLayer,
|
|
2773
|
+
raster: RasterTileLayer,
|
|
2774
|
+
tileset: VectorTileLayer
|
|
2775
|
+
};
|
|
2479
2776
|
var hexToRGBA = (c) => {
|
|
2480
2777
|
const { r, g, b, opacity } = (0, import_d3_color.rgb)(c);
|
|
2481
2778
|
return [r, g, b, 255 * opacity];
|
|
@@ -2514,7 +2811,7 @@ var aggregationVisConfig = {
|
|
|
2514
2811
|
elevationPercentile: ["elevationLowerPercentile", "elevationUpperPercentile"],
|
|
2515
2812
|
percentile: ["lowerPercentile", "upperPercentile"]
|
|
2516
2813
|
};
|
|
2517
|
-
var
|
|
2814
|
+
var defaultProps11 = {
|
|
2518
2815
|
lineMiterLimit: 2,
|
|
2519
2816
|
lineWidthUnits: "pixels",
|
|
2520
2817
|
pointRadiusUnits: "pixels",
|
|
@@ -2530,15 +2827,15 @@ function getLayer(type, config, dataset) {
|
|
|
2530
2827
|
if ((_a = config.visConfig) == null ? void 0 : _a.customMarkers) {
|
|
2531
2828
|
basePropMap = mergePropMaps(sharedPropMap, customMarkersPropsMap);
|
|
2532
2829
|
}
|
|
2533
|
-
if (type
|
|
2534
|
-
return getTileLayer(dataset, basePropMap);
|
|
2830
|
+
if (TILE_LAYER_TYPE_TO_LAYER[type]) {
|
|
2831
|
+
return getTileLayer(dataset, basePropMap, type);
|
|
2535
2832
|
}
|
|
2536
2833
|
const geoColumn = dataset == null ? void 0 : dataset.geoColumn;
|
|
2537
2834
|
const getPosition = (d) => d[geoColumn].coordinates;
|
|
2538
2835
|
const hexagonId = (_b = config.columns) == null ? void 0 : _b.hex_id;
|
|
2539
2836
|
const layerTypeDefs = {
|
|
2540
2837
|
point: {
|
|
2541
|
-
Layer:
|
|
2838
|
+
Layer: import_layers6.GeoJsonLayer,
|
|
2542
2839
|
propMap: {
|
|
2543
2840
|
columns: {
|
|
2544
2841
|
altitude: (x) => ({ parameters: { depthTest: Boolean(x) } })
|
|
@@ -2547,7 +2844,7 @@ function getLayer(type, config, dataset) {
|
|
|
2547
2844
|
}
|
|
2548
2845
|
},
|
|
2549
2846
|
geojson: {
|
|
2550
|
-
Layer:
|
|
2847
|
+
Layer: import_layers6.GeoJsonLayer
|
|
2551
2848
|
},
|
|
2552
2849
|
grid: {
|
|
2553
2850
|
Layer: import_aggregation_layers.CPUGridLayer,
|
|
@@ -2565,7 +2862,7 @@ function getLayer(type, config, dataset) {
|
|
|
2565
2862
|
defaultProps: { getPosition }
|
|
2566
2863
|
},
|
|
2567
2864
|
hexagonId: {
|
|
2568
|
-
Layer:
|
|
2865
|
+
Layer: import_geo_layers9.H3HexagonLayer,
|
|
2569
2866
|
propMap: { visConfig: { coverage: "coverage" } },
|
|
2570
2867
|
defaultProps: { getHexagon: (d) => d[hexagonId], stroked: false }
|
|
2571
2868
|
}
|
|
@@ -2575,28 +2872,16 @@ function getLayer(type, config, dataset) {
|
|
|
2575
2872
|
return {
|
|
2576
2873
|
...layer,
|
|
2577
2874
|
propMap: mergePropMaps(basePropMap, layer.propMap),
|
|
2578
|
-
defaultProps: { ...
|
|
2875
|
+
defaultProps: { ...defaultProps11, ...layer.defaultProps }
|
|
2579
2876
|
};
|
|
2580
2877
|
}
|
|
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;
|
|
2878
|
+
function getTileLayer(dataset, basePropMap, type) {
|
|
2879
|
+
const { aggregationExp, aggregationResLevel } = dataset;
|
|
2595
2880
|
return {
|
|
2596
|
-
Layer:
|
|
2881
|
+
Layer: TILE_LAYER_TYPE_TO_LAYER[type] || VectorTileLayer,
|
|
2597
2882
|
propMap: basePropMap,
|
|
2598
2883
|
defaultProps: {
|
|
2599
|
-
...
|
|
2884
|
+
...defaultProps11,
|
|
2600
2885
|
...aggregationExp && { aggregationExp },
|
|
2601
2886
|
...aggregationResLevel && { aggregationResLevel },
|
|
2602
2887
|
uniqueIdProperty: "geoid"
|
|
@@ -2810,12 +3095,12 @@ function parseMap(json) {
|
|
|
2810
3095
|
assert(dataset, `No dataset matching dataId: ${dataId}`);
|
|
2811
3096
|
const { data } = dataset;
|
|
2812
3097
|
assert(data, `No data loaded for dataId: ${dataId}`);
|
|
2813
|
-
const { Layer: Layer2, propMap, defaultProps:
|
|
3098
|
+
const { Layer: Layer2, propMap, defaultProps: defaultProps12 } = getLayer(type, config, dataset);
|
|
2814
3099
|
const styleProps = createStyleProps(config, propMap);
|
|
2815
3100
|
return new Layer2({
|
|
2816
3101
|
id: id4,
|
|
2817
3102
|
data,
|
|
2818
|
-
...
|
|
3103
|
+
...defaultProps12,
|
|
2819
3104
|
...createInteractionProps(interactionConfig),
|
|
2820
3105
|
...styleProps,
|
|
2821
3106
|
...createChannelProps(id4, type, config, visualChannels, data),
|
|
@@ -2823,7 +3108,7 @@ function parseMap(json) {
|
|
|
2823
3108
|
...createLoadOptions(token)
|
|
2824
3109
|
});
|
|
2825
3110
|
} catch (e) {
|
|
2826
|
-
|
|
3111
|
+
import_core16.log.error(e.message)();
|
|
2827
3112
|
return void 0;
|
|
2828
3113
|
}
|
|
2829
3114
|
})
|
|
@@ -3300,6 +3585,7 @@ var query = async function(options) {
|
|
|
3300
3585
|
|
|
3301
3586
|
// dist/index.js
|
|
3302
3587
|
var CARTO_LAYERS = {
|
|
3588
|
+
ClusterTileLayer,
|
|
3303
3589
|
H3TileLayer,
|
|
3304
3590
|
HeatmapTileLayer: heatmap_tile_layer_default,
|
|
3305
3591
|
_PointLabelLayer: PointLabelLayer,
|