@deck.gl/carto 9.0.40 → 9.1.0-beta.3
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/basemap.d.ts +2 -1
- package/dist/api/basemap.d.ts.map +1 -1
- package/dist/api/basemap.js +4 -0
- package/dist/api/basemap.js.map +1 -0
- package/dist/api/fetch-map.d.ts.map +1 -1
- package/dist/api/fetch-map.js +33 -28
- package/dist/api/fetch-map.js.map +1 -0
- package/dist/api/index.d.ts +1 -4
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +4 -2
- package/dist/api/index.js.map +1 -0
- package/dist/api/layer-map.d.ts.map +1 -1
- package/dist/api/layer-map.js +7 -3
- package/dist/api/layer-map.js.map +1 -0
- package/dist/api/parse-map.d.ts.map +1 -1
- package/dist/api/parse-map.js +4 -0
- package/dist/api/parse-map.js.map +1 -0
- package/dist/api/types.d.ts +0 -56
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +5 -20
- package/dist/api/types.js.map +1 -0
- package/dist/basemap.d.ts +2 -1
- package/dist/basemap.d.ts.map +1 -1
- package/dist/basemap.js +5 -1
- package/dist/basemap.js.map +1 -0
- package/dist/cartoRasterTile-worker.js +147 -18
- package/dist/cartoSpatialTile-worker.js +150 -19
- package/dist/cartoVectorTile-worker.js +151 -19
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -3
- package/dist/constants.js.map +1 -0
- package/dist/dist.dev.js +4262 -3235
- package/dist/index.cjs +263 -555
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +20 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -0
- package/dist/layers/cluster-tile-layer.d.ts +1 -1
- package/dist/layers/cluster-tile-layer.d.ts.map +1 -1
- package/dist/layers/cluster-tile-layer.js +5 -0
- package/dist/layers/cluster-tile-layer.js.map +1 -0
- package/dist/layers/cluster-utils.d.ts.map +1 -1
- package/dist/layers/cluster-utils.js +4 -0
- package/dist/layers/cluster-utils.js.map +1 -0
- package/dist/layers/h3-tile-layer.d.ts +1 -1
- package/dist/layers/h3-tile-layer.d.ts.map +1 -1
- package/dist/layers/h3-tile-layer.js +4 -0
- package/dist/layers/h3-tile-layer.js.map +1 -0
- package/dist/layers/h3-tileset-2d.d.ts.map +1 -1
- package/dist/layers/h3-tileset-2d.js +4 -0
- package/dist/layers/h3-tileset-2d.js.map +1 -0
- package/dist/layers/heatmap-tile-layer.d.ts +1 -1
- package/dist/layers/heatmap-tile-layer.d.ts.map +1 -1
- package/dist/layers/heatmap-tile-layer.js +24 -7
- package/dist/layers/heatmap-tile-layer.js.map +1 -0
- package/dist/layers/heatmap.d.ts +3 -3
- package/dist/layers/heatmap.d.ts.map +1 -1
- package/dist/layers/heatmap.js +70 -36
- package/dist/layers/heatmap.js.map +1 -0
- package/dist/layers/point-label-layer.d.ts.map +1 -1
- package/dist/layers/point-label-layer.js +6 -2
- package/dist/layers/point-label-layer.js.map +1 -0
- package/dist/layers/post-process-utils.d.ts +1 -1
- package/dist/layers/post-process-utils.d.ts.map +1 -1
- package/dist/layers/post-process-utils.js +11 -6
- package/dist/layers/post-process-utils.js.map +1 -0
- package/dist/layers/quadbin-layer.d.ts.map +1 -1
- package/dist/layers/quadbin-layer.js +4 -0
- package/dist/layers/quadbin-layer.js.map +1 -0
- package/dist/layers/quadbin-tile-layer.d.ts +1 -1
- package/dist/layers/quadbin-tile-layer.d.ts.map +1 -1
- package/dist/layers/quadbin-tile-layer.js +4 -0
- package/dist/layers/quadbin-tile-layer.js.map +1 -0
- package/dist/layers/quadbin-tileset-2d.d.ts.map +1 -1
- package/dist/layers/quadbin-tileset-2d.js +4 -0
- package/dist/layers/quadbin-tileset-2d.js.map +1 -0
- package/dist/layers/quadbin-utils.d.ts.map +1 -1
- package/dist/layers/quadbin-utils.js +4 -0
- package/dist/layers/quadbin-utils.js.map +1 -0
- package/dist/layers/raster-layer-vertex.glsl.d.ts +1 -1
- package/dist/layers/raster-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/layers/raster-layer-vertex.glsl.js +21 -25
- package/dist/layers/raster-layer-vertex.glsl.js.map +1 -0
- package/dist/layers/raster-layer.d.ts +6 -6
- package/dist/layers/raster-layer.d.ts.map +1 -1
- package/dist/layers/raster-layer.js +7 -1
- package/dist/layers/raster-layer.js.map +1 -0
- package/dist/layers/raster-tile-layer.d.ts +1 -1
- package/dist/layers/raster-tile-layer.d.ts.map +1 -1
- package/dist/layers/raster-tile-layer.js +4 -0
- package/dist/layers/raster-tile-layer.js.map +1 -0
- package/dist/layers/schema/carto-properties-tile-loader.d.ts.map +1 -1
- package/dist/layers/schema/carto-properties-tile-loader.js +4 -0
- package/dist/layers/schema/carto-properties-tile-loader.js.map +1 -0
- package/dist/layers/schema/carto-properties-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-properties-tile.js +4 -0
- package/dist/layers/schema/carto-properties-tile.js.map +1 -0
- package/dist/layers/schema/carto-raster-tile-loader.d.ts.map +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.js +6 -1
- package/dist/layers/schema/carto-raster-tile-loader.js.map +1 -0
- package/dist/layers/schema/carto-raster-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-raster-tile.js +4 -0
- package/dist/layers/schema/carto-raster-tile.js.map +1 -0
- package/dist/layers/schema/carto-spatial-tile-loader.d.ts.map +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +5 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js.map +1 -0
- package/dist/layers/schema/carto-spatial-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-spatial-tile.js +4 -0
- package/dist/layers/schema/carto-spatial-tile.js.map +1 -0
- package/dist/layers/schema/carto-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-tile.js +4 -0
- package/dist/layers/schema/carto-tile.js.map +1 -0
- package/dist/layers/schema/carto-vector-tile-loader.d.ts.map +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +5 -1
- package/dist/layers/schema/carto-vector-tile-loader.js.map +1 -0
- package/dist/layers/schema/fast-pbf.d.ts.map +1 -1
- package/dist/layers/schema/fast-pbf.js +4 -0
- package/dist/layers/schema/fast-pbf.js.map +1 -0
- package/dist/layers/schema/spatialjson-utils.d.ts.map +1 -1
- package/dist/layers/schema/spatialjson-utils.js +4 -0
- package/dist/layers/schema/spatialjson-utils.js.map +1 -0
- package/dist/layers/schema/tile-loader-utils.d.ts.map +1 -1
- package/dist/layers/schema/tile-loader-utils.js +4 -0
- package/dist/layers/schema/tile-loader-utils.js.map +1 -0
- package/dist/layers/spatial-index-tile-layer.d.ts.map +1 -1
- package/dist/layers/spatial-index-tile-layer.js +4 -0
- package/dist/layers/spatial-index-tile-layer.js.map +1 -0
- package/dist/layers/utils.d.ts +2 -2
- package/dist/layers/utils.d.ts.map +1 -1
- package/dist/layers/utils.js +4 -0
- package/dist/layers/utils.js.map +1 -0
- package/dist/layers/vector-tile-layer.d.ts +1 -1
- package/dist/layers/vector-tile-layer.d.ts.map +1 -1
- package/dist/layers/vector-tile-layer.js +4 -0
- package/dist/layers/vector-tile-layer.js.map +1 -0
- package/dist/style/color-bins-style.d.ts.map +1 -1
- package/dist/style/color-bins-style.js +4 -0
- package/dist/style/color-bins-style.js.map +1 -0
- package/dist/style/color-categories-style.d.ts.map +1 -1
- package/dist/style/color-categories-style.js +4 -0
- package/dist/style/color-categories-style.js.map +1 -0
- package/dist/style/color-continuous-style.d.ts.map +1 -1
- package/dist/style/color-continuous-style.js +4 -0
- package/dist/style/color-continuous-style.js.map +1 -0
- package/dist/style/palette.d.ts.map +1 -1
- package/dist/style/palette.js +4 -0
- package/dist/style/palette.js.map +1 -0
- package/dist/style/utils.d.ts.map +1 -1
- package/dist/style/utils.js +4 -0
- package/dist/style/utils.js.map +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -0
- package/dist/utils.js.map +1 -0
- package/dist/workers/cartoRasterTile.js +4 -0
- package/dist/workers/cartoRasterTile.js.map +1 -0
- package/dist/workers/cartoSpatialTile.js +4 -0
- package/dist/workers/cartoSpatialTile.js.map +1 -0
- package/dist/workers/cartoVectorTile.js +4 -0
- package/dist/workers/cartoVectorTile.js.map +1 -0
- package/dist.min.js +113 -73
- package/package.json +13 -11
- package/src/api/basemap.ts +6 -1
- package/src/api/fetch-map.ts +56 -61
- package/src/api/index.ts +5 -13
- package/src/api/layer-map.ts +7 -3
- package/src/api/parse-map.ts +4 -0
- package/src/api/types.ts +4 -75
- package/src/basemap.ts +6 -2
- package/src/constants.ts +4 -4
- package/src/index.ts +19 -18
- package/src/layers/cluster-tile-layer.ts +6 -1
- package/src/layers/cluster-utils.ts +4 -0
- package/src/layers/h3-tile-layer.ts +5 -1
- package/src/layers/h3-tileset-2d.ts +4 -0
- package/src/layers/heatmap-tile-layer.ts +29 -8
- package/src/layers/heatmap.ts +8 -2
- package/src/layers/point-label-layer.ts +6 -2
- package/src/layers/post-process-utils.ts +11 -6
- package/src/layers/quadbin-layer.ts +4 -0
- package/src/layers/quadbin-tile-layer.ts +5 -1
- package/src/layers/quadbin-tileset-2d.ts +4 -0
- package/src/layers/quadbin-utils.ts +4 -0
- package/src/layers/raster-layer-vertex.glsl.ts +21 -27
- package/src/layers/raster-layer.ts +7 -1
- package/src/layers/raster-tile-layer.ts +6 -2
- package/src/layers/schema/carto-properties-tile-loader.ts +4 -0
- package/src/layers/schema/carto-properties-tile.ts +4 -0
- package/src/layers/schema/carto-raster-tile-loader.ts +7 -1
- package/src/layers/schema/carto-raster-tile.ts +4 -0
- package/src/layers/schema/carto-spatial-tile-loader.ts +4 -0
- package/src/layers/schema/carto-spatial-tile.ts +4 -0
- package/src/layers/schema/carto-tile.ts +4 -0
- package/src/layers/schema/carto-vector-tile-loader.ts +4 -0
- package/src/layers/schema/fast-pbf.ts +4 -0
- package/src/layers/schema/spatialjson-utils.ts +4 -0
- package/src/layers/schema/tile-loader-utils.ts +4 -0
- package/src/layers/spatial-index-tile-layer.ts +4 -0
- package/src/layers/utils.ts +5 -1
- package/src/layers/vector-tile-layer.ts +5 -1
- package/src/style/color-bins-style.ts +4 -0
- package/src/style/color-categories-style.ts +4 -0
- package/src/style/color-continuous-style.ts +4 -0
- package/src/style/palette.ts +4 -0
- package/src/style/utils.ts +4 -0
- package/src/utils.ts +4 -0
- package/src/workers/cartoRasterTile.ts +4 -0
- package/src/workers/cartoSpatialTile.ts +4 -0
- package/src/workers/cartoVectorTile.ts +4 -0
- package/dist/api/carto-api-error.d.ts +0 -19
- package/dist/api/carto-api-error.d.ts.map +0 -1
- package/dist/api/carto-api-error.js +0 -48
- package/dist/api/common.d.ts +0 -5
- package/dist/api/common.d.ts.map +0 -1
- package/dist/api/common.js +0 -5
- package/dist/api/endpoints.d.ts +0 -23
- package/dist/api/endpoints.d.ts.map +0 -1
- package/dist/api/endpoints.js +0 -22
- package/dist/api/query.d.ts +0 -4
- package/dist/api/query.d.ts.map +0 -1
- package/dist/api/query.js +0 -26
- package/dist/api/request-with-parameters.d.ts +0 -9
- package/dist/api/request-with-parameters.d.ts.map +0 -1
- package/dist/api/request-with-parameters.js +0 -86
- package/dist/sources/base-source.d.ts +0 -5
- package/dist/sources/base-source.d.ts.map +0 -1
- package/dist/sources/base-source.js +0 -60
- package/dist/sources/boundary-query-source.d.ts +0 -10
- package/dist/sources/boundary-query-source.d.ts.map +0 -1
- package/dist/sources/boundary-query-source.js +0 -18
- package/dist/sources/boundary-table-source.d.ts +0 -8
- package/dist/sources/boundary-table-source.d.ts.map +0 -1
- package/dist/sources/boundary-table-source.js +0 -15
- package/dist/sources/h3-query-source.d.ts +0 -4
- package/dist/sources/h3-query-source.d.ts.map +0 -1
- package/dist/sources/h3-query-source.js +0 -22
- package/dist/sources/h3-table-source.d.ts +0 -4
- package/dist/sources/h3-table-source.d.ts.map +0 -1
- package/dist/sources/h3-table-source.js +0 -19
- package/dist/sources/h3-tileset-source.d.ts +0 -4
- package/dist/sources/h3-tileset-source.d.ts.map +0 -1
- package/dist/sources/h3-tileset-source.js +0 -6
- package/dist/sources/index.d.ts +0 -28
- package/dist/sources/index.d.ts.map +0 -1
- package/dist/sources/index.js +0 -13
- package/dist/sources/quadbin-query-source.d.ts +0 -4
- package/dist/sources/quadbin-query-source.d.ts.map +0 -1
- package/dist/sources/quadbin-query-source.js +0 -22
- package/dist/sources/quadbin-table-source.d.ts +0 -4
- package/dist/sources/quadbin-table-source.d.ts.map +0 -1
- package/dist/sources/quadbin-table-source.js +0 -19
- package/dist/sources/quadbin-tileset-source.d.ts +0 -4
- package/dist/sources/quadbin-tileset-source.d.ts.map +0 -1
- package/dist/sources/quadbin-tileset-source.js +0 -6
- package/dist/sources/raster-source.d.ts +0 -4
- package/dist/sources/raster-source.d.ts.map +0 -1
- package/dist/sources/raster-source.js +0 -9
- package/dist/sources/types.d.ts +0 -219
- package/dist/sources/types.d.ts.map +0 -1
- package/dist/sources/types.js +0 -1
- package/dist/sources/vector-query-source.d.ts +0 -4
- package/dist/sources/vector-query-source.d.ts.map +0 -1
- package/dist/sources/vector-query-source.js +0 -22
- package/dist/sources/vector-table-source.d.ts +0 -4
- package/dist/sources/vector-table-source.d.ts.map +0 -1
- package/dist/sources/vector-table-source.js +0 -19
- package/dist/sources/vector-tileset-source.d.ts +0 -4
- package/dist/sources/vector-tileset-source.d.ts.map +0 -1
- package/dist/sources/vector-tileset-source.js +0 -6
- package/src/api/carto-api-error.ts +0 -68
- package/src/api/common.ts +0 -6
- package/src/api/endpoints.ts +0 -69
- package/src/api/query.ts +0 -42
- package/src/api/request-with-parameters.ts +0 -117
- package/src/sources/base-source.ts +0 -79
- package/src/sources/boundary-query-source.ts +0 -39
- package/src/sources/boundary-table-source.ts +0 -33
- package/src/sources/h3-query-source.ts +0 -55
- package/src/sources/h3-table-source.ts +0 -51
- package/src/sources/h3-tileset-source.ts +0 -14
- package/src/sources/index.ts +0 -45
- package/src/sources/quadbin-query-source.ts +0 -56
- package/src/sources/quadbin-table-source.ts +0 -52
- package/src/sources/quadbin-tileset-source.ts +0 -14
- package/src/sources/raster-source.ts +0 -17
- package/src/sources/types.ts +0 -231
- package/src/sources/vector-query-source.ts +0 -57
- package/src/sources/vector-table-source.ts +0 -51
- package/src/sources/vector-tileset-source.ts +0 -14
package/dist/index.cjs
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -29,16 +33,16 @@ __export(dist_exports, {
|
|
|
29
33
|
BASEMAP: () => basemap_default,
|
|
30
34
|
CARTO_LAYERS: () => CARTO_LAYERS,
|
|
31
35
|
CARTO_SOURCES: () => CARTO_SOURCES,
|
|
32
|
-
CartoAPIError: () => CartoAPIError,
|
|
36
|
+
CartoAPIError: () => import_api_client4.CartoAPIError,
|
|
33
37
|
ClusterTileLayer: () => cluster_tile_layer_default,
|
|
34
38
|
H3TileLayer: () => h3_tile_layer_default,
|
|
35
39
|
HeatmapTileLayer: () => heatmap_tile_layer_default,
|
|
40
|
+
PointLabelLayer: () => point_label_layer_default,
|
|
36
41
|
QuadbinTileLayer: () => quadbin_tile_layer_default,
|
|
37
42
|
RasterTileLayer: () => raster_tile_layer_default,
|
|
38
|
-
SOURCE_DEFAULTS: () => SOURCE_DEFAULTS,
|
|
43
|
+
SOURCE_DEFAULTS: () => import_api_client4.SOURCE_DEFAULTS,
|
|
39
44
|
VectorTileLayer: () => vector_tile_layer_default,
|
|
40
45
|
_GOOGLE_BASEMAPS: () => GOOGLE_BASEMAPS,
|
|
41
|
-
_PointLabelLayer: () => point_label_layer_default,
|
|
42
46
|
_QuadbinLayer: () => quadbin_layer_default,
|
|
43
47
|
_RasterLayer: () => raster_layer_default,
|
|
44
48
|
_STYLE_LAYER_GROUPS: () => STYLE_LAYER_GROUPS,
|
|
@@ -46,24 +50,24 @@ __export(dist_exports, {
|
|
|
46
50
|
_applyLayerGroupFilters: () => applyLayerGroupFilters,
|
|
47
51
|
_fetchStyle: () => fetchStyle,
|
|
48
52
|
_getStyleUrl: () => getStyleUrl,
|
|
49
|
-
boundaryQuerySource: () => boundaryQuerySource,
|
|
50
|
-
boundaryTableSource: () => boundaryTableSource,
|
|
53
|
+
boundaryQuerySource: () => import_api_client4.boundaryQuerySource,
|
|
54
|
+
boundaryTableSource: () => import_api_client4.boundaryTableSource,
|
|
51
55
|
colorBins: () => colorBins,
|
|
52
56
|
colorCategories: () => colorCategories,
|
|
53
57
|
colorContinuous: () => colorContinuous,
|
|
54
58
|
fetchBasemapProps: () => fetchBasemapProps,
|
|
55
59
|
fetchMap: () => fetchMap,
|
|
56
|
-
h3QuerySource: () => h3QuerySource,
|
|
57
|
-
h3TableSource: () => h3TableSource,
|
|
58
|
-
h3TilesetSource: () => h3TilesetSource,
|
|
59
|
-
quadbinQuerySource: () => quadbinQuerySource,
|
|
60
|
-
quadbinTableSource: () => quadbinTableSource,
|
|
61
|
-
quadbinTilesetSource: () => quadbinTilesetSource,
|
|
62
|
-
query: () => query,
|
|
63
|
-
rasterSource: () => rasterSource,
|
|
64
|
-
vectorQuerySource: () => vectorQuerySource,
|
|
65
|
-
vectorTableSource: () => vectorTableSource,
|
|
66
|
-
vectorTilesetSource: () => vectorTilesetSource
|
|
60
|
+
h3QuerySource: () => import_api_client4.h3QuerySource,
|
|
61
|
+
h3TableSource: () => import_api_client4.h3TableSource,
|
|
62
|
+
h3TilesetSource: () => import_api_client4.h3TilesetSource,
|
|
63
|
+
quadbinQuerySource: () => import_api_client4.quadbinQuerySource,
|
|
64
|
+
quadbinTableSource: () => import_api_client4.quadbinTableSource,
|
|
65
|
+
quadbinTilesetSource: () => import_api_client4.quadbinTilesetSource,
|
|
66
|
+
query: () => import_api_client4.query,
|
|
67
|
+
rasterSource: () => import_api_client4.rasterSource,
|
|
68
|
+
vectorQuerySource: () => import_api_client4.vectorQuerySource,
|
|
69
|
+
vectorTableSource: () => import_api_client4.vectorTableSource,
|
|
70
|
+
vectorTilesetSource: () => import_api_client4.vectorTilesetSource
|
|
67
71
|
});
|
|
68
72
|
module.exports = __toCommonJS(dist_exports);
|
|
69
73
|
|
|
@@ -198,26 +202,28 @@ function clustersToBinary(data) {
|
|
|
198
202
|
|
|
199
203
|
// dist/constants.js
|
|
200
204
|
var DEFAULT_TILE_SIZE = 512;
|
|
201
|
-
var DEFAULT_TILE_RESOLUTION = 0.5;
|
|
202
|
-
var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
203
|
-
var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
204
205
|
|
|
205
206
|
// dist/layers/quadbin-tileset-2d.js
|
|
206
207
|
var import_geo_layers = require("@deck.gl/geo-layers");
|
|
207
208
|
var import_quadbin2 = require("quadbin");
|
|
208
209
|
var QuadbinTileset2D = class extends import_geo_layers._Tileset2D {
|
|
210
|
+
// @ts-expect-error for spatial indices, TileSet2d should be parametrized by TileIndexT
|
|
209
211
|
getTileIndices(opts) {
|
|
210
212
|
return super.getTileIndices(opts).map(import_quadbin2.tileToCell).map((q) => ({ q, i: (0, import_quadbin2.bigIntToHex)(q) }));
|
|
211
213
|
}
|
|
214
|
+
// @ts-expect-error TileIndex must be generic
|
|
212
215
|
getTileId({ q, i }) {
|
|
213
216
|
return i || (0, import_quadbin2.bigIntToHex)(q);
|
|
214
217
|
}
|
|
218
|
+
// @ts-expect-error TileIndex must be generic
|
|
215
219
|
getTileMetadata({ q }) {
|
|
216
220
|
return super.getTileMetadata((0, import_quadbin2.cellToTile)(q));
|
|
217
221
|
}
|
|
222
|
+
// @ts-expect-error TileIndex must be generic
|
|
218
223
|
getTileZoom({ q }) {
|
|
219
224
|
return Number((0, import_quadbin2.getResolution)(q));
|
|
220
225
|
}
|
|
226
|
+
// @ts-expect-error TileIndex must be generic
|
|
221
227
|
getParentIndex({ q }) {
|
|
222
228
|
return { q: (0, import_quadbin2.cellToParent)(q) };
|
|
223
229
|
}
|
|
@@ -538,8 +544,6 @@ function scaleIdentity() {
|
|
|
538
544
|
};
|
|
539
545
|
return scale;
|
|
540
546
|
}
|
|
541
|
-
var isObject = (x) => x !== null && typeof x === "object";
|
|
542
|
-
var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
|
|
543
547
|
|
|
544
548
|
// dist/layers/schema/spatialjson-utils.js
|
|
545
549
|
var import_quadbin4 = require("quadbin");
|
|
@@ -559,7 +563,7 @@ function binaryToSpatialjson(binary) {
|
|
|
559
563
|
}
|
|
560
564
|
|
|
561
565
|
// dist/layers/schema/carto-spatial-tile-loader.js
|
|
562
|
-
var VERSION = true ? "9.0.
|
|
566
|
+
var VERSION = true ? "9.1.0-beta.3" : "latest";
|
|
563
567
|
var id = "cartoSpatialTile";
|
|
564
568
|
var DEFAULT_OPTIONS = {
|
|
565
569
|
cartoSpatialTile: {
|
|
@@ -676,6 +680,7 @@ var ClusterGeoJsonLayer = class extends import_geo_layers2.TileLayer {
|
|
|
676
680
|
super.initializeState();
|
|
677
681
|
this.state.aggregationCache = /* @__PURE__ */ new WeakMap();
|
|
678
682
|
}
|
|
683
|
+
// eslint-disable-next-line max-statements
|
|
679
684
|
renderLayers() {
|
|
680
685
|
var _a;
|
|
681
686
|
const visibleTiles = (_a = this.state.tileset) == null ? void 0 : _a.tiles.filter((tile) => {
|
|
@@ -761,9 +766,11 @@ var ClusterTileLayer = class extends import_core6.CompositeLayer {
|
|
|
761
766
|
return null;
|
|
762
767
|
const { tiles: data, maxresolution: maxZoom } = tileJSON;
|
|
763
768
|
return [
|
|
769
|
+
// @ts-ignore
|
|
764
770
|
new ClusterGeoJsonLayer(this.props, {
|
|
765
771
|
id: `cluster-geojson-layer-${this.props.id}`,
|
|
766
772
|
data,
|
|
773
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
767
774
|
TilesetClass: QuadbinTileset2D,
|
|
768
775
|
maxZoom,
|
|
769
776
|
loadOptions: this.getLoadOptions()
|
|
@@ -840,6 +847,12 @@ function getHexagonResolution(viewport, tileSize) {
|
|
|
840
847
|
return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
|
|
841
848
|
}
|
|
842
849
|
var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
|
|
850
|
+
/**
|
|
851
|
+
* Returns all tile indices in the current viewport. If the current zoom level is smaller
|
|
852
|
+
* than minZoom, return an empty array. If the current zoom level is greater than maxZoom,
|
|
853
|
+
* return tiles that are on maxZoom.
|
|
854
|
+
*/
|
|
855
|
+
// @ts-expect-error Tileset2D should be generic over TileIndex
|
|
843
856
|
getTileIndices({ viewport, minZoom, maxZoom }) {
|
|
844
857
|
if (viewport.latitude === void 0)
|
|
845
858
|
return [];
|
|
@@ -860,15 +873,19 @@ var H3Tileset2D = class extends import_geo_layers3._Tileset2D {
|
|
|
860
873
|
}
|
|
861
874
|
return indices.map((i) => ({ i }));
|
|
862
875
|
}
|
|
876
|
+
// @ts-expect-error Tileset2D should be generic over TileIndex
|
|
863
877
|
getTileId({ i }) {
|
|
864
878
|
return i;
|
|
865
879
|
}
|
|
880
|
+
// @ts-expect-error Tileset2D should be generic over TileIndex
|
|
866
881
|
getTileMetadata({ i }) {
|
|
867
882
|
return { bbox: tileToBoundingBox(i) };
|
|
868
883
|
}
|
|
884
|
+
// @ts-expect-error Tileset2D should be generic over TileIndex
|
|
869
885
|
getTileZoom({ i }) {
|
|
870
886
|
return (0, import_h3_js.getResolution)(i);
|
|
871
887
|
}
|
|
888
|
+
// @ts-expect-error Tileset2D should be generic over TileIndex
|
|
872
889
|
getParentIndex(index) {
|
|
873
890
|
const resolution = (0, import_h3_js.getResolution)(index.i);
|
|
874
891
|
const i = (0, import_h3_js.cellToParent)(index.i, resolution - 1);
|
|
@@ -925,7 +942,7 @@ var TileReader3 = class {
|
|
|
925
942
|
};
|
|
926
943
|
|
|
927
944
|
// dist/layers/schema/carto-raster-tile-loader.js
|
|
928
|
-
var VERSION2 = true ? "9.0.
|
|
945
|
+
var VERSION2 = true ? "9.1.0-beta.3" : "latest";
|
|
929
946
|
var id2 = "cartoRasterTile";
|
|
930
947
|
var DEFAULT_OPTIONS2 = {
|
|
931
948
|
cartoRasterTile: {
|
|
@@ -1001,7 +1018,8 @@ var SpatialIndexTileLayer = class extends import_geo_layers4.TileLayer {
|
|
|
1001
1018
|
const { hoveredFeatureId } = this.state;
|
|
1002
1019
|
const data = tile.content;
|
|
1003
1020
|
const isFeatureIdPresent = isFeatureIdDefined(hoveredFeatureId);
|
|
1004
|
-
if (!isFeatureIdPresent || !Array.isArray(data) ||
|
|
1021
|
+
if (!isFeatureIdPresent || !Array.isArray(data) || // Quick check for whether id is within tile. data.findIndex is expensive
|
|
1022
|
+
!this._featureInTile(tile, hoveredFeatureId)) {
|
|
1005
1023
|
return -1;
|
|
1006
1024
|
}
|
|
1007
1025
|
return data.findIndex((feature) => feature.id === hoveredFeatureId);
|
|
@@ -1066,8 +1084,10 @@ var H3TileLayer = class extends import_core8.CompositeLayer {
|
|
|
1066
1084
|
return new SubLayerClass(this.props, {
|
|
1067
1085
|
id: `h3-tile-layer-${this.props.id}`,
|
|
1068
1086
|
data,
|
|
1087
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
1069
1088
|
TilesetClass: H3Tileset2D,
|
|
1070
1089
|
renderSubLayers,
|
|
1090
|
+
// minZoom and maxZoom are H3 resolutions, however we must use this naming as that is what the Tileset2D class expects
|
|
1071
1091
|
minZoom: minresolution,
|
|
1072
1092
|
maxZoom: maxresolution,
|
|
1073
1093
|
loadOptions: this.getLoadOptions()
|
|
@@ -1084,55 +1104,86 @@ var import_core11 = require("@deck.gl/core");
|
|
|
1084
1104
|
var import_layers2 = require("@deck.gl/layers");
|
|
1085
1105
|
|
|
1086
1106
|
// dist/layers/heatmap.js
|
|
1087
|
-
var fs =
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
float
|
|
1107
|
+
var fs = (
|
|
1108
|
+
/* glsl */
|
|
1109
|
+
`uniform heatmapUniforms {
|
|
1110
|
+
vec2 colorDomain;
|
|
1111
|
+
vec2 delta;
|
|
1112
|
+
float intensity;
|
|
1113
|
+
float opacity;
|
|
1114
|
+
float radiusPixels;
|
|
1093
1115
|
} heatmap;
|
|
1116
|
+
|
|
1094
1117
|
uniform sampler2D colorTexture;
|
|
1118
|
+
|
|
1095
1119
|
vec3 colorGradient(float value) {
|
|
1096
|
-
return texture(colorTexture, vec2(value, 0.5)).rgb;
|
|
1120
|
+
return texture(colorTexture, vec2(value, 0.5)).rgb;
|
|
1097
1121
|
}
|
|
1122
|
+
|
|
1098
1123
|
const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0);
|
|
1099
1124
|
const float MAX_VAL = SHIFT.z * 255.0;
|
|
1100
1125
|
const float SCALE = MAX_VAL / 8.0;
|
|
1101
1126
|
vec4 pack(float value) {
|
|
1102
|
-
return vec4(mod(vec3(value, floor(value / SHIFT.yz)), 256.0), 255.0) / 255.0;
|
|
1127
|
+
return vec4(mod(vec3(value, floor(value / SHIFT.yz)), 256.0), 255.0) / 255.0;
|
|
1103
1128
|
}
|
|
1104
1129
|
float unpack(vec3 color) {
|
|
1105
|
-
return 255.0 * dot(color, SHIFT);
|
|
1130
|
+
return 255.0 * dot(color, SHIFT);
|
|
1106
1131
|
}
|
|
1132
|
+
|
|
1107
1133
|
vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
1108
|
-
bool firstPass = (heatmap.delta.y < 0.5);
|
|
1109
|
-
float accumulator = 0.0;
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
float
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
float
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
float
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
return
|
|
1134
|
+
bool firstPass = (heatmap.delta.y < 0.5);
|
|
1135
|
+
float accumulator = 0.0;
|
|
1136
|
+
|
|
1137
|
+
// Controls quality of heatmap, larger values increase quality at expense of performance
|
|
1138
|
+
float SUPPORT = clamp(heatmap.radiusPixels / 2.0, 8.0, 32.0);
|
|
1139
|
+
|
|
1140
|
+
// Gaussian normalization parameters
|
|
1141
|
+
float sigma = SUPPORT / 3.0;
|
|
1142
|
+
float a = -0.5 / (sigma * sigma);
|
|
1143
|
+
float w0 = 0.3989422804014327 / sigma; // 1D normalization
|
|
1144
|
+
for (float t = -SUPPORT; t <= SUPPORT; t++) {
|
|
1145
|
+
vec2 percent = (t * heatmap.delta - 0.5) / SUPPORT;
|
|
1146
|
+
vec2 delta = percent * heatmap.radiusPixels / texSize;
|
|
1147
|
+
vec4 offsetColor = texture(source, texCoord + delta);
|
|
1148
|
+
|
|
1149
|
+
// Unpack float
|
|
1150
|
+
float value = unpack(offsetColor.rgb);
|
|
1151
|
+
|
|
1152
|
+
// Gaussian
|
|
1153
|
+
float weight = w0 * exp(a * t * t);
|
|
1154
|
+
|
|
1155
|
+
accumulator += value * weight;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
if (firstPass) {
|
|
1159
|
+
return pack(accumulator);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// Undo scaling to obtain normalized density
|
|
1163
|
+
float density = 10.0 * heatmap.intensity * accumulator / SCALE;
|
|
1164
|
+
|
|
1165
|
+
// Domain also in normalized density units
|
|
1166
|
+
vec2 domain = heatmap.colorDomain;
|
|
1167
|
+
|
|
1168
|
+
// Apply domain
|
|
1169
|
+
float f = (density - domain[0]) / (domain[1] - domain[0]);
|
|
1170
|
+
|
|
1171
|
+
// sqrt/log scaling??
|
|
1172
|
+
// float f = (log(density) - log(domain[0] + 1.0)) / (log(domain[1] + 1.0) - log(domain[0] + 1.0));
|
|
1173
|
+
// f = sqrt(f);
|
|
1174
|
+
|
|
1175
|
+
// Color map
|
|
1176
|
+
vec4 color = vec4(0.0);
|
|
1177
|
+
color.rgb = colorGradient(f);
|
|
1178
|
+
|
|
1179
|
+
color.a = smoothstep(0.0, 0.1, f);
|
|
1180
|
+
color.a = pow(color.a, 1.0 / 2.2);
|
|
1181
|
+
color.a *= heatmap.opacity;
|
|
1182
|
+
|
|
1183
|
+
return color;
|
|
1134
1184
|
}
|
|
1135
|
-
|
|
1185
|
+
`
|
|
1186
|
+
);
|
|
1136
1187
|
var heatmap = {
|
|
1137
1188
|
name: "heatmap",
|
|
1138
1189
|
uniformPropTypes: {
|
|
@@ -1149,6 +1200,7 @@ var heatmap = {
|
|
|
1149
1200
|
opacity: "f32",
|
|
1150
1201
|
radiusPixels: "f32"
|
|
1151
1202
|
},
|
|
1203
|
+
// @ts-ignore TODO v9.1
|
|
1152
1204
|
getUniforms: (opts) => {
|
|
1153
1205
|
if (!opts)
|
|
1154
1206
|
return {};
|
|
@@ -1164,7 +1216,9 @@ var heatmap = {
|
|
|
1164
1216
|
},
|
|
1165
1217
|
fs,
|
|
1166
1218
|
passes: [
|
|
1219
|
+
// @ts-expect-error Seems typing in luma.gl should be Partial<>
|
|
1167
1220
|
{ sampler: true, uniforms: { delta: [1, 0] } },
|
|
1221
|
+
// @ts-expect-error Seems typing in luma.gl should be Partial<>
|
|
1168
1222
|
{ sampler: true, uniforms: { delta: [0, 1] } }
|
|
1169
1223
|
]
|
|
1170
1224
|
};
|
|
@@ -1200,8 +1254,8 @@ function RTTModifier(BaseLayer) {
|
|
|
1200
1254
|
var _a;
|
|
1201
1255
|
return _a = class RTTLayer extends BaseLayer {
|
|
1202
1256
|
draw(opts) {
|
|
1203
|
-
const {
|
|
1204
|
-
const { picking } =
|
|
1257
|
+
const { shaderModuleProps } = opts;
|
|
1258
|
+
const { picking } = shaderModuleProps;
|
|
1205
1259
|
const postProcessLayer = getPostProcessLayer(this);
|
|
1206
1260
|
if (!picking.isActive) {
|
|
1207
1261
|
postProcessLayer.enableRTT(opts);
|
|
@@ -1211,7 +1265,8 @@ function RTTModifier(BaseLayer) {
|
|
|
1211
1265
|
postProcessLayer.disableRTT();
|
|
1212
1266
|
}
|
|
1213
1267
|
}
|
|
1214
|
-
},
|
|
1268
|
+
}, // @ts-expect-error typescript doesn't see static property
|
|
1269
|
+
_a.layerName = `RTT-${BaseLayer.layerName}`, _a;
|
|
1215
1270
|
}
|
|
1216
1271
|
function PostProcessModifier(BaseLayer, effect) {
|
|
1217
1272
|
var _a;
|
|
@@ -1245,10 +1300,11 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
1245
1300
|
});
|
|
1246
1301
|
}
|
|
1247
1302
|
_resizeBuffers(opts) {
|
|
1248
|
-
const {
|
|
1303
|
+
const { shaderModuleProps } = opts;
|
|
1249
1304
|
const { viewport } = this.context;
|
|
1250
|
-
const
|
|
1251
|
-
const
|
|
1305
|
+
const { devicePixelRatio } = shaderModuleProps.project;
|
|
1306
|
+
const width = devicePixelRatio * viewport.width;
|
|
1307
|
+
const height = devicePixelRatio * viewport.height;
|
|
1252
1308
|
this.internalState.renderBuffers.forEach((fbo) => fbo.resize({ width, height }));
|
|
1253
1309
|
}
|
|
1254
1310
|
enableRTT(opts) {
|
|
@@ -1258,6 +1314,7 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
1258
1314
|
this.internalState.internalRenderPass = this.context.device.beginRenderPass({
|
|
1259
1315
|
framebuffer,
|
|
1260
1316
|
parameters: { viewport: [0, 0, framebuffer.width, framebuffer.height] },
|
|
1317
|
+
// Only clear on first render
|
|
1261
1318
|
clearColor: this.internalState.renderInProgress ? false : [0, 0, 0, 0]
|
|
1262
1319
|
});
|
|
1263
1320
|
this.internalState.renderInProgress = true;
|
|
@@ -1289,10 +1346,13 @@ function PostProcessModifier(BaseLayer, effect) {
|
|
|
1289
1346
|
}
|
|
1290
1347
|
}, _a.layerName = `PostProcess${BaseLayer.layerName}`, _a;
|
|
1291
1348
|
}
|
|
1292
|
-
var fs2 =
|
|
1349
|
+
var fs2 = (
|
|
1350
|
+
/* glsl */
|
|
1351
|
+
`vec4 copy_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
1293
1352
|
return color;
|
|
1294
1353
|
}
|
|
1295
|
-
|
|
1354
|
+
`
|
|
1355
|
+
);
|
|
1296
1356
|
var copy = {
|
|
1297
1357
|
name: "copy",
|
|
1298
1358
|
fs: fs2,
|
|
@@ -1357,6 +1417,7 @@ var QuadbinTileLayer = class extends import_core10.CompositeLayer {
|
|
|
1357
1417
|
return new SubLayerClass(this.props, {
|
|
1358
1418
|
id: `quadbin-tile-layer-${this.props.id}`,
|
|
1359
1419
|
data,
|
|
1420
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
1360
1421
|
TilesetClass: QuadbinTileset2D,
|
|
1361
1422
|
renderSubLayers: renderSubLayers2,
|
|
1362
1423
|
maxZoom,
|
|
@@ -1403,20 +1464,28 @@ function colorRangeToFlatArray(colorRange) {
|
|
|
1403
1464
|
}
|
|
1404
1465
|
return flatArray;
|
|
1405
1466
|
}
|
|
1467
|
+
var uniformBlock = `uniform densityUniforms {
|
|
1468
|
+
float factor;
|
|
1469
|
+
} density;
|
|
1470
|
+
`;
|
|
1471
|
+
var densityUniforms = {
|
|
1472
|
+
name: "density",
|
|
1473
|
+
vs: uniformBlock,
|
|
1474
|
+
uniformTypes: {
|
|
1475
|
+
factor: "f32"
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1406
1478
|
var RTTSolidPolygonLayer = class extends RTTModifier(import_layers2.SolidPolygonLayer) {
|
|
1407
1479
|
getShaders(type) {
|
|
1408
1480
|
const shaders = super.getShaders(type);
|
|
1409
1481
|
shaders.inject = {
|
|
1410
|
-
"vs:#decl": `
|
|
1411
|
-
uniform float densityFactor;
|
|
1412
|
-
`,
|
|
1413
1482
|
"vs:#main-end": `
|
|
1414
1483
|
// Value from getWeight accessor
|
|
1415
1484
|
float weight = elevations;
|
|
1416
1485
|
|
|
1417
1486
|
// Keep "power" delivered to screen constant when tiles update
|
|
1418
|
-
// by outputting normalized density
|
|
1419
|
-
weight *=
|
|
1487
|
+
// by outputting normalized density
|
|
1488
|
+
weight *= density.factor;
|
|
1420
1489
|
|
|
1421
1490
|
// Pack float into 3 channels to pass to heatmap shader
|
|
1422
1491
|
// SCALE value important, as we don't want to saturate
|
|
@@ -1429,14 +1498,17 @@ uniform float densityFactor;
|
|
|
1429
1498
|
vColor = vec4(mod(vec3(weight, floor(weight / SHIFT.yz)), 256.0), 255.0) / 255.0;
|
|
1430
1499
|
`
|
|
1431
1500
|
};
|
|
1501
|
+
shaders.modules = [...shaders.modules, densityUniforms];
|
|
1432
1502
|
return shaders;
|
|
1433
1503
|
}
|
|
1434
1504
|
draw(opts) {
|
|
1435
1505
|
const cell = this.props.data[0];
|
|
1436
1506
|
const maxDensity = this.props.elevationScale;
|
|
1437
|
-
const
|
|
1507
|
+
const densityProps = {
|
|
1508
|
+
factor: unitDensityForCell(cell.id) / maxDensity
|
|
1509
|
+
};
|
|
1438
1510
|
for (const model of this.state.models) {
|
|
1439
|
-
model.
|
|
1511
|
+
model.shaderInputs.setProps({ density: densityProps });
|
|
1440
1512
|
}
|
|
1441
1513
|
super.draw(opts);
|
|
1442
1514
|
}
|
|
@@ -1506,6 +1578,8 @@ var HeatmapTileLayer = class extends import_core11.CompositeLayer {
|
|
|
1506
1578
|
return new PostProcessQuadbinTileLayer(tileLayerProps, this.getSubLayerProps({
|
|
1507
1579
|
id: "heatmap",
|
|
1508
1580
|
data,
|
|
1581
|
+
// Re-use existing props to pass down values to sublayer
|
|
1582
|
+
// TODO replace with custom layer
|
|
1509
1583
|
getFillColor: 0,
|
|
1510
1584
|
getElevation: getWeight,
|
|
1511
1585
|
elevationScale: maxDensity,
|
|
@@ -1515,11 +1589,13 @@ var HeatmapTileLayer = class extends import_core11.CompositeLayer {
|
|
|
1515
1589
|
_subLayerProps: subLayerProps,
|
|
1516
1590
|
refinementStrategy: "no-overlap",
|
|
1517
1591
|
colorTexture: this.state.colorTexture,
|
|
1592
|
+
// Disable line rendering
|
|
1518
1593
|
extruded: false,
|
|
1519
1594
|
stroked: false,
|
|
1520
1595
|
updateTriggers: {
|
|
1521
1596
|
getElevation: updateTriggers.getWeight
|
|
1522
1597
|
},
|
|
1598
|
+
// Tile stats
|
|
1523
1599
|
onViewportLoad: (tiles2) => {
|
|
1524
1600
|
this.setState({ isLoaded: true });
|
|
1525
1601
|
if (typeof onViewportLoad === "function") {
|
|
@@ -1580,8 +1656,8 @@ var EnhancedTextBackgroundLayer = class extends import_layers3._TextBackgroundLa
|
|
|
1580
1656
|
getShaders() {
|
|
1581
1657
|
const shaders = super.getShaders();
|
|
1582
1658
|
let vs = shaders.vs;
|
|
1583
|
-
vs = vs.replaceAll("padding.", "_padding.");
|
|
1584
|
-
vs = vs.replace("void main(void) {", "void main(void) {\n vec4 _padding = padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);");
|
|
1659
|
+
vs = vs.replaceAll("textBackground.padding.", "_padding.");
|
|
1660
|
+
vs = vs.replace("void main(void) {", "void main(void) {\n vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);");
|
|
1585
1661
|
return { ...shaders, vs };
|
|
1586
1662
|
}
|
|
1587
1663
|
};
|
|
@@ -1684,16 +1760,20 @@ var PointLabelLayer = class extends import_core12.CompositeLayer {
|
|
|
1684
1760
|
const getPixelOffset = this.calculatePixelOffset(false);
|
|
1685
1761
|
const backgroundPadding = this.calculateBackgroundPadding();
|
|
1686
1762
|
const out = [
|
|
1763
|
+
// Text doesn't update via updateTrigger for some reason
|
|
1687
1764
|
this.renderTextLayer(`${updateTriggers.getText}-primary`, {
|
|
1688
1765
|
backgroundPadding,
|
|
1689
1766
|
getText,
|
|
1690
1767
|
getPixelOffset,
|
|
1691
1768
|
background: true
|
|
1769
|
+
// Only use background for primary label for faster collisions
|
|
1692
1770
|
}),
|
|
1693
1771
|
Boolean(getSecondaryText) && this.renderTextLayer(`${updateTriggers.getSecondaryText}-secondary`, {
|
|
1694
1772
|
getText: getSecondaryText,
|
|
1695
1773
|
getPixelOffset: this.calculatePixelOffset(true),
|
|
1696
1774
|
getAlignmentBaseline: "top",
|
|
1775
|
+
// updateTriggers: {getText: updateTriggers.getSecondaryText},
|
|
1776
|
+
// Optional overrides
|
|
1697
1777
|
...getSecondaryColor && { getColor: getSecondaryColor },
|
|
1698
1778
|
...secondarySizeScale && { sizeScale: secondarySizeScale },
|
|
1699
1779
|
...secondaryOutlineColor && { outlineColor: secondaryOutlineColor }
|
|
@@ -1722,61 +1802,53 @@ in float instanceElevations;
|
|
|
1722
1802
|
in vec4 instanceFillColors;
|
|
1723
1803
|
in vec4 instanceLineColors;
|
|
1724
1804
|
in vec3 instancePickingColors;
|
|
1725
|
-
uniform float opacity;
|
|
1726
|
-
uniform bool extruded;
|
|
1727
|
-
uniform bool stroked;
|
|
1728
|
-
uniform bool isStroke;
|
|
1729
|
-
uniform float coverage;
|
|
1730
|
-
uniform float elevationScale;
|
|
1731
|
-
uniform float widthScale;
|
|
1732
|
-
uniform vec3 offset;
|
|
1733
1805
|
out vec4 vColor;
|
|
1734
1806
|
#ifdef FLAT_SHADING
|
|
1735
1807
|
out vec4 position_commonspace;
|
|
1736
1808
|
#endif
|
|
1737
1809
|
void main(void) {
|
|
1738
|
-
vec2 tileOrigin = offset.xy;
|
|
1739
|
-
float scale =
|
|
1810
|
+
vec2 tileOrigin = column.offset.xy;
|
|
1811
|
+
float scale = column.widthScale;
|
|
1740
1812
|
int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
|
|
1741
1813
|
int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
|
|
1742
1814
|
vec2 cellCenter = scale * vec2(float(xIndex) + 0.5, float(yIndex) - 0.5);
|
|
1743
|
-
vec4 color = isStroke ? instanceLineColors : instanceFillColors;
|
|
1815
|
+
vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
|
|
1744
1816
|
float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
|
|
1745
|
-
float cellWidth = coverage * scale;
|
|
1817
|
+
float cellWidth = column.coverage * scale;
|
|
1746
1818
|
geometry.position = vec4(tileOrigin + cellCenter, 0.0, 1.0);
|
|
1747
|
-
if (
|
|
1748
|
-
geometry.position.xyz -=
|
|
1819
|
+
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
|
|
1820
|
+
geometry.position.xyz -= project.commonOrigin;
|
|
1749
1821
|
}
|
|
1750
1822
|
float elevation = 0.0;
|
|
1751
1823
|
float strokeOffsetRatio = 1.0;
|
|
1752
|
-
if (extruded) {
|
|
1753
|
-
elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;
|
|
1754
|
-
} else if (stroked) {
|
|
1755
|
-
float halfOffset = project_pixel_size(widthScale) / cellWidth;
|
|
1756
|
-
if (isStroke) {
|
|
1824
|
+
if (column.extruded) {
|
|
1825
|
+
elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
|
|
1826
|
+
} else if (column.stroked) {
|
|
1827
|
+
float halfOffset = project_pixel_size(column.widthScale) / cellWidth;
|
|
1828
|
+
if (column.isStroke) {
|
|
1757
1829
|
strokeOffsetRatio -= sign(positions.z) * halfOffset;
|
|
1758
1830
|
} else {
|
|
1759
1831
|
strokeOffsetRatio -= halfOffset;
|
|
1760
1832
|
}
|
|
1761
1833
|
}
|
|
1762
1834
|
geometry.pickingColor = instancePickingColors;
|
|
1763
|
-
vec2 base = positions.xy * scale * strokeOffsetRatio * coverage * shouldRender;
|
|
1835
|
+
vec2 base = positions.xy * scale * strokeOffsetRatio * column.coverage * shouldRender;
|
|
1764
1836
|
vec3 cell = vec3(base, project_size(elevation));
|
|
1765
1837
|
DECKGL_FILTER_SIZE(cell, geometry);
|
|
1766
1838
|
geometry.position.xyz += cell;
|
|
1767
1839
|
gl_Position = project_common_position_to_clipspace(geometry.position);
|
|
1768
1840
|
geometry.normal = project_normal(normals);
|
|
1769
1841
|
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1770
|
-
if (extruded && !isStroke) {
|
|
1842
|
+
if (column.extruded && !column.isStroke) {
|
|
1771
1843
|
#ifdef FLAT_SHADING
|
|
1772
1844
|
position_commonspace = geometry.position;
|
|
1773
|
-
vColor = vec4(color.rgb, color.a * opacity);
|
|
1845
|
+
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
1774
1846
|
#else
|
|
1775
|
-
vec3 lightColor = lighting_getLightColor(color.rgb,
|
|
1776
|
-
vColor = vec4(lightColor, color.a * opacity);
|
|
1847
|
+
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
1848
|
+
vColor = vec4(lightColor, color.a * layer.opacity);
|
|
1777
1849
|
#endif
|
|
1778
1850
|
} else {
|
|
1779
|
-
vColor = vec4(color.rgb, color.a * opacity);
|
|
1851
|
+
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
1780
1852
|
}
|
|
1781
1853
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1782
1854
|
}
|
|
@@ -1837,7 +1909,8 @@ var RasterLayer = class extends import_core13.CompositeLayer {
|
|
|
1837
1909
|
return null;
|
|
1838
1910
|
const blockSize = data.blockSize ?? 0;
|
|
1839
1911
|
const [xOffset, yOffset, scale] = quadbinToOffset(tileIndex);
|
|
1840
|
-
const offset = [xOffset, yOffset
|
|
1912
|
+
const offset = [xOffset, yOffset];
|
|
1913
|
+
const lineWidthScale = scale / blockSize;
|
|
1841
1914
|
const CellLayer = this.getSubLayerClass("column", RasterColumnLayer);
|
|
1842
1915
|
const { highlightedObjectIndex, highlightColor } = this.state;
|
|
1843
1916
|
return new CellLayer(this.props, this.getSubLayerProps({
|
|
@@ -1850,12 +1923,17 @@ var RasterLayer = class extends import_core13.CompositeLayer {
|
|
|
1850
1923
|
}), {
|
|
1851
1924
|
data: {
|
|
1852
1925
|
data,
|
|
1926
|
+
// Pass through data for getSubLayerAccessor()
|
|
1853
1927
|
length: blockSize * blockSize
|
|
1854
1928
|
},
|
|
1855
1929
|
dataComparator: wrappedDataComparator,
|
|
1856
1930
|
offset,
|
|
1931
|
+
lineWidthScale,
|
|
1932
|
+
// Re-use widthScale prop to pass cell scale,
|
|
1857
1933
|
highlightedObjectIndex,
|
|
1858
1934
|
highlightColor,
|
|
1935
|
+
// RTT requires blending otherwise opacity < 1 blends with black
|
|
1936
|
+
// render target
|
|
1859
1937
|
parameters: {
|
|
1860
1938
|
blendColorSrcFactor: "one",
|
|
1861
1939
|
blendAlphaSrcFactor: "one",
|
|
@@ -1947,6 +2025,7 @@ var RasterTileLayer = class extends import_core14.CompositeLayer {
|
|
|
1947
2025
|
return new SubLayerClass(this.props, {
|
|
1948
2026
|
id: `raster-tile-layer-${this.props.id}`,
|
|
1949
2027
|
data,
|
|
2028
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
1950
2029
|
TilesetClass: QuadbinTileset2D,
|
|
1951
2030
|
renderSubLayers: renderSubLayers3,
|
|
1952
2031
|
minZoom,
|
|
@@ -2003,7 +2082,7 @@ var carto_properties_tile_loader_default = CartoPropertiesTileLoader;
|
|
|
2003
2082
|
|
|
2004
2083
|
// dist/layers/schema/carto-vector-tile-loader.js
|
|
2005
2084
|
var import_earcut = __toESM(require("earcut"), 1);
|
|
2006
|
-
var VERSION3 = true ? "9.0.
|
|
2085
|
+
var VERSION3 = true ? "9.1.0-beta.3" : "latest";
|
|
2007
2086
|
var id3 = "cartoVectorTile";
|
|
2008
2087
|
var DEFAULT_OPTIONS3 = {
|
|
2009
2088
|
cartoVectorTile: {
|
|
@@ -2094,6 +2173,7 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
|
2094
2173
|
loadOptions.gis = { format: "binary" };
|
|
2095
2174
|
return loadOptions;
|
|
2096
2175
|
}
|
|
2176
|
+
/* eslint-disable camelcase */
|
|
2097
2177
|
async getTileData(tile) {
|
|
2098
2178
|
const tileJSON = this.props.data;
|
|
2099
2179
|
const { tiles, properties_tiles } = tileJSON;
|
|
@@ -2123,6 +2203,7 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
|
2123
2203
|
return null;
|
|
2124
2204
|
return attributes ? mergeBoundaryData(geometry, attributes) : geometry;
|
|
2125
2205
|
}
|
|
2206
|
+
/* eslint-enable camelcase */
|
|
2126
2207
|
renderSubLayers(props) {
|
|
2127
2208
|
if (props.data === null) {
|
|
2128
2209
|
return null;
|
|
@@ -2149,6 +2230,7 @@ var VectorTileLayer = class extends import_geo_layers8.MVTLayer {
|
|
|
2149
2230
|
const subLayerProps = {
|
|
2150
2231
|
...props,
|
|
2151
2232
|
autoHighlight: false,
|
|
2233
|
+
// Do not perform clipping on points (#9059)
|
|
2152
2234
|
_subLayerProps: {
|
|
2153
2235
|
...props._subLayerProps,
|
|
2154
2236
|
...applyClipExtensionToSublayerProps("polygons-fill"),
|
|
@@ -2169,47 +2251,8 @@ VectorTileLayer.layerName = "VectorTileLayer";
|
|
|
2169
2251
|
VectorTileLayer.defaultProps = defaultProps10;
|
|
2170
2252
|
var vector_tile_layer_default = VectorTileLayer;
|
|
2171
2253
|
|
|
2172
|
-
// dist/api/carto-api-error.js
|
|
2173
|
-
var CartoAPIError = class extends Error {
|
|
2174
|
-
constructor(error, errorContext, response, responseJson) {
|
|
2175
|
-
let responseString = "Failed to connect";
|
|
2176
|
-
if (response) {
|
|
2177
|
-
responseString = "Server returned: ";
|
|
2178
|
-
if (response.status === 400) {
|
|
2179
|
-
responseString += "Bad request";
|
|
2180
|
-
} else if (response.status === 401 || response.status === 403) {
|
|
2181
|
-
responseString += "Unauthorized access";
|
|
2182
|
-
} else if (response.status === 404) {
|
|
2183
|
-
responseString += "Not found";
|
|
2184
|
-
} else {
|
|
2185
|
-
responseString += "Error";
|
|
2186
|
-
}
|
|
2187
|
-
responseString += ` (${response.status}):`;
|
|
2188
|
-
}
|
|
2189
|
-
responseString += ` ${error.message || error}`;
|
|
2190
|
-
let message = `${errorContext.requestType} API request failed`;
|
|
2191
|
-
message += `
|
|
2192
|
-
${responseString}`;
|
|
2193
|
-
for (const key of Object.keys(errorContext)) {
|
|
2194
|
-
if (key === "requestType")
|
|
2195
|
-
continue;
|
|
2196
|
-
message += `
|
|
2197
|
-
${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
2198
|
-
}
|
|
2199
|
-
message += "\n";
|
|
2200
|
-
super(message);
|
|
2201
|
-
this.name = "CartoAPIError";
|
|
2202
|
-
this.response = response;
|
|
2203
|
-
this.responseJson = responseJson;
|
|
2204
|
-
this.error = error;
|
|
2205
|
-
this.errorContext = errorContext;
|
|
2206
|
-
}
|
|
2207
|
-
};
|
|
2208
|
-
function formatErrorKey(key) {
|
|
2209
|
-
return key.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
2254
|
// dist/basemap.js
|
|
2255
|
+
var import_api_client = require("@carto/api-client");
|
|
2213
2256
|
var cartoStyleUrlTemplate = "https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json";
|
|
2214
2257
|
var CARTO_MAP_STYLES = ["positron", "dark-matter", "voyager"];
|
|
2215
2258
|
var GOOGLE_BASEMAPS = {
|
|
@@ -2294,7 +2337,7 @@ async function fetchStyle({ styleUrl, errorContext }) {
|
|
|
2294
2337
|
response = res;
|
|
2295
2338
|
return res.json();
|
|
2296
2339
|
}).catch((error) => {
|
|
2297
|
-
throw new CartoAPIError(error, { ...errorContext, requestType: "Basemap style" }, response);
|
|
2340
|
+
throw new import_api_client.CartoAPIError(error, { ...errorContext, requestType: "Basemap style" }, response);
|
|
2298
2341
|
});
|
|
2299
2342
|
}
|
|
2300
2343
|
var basemap_default = {
|
|
@@ -2414,343 +2457,11 @@ function colorContinuous({ attr, domain, colors = DEFAULT_PALETTE, nullColor = N
|
|
|
2414
2457
|
};
|
|
2415
2458
|
}
|
|
2416
2459
|
|
|
2417
|
-
// dist/api/
|
|
2418
|
-
var
|
|
2419
|
-
var DEFAULT_CLIENT = "deck-gl-carto";
|
|
2420
|
-
var V3_MINOR_VERSION = "3.4";
|
|
2421
|
-
var DEFAULT_MAX_LENGTH_URL = 7e3;
|
|
2422
|
-
|
|
2423
|
-
// dist/api/endpoints.js
|
|
2424
|
-
function joinPath(...args) {
|
|
2425
|
-
return args.map((part) => part.endsWith("/") ? part.slice(0, -1) : part).join("/");
|
|
2426
|
-
}
|
|
2427
|
-
function buildV3Path(apiBaseUrl, version, endpoint, ...rest) {
|
|
2428
|
-
return joinPath(apiBaseUrl, version, endpoint, ...rest);
|
|
2429
|
-
}
|
|
2430
|
-
function buildPublicMapUrl({ apiBaseUrl, cartoMapId }) {
|
|
2431
|
-
return buildV3Path(apiBaseUrl, "v3", "maps", "public", cartoMapId);
|
|
2432
|
-
}
|
|
2433
|
-
function buildStatsUrl({ attribute, apiBaseUrl, connectionName, source, type }) {
|
|
2434
|
-
if (type === "query") {
|
|
2435
|
-
return buildV3Path(apiBaseUrl, "v3", "stats", connectionName, attribute);
|
|
2436
|
-
}
|
|
2437
|
-
return buildV3Path(apiBaseUrl, "v3", "stats", connectionName, source, attribute);
|
|
2438
|
-
}
|
|
2439
|
-
function buildSourceUrl({ apiBaseUrl, connectionName, endpoint }) {
|
|
2440
|
-
return buildV3Path(apiBaseUrl, "v3", "maps", connectionName, endpoint);
|
|
2441
|
-
}
|
|
2442
|
-
function buildQueryUrl({ apiBaseUrl, connectionName }) {
|
|
2443
|
-
return buildV3Path(apiBaseUrl, "v3", "sql", connectionName, "query");
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
// dist/api/request-with-parameters.js
|
|
2447
|
-
var import_core16 = require("@deck.gl/core");
|
|
2448
|
-
var DEFAULT_PARAMETERS = {
|
|
2449
|
-
v: V3_MINOR_VERSION,
|
|
2450
|
-
deckglVersion: import_core16.VERSION
|
|
2451
|
-
};
|
|
2452
|
-
var DEFAULT_HEADERS = {
|
|
2453
|
-
Accept: "application/json",
|
|
2454
|
-
"Content-Type": "application/json"
|
|
2455
|
-
};
|
|
2456
|
-
var REQUEST_CACHE = /* @__PURE__ */ new Map();
|
|
2457
|
-
async function requestWithParameters({ baseUrl, parameters = {}, headers: customHeaders = {}, errorContext, maxLengthURL = DEFAULT_MAX_LENGTH_URL }) {
|
|
2458
|
-
parameters = { ...DEFAULT_PARAMETERS, ...parameters };
|
|
2459
|
-
baseUrl = excludeURLParameters(baseUrl, Object.keys(parameters));
|
|
2460
|
-
const key = createCacheKey(baseUrl, parameters, customHeaders);
|
|
2461
|
-
if (REQUEST_CACHE.has(key)) {
|
|
2462
|
-
return REQUEST_CACHE.get(key);
|
|
2463
|
-
}
|
|
2464
|
-
const url = createURLWithParameters(baseUrl, parameters);
|
|
2465
|
-
const headers = { ...DEFAULT_HEADERS, ...customHeaders };
|
|
2466
|
-
const fetchPromise = url.length > maxLengthURL ? fetch(baseUrl, { method: "POST", body: JSON.stringify(parameters), headers }) : fetch(url, { headers });
|
|
2467
|
-
let response;
|
|
2468
|
-
let responseJson;
|
|
2469
|
-
const jsonPromise = fetchPromise.then((_response) => {
|
|
2470
|
-
response = _response;
|
|
2471
|
-
return response.json();
|
|
2472
|
-
}).then((json) => {
|
|
2473
|
-
responseJson = json;
|
|
2474
|
-
if (!response || !response.ok) {
|
|
2475
|
-
throw new Error(json.error);
|
|
2476
|
-
}
|
|
2477
|
-
return json;
|
|
2478
|
-
}).catch((error) => {
|
|
2479
|
-
REQUEST_CACHE.delete(key);
|
|
2480
|
-
throw new CartoAPIError(error, errorContext, response, responseJson);
|
|
2481
|
-
});
|
|
2482
|
-
REQUEST_CACHE.set(key, jsonPromise);
|
|
2483
|
-
return jsonPromise;
|
|
2484
|
-
}
|
|
2485
|
-
function createCacheKey(baseUrl, parameters, headers) {
|
|
2486
|
-
const parameterEntries = Object.entries(parameters).sort(([a], [b]) => a > b ? 1 : -1);
|
|
2487
|
-
const headerEntries = Object.entries(headers).sort(([a], [b]) => a > b ? 1 : -1);
|
|
2488
|
-
return JSON.stringify({ baseUrl, parameters: parameterEntries, headers: headerEntries });
|
|
2489
|
-
}
|
|
2490
|
-
function createURLWithParameters(baseUrlString, parameters) {
|
|
2491
|
-
const baseUrl = new URL(baseUrlString);
|
|
2492
|
-
for (const [key, value] of Object.entries(parameters)) {
|
|
2493
|
-
if (isPureObject(value) || Array.isArray(value)) {
|
|
2494
|
-
baseUrl.searchParams.set(key, JSON.stringify(value));
|
|
2495
|
-
} else {
|
|
2496
|
-
baseUrl.searchParams.set(key, value.toString());
|
|
2497
|
-
}
|
|
2498
|
-
}
|
|
2499
|
-
return baseUrl.toString();
|
|
2500
|
-
}
|
|
2501
|
-
function excludeURLParameters(baseUrlString, parameters) {
|
|
2502
|
-
const baseUrl = new URL(baseUrlString);
|
|
2503
|
-
for (const param of parameters) {
|
|
2504
|
-
if (baseUrl.searchParams.has(param)) {
|
|
2505
|
-
baseUrl.searchParams.delete(param);
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
return baseUrl.toString();
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
// dist/sources/base-source.js
|
|
2512
|
-
var SOURCE_DEFAULTS = {
|
|
2513
|
-
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
2514
|
-
clientId: DEFAULT_CLIENT,
|
|
2515
|
-
format: "tilejson",
|
|
2516
|
-
headers: {},
|
|
2517
|
-
maxLengthURL: DEFAULT_MAX_LENGTH_URL
|
|
2518
|
-
};
|
|
2519
|
-
async function baseSource(endpoint, options, urlParameters) {
|
|
2520
|
-
const { accessToken, connectionName, cache, ...optionalOptions } = options;
|
|
2521
|
-
const mergedOptions = { ...SOURCE_DEFAULTS, accessToken, connectionName, endpoint };
|
|
2522
|
-
for (const key in optionalOptions) {
|
|
2523
|
-
if (optionalOptions[key]) {
|
|
2524
|
-
mergedOptions[key] = optionalOptions[key];
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
const baseUrl = buildSourceUrl(mergedOptions);
|
|
2528
|
-
const { clientId, maxLengthURL, format } = mergedOptions;
|
|
2529
|
-
const headers = { Authorization: `Bearer ${options.accessToken}`, ...options.headers };
|
|
2530
|
-
const parameters = { client: clientId, ...urlParameters };
|
|
2531
|
-
const errorContext = {
|
|
2532
|
-
requestType: "Map instantiation",
|
|
2533
|
-
connection: options.connectionName,
|
|
2534
|
-
type: endpoint,
|
|
2535
|
-
source: JSON.stringify(parameters, void 0, 2)
|
|
2536
|
-
};
|
|
2537
|
-
const mapInstantiation = await requestWithParameters({
|
|
2538
|
-
baseUrl,
|
|
2539
|
-
parameters,
|
|
2540
|
-
headers,
|
|
2541
|
-
errorContext,
|
|
2542
|
-
maxLengthURL
|
|
2543
|
-
});
|
|
2544
|
-
const dataUrl = mapInstantiation[format].url[0];
|
|
2545
|
-
if (cache) {
|
|
2546
|
-
cache.value = parseInt(new URL(dataUrl).searchParams.get("cache") || "", 10);
|
|
2547
|
-
}
|
|
2548
|
-
errorContext.requestType = "Map data";
|
|
2549
|
-
if (format === "tilejson") {
|
|
2550
|
-
const json = await requestWithParameters({
|
|
2551
|
-
baseUrl: dataUrl,
|
|
2552
|
-
headers,
|
|
2553
|
-
errorContext,
|
|
2554
|
-
maxLengthURL
|
|
2555
|
-
});
|
|
2556
|
-
if (accessToken) {
|
|
2557
|
-
json.accessToken = accessToken;
|
|
2558
|
-
}
|
|
2559
|
-
return json;
|
|
2560
|
-
}
|
|
2561
|
-
return await requestWithParameters({
|
|
2562
|
-
baseUrl: dataUrl,
|
|
2563
|
-
headers,
|
|
2564
|
-
errorContext,
|
|
2565
|
-
maxLengthURL
|
|
2566
|
-
});
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
// dist/sources/boundary-query-source.js
|
|
2570
|
-
var boundaryQuerySource = async function(options) {
|
|
2571
|
-
const { columns, filters, tilesetTableName, propertiesSqlQuery, queryParameters } = options;
|
|
2572
|
-
const urlParameters = {
|
|
2573
|
-
tilesetTableName,
|
|
2574
|
-
propertiesSqlQuery
|
|
2575
|
-
};
|
|
2576
|
-
if (columns) {
|
|
2577
|
-
urlParameters.columns = columns.join(",");
|
|
2578
|
-
}
|
|
2579
|
-
if (filters) {
|
|
2580
|
-
urlParameters.filters = filters;
|
|
2581
|
-
}
|
|
2582
|
-
if (queryParameters) {
|
|
2583
|
-
urlParameters.queryParameters = queryParameters;
|
|
2584
|
-
}
|
|
2585
|
-
return baseSource("boundary", options, urlParameters);
|
|
2586
|
-
};
|
|
2587
|
-
|
|
2588
|
-
// dist/sources/boundary-table-source.js
|
|
2589
|
-
var boundaryTableSource = async function(options) {
|
|
2590
|
-
const { filters, tilesetTableName, columns, propertiesTableName } = options;
|
|
2591
|
-
const urlParameters = {
|
|
2592
|
-
tilesetTableName,
|
|
2593
|
-
propertiesTableName
|
|
2594
|
-
};
|
|
2595
|
-
if (columns) {
|
|
2596
|
-
urlParameters.columns = columns.join(",");
|
|
2597
|
-
}
|
|
2598
|
-
if (filters) {
|
|
2599
|
-
urlParameters.filters = filters;
|
|
2600
|
-
}
|
|
2601
|
-
return baseSource("boundary", options, urlParameters);
|
|
2602
|
-
};
|
|
2603
|
-
|
|
2604
|
-
// dist/sources/h3-query-source.js
|
|
2605
|
-
var h3QuerySource = async function(options) {
|
|
2606
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, sqlQuery, spatialDataColumn = "h3", queryParameters, filters } = options;
|
|
2607
|
-
const urlParameters = {
|
|
2608
|
-
aggregationExp,
|
|
2609
|
-
spatialDataColumn,
|
|
2610
|
-
spatialDataType: "h3",
|
|
2611
|
-
q: sqlQuery
|
|
2612
|
-
};
|
|
2613
|
-
if (aggregationResLevel) {
|
|
2614
|
-
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
2615
|
-
}
|
|
2616
|
-
if (queryParameters) {
|
|
2617
|
-
urlParameters.queryParameters = queryParameters;
|
|
2618
|
-
}
|
|
2619
|
-
if (filters) {
|
|
2620
|
-
urlParameters.filters = filters;
|
|
2621
|
-
}
|
|
2622
|
-
return baseSource("query", options, urlParameters);
|
|
2623
|
-
};
|
|
2624
|
-
|
|
2625
|
-
// dist/sources/h3-table-source.js
|
|
2626
|
-
var h3TableSource = async function(options) {
|
|
2627
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3, spatialDataColumn = "h3", tableName, filters } = options;
|
|
2628
|
-
const urlParameters = {
|
|
2629
|
-
aggregationExp,
|
|
2630
|
-
name: tableName,
|
|
2631
|
-
spatialDataColumn,
|
|
2632
|
-
spatialDataType: "h3"
|
|
2633
|
-
};
|
|
2634
|
-
if (aggregationResLevel) {
|
|
2635
|
-
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
2636
|
-
}
|
|
2637
|
-
if (filters) {
|
|
2638
|
-
urlParameters.filters = filters;
|
|
2639
|
-
}
|
|
2640
|
-
return baseSource("table", options, urlParameters);
|
|
2641
|
-
};
|
|
2642
|
-
|
|
2643
|
-
// dist/sources/h3-tileset-source.js
|
|
2644
|
-
var h3TilesetSource = async function(options) {
|
|
2645
|
-
const { tableName } = options;
|
|
2646
|
-
const urlParameters = { name: tableName };
|
|
2647
|
-
return baseSource("tileset", options, urlParameters);
|
|
2648
|
-
};
|
|
2649
|
-
|
|
2650
|
-
// dist/sources/raster-source.js
|
|
2651
|
-
var rasterSource = async function(options) {
|
|
2652
|
-
const { tableName, filters } = options;
|
|
2653
|
-
const urlParameters = { name: tableName };
|
|
2654
|
-
if (filters) {
|
|
2655
|
-
urlParameters.filters = filters;
|
|
2656
|
-
}
|
|
2657
|
-
return baseSource("raster", options, urlParameters);
|
|
2658
|
-
};
|
|
2659
|
-
|
|
2660
|
-
// dist/sources/quadbin-query-source.js
|
|
2661
|
-
var quadbinQuerySource = async function(options) {
|
|
2662
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, sqlQuery, spatialDataColumn = "quadbin", queryParameters, filters } = options;
|
|
2663
|
-
const urlParameters = {
|
|
2664
|
-
aggregationExp,
|
|
2665
|
-
q: sqlQuery,
|
|
2666
|
-
spatialDataColumn,
|
|
2667
|
-
spatialDataType: "quadbin"
|
|
2668
|
-
};
|
|
2669
|
-
if (aggregationResLevel) {
|
|
2670
|
-
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
2671
|
-
}
|
|
2672
|
-
if (queryParameters) {
|
|
2673
|
-
urlParameters.queryParameters = queryParameters;
|
|
2674
|
-
}
|
|
2675
|
-
if (filters) {
|
|
2676
|
-
urlParameters.filters = filters;
|
|
2677
|
-
}
|
|
2678
|
-
return baseSource("query", options, urlParameters);
|
|
2679
|
-
};
|
|
2680
|
-
|
|
2681
|
-
// dist/sources/quadbin-table-source.js
|
|
2682
|
-
var quadbinTableSource = async function(options) {
|
|
2683
|
-
const { aggregationExp, aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN, spatialDataColumn = "quadbin", tableName, filters } = options;
|
|
2684
|
-
const urlParameters = {
|
|
2685
|
-
aggregationExp,
|
|
2686
|
-
name: tableName,
|
|
2687
|
-
spatialDataColumn,
|
|
2688
|
-
spatialDataType: "quadbin"
|
|
2689
|
-
};
|
|
2690
|
-
if (aggregationResLevel) {
|
|
2691
|
-
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
2692
|
-
}
|
|
2693
|
-
if (filters) {
|
|
2694
|
-
urlParameters.filters = filters;
|
|
2695
|
-
}
|
|
2696
|
-
return baseSource("table", options, urlParameters);
|
|
2697
|
-
};
|
|
2698
|
-
|
|
2699
|
-
// dist/sources/quadbin-tileset-source.js
|
|
2700
|
-
var quadbinTilesetSource = async function(options) {
|
|
2701
|
-
const { tableName } = options;
|
|
2702
|
-
const urlParameters = { name: tableName };
|
|
2703
|
-
return baseSource("tileset", options, urlParameters);
|
|
2704
|
-
};
|
|
2705
|
-
|
|
2706
|
-
// dist/sources/vector-query-source.js
|
|
2707
|
-
var vectorQuerySource = async function(options) {
|
|
2708
|
-
const { columns, filters, spatialDataColumn = "geom", sqlQuery, tileResolution = DEFAULT_TILE_RESOLUTION, queryParameters } = options;
|
|
2709
|
-
const urlParameters = {
|
|
2710
|
-
spatialDataColumn,
|
|
2711
|
-
spatialDataType: "geo",
|
|
2712
|
-
tileResolution: tileResolution.toString(),
|
|
2713
|
-
q: sqlQuery
|
|
2714
|
-
};
|
|
2715
|
-
if (columns) {
|
|
2716
|
-
urlParameters.columns = columns.join(",");
|
|
2717
|
-
}
|
|
2718
|
-
if (filters) {
|
|
2719
|
-
urlParameters.filters = filters;
|
|
2720
|
-
}
|
|
2721
|
-
if (queryParameters) {
|
|
2722
|
-
urlParameters.queryParameters = queryParameters;
|
|
2723
|
-
}
|
|
2724
|
-
return baseSource("query", options, urlParameters);
|
|
2725
|
-
};
|
|
2726
|
-
|
|
2727
|
-
// dist/sources/vector-table-source.js
|
|
2728
|
-
var vectorTableSource = async function(options) {
|
|
2729
|
-
const { columns, filters, spatialDataColumn = "geom", tableName, tileResolution = DEFAULT_TILE_RESOLUTION } = options;
|
|
2730
|
-
const urlParameters = {
|
|
2731
|
-
name: tableName,
|
|
2732
|
-
spatialDataColumn,
|
|
2733
|
-
spatialDataType: "geo",
|
|
2734
|
-
tileResolution: tileResolution.toString()
|
|
2735
|
-
};
|
|
2736
|
-
if (columns) {
|
|
2737
|
-
urlParameters.columns = columns.join(",");
|
|
2738
|
-
}
|
|
2739
|
-
if (filters) {
|
|
2740
|
-
urlParameters.filters = filters;
|
|
2741
|
-
}
|
|
2742
|
-
return baseSource("table", options, urlParameters);
|
|
2743
|
-
};
|
|
2744
|
-
|
|
2745
|
-
// dist/sources/vector-tileset-source.js
|
|
2746
|
-
var vectorTilesetSource = async function(options) {
|
|
2747
|
-
const { tableName } = options;
|
|
2748
|
-
const urlParameters = { name: tableName };
|
|
2749
|
-
return baseSource("tileset", options, urlParameters);
|
|
2750
|
-
};
|
|
2460
|
+
// dist/api/fetch-map.js
|
|
2461
|
+
var import_api_client2 = require("@carto/api-client");
|
|
2751
2462
|
|
|
2752
2463
|
// dist/api/parse-map.js
|
|
2753
|
-
var
|
|
2464
|
+
var import_core16 = require("@deck.gl/core");
|
|
2754
2465
|
|
|
2755
2466
|
// dist/api/layer-map.js
|
|
2756
2467
|
var import_d3_array = require("d3-array");
|
|
@@ -2790,6 +2501,7 @@ var OPACITY_MAP = {
|
|
|
2790
2501
|
var AGGREGATION_FUNC = {
|
|
2791
2502
|
"count unique": (values, accessor) => (0, import_d3_array.groupSort)(values, (v) => v.length, accessor).length,
|
|
2792
2503
|
median: import_d3_array.median,
|
|
2504
|
+
// Unfortunately mode() is only available in d3-array@3+ which is ESM only
|
|
2793
2505
|
mode: (values, accessor) => (0, import_d3_array.groupSort)(values, (v) => v.length, accessor).pop(),
|
|
2794
2506
|
stddev: import_d3_array.deviation,
|
|
2795
2507
|
variance: import_d3_array.variance
|
|
@@ -2808,12 +2520,14 @@ var hexToRGBA = (c) => {
|
|
|
2808
2520
|
return [r, g, b, 255 * opacity];
|
|
2809
2521
|
};
|
|
2810
2522
|
var sharedPropMap = {
|
|
2523
|
+
// Apply the value of Kepler `color` prop to the deck `getFillColor` prop
|
|
2811
2524
|
color: "getFillColor",
|
|
2812
2525
|
isVisible: "visible",
|
|
2813
2526
|
label: "cartoLabel",
|
|
2814
2527
|
textLabel: {
|
|
2815
2528
|
alignment: "getTextAlignmentBaseline",
|
|
2816
2529
|
anchor: "getTextAnchor",
|
|
2530
|
+
// Apply the value of Kepler `textLabel.color` prop to the deck `getTextColor` prop
|
|
2817
2531
|
color: "getTextColor",
|
|
2818
2532
|
size: "getTextSize"
|
|
2819
2533
|
},
|
|
@@ -2877,7 +2591,7 @@ function getLayer(type, config, dataset) {
|
|
|
2877
2591
|
Layer: import_layers6.GeoJsonLayer,
|
|
2878
2592
|
propMap: {
|
|
2879
2593
|
columns: {
|
|
2880
|
-
altitude: (x) => ({ parameters: {
|
|
2594
|
+
altitude: (x) => ({ parameters: { depthWriteEnabled: Boolean(x) } })
|
|
2881
2595
|
},
|
|
2882
2596
|
visConfig: { outline: "stroked" }
|
|
2883
2597
|
}
|
|
@@ -2886,7 +2600,7 @@ function getLayer(type, config, dataset) {
|
|
|
2886
2600
|
Layer: import_layers6.GeoJsonLayer
|
|
2887
2601
|
},
|
|
2888
2602
|
grid: {
|
|
2889
|
-
Layer: import_aggregation_layers.
|
|
2603
|
+
Layer: import_aggregation_layers.GridLayer,
|
|
2890
2604
|
propMap: { visConfig: { ...aggregationVisConfig, worldUnitSize: (x) => ({ cellSize: 1e3 * x }) } },
|
|
2891
2605
|
defaultProps: { getPosition }
|
|
2892
2606
|
},
|
|
@@ -3125,6 +2839,7 @@ function parseMap(json) {
|
|
|
3125
2839
|
createdAt: json.createdAt,
|
|
3126
2840
|
updatedAt: json.updatedAt,
|
|
3127
2841
|
initialViewState: mapState,
|
|
2842
|
+
/** @deprecated Use `basemap`. */
|
|
3128
2843
|
mapStyle,
|
|
3129
2844
|
token,
|
|
3130
2845
|
layers: layers.reverse().map(({ id: id4, type, config, visualChannels }) => {
|
|
@@ -3143,11 +2858,13 @@ function parseMap(json) {
|
|
|
3143
2858
|
...createInteractionProps(interactionConfig),
|
|
3144
2859
|
...styleProps,
|
|
3145
2860
|
...createChannelProps(id4, type, config, visualChannels, data),
|
|
2861
|
+
// Must come after style
|
|
3146
2862
|
...createParametersProp(layerBlending, styleProps.parameters || {}),
|
|
2863
|
+
// Must come after style
|
|
3147
2864
|
...createLoadOptions(token)
|
|
3148
2865
|
});
|
|
3149
2866
|
} catch (e) {
|
|
3150
|
-
|
|
2867
|
+
import_core16.log.error(e.message)();
|
|
3151
2868
|
return void 0;
|
|
3152
2869
|
}
|
|
3153
2870
|
})
|
|
@@ -3234,6 +2951,7 @@ function createChannelProps(id4, type, config, visualChannels, data) {
|
|
|
3234
2951
|
const { colorAggregation: aggregation, colorRange: range } = visConfig;
|
|
3235
2952
|
result.getFillColor = getColorAccessor(
|
|
3236
2953
|
colorField,
|
|
2954
|
+
// @ts-ignore
|
|
3237
2955
|
colorScale,
|
|
3238
2956
|
{ aggregation, range },
|
|
3239
2957
|
visConfig.opacity,
|
|
@@ -3256,7 +2974,9 @@ function createChannelProps(id4, type, config, visualChannels, data) {
|
|
|
3256
2974
|
}
|
|
3257
2975
|
if (radiusField || sizeField) {
|
|
3258
2976
|
result.getPointRadius = getSizeAccessor(
|
|
2977
|
+
// @ts-ignore
|
|
3259
2978
|
radiusField || sizeField,
|
|
2979
|
+
// @ts-ignore
|
|
3260
2980
|
radiusScale || sizeScale,
|
|
3261
2981
|
visConfig.sizeAggregation,
|
|
3262
2982
|
visConfig.radiusRange || visConfig.sizeRange,
|
|
@@ -3269,7 +2989,9 @@ function createChannelProps(id4, type, config, visualChannels, data) {
|
|
|
3269
2989
|
const { strokeColorAggregation: aggregation, strokeColorRange: range } = visConfig;
|
|
3270
2990
|
result.getLineColor = getColorAccessor(
|
|
3271
2991
|
strokeColorField,
|
|
2992
|
+
// @ts-ignore
|
|
3272
2993
|
strokeColorScale,
|
|
2994
|
+
// @ts-ignore
|
|
3273
2995
|
{ aggregation, range },
|
|
3274
2996
|
opacity,
|
|
3275
2997
|
data
|
|
@@ -3278,6 +3000,7 @@ function createChannelProps(id4, type, config, visualChannels, data) {
|
|
|
3278
3000
|
if (heightField && visConfig.enable3d) {
|
|
3279
3001
|
result.getElevation = getSizeAccessor(
|
|
3280
3002
|
heightField,
|
|
3003
|
+
// @ts-ignore
|
|
3281
3004
|
heightScale,
|
|
3282
3005
|
visConfig.heightAggregation,
|
|
3283
3006
|
visConfig.heightRange || visConfig.sizeRange,
|
|
@@ -3345,6 +3068,7 @@ function createChannelProps(id4, type, config, visualChannels, data) {
|
|
|
3345
3068
|
extensions: [collisionFilterExtension],
|
|
3346
3069
|
collisionEnabled: true,
|
|
3347
3070
|
collisionGroup,
|
|
3071
|
+
// getPointRadius already has radiusScale baked in, so only pass one or the other
|
|
3348
3072
|
...result.getPointRadius ? { getRadius: result.getPointRadius } : { radiusScale: visConfig.radius },
|
|
3349
3073
|
...secondaryField && {
|
|
3350
3074
|
getSecondaryText,
|
|
@@ -3433,29 +3157,25 @@ async function fetchBasemapProps({ config, errorContext, applyLayerFilters = tru
|
|
|
3433
3157
|
}
|
|
3434
3158
|
|
|
3435
3159
|
// dist/api/fetch-map.js
|
|
3436
|
-
async function _fetchMapDataset(dataset,
|
|
3160
|
+
async function _fetchMapDataset(dataset, context) {
|
|
3437
3161
|
const { aggregationExp, aggregationResLevel, connectionName, columns, format, geoColumn, source, type, queryParameters } = dataset;
|
|
3438
3162
|
const cache = {};
|
|
3439
3163
|
const globalOptions = {
|
|
3440
|
-
|
|
3441
|
-
apiBaseUrl,
|
|
3164
|
+
...context,
|
|
3442
3165
|
cache,
|
|
3443
|
-
clientId,
|
|
3444
3166
|
connectionName,
|
|
3445
|
-
format
|
|
3446
|
-
headers,
|
|
3447
|
-
maxLengthURL
|
|
3167
|
+
format
|
|
3448
3168
|
};
|
|
3449
3169
|
if (type === "tileset") {
|
|
3450
|
-
dataset.data = await vectorTilesetSource({ ...globalOptions, tableName: source });
|
|
3170
|
+
dataset.data = await (0, import_api_client2.vectorTilesetSource)({ ...globalOptions, tableName: source });
|
|
3451
3171
|
} else {
|
|
3452
3172
|
const [spatialDataType, spatialDataColumn] = geoColumn ? geoColumn.split(":") : ["geom"];
|
|
3453
3173
|
if (spatialDataType === "geom") {
|
|
3454
3174
|
const options = { ...globalOptions, spatialDataColumn };
|
|
3455
3175
|
if (type === "table") {
|
|
3456
|
-
dataset.data = await vectorTableSource({ ...options, columns, tableName: source });
|
|
3176
|
+
dataset.data = await (0, import_api_client2.vectorTableSource)({ ...options, columns, tableName: source });
|
|
3457
3177
|
} else if (type === "query") {
|
|
3458
|
-
dataset.data = await vectorQuerySource({
|
|
3178
|
+
dataset.data = await (0, import_api_client2.vectorQuerySource)({
|
|
3459
3179
|
...options,
|
|
3460
3180
|
columns,
|
|
3461
3181
|
sqlQuery: source,
|
|
@@ -3465,16 +3185,16 @@ async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, head
|
|
|
3465
3185
|
} else if (spatialDataType === "h3") {
|
|
3466
3186
|
const options = { ...globalOptions, aggregationExp, aggregationResLevel, spatialDataColumn };
|
|
3467
3187
|
if (type === "table") {
|
|
3468
|
-
dataset.data = await h3TableSource({ ...options, tableName: source });
|
|
3188
|
+
dataset.data = await (0, import_api_client2.h3TableSource)({ ...options, tableName: source });
|
|
3469
3189
|
} else if (type === "query") {
|
|
3470
|
-
dataset.data = await h3QuerySource({ ...options, sqlQuery: source, queryParameters });
|
|
3190
|
+
dataset.data = await (0, import_api_client2.h3QuerySource)({ ...options, sqlQuery: source, queryParameters });
|
|
3471
3191
|
}
|
|
3472
3192
|
} else if (spatialDataType === "quadbin") {
|
|
3473
3193
|
const options = { ...globalOptions, aggregationExp, aggregationResLevel, spatialDataColumn };
|
|
3474
3194
|
if (type === "table") {
|
|
3475
|
-
dataset.data = await quadbinTableSource({ ...options, tableName: source });
|
|
3195
|
+
dataset.data = await (0, import_api_client2.quadbinTableSource)({ ...options, tableName: source });
|
|
3476
3196
|
} else if (type === "query") {
|
|
3477
|
-
dataset.data = await quadbinQuerySource({ ...options, sqlQuery: source, queryParameters });
|
|
3197
|
+
dataset.data = await (0, import_api_client2.quadbinQuerySource)({ ...options, sqlQuery: source, queryParameters });
|
|
3478
3198
|
}
|
|
3479
3199
|
}
|
|
3480
3200
|
}
|
|
@@ -3485,8 +3205,9 @@ async function _fetchMapDataset(dataset, accessToken, apiBaseUrl, clientId, head
|
|
|
3485
3205
|
}
|
|
3486
3206
|
return cacheChanged;
|
|
3487
3207
|
}
|
|
3488
|
-
async function _fetchTilestats(attribute, dataset,
|
|
3208
|
+
async function _fetchTilestats(attribute, dataset, context) {
|
|
3489
3209
|
const { connectionName, data, id: id4, source, type, queryParameters } = dataset;
|
|
3210
|
+
const { apiBaseUrl } = context;
|
|
3490
3211
|
const errorContext = {
|
|
3491
3212
|
requestType: "Tile stats",
|
|
3492
3213
|
connection: connectionName,
|
|
@@ -3494,11 +3215,11 @@ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxL
|
|
|
3494
3215
|
source
|
|
3495
3216
|
};
|
|
3496
3217
|
if (!("tilestats" in data)) {
|
|
3497
|
-
throw new CartoAPIError(new Error(`Invalid dataset for tilestats: ${id4}`), errorContext);
|
|
3218
|
+
throw new import_api_client2.CartoAPIError(new Error(`Invalid dataset for tilestats: ${id4}`), errorContext);
|
|
3498
3219
|
}
|
|
3499
|
-
const baseUrl = buildStatsUrl({ attribute, apiBaseUrl, ...dataset });
|
|
3220
|
+
const baseUrl = (0, import_api_client2.buildStatsUrl)({ attribute, apiBaseUrl, ...dataset });
|
|
3500
3221
|
const client = new URLSearchParams(data.tiles[0]).get("client");
|
|
3501
|
-
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
3222
|
+
const headers = { Authorization: `Bearer ${context.accessToken}` };
|
|
3502
3223
|
const parameters = {};
|
|
3503
3224
|
if (client) {
|
|
3504
3225
|
parameters.client = client;
|
|
@@ -3509,23 +3230,23 @@ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl, maxL
|
|
|
3509
3230
|
parameters.queryParameters = JSON.stringify(queryParameters);
|
|
3510
3231
|
}
|
|
3511
3232
|
}
|
|
3512
|
-
const stats = await requestWithParameters({
|
|
3233
|
+
const stats = await (0, import_api_client2.requestWithParameters)({
|
|
3513
3234
|
baseUrl,
|
|
3514
3235
|
headers,
|
|
3515
3236
|
parameters,
|
|
3516
3237
|
errorContext,
|
|
3517
|
-
maxLengthURL
|
|
3238
|
+
maxLengthURL: context.maxLengthURL
|
|
3518
3239
|
});
|
|
3519
3240
|
const { attributes } = data.tilestats.layers[0];
|
|
3520
3241
|
const index = attributes.findIndex((d) => d.attribute === attribute);
|
|
3521
3242
|
attributes[index] = stats;
|
|
3522
3243
|
return true;
|
|
3523
3244
|
}
|
|
3524
|
-
async function fillInMapDatasets({ datasets
|
|
3525
|
-
const promises = datasets.map((dataset) => _fetchMapDataset(dataset,
|
|
3245
|
+
async function fillInMapDatasets({ datasets }, context) {
|
|
3246
|
+
const promises = datasets.map((dataset) => _fetchMapDataset(dataset, context));
|
|
3526
3247
|
return await Promise.all(promises);
|
|
3527
3248
|
}
|
|
3528
|
-
async function fillInTileStats({ datasets, keplerMapConfig
|
|
3249
|
+
async function fillInTileStats({ datasets, keplerMapConfig }, context) {
|
|
3529
3250
|
var _a;
|
|
3530
3251
|
const attributes = [];
|
|
3531
3252
|
const { layers } = keplerMapConfig.config.visState;
|
|
@@ -3546,12 +3267,11 @@ async function fillInTileStats({ datasets, keplerMapConfig, token }, apiBaseUrl,
|
|
|
3546
3267
|
filteredAttributes.push(a);
|
|
3547
3268
|
}
|
|
3548
3269
|
}
|
|
3549
|
-
const promises = filteredAttributes.map(({ attribute, dataset }) => _fetchTilestats(attribute, dataset,
|
|
3270
|
+
const promises = filteredAttributes.map(({ attribute, dataset }) => _fetchTilestats(attribute, dataset, context));
|
|
3550
3271
|
return await Promise.all(promises);
|
|
3551
3272
|
}
|
|
3552
|
-
async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoMapId, clientId
|
|
3273
|
+
async function fetchMap({ accessToken, apiBaseUrl = import_api_client2.DEFAULT_API_BASE_URL, cartoMapId, clientId, headers, autoRefresh, onNewData, maxLengthURL }) {
|
|
3553
3274
|
assert(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
|
|
3554
|
-
assert(apiBaseUrl, "Must define apiBaseUrl");
|
|
3555
3275
|
if (accessToken) {
|
|
3556
3276
|
headers = { Authorization: `Bearer ${accessToken}`, ...headers };
|
|
3557
3277
|
}
|
|
@@ -3560,16 +3280,26 @@ async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoM
|
|
|
3560
3280
|
assert(typeof onNewData === "function", "`onNewData` must be a function");
|
|
3561
3281
|
assert(typeof autoRefresh === "number" && autoRefresh > 0, "`autoRefresh` must be a positive number");
|
|
3562
3282
|
}
|
|
3563
|
-
const baseUrl = buildPublicMapUrl({ apiBaseUrl, cartoMapId });
|
|
3283
|
+
const baseUrl = (0, import_api_client2.buildPublicMapUrl)({ apiBaseUrl, cartoMapId });
|
|
3564
3284
|
const errorContext = { requestType: "Public map", mapId: cartoMapId };
|
|
3565
|
-
const map = await requestWithParameters({ baseUrl, headers, errorContext, maxLengthURL });
|
|
3285
|
+
const map = await (0, import_api_client2.requestWithParameters)({ baseUrl, headers, errorContext, maxLengthURL });
|
|
3286
|
+
const context = {
|
|
3287
|
+
accessToken: map.token || accessToken,
|
|
3288
|
+
apiBaseUrl,
|
|
3289
|
+
clientId,
|
|
3290
|
+
headers,
|
|
3291
|
+
maxLengthURL
|
|
3292
|
+
};
|
|
3566
3293
|
let stopAutoRefresh;
|
|
3567
3294
|
if (autoRefresh) {
|
|
3568
3295
|
const intervalId = setInterval(async () => {
|
|
3569
|
-
const changed = await fillInMapDatasets(map,
|
|
3570
|
-
...
|
|
3571
|
-
|
|
3572
|
-
|
|
3296
|
+
const changed = await fillInMapDatasets(map, {
|
|
3297
|
+
...context,
|
|
3298
|
+
headers: {
|
|
3299
|
+
...headers,
|
|
3300
|
+
"If-Modified-Since": new Date().toUTCString()
|
|
3301
|
+
}
|
|
3302
|
+
});
|
|
3573
3303
|
if (onNewData && changed.some((v) => v === true)) {
|
|
3574
3304
|
onNewData(parseMap(map));
|
|
3575
3305
|
}
|
|
@@ -3591,9 +3321,10 @@ async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoM
|
|
|
3591
3321
|
});
|
|
3592
3322
|
const [basemap] = await Promise.all([
|
|
3593
3323
|
fetchBasemapProps({ config: map.keplerMapConfig.config, errorContext }),
|
|
3594
|
-
|
|
3324
|
+
// Mutates map.datasets so that dataset.data contains data
|
|
3325
|
+
fillInMapDatasets(map, context)
|
|
3595
3326
|
]);
|
|
3596
|
-
await fillInTileStats(map,
|
|
3327
|
+
await fillInTileStats(map, context);
|
|
3597
3328
|
const out = { ...parseMap(map), basemap, ...{ stopAutoRefresh } };
|
|
3598
3329
|
const textLayers = out.layers.filter((layer) => {
|
|
3599
3330
|
const pointType = layer.props.pointType || "";
|
|
@@ -3606,53 +3337,30 @@ async function fetchMap({ accessToken, apiBaseUrl = DEFAULT_API_BASE_URL, cartoM
|
|
|
3606
3337
|
return out;
|
|
3607
3338
|
}
|
|
3608
3339
|
|
|
3609
|
-
// dist/api/query.js
|
|
3610
|
-
var query = async function(options) {
|
|
3611
|
-
const { apiBaseUrl = SOURCE_DEFAULTS.apiBaseUrl, clientId = SOURCE_DEFAULTS.clientId, maxLengthURL = SOURCE_DEFAULTS.maxLengthURL, connectionName, sqlQuery, queryParameters } = options;
|
|
3612
|
-
const urlParameters = { q: sqlQuery };
|
|
3613
|
-
if (queryParameters) {
|
|
3614
|
-
urlParameters.queryParameters = JSON.stringify(queryParameters);
|
|
3615
|
-
}
|
|
3616
|
-
const baseUrl = buildQueryUrl({ apiBaseUrl, connectionName });
|
|
3617
|
-
const headers = { Authorization: `Bearer ${options.accessToken}`, ...options.headers };
|
|
3618
|
-
const parameters = { client: clientId, ...urlParameters };
|
|
3619
|
-
const errorContext = {
|
|
3620
|
-
requestType: "SQL",
|
|
3621
|
-
connection: options.connectionName,
|
|
3622
|
-
type: "query",
|
|
3623
|
-
source: JSON.stringify(parameters, void 0, 2)
|
|
3624
|
-
};
|
|
3625
|
-
return await requestWithParameters({
|
|
3626
|
-
baseUrl,
|
|
3627
|
-
parameters,
|
|
3628
|
-
headers,
|
|
3629
|
-
errorContext,
|
|
3630
|
-
maxLengthURL
|
|
3631
|
-
});
|
|
3632
|
-
};
|
|
3633
|
-
|
|
3634
3340
|
// dist/index.js
|
|
3341
|
+
var import_api_client3 = require("@carto/api-client");
|
|
3342
|
+
var import_api_client4 = require("@carto/api-client");
|
|
3635
3343
|
var CARTO_LAYERS = {
|
|
3636
3344
|
ClusterTileLayer: cluster_tile_layer_default,
|
|
3637
3345
|
H3TileLayer: h3_tile_layer_default,
|
|
3638
3346
|
HeatmapTileLayer: heatmap_tile_layer_default,
|
|
3639
|
-
|
|
3347
|
+
PointLabelLayer: point_label_layer_default,
|
|
3640
3348
|
QuadbinTileLayer: quadbin_tile_layer_default,
|
|
3641
3349
|
RasterTileLayer: raster_tile_layer_default,
|
|
3642
3350
|
VectorTileLayer: vector_tile_layer_default
|
|
3643
3351
|
};
|
|
3644
3352
|
var CARTO_SOURCES = {
|
|
3645
|
-
boundaryQuerySource,
|
|
3646
|
-
boundaryTableSource,
|
|
3647
|
-
h3QuerySource,
|
|
3648
|
-
h3TableSource,
|
|
3649
|
-
h3TilesetSource,
|
|
3650
|
-
rasterSource,
|
|
3651
|
-
quadbinQuerySource,
|
|
3652
|
-
quadbinTableSource,
|
|
3653
|
-
quadbinTilesetSource,
|
|
3654
|
-
vectorQuerySource,
|
|
3655
|
-
vectorTableSource,
|
|
3656
|
-
vectorTilesetSource
|
|
3353
|
+
boundaryQuerySource: import_api_client3.boundaryQuerySource,
|
|
3354
|
+
boundaryTableSource: import_api_client3.boundaryTableSource,
|
|
3355
|
+
h3QuerySource: import_api_client3.h3QuerySource,
|
|
3356
|
+
h3TableSource: import_api_client3.h3TableSource,
|
|
3357
|
+
h3TilesetSource: import_api_client3.h3TilesetSource,
|
|
3358
|
+
rasterSource: import_api_client3.rasterSource,
|
|
3359
|
+
quadbinQuerySource: import_api_client3.quadbinQuerySource,
|
|
3360
|
+
quadbinTableSource: import_api_client3.quadbinTableSource,
|
|
3361
|
+
quadbinTilesetSource: import_api_client3.quadbinTilesetSource,
|
|
3362
|
+
vectorQuerySource: import_api_client3.vectorQuerySource,
|
|
3363
|
+
vectorTableSource: import_api_client3.vectorTableSource,
|
|
3364
|
+
vectorTilesetSource: import_api_client3.vectorTilesetSource
|
|
3657
3365
|
};
|
|
3658
3366
|
//# sourceMappingURL=index.cjs.map
|