@deck.gl/carto 9.0.0-beta.4 → 9.0.0-beta.6

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/index.cjs CHANGED
@@ -243,7 +243,7 @@ function scaleIdentity() {
243
243
  }
244
244
 
245
245
  // dist/layers/schema/carto-raster-tile-loader.js
246
- var VERSION = true ? "9.0.0-beta.3" : "latest";
246
+ var VERSION = true ? "9.0.0-beta.5" : "latest";
247
247
  var id = "cartoRasterTile";
248
248
  var DEFAULT_OPTIONS = {
249
249
  cartoRasterTile: {
@@ -515,7 +515,7 @@ function binaryToSpatialjson(binary) {
515
515
  }
516
516
 
517
517
  // dist/layers/schema/carto-spatial-tile-loader.js
518
- var VERSION2 = true ? "9.0.0-beta.3" : "latest";
518
+ var VERSION2 = true ? "9.0.0-beta.5" : "latest";
519
519
  var id2 = "cartoSpatialTile";
520
520
  var DEFAULT_OPTIONS2 = {
521
521
  cartoSpatialTile: {
@@ -1005,24 +1005,18 @@ var QuadbinTileLayer = _QuadbinTileLayer;
1005
1005
  var import_core9 = require("@deck.gl/core");
1006
1006
 
1007
1007
  // dist/layers/raster-layer.js
1008
- var import_constants = require("@luma.gl/constants");
1009
1008
  var import_core8 = require("@deck.gl/core");
1010
1009
  var import_layers2 = require("@deck.gl/layers");
1011
1010
 
1012
1011
  // dist/layers/raster-layer-vertex.glsl.js
1013
1012
  var raster_layer_vertex_glsl_default = `#version 300 es
1014
1013
  #define SHADER_NAME raster-layer-vertex-shader
1015
-
1016
1014
  in vec3 positions;
1017
1015
  in vec3 normals;
1018
-
1019
1016
  in float instanceElevations;
1020
1017
  in vec4 instanceFillColors;
1021
1018
  in vec4 instanceLineColors;
1022
-
1023
1019
  in vec3 instancePickingColors;
1024
-
1025
- // Custom uniforms
1026
1020
  uniform float opacity;
1027
1021
  uniform bool extruded;
1028
1022
  uniform bool stroked;
@@ -1031,80 +1025,55 @@ uniform float coverage;
1031
1025
  uniform float elevationScale;
1032
1026
  uniform float widthScale;
1033
1027
  uniform vec3 offset;
1034
-
1035
- // Result
1036
1028
  out vec4 vColor;
1037
1029
  #ifdef FLAT_SHADING
1038
1030
  out vec4 position_commonspace;
1039
1031
  #endif
1040
-
1041
1032
  void main(void) {
1042
- // Rather than positioning using attribute, layout pixel grid using gl_InstanceID
1043
- vec2 common_position = offset.xy;
1044
- float scale = offset.z;
1045
-
1046
- int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
1047
- int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
1048
- common_position += scale * vec2(float(xIndex), float(yIndex));
1049
-
1050
- vec4 color = isStroke ? instanceLineColors : instanceFillColors;
1051
-
1052
- // if alpha == 0.0 or z < 0.0, do not render element
1053
- float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
1054
- float cellWidth = coverage * scale;
1055
-
1056
- // Get position directly from quadbin, rather than projecting
1057
- // Important to set geometry.position before using project_ methods below
1058
- // as geometry.worldPosition is not set (we don't know our lat/long)
1059
- geometry.position = vec4(common_position, 0.0, 1.0);
1060
- if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
1061
- geometry.position.xyz -= project_uCommonOrigin;
1062
- }
1063
-
1064
- // calculate elevation, if 3d not enabled set to 0
1065
- // cylindar geometry height are between -1.0 to 1.0, transform it to between 0, 1
1066
- float elevation = 0.0;
1067
- // calculate stroke offset
1068
- float strokeOffsetRatio = 1.0;
1069
-
1070
- if (extruded) {
1071
- elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;
1072
- } else if (stroked) {
1073
- float halfOffset = project_pixel_size(widthScale) / cellWidth;
1074
- if (isStroke) {
1075
- strokeOffsetRatio -= sign(positions.z) * halfOffset;
1076
- } else {
1077
- strokeOffsetRatio -= halfOffset;
1078
- }
1079
- }
1080
-
1081
- geometry.pickingColor = instancePickingColors;
1082
-
1083
- // project center of column
1084
- vec2 offset = (vec2(0.5) + positions.xy * strokeOffsetRatio) * cellWidth * shouldRender;
1085
- vec3 pos = vec3(offset, project_size(elevation));
1086
- DECKGL_FILTER_SIZE(pos, geometry);
1087
-
1088
- geometry.position.xyz += pos;
1089
- gl_Position = project_common_position_to_clipspace(geometry.position);
1090
-
1091
- geometry.normal = project_normal(normals);
1092
- DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
1093
-
1094
- // Light calculations
1095
- if (extruded && !isStroke) {
1033
+ vec2 common_position = offset.xy;
1034
+ float scale = offset.z;
1035
+ int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
1036
+ int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
1037
+ common_position += scale * vec2(float(xIndex), float(yIndex));
1038
+ vec4 color = isStroke ? instanceLineColors : instanceFillColors;
1039
+ float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
1040
+ float cellWidth = coverage * scale;
1041
+ geometry.position = vec4(common_position, 0.0, 1.0);
1042
+ if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
1043
+ geometry.position.xyz -= project_uCommonOrigin;
1044
+ }
1045
+ float elevation = 0.0;
1046
+ float strokeOffsetRatio = 1.0;
1047
+ if (extruded) {
1048
+ elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;
1049
+ } else if (stroked) {
1050
+ float halfOffset = project_pixel_size(widthScale) / cellWidth;
1051
+ if (isStroke) {
1052
+ strokeOffsetRatio -= sign(positions.z) * halfOffset;
1053
+ } else {
1054
+ strokeOffsetRatio -= halfOffset;
1055
+ }
1056
+ }
1057
+ geometry.pickingColor = instancePickingColors;
1058
+ vec2 offset = (vec2(0.5) + positions.xy * strokeOffsetRatio) * cellWidth * shouldRender;
1059
+ vec3 pos = vec3(offset, project_size(elevation));
1060
+ DECKGL_FILTER_SIZE(pos, geometry);
1061
+ geometry.position.xyz += pos;
1062
+ gl_Position = project_common_position_to_clipspace(geometry.position);
1063
+ geometry.normal = project_normal(normals);
1064
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
1065
+ if (extruded && !isStroke) {
1096
1066
  #ifdef FLAT_SHADING
1097
- position_commonspace = geometry.position;
1098
- vColor = vec4(color.rgb, color.a * opacity);
1067
+ position_commonspace = geometry.position;
1068
+ vColor = vec4(color.rgb, color.a * opacity);
1099
1069
  #else
1100
- vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);
1101
- vColor = vec4(lightColor, color.a * opacity);
1070
+ vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);
1071
+ vColor = vec4(lightColor, color.a * opacity);
1102
1072
  #endif
1103
- } else {
1104
- vColor = vec4(color.rgb, color.a * opacity);
1105
- }
1106
-
1107
- DECKGL_FILTER_COLOR(vColor, geometry);
1073
+ } else {
1074
+ vColor = vec4(color.rgb, color.a * opacity);
1075
+ }
1076
+ DECKGL_FILTER_COLOR(vColor, geometry);
1108
1077
  }
1109
1078
  `;
1110
1079
 
@@ -1137,16 +1106,14 @@ var _RasterColumnLayer = class extends import_layers2.ColumnLayer {
1137
1106
  },
1138
1107
  instanceFillColors: {
1139
1108
  size: this.props.colorFormat.length,
1140
- type: import_constants.GL.UNSIGNED_BYTE,
1141
- normalized: true,
1109
+ type: "unorm8",
1142
1110
  transition: true,
1143
1111
  accessor: "getFillColor",
1144
1112
  defaultValue: [0, 0, 0, 255]
1145
1113
  },
1146
1114
  instanceLineColors: {
1147
1115
  size: this.props.colorFormat.length,
1148
- type: import_constants.GL.UNSIGNED_BYTE,
1149
- normalized: true,
1116
+ type: "unorm8",
1150
1117
  transition: true,
1151
1118
  accessor: "getLineColor",
1152
1119
  defaultValue: [255, 255, 255, 255]
@@ -1288,7 +1255,7 @@ var carto_properties_tile_loader_default = CartoPropertiesTileLoader;
1288
1255
 
1289
1256
  // dist/layers/schema/carto-vector-tile-loader.js
1290
1257
  var import_earcut = __toESM(require("earcut"), 1);
1291
- var VERSION3 = true ? "9.0.0-beta.3" : "latest";
1258
+ var VERSION3 = true ? "9.0.0-beta.5" : "latest";
1292
1259
  var id3 = "cartoVectorTile";
1293
1260
  var DEFAULT_OPTIONS3 = {
1294
1261
  cartoVectorTile: {
@@ -1609,7 +1576,6 @@ var DEFAULT_CLIENT = "deck-gl-carto";
1609
1576
  var V3_MINOR_VERSION = "3.3";
1610
1577
  var MAX_GET_LENGTH = 8192;
1611
1578
  var DEFAULT_PARAMETERS = {
1612
- client: DEFAULT_CLIENT,
1613
1579
  v: V3_MINOR_VERSION
1614
1580
  };
1615
1581
  var DEFAULT_HEADERS = {
@@ -1702,17 +1668,18 @@ async function baseSource(endpoint, options, urlParameters) {
1702
1668
  }
1703
1669
  }
1704
1670
  const baseUrl2 = buildSourceUrl(mergedOptions);
1705
- const { format } = mergedOptions;
1671
+ const { clientId, format } = mergedOptions;
1706
1672
  const headers = { Authorization: `Bearer ${options.accessToken}`, ...options.headers };
1673
+ const parameters = { client: clientId, ...urlParameters };
1707
1674
  const errorContext = {
1708
1675
  requestType: "Map instantiation",
1709
1676
  connection: options.connectionName,
1710
1677
  type: endpoint,
1711
- source: JSON.stringify(urlParameters, void 0, 2)
1678
+ source: JSON.stringify(parameters, void 0, 2)
1712
1679
  };
1713
1680
  const mapInstantiation = await requestWithParameters({
1714
1681
  baseUrl: baseUrl2,
1715
- parameters: urlParameters,
1682
+ parameters,
1716
1683
  headers,
1717
1684
  errorContext
1718
1685
  });
@@ -1903,7 +1870,7 @@ var vectorTilesetSource = async function(options) {
1903
1870
  };
1904
1871
 
1905
1872
  // dist/api/parse-map.js
1906
- var import_constants2 = require("@luma.gl/constants");
1873
+ var import_constants = require("@luma.gl/constants");
1907
1874
  var import_core11 = require("@deck.gl/core");
1908
1875
 
1909
1876
  // dist/api/layer-map.js
@@ -2303,11 +2270,11 @@ function parseMap(json) {
2303
2270
  }
2304
2271
  function createParametersProp(layerBlending, parameters) {
2305
2272
  if (layerBlending === "additive") {
2306
- parameters.blendFunc = [import_constants2.GL.SRC_ALPHA, import_constants2.GL.DST_ALPHA];
2307
- parameters.blendEquation = import_constants2.GL.FUNC_ADD;
2273
+ parameters.blendFunc = [770, 772];
2274
+ parameters.blendEquation = 32774;
2308
2275
  } else if (layerBlending === "subtractive") {
2309
- parameters.blendFunc = [import_constants2.GL.ONE, import_constants2.GL.ONE_MINUS_DST_COLOR, import_constants2.GL.SRC_ALPHA, import_constants2.GL.DST_ALPHA];
2310
- parameters.blendEquation = [import_constants2.GL.FUNC_SUBTRACT, import_constants2.GL.FUNC_ADD];
2276
+ parameters.blendFunc = [1, 775, 770, 772];
2277
+ parameters.blendEquation = [32778, 32774];
2311
2278
  }
2312
2279
  return Object.keys(parameters).length ? { parameters } : {};
2313
2280
  }
@@ -2562,8 +2529,12 @@ async function _fetchTilestats(attribute, dataset, accessToken, apiBaseUrl) {
2562
2529
  throw new CartoAPIError(new Error(`Invalid dataset for tilestats: ${id4}`), errorContext);
2563
2530
  }
2564
2531
  const baseUrl2 = buildStatsUrl({ attribute, apiBaseUrl, ...dataset });
2532
+ const client = new URLSearchParams(data.tiles[0]).get("client");
2565
2533
  const headers = { Authorization: `Bearer ${accessToken}` };
2566
2534
  const parameters = {};
2535
+ if (client) {
2536
+ parameters.client = client;
2537
+ }
2567
2538
  if (type === "query") {
2568
2539
  parameters.q = source;
2569
2540
  if (queryParameters) {