@deck.gl/carto 9.0.35 → 9.1.0-beta.1

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.
Files changed (242) hide show
  1. package/dist/api/basemap.d.ts +2 -1
  2. package/dist/api/basemap.d.ts.map +1 -1
  3. package/dist/api/basemap.js +3 -0
  4. package/dist/api/fetch-map.d.ts.map +1 -1
  5. package/dist/api/fetch-map.js +9 -11
  6. package/dist/api/index.d.ts +1 -4
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/api/index.js +3 -2
  9. package/dist/api/layer-map.d.ts.map +1 -1
  10. package/dist/api/layer-map.js +5 -2
  11. package/dist/api/parse-map.d.ts.map +1 -1
  12. package/dist/api/parse-map.js +3 -0
  13. package/dist/api/types.d.ts +0 -56
  14. package/dist/api/types.d.ts.map +1 -1
  15. package/dist/api/types.js +4 -20
  16. package/dist/basemap.d.ts +2 -1
  17. package/dist/basemap.d.ts.map +1 -1
  18. package/dist/basemap.js +4 -1
  19. package/dist/cartoRasterTile-worker.js +25 -2
  20. package/dist/cartoSpatialTile-worker.js +28 -3
  21. package/dist/cartoVectorTile-worker.js +29 -3
  22. package/dist/constants.d.ts +0 -3
  23. package/dist/constants.d.ts.map +1 -1
  24. package/dist/constants.js +3 -3
  25. package/dist/dist.dev.js +4391 -3737
  26. package/dist/index.cjs +224 -531
  27. package/dist/index.cjs.map +4 -4
  28. package/dist/index.d.ts +16 -16
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +5 -2
  31. package/dist/layers/cluster-tile-layer.d.ts +1 -1
  32. package/dist/layers/cluster-tile-layer.d.ts.map +1 -1
  33. package/dist/layers/cluster-tile-layer.js +4 -0
  34. package/dist/layers/cluster-utils.d.ts.map +1 -1
  35. package/dist/layers/cluster-utils.js +3 -0
  36. package/dist/layers/h3-tile-layer.d.ts +1 -1
  37. package/dist/layers/h3-tile-layer.d.ts.map +1 -1
  38. package/dist/layers/h3-tile-layer.js +3 -0
  39. package/dist/layers/h3-tileset-2d.d.ts.map +1 -1
  40. package/dist/layers/h3-tileset-2d.js +3 -0
  41. package/dist/layers/heatmap-tile-layer.d.ts +1 -1
  42. package/dist/layers/heatmap-tile-layer.d.ts.map +1 -1
  43. package/dist/layers/heatmap-tile-layer.js +23 -7
  44. package/dist/layers/heatmap.d.ts +3 -3
  45. package/dist/layers/heatmap.d.ts.map +1 -1
  46. package/dist/layers/heatmap.js +69 -36
  47. package/dist/layers/point-label-layer.d.ts.map +1 -1
  48. package/dist/layers/point-label-layer.js +5 -2
  49. package/dist/layers/post-process-utils.d.ts.map +1 -1
  50. package/dist/layers/post-process-utils.js +9 -5
  51. package/dist/layers/quadbin-layer.d.ts.map +1 -1
  52. package/dist/layers/quadbin-layer.js +3 -0
  53. package/dist/layers/quadbin-tile-layer.d.ts +1 -1
  54. package/dist/layers/quadbin-tile-layer.d.ts.map +1 -1
  55. package/dist/layers/quadbin-tile-layer.js +3 -0
  56. package/dist/layers/quadbin-tileset-2d.d.ts.map +1 -1
  57. package/dist/layers/quadbin-tileset-2d.js +3 -0
  58. package/dist/layers/quadbin-utils.d.ts.map +1 -1
  59. package/dist/layers/quadbin-utils.js +3 -0
  60. package/dist/layers/raster-layer-vertex.glsl.d.ts +1 -1
  61. package/dist/layers/raster-layer-vertex.glsl.d.ts.map +1 -1
  62. package/dist/layers/raster-layer-vertex.glsl.js +19 -24
  63. package/dist/layers/raster-layer.d.ts +6 -6
  64. package/dist/layers/raster-layer.d.ts.map +1 -1
  65. package/dist/layers/raster-layer.js +6 -1
  66. package/dist/layers/raster-tile-layer.d.ts +1 -1
  67. package/dist/layers/raster-tile-layer.d.ts.map +1 -1
  68. package/dist/layers/raster-tile-layer.js +3 -0
  69. package/dist/layers/schema/carto-properties-tile-loader.d.ts.map +1 -1
  70. package/dist/layers/schema/carto-properties-tile-loader.js +3 -0
  71. package/dist/layers/schema/carto-properties-tile.d.ts.map +1 -1
  72. package/dist/layers/schema/carto-properties-tile.js +3 -0
  73. package/dist/layers/schema/carto-raster-tile-loader.d.ts.map +1 -1
  74. package/dist/layers/schema/carto-raster-tile-loader.js +4 -1
  75. package/dist/layers/schema/carto-raster-tile.d.ts.map +1 -1
  76. package/dist/layers/schema/carto-raster-tile.js +3 -0
  77. package/dist/layers/schema/carto-spatial-tile-loader.d.ts.map +1 -1
  78. package/dist/layers/schema/carto-spatial-tile-loader.js +4 -1
  79. package/dist/layers/schema/carto-spatial-tile.d.ts.map +1 -1
  80. package/dist/layers/schema/carto-spatial-tile.js +3 -0
  81. package/dist/layers/schema/carto-tile.d.ts.map +1 -1
  82. package/dist/layers/schema/carto-tile.js +3 -0
  83. package/dist/layers/schema/carto-vector-tile-loader.d.ts.map +1 -1
  84. package/dist/layers/schema/carto-vector-tile-loader.js +4 -1
  85. package/dist/layers/schema/fast-pbf.d.ts.map +1 -1
  86. package/dist/layers/schema/fast-pbf.js +3 -0
  87. package/dist/layers/schema/spatialjson-utils.d.ts.map +1 -1
  88. package/dist/layers/schema/spatialjson-utils.js +3 -0
  89. package/dist/layers/schema/tile-loader-utils.d.ts.map +1 -1
  90. package/dist/layers/schema/tile-loader-utils.js +3 -0
  91. package/dist/layers/spatial-index-tile-layer.d.ts.map +1 -1
  92. package/dist/layers/spatial-index-tile-layer.js +3 -0
  93. package/dist/layers/utils.d.ts +2 -2
  94. package/dist/layers/utils.d.ts.map +1 -1
  95. package/dist/layers/utils.js +3 -0
  96. package/dist/layers/vector-tile-layer.d.ts +1 -1
  97. package/dist/layers/vector-tile-layer.d.ts.map +1 -1
  98. package/dist/layers/vector-tile-layer.js +3 -0
  99. package/dist/style/color-bins-style.d.ts.map +1 -1
  100. package/dist/style/color-bins-style.js +3 -0
  101. package/dist/style/color-categories-style.d.ts.map +1 -1
  102. package/dist/style/color-categories-style.js +3 -0
  103. package/dist/style/color-continuous-style.d.ts.map +1 -1
  104. package/dist/style/color-continuous-style.js +3 -0
  105. package/dist/style/palette.d.ts.map +1 -1
  106. package/dist/style/palette.js +3 -0
  107. package/dist/style/utils.d.ts.map +1 -1
  108. package/dist/style/utils.js +3 -0
  109. package/dist/utils.d.ts.map +1 -1
  110. package/dist/utils.js +3 -0
  111. package/dist/workers/cartoRasterTile.js +3 -0
  112. package/dist/workers/cartoSpatialTile.js +3 -0
  113. package/dist/workers/cartoVectorTile.js +3 -0
  114. package/dist.min.js +113 -73
  115. package/package.json +13 -11
  116. package/src/api/basemap.ts +6 -1
  117. package/src/api/fetch-map.ts +23 -15
  118. package/src/api/index.ts +5 -13
  119. package/src/api/layer-map.ts +6 -2
  120. package/src/api/parse-map.ts +4 -0
  121. package/src/api/types.ts +4 -75
  122. package/src/basemap.ts +6 -2
  123. package/src/constants.ts +4 -4
  124. package/src/index.ts +7 -9
  125. package/src/layers/cluster-tile-layer.ts +6 -1
  126. package/src/layers/cluster-utils.ts +4 -0
  127. package/src/layers/h3-tile-layer.ts +5 -1
  128. package/src/layers/h3-tileset-2d.ts +4 -0
  129. package/src/layers/heatmap-tile-layer.ts +29 -8
  130. package/src/layers/heatmap.ts +8 -2
  131. package/src/layers/point-label-layer.ts +6 -2
  132. package/src/layers/post-process-utils.ts +10 -5
  133. package/src/layers/quadbin-layer.ts +4 -0
  134. package/src/layers/quadbin-tile-layer.ts +5 -1
  135. package/src/layers/quadbin-tileset-2d.ts +4 -0
  136. package/src/layers/quadbin-utils.ts +4 -0
  137. package/src/layers/raster-layer-vertex.glsl.ts +20 -26
  138. package/src/layers/raster-layer.ts +7 -1
  139. package/src/layers/raster-tile-layer.ts +5 -1
  140. package/src/layers/schema/carto-properties-tile-loader.ts +4 -0
  141. package/src/layers/schema/carto-properties-tile.ts +4 -0
  142. package/src/layers/schema/carto-raster-tile-loader.ts +4 -0
  143. package/src/layers/schema/carto-raster-tile.ts +4 -0
  144. package/src/layers/schema/carto-spatial-tile-loader.ts +4 -0
  145. package/src/layers/schema/carto-spatial-tile.ts +4 -0
  146. package/src/layers/schema/carto-tile.ts +4 -0
  147. package/src/layers/schema/carto-vector-tile-loader.ts +4 -0
  148. package/src/layers/schema/fast-pbf.ts +4 -0
  149. package/src/layers/schema/spatialjson-utils.ts +4 -0
  150. package/src/layers/schema/tile-loader-utils.ts +4 -0
  151. package/src/layers/spatial-index-tile-layer.ts +4 -0
  152. package/src/layers/utils.ts +5 -1
  153. package/src/layers/vector-tile-layer.ts +5 -1
  154. package/src/style/color-bins-style.ts +4 -0
  155. package/src/style/color-categories-style.ts +4 -0
  156. package/src/style/color-continuous-style.ts +4 -0
  157. package/src/style/palette.ts +4 -0
  158. package/src/style/utils.ts +4 -0
  159. package/src/utils.ts +4 -0
  160. package/src/workers/cartoRasterTile.ts +4 -0
  161. package/src/workers/cartoSpatialTile.ts +4 -0
  162. package/src/workers/cartoVectorTile.ts +4 -0
  163. package/dist/api/carto-api-error.d.ts +0 -19
  164. package/dist/api/carto-api-error.d.ts.map +0 -1
  165. package/dist/api/carto-api-error.js +0 -48
  166. package/dist/api/common.d.ts +0 -5
  167. package/dist/api/common.d.ts.map +0 -1
  168. package/dist/api/common.js +0 -5
  169. package/dist/api/endpoints.d.ts +0 -23
  170. package/dist/api/endpoints.d.ts.map +0 -1
  171. package/dist/api/endpoints.js +0 -22
  172. package/dist/api/query.d.ts +0 -4
  173. package/dist/api/query.d.ts.map +0 -1
  174. package/dist/api/query.js +0 -26
  175. package/dist/api/request-with-parameters.d.ts +0 -9
  176. package/dist/api/request-with-parameters.d.ts.map +0 -1
  177. package/dist/api/request-with-parameters.js +0 -86
  178. package/dist/sources/base-source.d.ts +0 -5
  179. package/dist/sources/base-source.d.ts.map +0 -1
  180. package/dist/sources/base-source.js +0 -60
  181. package/dist/sources/boundary-query-source.d.ts +0 -10
  182. package/dist/sources/boundary-query-source.d.ts.map +0 -1
  183. package/dist/sources/boundary-query-source.js +0 -18
  184. package/dist/sources/boundary-table-source.d.ts +0 -8
  185. package/dist/sources/boundary-table-source.d.ts.map +0 -1
  186. package/dist/sources/boundary-table-source.js +0 -15
  187. package/dist/sources/h3-query-source.d.ts +0 -4
  188. package/dist/sources/h3-query-source.d.ts.map +0 -1
  189. package/dist/sources/h3-query-source.js +0 -22
  190. package/dist/sources/h3-table-source.d.ts +0 -4
  191. package/dist/sources/h3-table-source.d.ts.map +0 -1
  192. package/dist/sources/h3-table-source.js +0 -19
  193. package/dist/sources/h3-tileset-source.d.ts +0 -4
  194. package/dist/sources/h3-tileset-source.d.ts.map +0 -1
  195. package/dist/sources/h3-tileset-source.js +0 -6
  196. package/dist/sources/index.d.ts +0 -28
  197. package/dist/sources/index.d.ts.map +0 -1
  198. package/dist/sources/index.js +0 -13
  199. package/dist/sources/quadbin-query-source.d.ts +0 -4
  200. package/dist/sources/quadbin-query-source.d.ts.map +0 -1
  201. package/dist/sources/quadbin-query-source.js +0 -22
  202. package/dist/sources/quadbin-table-source.d.ts +0 -4
  203. package/dist/sources/quadbin-table-source.d.ts.map +0 -1
  204. package/dist/sources/quadbin-table-source.js +0 -19
  205. package/dist/sources/quadbin-tileset-source.d.ts +0 -4
  206. package/dist/sources/quadbin-tileset-source.d.ts.map +0 -1
  207. package/dist/sources/quadbin-tileset-source.js +0 -6
  208. package/dist/sources/raster-source.d.ts +0 -4
  209. package/dist/sources/raster-source.d.ts.map +0 -1
  210. package/dist/sources/raster-source.js +0 -9
  211. package/dist/sources/types.d.ts +0 -219
  212. package/dist/sources/types.d.ts.map +0 -1
  213. package/dist/sources/types.js +0 -1
  214. package/dist/sources/vector-query-source.d.ts +0 -4
  215. package/dist/sources/vector-query-source.d.ts.map +0 -1
  216. package/dist/sources/vector-query-source.js +0 -22
  217. package/dist/sources/vector-table-source.d.ts +0 -4
  218. package/dist/sources/vector-table-source.d.ts.map +0 -1
  219. package/dist/sources/vector-table-source.js +0 -19
  220. package/dist/sources/vector-tileset-source.d.ts +0 -4
  221. package/dist/sources/vector-tileset-source.d.ts.map +0 -1
  222. package/dist/sources/vector-tileset-source.js +0 -6
  223. package/src/api/carto-api-error.ts +0 -68
  224. package/src/api/common.ts +0 -6
  225. package/src/api/endpoints.ts +0 -69
  226. package/src/api/query.ts +0 -42
  227. package/src/api/request-with-parameters.ts +0 -117
  228. package/src/sources/base-source.ts +0 -79
  229. package/src/sources/boundary-query-source.ts +0 -39
  230. package/src/sources/boundary-table-source.ts +0 -33
  231. package/src/sources/h3-query-source.ts +0 -55
  232. package/src/sources/h3-table-source.ts +0 -51
  233. package/src/sources/h3-tileset-source.ts +0 -14
  234. package/src/sources/index.ts +0 -45
  235. package/src/sources/quadbin-query-source.ts +0 -56
  236. package/src/sources/quadbin-table-source.ts +0 -52
  237. package/src/sources/quadbin-tileset-source.ts +0 -14
  238. package/src/sources/raster-source.ts +0 -17
  239. package/src/sources/types.ts +0 -231
  240. package/src/sources/vector-query-source.ts +0 -57
  241. package/src/sources/vector-table-source.ts +0 -51
  242. package/src/sources/vector-tileset-source.ts +0 -14
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "CARTO official integration with Deck.gl. Build geospatial applications using CARTO and Deck.gl.",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "9.0.35",
6
+ "version": "9.1.0-beta.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -42,14 +42,15 @@
42
42
  "prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
43
43
  },
44
44
  "dependencies": {
45
+ "@carto/api-client": "^0.4.0-alpha.4",
45
46
  "@loaders.gl/gis": "^4.2.0",
46
47
  "@loaders.gl/loader-utils": "^4.2.0",
47
48
  "@loaders.gl/mvt": "^4.2.0",
48
49
  "@loaders.gl/schema": "^4.2.0",
49
50
  "@loaders.gl/tiles": "^4.2.0",
50
- "@luma.gl/core": "~9.0.27",
51
- "@luma.gl/shadertools": "~9.0.27",
52
- "@math.gl/web-mercator": "^4.0.0",
51
+ "@luma.gl/core": "^9.1.0-beta.11",
52
+ "@luma.gl/shadertools": "^9.1.0-beta.11",
53
+ "@math.gl/web-mercator": "^4.1.0",
53
54
  "@types/d3-array": "^3.0.2",
54
55
  "@types/d3-color": "^1.4.2",
55
56
  "@types/d3-scale": "^3.0.0",
@@ -65,12 +66,13 @@
65
66
  "quadbin": "^0.2.0"
66
67
  },
67
68
  "peerDependencies": {
68
- "@deck.gl/aggregation-layers": "^9.0.0",
69
- "@deck.gl/core": "^9.0.0",
70
- "@deck.gl/extensions": "^9.0.0",
71
- "@deck.gl/geo-layers": "^9.0.0",
72
- "@deck.gl/layers": "^9.0.0",
73
- "@loaders.gl/core": "^4.2.0"
69
+ "@deck.gl/aggregation-layers": "9.0.0-alpha.0",
70
+ "@deck.gl/core": "9.0.0-alpha.0",
71
+ "@deck.gl/extensions": "9.0.0-alpha.0",
72
+ "@deck.gl/geo-layers": "9.0.0-alpha.0",
73
+ "@deck.gl/layers": "9.0.0-alpha.0",
74
+ "@loaders.gl/core": "^4.2.0",
75
+ "@luma.gl/core": "^9.1.0-beta.11"
74
76
  },
75
- "gitHead": "8e8fc65d8fa9b9bf7e6d82a7e89d37c6d0126aae"
77
+ "gitHead": "a86fb154cf323eacc3f56ef087f636fb9f6c30b6"
76
78
  }
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {MapViewState} from '@deck.gl/core';
2
6
  import {
3
7
  GOOGLE_BASEMAPS,
@@ -7,7 +11,8 @@ import {
7
11
  getStyleUrl,
8
12
  someLayerGroupsDisabled
9
13
  } from '../basemap';
10
- import {APIErrorContext, Basemap, KeplerMapConfig, MapLibreBasemapProps} from './types';
14
+ import {Basemap, KeplerMapConfig, MapLibreBasemapProps} from './types';
15
+ import {APIErrorContext} from '@carto/api-client';
11
16
 
12
17
  const CUSTOM_STYLE_ID_PREFIX = 'custom:';
13
18
  const DEFAULT_CARTO_STYLE = 'positron';
@@ -1,23 +1,31 @@
1
- /* eslint-disable camelcase */
2
- import {CartoAPIError} from './carto-api-error';
3
- import {DEFAULT_API_BASE_URL, DEFAULT_CLIENT, DEFAULT_MAX_LENGTH_URL} from './common';
4
- import {buildPublicMapUrl, buildStatsUrl} from './endpoints';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
5
  import {
6
+ SOURCE_DEFAULTS,
7
+ APIErrorContext,
8
+ CartoAPIError,
6
9
  GeojsonResult,
7
10
  JsonResult,
8
11
  TilejsonResult,
12
+ Format,
13
+ MapType,
14
+ QueryParameters,
15
+ buildPublicMapUrl,
16
+ buildStatsUrl,
9
17
  h3QuerySource,
10
18
  h3TableSource,
11
19
  quadbinQuerySource,
12
20
  quadbinTableSource,
13
21
  vectorQuerySource,
14
22
  vectorTableSource,
15
- vectorTilesetSource
16
- } from '../sources/index';
23
+ vectorTilesetSource,
24
+ requestWithParameters
25
+ } from '@carto/api-client';
17
26
  import {ParseMapResult, parseMap} from './parse-map';
18
- import {requestWithParameters} from './request-with-parameters';
19
27
  import {assert} from '../utils';
20
- import type {APIErrorContext, Basemap, Format, MapType, QueryParameters} from './types';
28
+ import type {Basemap} from './types';
21
29
  import {fetchBasemapProps} from './basemap';
22
30
 
23
31
  type Dataset = {
@@ -43,7 +51,7 @@ async function _fetchMapDataset(
43
51
  apiBaseUrl: string,
44
52
  clientId?: string,
45
53
  headers?: Record<string, string>,
46
- maxLengthURL = DEFAULT_MAX_LENGTH_URL
54
+ maxLengthURL = SOURCE_DEFAULTS.maxLengthURL
47
55
  ) {
48
56
  const {
49
57
  aggregationExp,
@@ -117,7 +125,7 @@ async function _fetchTilestats(
117
125
  dataset: Dataset,
118
126
  accessToken: string,
119
127
  apiBaseUrl: string,
120
- maxLengthURL = DEFAULT_MAX_LENGTH_URL
128
+ maxLengthURL = SOURCE_DEFAULTS.maxLengthURL
121
129
  ) {
122
130
  const {connectionName, data, id, source, type, queryParameters} = dataset;
123
131
  const errorContext: APIErrorContext = {
@@ -163,7 +171,7 @@ async function fillInMapDatasets(
163
171
  clientId: string,
164
172
  apiBaseUrl: string,
165
173
  headers?: Record<string, string>,
166
- maxLengthURL = DEFAULT_MAX_LENGTH_URL
174
+ maxLengthURL = SOURCE_DEFAULTS.maxLengthURL
167
175
  ) {
168
176
  const promises = datasets.map(dataset =>
169
177
  _fetchMapDataset(dataset, token, apiBaseUrl, clientId, headers, maxLengthURL)
@@ -174,7 +182,7 @@ async function fillInMapDatasets(
174
182
  async function fillInTileStats(
175
183
  {datasets, keplerMapConfig, token}: {datasets: Dataset[]; keplerMapConfig: any; token: string},
176
184
  apiBaseUrl: string,
177
- maxLengthURL = DEFAULT_MAX_LENGTH_URL
185
+ maxLengthURL = SOURCE_DEFAULTS.maxLengthURL
178
186
  ) {
179
187
  const attributes: {attribute: string; dataset: any}[] = [];
180
188
  const {layers} = keplerMapConfig.config.visState;
@@ -263,13 +271,13 @@ export type FetchMapResult = ParseMapResult & {
263
271
  /* eslint-disable max-statements */
264
272
  export async function fetchMap({
265
273
  accessToken,
266
- apiBaseUrl = DEFAULT_API_BASE_URL,
274
+ apiBaseUrl = SOURCE_DEFAULTS.apiBaseUrl,
267
275
  cartoMapId,
268
- clientId = DEFAULT_CLIENT,
276
+ clientId = SOURCE_DEFAULTS.clientId,
269
277
  headers = {},
270
278
  autoRefresh,
271
279
  onNewData,
272
- maxLengthURL = DEFAULT_MAX_LENGTH_URL
280
+ maxLengthURL = SOURCE_DEFAULTS.maxLengthURL
273
281
  }: FetchMapOptions): Promise<FetchMapResult> {
274
282
  assert(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
275
283
  assert(apiBaseUrl, 'Must define apiBaseUrl');
package/src/api/index.ts CHANGED
@@ -1,15 +1,7 @@
1
- export {CartoAPIError} from './carto-api-error';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
2
5
  export {fetchMap} from './fetch-map';
3
6
  export type {FetchMapOptions, FetchMapResult} from './fetch-map';
4
- export type {
5
- APIErrorContext,
6
- Format,
7
- MapType,
8
- RequestType,
9
- QueryParameters,
10
- Basemap,
11
- MapLibreBasemap,
12
- GoogleBasemap
13
- } from './types';
14
- export {query} from './query';
15
- export type {QueryOptions} from './query';
7
+ export type {Basemap, MapLibreBasemap, GoogleBasemap} from './types';
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {deviation, extent, groupSort, median, variance} from 'd3-array';
2
6
  import {rgb} from 'd3-color';
3
7
  import {
@@ -14,7 +18,7 @@ import {format as d3Format} from 'd3-format';
14
18
  import moment from 'moment-timezone';
15
19
 
16
20
  import {Accessor, Layer, _ConstructorOf as ConstructorOf} from '@deck.gl/core';
17
- import {CPUGridLayer, HeatmapLayer, HexagonLayer} from '@deck.gl/aggregation-layers';
21
+ import {GridLayer, HeatmapLayer, HexagonLayer} from '@deck.gl/aggregation-layers';
18
22
  import {GeoJsonLayer} from '@deck.gl/layers';
19
23
  import {H3HexagonLayer} from '@deck.gl/geo-layers';
20
24
 
@@ -202,7 +206,7 @@ export function getLayer(
202
206
  Layer: GeoJsonLayer
203
207
  },
204
208
  grid: {
205
- Layer: CPUGridLayer,
209
+ Layer: GridLayer,
206
210
  propMap: {visConfig: {...aggregationVisConfig, worldUnitSize: x => ({cellSize: 1000 * x})}},
207
211
  defaultProps: {getPosition}
208
212
  },
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {ColorParameters} from '@luma.gl/core';
2
6
  import {Layer, log} from '@deck.gl/core';
3
7
  import {
package/src/api/types.ts CHANGED
@@ -1,86 +1,15 @@
1
- import {SCALE_TYPE} from './layer-map';
2
-
3
- export type Format = 'json' | 'geojson' | 'tilejson';
4
- export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
5
- export type RequestType =
6
- | 'Map data'
7
- | 'Map instantiation'
8
- | 'Public map'
9
- | 'Tile stats'
10
- | 'SQL'
11
- | 'Basemap style';
12
-
13
- export type APIErrorContext = {
14
- requestType: RequestType;
15
- mapId?: string;
16
- connection?: string;
17
- source?: string;
18
- type?: MapType;
19
- };
20
-
21
- export enum SchemaFieldType {
22
- Number = 'number',
23
- Bigint = 'bigint',
24
- String = 'string',
25
- Geometry = 'geometry',
26
- Timestamp = 'timestamp',
27
- Object = 'object',
28
- Boolean = 'boolean',
29
- Variant = 'variant',
30
- Unknown = 'unknown'
31
- }
32
- export interface SchemaField {
33
- name: string;
34
- type: SchemaFieldType; // Field type in the CARTO stack, common for all providers
35
- }
36
-
37
- export interface MapInstantiation extends MapInstantiationFormats {
38
- nrows: number;
39
- size?: number;
40
- schema: SchemaField[];
41
- }
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
42
4
 
43
- type MapInstantiationFormats = Record<
44
- Format,
45
- {
46
- url: string[];
47
- error?: any;
48
- }
49
- >;
50
-
51
- export type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
52
-
53
- export type NamedQueryParameter = Record<string, QueryParameterValue>;
54
-
55
- export type PositionalQueryParameter = QueryParameterValue[];
5
+ import {SCALE_TYPE} from './layer-map';
56
6
 
57
- export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
58
7
  export type VisualChannelField = {
59
8
  name: string;
60
9
  type: string;
61
10
  colorColumn?: string;
62
11
  };
63
12
 
64
- export interface Filters {
65
- [column: string]: Filter;
66
- }
67
-
68
- interface Filter {
69
- [FilterTypes.In]?: number[];
70
- [FilterTypes.Between]?: number[][];
71
- [FilterTypes.ClosedOpen]?: number[][];
72
- [FilterTypes.Time]?: number[][];
73
- [FilterTypes.StringSearch]?: string[];
74
- }
75
-
76
- export enum FilterTypes {
77
- In = 'in',
78
- Between = 'between', // [a, b] both are included
79
- ClosedOpen = 'closed_open', // [a, b) a is included, b is not
80
- Time = 'time',
81
- StringSearch = 'stringSearch'
82
- }
83
-
84
13
  export type VisualChannels = {
85
14
  colorField?: VisualChannelField;
86
15
  colorScale?: SCALE_TYPE;
package/src/basemap.ts CHANGED
@@ -1,5 +1,9 @@
1
- import {CartoAPIError} from './api/carto-api-error';
2
- import {APIErrorContext, GoogleBasemapProps} from './api/types';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import {CartoAPIError, APIErrorContext} from '@carto/api-client';
6
+ import {GoogleBasemapProps} from './api/types';
3
7
 
4
8
  const cartoStyleUrlTemplate = 'https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json';
5
9
 
package/src/constants.ts CHANGED
@@ -1,5 +1,5 @@
1
- export const DEFAULT_TILE_SIZE = 512;
2
- export const DEFAULT_TILE_RESOLUTION = 0.5;
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
3
4
 
4
- export const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
5
- export const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
5
+ export const DEFAULT_TILE_SIZE = 512;
package/src/index.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // CARTO Layers
2
6
  import {default as ClusterTileLayer} from './layers/cluster-tile-layer';
3
7
  import {default as H3TileLayer} from './layers/h3-tile-layer';
@@ -57,17 +61,11 @@ export {
57
61
  export {default as colorBins} from './style/color-bins-style';
58
62
  export {default as colorCategories} from './style/color-categories-style';
59
63
  export {default as colorContinuous} from './style/color-continuous-style';
60
- export {CartoAPIError, fetchMap, query} from './api/index';
64
+ export {fetchMap} from './api/index';
61
65
  export {fetchBasemapProps} from './api/basemap';
62
66
  export type {
63
- APIErrorContext,
64
67
  FetchMapOptions,
65
68
  FetchMapResult,
66
- Format,
67
- MapType,
68
- RequestType,
69
- QueryParameters,
70
- QueryOptions,
71
69
  Basemap as _Basemap,
72
70
  MapLibreBasemap as _MapLibreBasemap,
73
71
  GoogleBasemap as _GoogleBasemap
@@ -87,7 +85,7 @@ import {
87
85
  vectorTableSource,
88
86
  vectorTilesetSource,
89
87
  SOURCE_DEFAULTS
90
- } from './sources/index';
88
+ } from '@carto/api-client';
91
89
 
92
90
  const CARTO_SOURCES = {
93
91
  boundaryQuerySource,
@@ -141,4 +139,4 @@ export type {
141
139
  VectorQuerySourceOptions,
142
140
  VectorTableSourceOptions,
143
141
  VectorTilesetSourceOptions
144
- } from './sources/index';
142
+ } from '@carto/api-client';
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {GeoJsonLayer, GeoJsonLayerProps} from '@deck.gl/layers';
2
6
  import {
3
7
  TileLayer,
@@ -35,7 +39,7 @@ import QuadbinTileset2D from './quadbin-tileset-2d';
35
39
  import {getQuadbinPolygon} from './quadbin-utils';
36
40
  import CartoSpatialTileLoader from './schema/carto-spatial-tile-loader';
37
41
  import {injectAccessToken, TilejsonPropType} from './utils';
38
- import type {TilejsonResult} from '../sources/types';
42
+ import type {TilejsonResult} from '@carto/api-client';
39
43
 
40
44
  registerLoaders([CartoSpatialTileLoader]);
41
45
 
@@ -114,6 +118,7 @@ class ClusterGeoJsonLayer<
114
118
  this.state.aggregationCache = new WeakMap();
115
119
  }
116
120
 
121
+ // eslint-disable-next-line max-statements
117
122
  renderLayers(): Layer | null | LayersList {
118
123
  const visibleTiles = this.state.tileset?.tiles.filter((tile: Tile2DHeader) => {
119
124
  return tile.isLoaded && tile.content && this.state.tileset!.isTileVisible(tile);
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {cellToParent} from 'quadbin';
2
6
  import {_Tile2DHeader as Tile2DHeader} from '@deck.gl/geo-layers';
3
7
  import {Accessor, log} from '@deck.gl/core';
@@ -1,8 +1,12 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {CompositeLayer, CompositeLayerProps, Layer, LayersList, DefaultProps} from '@deck.gl/core';
2
6
  import {H3HexagonLayer, H3HexagonLayerProps} from '@deck.gl/geo-layers';
3
7
  import H3Tileset2D, {getHexagonResolution} from './h3-tileset-2d';
4
8
  import SpatialIndexTileLayer, {SpatialIndexTileLayerProps} from './spatial-index-tile-layer';
5
- import type {TilejsonResult} from '../sources/types';
9
+ import type {TilejsonResult} from '@carto/api-client';
6
10
  import {injectAccessToken, TilejsonPropType} from './utils';
7
11
  import {DEFAULT_TILE_SIZE} from '../constants';
8
12
 
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {_Tileset2D as Tileset2D, GeoBoundingBox} from '@deck.gl/geo-layers';
2
6
  import {
3
7
  polygonToCells,
@@ -1,3 +1,8 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderModule} from '@luma.gl/shadertools';
1
6
  import {getResolution} from 'quadbin';
2
7
 
3
8
  import {
@@ -15,7 +20,7 @@ import {HeatmapProps, heatmap} from './heatmap';
15
20
  import {RTTModifier, PostProcessModifier} from './post-process-utils';
16
21
  import QuadbinTileLayer, {QuadbinTileLayerProps} from './quadbin-tile-layer';
17
22
  import {TilejsonPropType} from './utils';
18
- import {TilejsonResult} from '../sources';
23
+ import {TilejsonResult} from '@carto/api-client';
19
24
  import {_Tile2DHeader as Tile2DHeader} from '@deck.gl/geo-layers';
20
25
  import {Texture, TextureProps} from '@luma.gl/core';
21
26
 
@@ -64,6 +69,21 @@ function colorRangeToFlatArray(colorRange: Color[]): Uint8Array {
64
69
  return flatArray;
65
70
  }
66
71
 
72
+ const uniformBlock = `\
73
+ uniform densityUniforms {
74
+ float factor;
75
+ } density;
76
+ `;
77
+
78
+ type DensityProps = {factor: number};
79
+ const densityUniforms = {
80
+ name: 'density',
81
+ vs: uniformBlock,
82
+ uniformTypes: {
83
+ factor: 'f32'
84
+ }
85
+ } as const satisfies ShaderModule<DensityProps>;
86
+
67
87
  // Modified polygon layer to draw offscreen and output value expected by heatmap
68
88
  class RTTSolidPolygonLayer extends RTTModifier(SolidPolygonLayer) {
69
89
  static layerName = 'RTTSolidPolygonLayer';
@@ -71,16 +91,13 @@ class RTTSolidPolygonLayer extends RTTModifier(SolidPolygonLayer) {
71
91
  getShaders(type) {
72
92
  const shaders = super.getShaders(type);
73
93
  shaders.inject = {
74
- 'vs:#decl': `
75
- uniform float densityFactor;
76
- `,
77
94
  'vs:#main-end': `
78
95
  // Value from getWeight accessor
79
96
  float weight = elevations;
80
97
 
81
98
  // Keep "power" delivered to screen constant when tiles update
82
- // by outputting normalized density
83
- weight *= densityFactor;
99
+ // by outputting normalized density
100
+ weight *= density.factor;
84
101
 
85
102
  // Pack float into 3 channels to pass to heatmap shader
86
103
  // SCALE value important, as we don't want to saturate
@@ -93,15 +110,18 @@ uniform float densityFactor;
93
110
  vColor = vec4(mod(vec3(weight, floor(weight / SHIFT.yz)), 256.0), 255.0) / 255.0;
94
111
  `
95
112
  };
113
+ shaders.modules = [...shaders.modules, densityUniforms];
96
114
  return shaders;
97
115
  }
98
116
 
99
117
  draw(this, opts: any) {
100
118
  const cell = this.props!.data[0];
101
119
  const maxDensity = this.props.elevationScale;
102
- const densityFactor = unitDensityForCell(cell.id) / maxDensity;
120
+ const densityProps: DensityProps = {
121
+ factor: unitDensityForCell(cell.id) / maxDensity
122
+ };
103
123
  for (const model of this.state.models) {
104
- model.setUniforms({densityFactor});
124
+ model.shaderInputs.setProps({density: densityProps});
105
125
  }
106
126
 
107
127
  super.draw(opts);
@@ -305,6 +325,7 @@ class HeatmapTileLayer<DataT = any, ExtraProps extends {} = {}> extends Composit
305
325
  (colorTexture as any).setSubImageData({data: colors});
306
326
  } else {
307
327
  colorTexture?.destroy();
328
+ // @ts-ignore TODO v9.1
308
329
  colorTexture = this.context.device.createTexture({
309
330
  ...TEXTURE_PROPS,
310
331
  data: colors,
@@ -1,6 +1,9 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import type {ShaderPass} from '@luma.gl/shadertools';
2
6
  import {Texture} from '@luma.gl/core';
3
- const glsl = (s: TemplateStringsArray) => `${s}`;
4
7
 
5
8
  /**
6
9
  * @filter Heatmap
@@ -11,7 +14,7 @@ const glsl = (s: TemplateStringsArray) => `${s}`;
11
14
  * @param opacity Output opacity
12
15
  */
13
16
 
14
- const fs = glsl`\
17
+ const fs = /* glsl */ `\
15
18
  uniform heatmapUniforms {
16
19
  vec2 colorDomain;
17
20
  vec2 delta;
@@ -134,6 +137,7 @@ export const heatmap = {
134
137
  opacity: 'f32',
135
138
  radiusPixels: 'f32'
136
139
  },
140
+ // @ts-ignore TODO v9.1
137
141
  getUniforms: opts => {
138
142
  if (!opts) return {};
139
143
  const {
@@ -155,7 +159,9 @@ export const heatmap = {
155
159
  },
156
160
  fs,
157
161
  passes: [
162
+ // @ts-expect-error Seems typing in luma.gl should be Partial<>
158
163
  {sampler: true, uniforms: {delta: [1, 0]}},
164
+ // @ts-expect-error Seems typing in luma.gl should be Partial<>
159
165
  {sampler: true, uniforms: {delta: [0, 1]}}
160
166
  ]
161
167
  } as const satisfies ShaderPass<HeatmapProps & PassProps>;
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {
2
6
  Accessor,
3
7
  Color,
@@ -24,10 +28,10 @@ class EnhancedTextBackgroundLayer extends TextBackgroundLayer {
24
28
 
25
29
  // Modify shader so that the padding is offset by the pixel offset to ensure the padding
26
30
  // always captures the anchor point. As padding is uniform we cannot pass it a per-label value
27
- vs = vs.replaceAll('padding.', '_padding.');
31
+ vs = vs.replaceAll('textBackground.padding.', '_padding.');
28
32
  vs = vs.replace(
29
33
  'void main(void) {',
30
- 'void main(void) {\n vec4 _padding = padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);'
34
+ 'void main(void) {\n vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);'
31
35
  );
32
36
 
33
37
  return {...shaders, vs};
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {Framebuffer, TextureProps} from '@luma.gl/core';
2
6
  import {
3
7
  CompositeLayer,
@@ -64,8 +68,8 @@ export function RTTModifier(BaseLayer) {
64
68
  static layerName = `RTT-${BaseLayer.layerName}`;
65
69
 
66
70
  draw(this: RTTLayer, opts: any) {
67
- const {moduleParameters} = opts;
68
- const {picking} = moduleParameters;
71
+ const {shaderModuleProps} = opts;
72
+ const {picking} = shaderModuleProps;
69
73
  const postProcessLayer = getPostProcessLayer(this);
70
74
 
71
75
  if (!picking.isActive) {
@@ -130,10 +134,11 @@ export function PostProcessModifier<T extends Constructor<DrawableCompositeLayer
130
134
 
131
135
  _resizeBuffers(this: PostProcessLayer, opts: any) {
132
136
  // TODO we could likely render to a smaller buffer for better perf
133
- const {moduleParameters} = opts;
137
+ const {shaderModuleProps} = opts;
134
138
  const {viewport} = this.context;
135
- const width = moduleParameters.devicePixelRatio * viewport.width;
136
- const height = moduleParameters.devicePixelRatio * viewport.height;
139
+ const {devicePixelRatio} = shaderModuleProps.project;
140
+ const width = devicePixelRatio * viewport.width;
141
+ const height = devicePixelRatio * viewport.height;
137
142
  this.internalState.renderBuffers.forEach((fbo: Framebuffer) => fbo.resize({width, height}));
138
143
  }
139
144
 
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {AccessorFunction, DefaultProps} from '@deck.gl/core';
2
6
  import {
3
7
  _GeoCellLayer as GeoCellLayer,
@@ -1,9 +1,13 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {CompositeLayer, CompositeLayerProps, Layer, LayersList, DefaultProps} from '@deck.gl/core';
2
6
  import QuadbinLayer, {QuadbinLayerProps} from './quadbin-layer';
3
7
  import QuadbinTileset2D from './quadbin-tileset-2d';
4
8
  import SpatialIndexTileLayer, {SpatialIndexTileLayerProps} from './spatial-index-tile-layer';
5
9
  import {hexToBigInt} from 'quadbin';
6
- import type {TilejsonResult} from '../sources/types';
10
+ import type {TilejsonResult} from '@carto/api-client';
7
11
  import {injectAccessToken, TilejsonPropType} from './utils';
8
12
  import {DEFAULT_TILE_SIZE} from '../constants';
9
13
 
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {_Tileset2D as Tileset2D} from '@deck.gl/geo-layers';
2
6
  import {bigIntToHex, cellToParent, cellToTile, getResolution, tileToCell} from 'quadbin';
3
7
 
@@ -1,3 +1,7 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {worldToLngLat} from '@math.gl/web-mercator';
2
6
  import {cellToTile} from 'quadbin';
3
7