@deck.gl/carto 8.10.0-alpha.7 → 9.0.0-alpha.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.
Files changed (365) hide show
  1. package/dist/cartoRasterTile-worker.js +32 -24
  2. package/dist/cartoSpatialTile-worker.js +32 -24
  3. package/dist/cartoVectorTile-worker.js +69 -63
  4. package/dist/dist.dev.js +12055 -12562
  5. package/dist/es5/api/carto-api-error.js.map +1 -1
  6. package/dist/es5/api/common.js +25 -0
  7. package/dist/es5/api/common.js.map +1 -0
  8. package/dist/es5/api/endpoints.js +40 -0
  9. package/dist/es5/api/endpoints.js.map +1 -0
  10. package/dist/es5/api/fetch-map.js +560 -0
  11. package/dist/es5/api/fetch-map.js.map +1 -0
  12. package/dist/es5/api/index.js +5 -49
  13. package/dist/es5/api/index.js.map +1 -1
  14. package/dist/es5/api/layer-map.js +43 -45
  15. package/dist/es5/api/layer-map.js.map +1 -1
  16. package/dist/es5/api/{parseMap.js → parse-map.js} +5 -3
  17. package/dist/es5/api/parse-map.js.map +1 -0
  18. package/dist/es5/api/query.js +78 -0
  19. package/dist/es5/api/query.js.map +1 -0
  20. package/dist/es5/{sources/utils.js → api/request-with-parameters.js} +60 -46
  21. package/dist/es5/api/request-with-parameters.js.map +1 -0
  22. package/dist/es5/api/types.js +19 -0
  23. package/dist/es5/api/types.js.map +1 -1
  24. package/dist/es5/index.js +66 -80
  25. package/dist/es5/index.js.map +1 -1
  26. package/dist/es5/layers/h3-tile-layer.js +3 -5
  27. package/dist/es5/layers/h3-tile-layer.js.map +1 -1
  28. package/dist/es5/layers/point-label-layer.js.map +1 -1
  29. package/dist/es5/layers/quadbin-layer.js.map +1 -1
  30. package/dist/es5/layers/quadbin-tile-layer.js +1 -4
  31. package/dist/es5/layers/quadbin-tile-layer.js.map +1 -1
  32. package/dist/es5/layers/raster-layer.js +2 -0
  33. package/dist/es5/layers/raster-layer.js.map +1 -1
  34. package/dist/es5/layers/raster-tile-layer.js +1 -3
  35. package/dist/es5/layers/raster-tile-layer.js.map +1 -1
  36. package/dist/es5/layers/schema/carto-properties-tile-loader.js +60 -0
  37. package/dist/es5/layers/schema/carto-properties-tile-loader.js.map +1 -0
  38. package/dist/es5/layers/schema/carto-properties-tile.js +38 -0
  39. package/dist/es5/layers/schema/carto-properties-tile.js.map +1 -0
  40. package/dist/es5/layers/schema/carto-raster-tile-loader.js +1 -1
  41. package/dist/es5/layers/schema/carto-raster-tile-loader.js.map +1 -1
  42. package/dist/es5/layers/schema/carto-spatial-tile-loader.js +1 -1
  43. package/dist/es5/layers/schema/carto-spatial-tile-loader.js.map +1 -1
  44. package/dist/es5/layers/schema/carto-vector-tile-loader.js +1 -2
  45. package/dist/es5/layers/schema/carto-vector-tile-loader.js.map +1 -1
  46. package/dist/es5/layers/spatial-index-tile-layer.js +16 -26
  47. package/dist/es5/layers/spatial-index-tile-layer.js.map +1 -1
  48. package/dist/es5/layers/utils.js +102 -0
  49. package/dist/es5/layers/utils.js.map +1 -1
  50. package/dist/es5/layers/vector-tile-layer.js +112 -27
  51. package/dist/es5/layers/vector-tile-layer.js.map +1 -1
  52. package/dist/es5/sources/base-source.js +56 -28
  53. package/dist/es5/sources/base-source.js.map +1 -1
  54. package/dist/es5/sources/boundary-query-source.js +51 -0
  55. package/dist/es5/sources/boundary-query-source.js.map +1 -0
  56. package/dist/es5/sources/boundary-table-source.js +51 -0
  57. package/dist/es5/sources/boundary-table-source.js.map +1 -0
  58. package/dist/es5/sources/boundary-tileset-source.js +43 -0
  59. package/dist/es5/sources/boundary-tileset-source.js.map +1 -0
  60. package/dist/es5/sources/h3-query-source.js +9 -11
  61. package/dist/es5/sources/h3-query-source.js.map +1 -1
  62. package/dist/es5/sources/h3-table-source.js +10 -12
  63. package/dist/es5/sources/h3-table-source.js.map +1 -1
  64. package/dist/es5/sources/h3-tileset-source.js +5 -5
  65. package/dist/es5/sources/h3-tileset-source.js.map +1 -1
  66. package/dist/es5/sources/index.js +46 -22
  67. package/dist/es5/sources/index.js.map +1 -1
  68. package/dist/es5/sources/quadbin-query-source.js +10 -12
  69. package/dist/es5/sources/quadbin-query-source.js.map +1 -1
  70. package/dist/es5/sources/quadbin-table-source.js +10 -12
  71. package/dist/es5/sources/quadbin-table-source.js.map +1 -1
  72. package/dist/es5/sources/quadbin-tileset-source.js +5 -5
  73. package/dist/es5/sources/quadbin-tileset-source.js.map +1 -1
  74. package/dist/es5/sources/raster-source.js +5 -5
  75. package/dist/es5/sources/raster-source.js.map +1 -1
  76. package/dist/es5/sources/types.js +2 -0
  77. package/dist/es5/sources/types.js.map +1 -0
  78. package/dist/es5/sources/vector-query-source.js +11 -12
  79. package/dist/es5/sources/vector-query-source.js.map +1 -1
  80. package/dist/es5/sources/vector-table-source.js +12 -13
  81. package/dist/es5/sources/vector-table-source.js.map +1 -1
  82. package/dist/es5/sources/vector-tileset-source.js +5 -5
  83. package/dist/es5/sources/vector-tileset-source.js.map +1 -1
  84. package/dist/es5/style/color-bins-style.js +4 -2
  85. package/dist/es5/style/color-bins-style.js.map +1 -1
  86. package/dist/es5/style/color-categories-style.js +4 -2
  87. package/dist/es5/style/color-categories-style.js.map +1 -1
  88. package/dist/es5/style/color-continuous-style.js +4 -2
  89. package/dist/es5/style/color-continuous-style.js.map +1 -1
  90. package/dist/es5/style/palette.js +1 -1
  91. package/dist/es5/style/palette.js.map +1 -1
  92. package/dist/es5/style/utils.js +4 -11
  93. package/dist/es5/style/utils.js.map +1 -1
  94. package/dist/es5/utils.js +30 -1
  95. package/dist/es5/utils.js.map +1 -1
  96. package/dist/esm/api/carto-api-error.js.map +1 -1
  97. package/dist/esm/api/common.js +13 -0
  98. package/dist/esm/api/common.js.map +1 -0
  99. package/dist/esm/api/endpoints.js +28 -0
  100. package/dist/esm/api/endpoints.js.map +1 -0
  101. package/dist/esm/api/fetch-map.js +291 -0
  102. package/dist/esm/api/fetch-map.js.map +1 -0
  103. package/dist/esm/api/index.js +2 -3
  104. package/dist/esm/api/index.js.map +1 -1
  105. package/dist/esm/api/layer-map.js +43 -35
  106. package/dist/esm/api/layer-map.js.map +1 -1
  107. package/dist/esm/api/{parseMap.js → parse-map.js} +3 -2
  108. package/dist/esm/api/parse-map.js.map +1 -0
  109. package/dist/esm/api/query.js +38 -0
  110. package/dist/esm/api/query.js.map +1 -0
  111. package/dist/esm/{sources/utils.js → api/request-with-parameters.js} +25 -12
  112. package/dist/esm/api/request-with-parameters.js.map +1 -0
  113. package/dist/esm/api/types.js +13 -1
  114. package/dist/esm/api/types.js.map +1 -1
  115. package/dist/esm/index.js +31 -9
  116. package/dist/esm/index.js.map +1 -1
  117. package/dist/esm/layers/h3-tile-layer.js +2 -6
  118. package/dist/esm/layers/h3-tile-layer.js.map +1 -1
  119. package/dist/esm/layers/point-label-layer.js.map +1 -1
  120. package/dist/esm/layers/quadbin-layer.js.map +1 -1
  121. package/dist/esm/layers/quadbin-tile-layer.js +1 -3
  122. package/dist/esm/layers/quadbin-tile-layer.js.map +1 -1
  123. package/dist/esm/layers/raster-layer.js +1 -0
  124. package/dist/esm/layers/raster-layer.js.map +1 -1
  125. package/dist/esm/layers/raster-tile-layer.js +1 -2
  126. package/dist/esm/layers/raster-tile-layer.js.map +1 -1
  127. package/dist/esm/layers/schema/carto-properties-tile-loader.js +23 -0
  128. package/dist/esm/layers/schema/carto-properties-tile-loader.js.map +1 -0
  129. package/dist/esm/layers/schema/carto-properties-tile.js +18 -0
  130. package/dist/esm/layers/schema/carto-properties-tile.js.map +1 -0
  131. package/dist/esm/layers/schema/carto-raster-tile-loader.js +1 -1
  132. package/dist/esm/layers/schema/carto-raster-tile-loader.js.map +1 -1
  133. package/dist/esm/layers/schema/carto-spatial-tile-loader.js +1 -1
  134. package/dist/esm/layers/schema/carto-spatial-tile-loader.js.map +1 -1
  135. package/dist/esm/layers/schema/carto-vector-tile-loader.js +1 -2
  136. package/dist/esm/layers/schema/carto-vector-tile-loader.js.map +1 -1
  137. package/dist/esm/layers/spatial-index-tile-layer.js +9 -24
  138. package/dist/esm/layers/spatial-index-tile-layer.js.map +1 -1
  139. package/dist/esm/layers/utils.js +70 -0
  140. package/dist/esm/layers/utils.js.map +1 -1
  141. package/dist/esm/layers/vector-tile-layer.js +40 -12
  142. package/dist/esm/layers/vector-tile-layer.js.map +1 -1
  143. package/dist/esm/sources/base-source.js +33 -10
  144. package/dist/esm/sources/base-source.js.map +1 -1
  145. package/dist/esm/sources/boundary-query-source.js +21 -0
  146. package/dist/esm/sources/boundary-query-source.js.map +1 -0
  147. package/dist/esm/sources/boundary-table-source.js +21 -0
  148. package/dist/esm/sources/boundary-table-source.js.map +1 -0
  149. package/dist/esm/sources/boundary-tileset-source.js +11 -0
  150. package/dist/esm/sources/boundary-tileset-source.js.map +1 -0
  151. package/dist/esm/sources/h3-query-source.js +6 -11
  152. package/dist/esm/sources/h3-query-source.js.map +1 -1
  153. package/dist/esm/sources/h3-table-source.js +7 -12
  154. package/dist/esm/sources/h3-table-source.js.map +1 -1
  155. package/dist/esm/sources/h3-tileset-source.js +3 -6
  156. package/dist/esm/sources/h3-tileset-source.js.map +1 -1
  157. package/dist/esm/sources/index.js +14 -11
  158. package/dist/esm/sources/index.js.map +1 -1
  159. package/dist/esm/sources/quadbin-query-source.js +7 -12
  160. package/dist/esm/sources/quadbin-query-source.js.map +1 -1
  161. package/dist/esm/sources/quadbin-table-source.js +7 -12
  162. package/dist/esm/sources/quadbin-table-source.js.map +1 -1
  163. package/dist/esm/sources/quadbin-tileset-source.js +3 -6
  164. package/dist/esm/sources/quadbin-tileset-source.js.map +1 -1
  165. package/dist/esm/sources/raster-source.js +3 -6
  166. package/dist/esm/sources/raster-source.js.map +1 -1
  167. package/dist/esm/sources/types.js +2 -0
  168. package/dist/esm/sources/types.js.map +1 -0
  169. package/dist/esm/sources/vector-query-source.js +6 -11
  170. package/dist/esm/sources/vector-query-source.js.map +1 -1
  171. package/dist/esm/sources/vector-table-source.js +7 -12
  172. package/dist/esm/sources/vector-table-source.js.map +1 -1
  173. package/dist/esm/sources/vector-tileset-source.js +3 -6
  174. package/dist/esm/sources/vector-tileset-source.js.map +1 -1
  175. package/dist/esm/style/color-bins-style.js +2 -1
  176. package/dist/esm/style/color-bins-style.js.map +1 -1
  177. package/dist/esm/style/color-categories-style.js +2 -1
  178. package/dist/esm/style/color-categories-style.js.map +1 -1
  179. package/dist/esm/style/color-continuous-style.js +2 -1
  180. package/dist/esm/style/color-continuous-style.js.map +1 -1
  181. package/dist/esm/style/palette.js +1 -1
  182. package/dist/esm/style/palette.js.map +1 -1
  183. package/dist/esm/style/utils.js +1 -5
  184. package/dist/esm/style/utils.js.map +1 -1
  185. package/dist/esm/utils.js +24 -1
  186. package/dist/esm/utils.js.map +1 -1
  187. package/dist.min.js +42 -41
  188. package/package.json +10 -9
  189. package/src/.DS_Store +0 -0
  190. package/src/api/carto-api-error.ts +1 -9
  191. package/src/api/common.ts +14 -0
  192. package/src/api/endpoints.ts +38 -0
  193. package/src/api/fetch-map.ts +287 -0
  194. package/src/api/index.ts +5 -5
  195. package/src/api/layer-map.ts +40 -36
  196. package/src/api/{parseMap.ts → parse-map.ts} +2 -2
  197. package/src/api/query.ts +34 -0
  198. package/src/{sources/utils.ts → api/request-with-parameters.ts} +22 -17
  199. package/src/api/types.ts +49 -0
  200. package/src/index.ts +93 -41
  201. package/src/layers/h3-tile-layer.ts +13 -18
  202. package/src/layers/point-label-layer.ts +1 -1
  203. package/src/layers/quadbin-layer.ts +3 -2
  204. package/src/layers/quadbin-tile-layer.ts +10 -11
  205. package/src/layers/raster-layer.ts +2 -2
  206. package/src/layers/raster-tile-layer.ts +11 -9
  207. package/src/layers/schema/carto-properties-tile-loader.ts +25 -0
  208. package/src/layers/schema/carto-properties-tile.ts +21 -0
  209. package/src/layers/schema/carto-vector-tile-loader.ts +1 -1
  210. package/src/layers/spatial-index-tile-layer.ts +18 -26
  211. package/src/layers/utils.ts +71 -0
  212. package/src/layers/vector-tile-layer.ts +40 -21
  213. package/src/sources/base-source.ts +35 -18
  214. package/src/sources/boundary-query-source.ts +31 -0
  215. package/src/sources/boundary-table-source.ts +31 -0
  216. package/src/sources/boundary-tileset-source.ts +14 -0
  217. package/src/sources/h3-query-source.ts +22 -22
  218. package/src/sources/h3-table-source.ts +22 -22
  219. package/src/sources/h3-tileset-source.ts +7 -9
  220. package/src/sources/index.ts +31 -22
  221. package/src/sources/quadbin-query-source.ts +22 -22
  222. package/src/sources/quadbin-table-source.ts +23 -22
  223. package/src/sources/quadbin-tileset-source.ts +7 -9
  224. package/src/sources/raster-source.ts +5 -9
  225. package/src/sources/types.ts +98 -0
  226. package/src/sources/vector-query-source.ts +15 -15
  227. package/src/sources/vector-table-source.ts +15 -15
  228. package/src/sources/vector-tileset-source.ts +7 -9
  229. package/src/style/color-bins-style.ts +2 -1
  230. package/src/style/color-categories-style.ts +2 -1
  231. package/src/style/color-continuous-style.ts +2 -1
  232. package/src/style/palette.ts +1 -1
  233. package/src/style/utils.ts +1 -6
  234. package/src/utils.ts +25 -1
  235. package/typed/api/carto-api-error.d.ts +1 -8
  236. package/typed/api/carto-api-error.d.ts.map +1 -1
  237. package/typed/api/common.d.ts +13 -0
  238. package/typed/api/common.d.ts.map +1 -0
  239. package/typed/api/endpoints.d.ts +12 -0
  240. package/typed/api/endpoints.d.ts.map +1 -0
  241. package/typed/api/fetch-map.d.ts +22 -0
  242. package/typed/api/fetch-map.d.ts.map +1 -0
  243. package/typed/api/index.d.ts +5 -5
  244. package/typed/api/index.d.ts.map +1 -1
  245. package/typed/api/layer-map.d.ts +6 -9
  246. package/typed/api/layer-map.d.ts.map +1 -1
  247. package/typed/api/{parseMap.d.ts → parse-map.d.ts} +1 -1
  248. package/typed/api/parse-map.d.ts.map +1 -0
  249. package/typed/api/query.d.ts +4 -0
  250. package/typed/api/query.d.ts.map +1 -0
  251. package/typed/api/request-with-parameters.d.ts +9 -0
  252. package/typed/api/request-with-parameters.d.ts.map +1 -0
  253. package/typed/api/types.d.ts +40 -0
  254. package/typed/api/types.d.ts.map +1 -1
  255. package/typed/index.d.ts +33 -12
  256. package/typed/index.d.ts.map +1 -1
  257. package/typed/layers/h3-tile-layer.d.ts +12 -7
  258. package/typed/layers/h3-tile-layer.d.ts.map +1 -1
  259. package/typed/layers/point-label-layer.d.ts +2 -2
  260. package/typed/layers/point-label-layer.d.ts.map +1 -1
  261. package/typed/layers/quadbin-layer.d.ts +2 -2
  262. package/typed/layers/quadbin-layer.d.ts.map +1 -1
  263. package/typed/layers/quadbin-tile-layer.d.ts +6 -6
  264. package/typed/layers/quadbin-tile-layer.d.ts.map +1 -1
  265. package/typed/layers/raster-layer.d.ts +2 -2
  266. package/typed/layers/raster-layer.d.ts.map +1 -1
  267. package/typed/layers/raster-tile-layer.d.ts +6 -5
  268. package/typed/layers/raster-tile-layer.d.ts.map +1 -1
  269. package/typed/layers/schema/carto-properties-tile-loader.d.ts +4 -0
  270. package/typed/layers/schema/carto-properties-tile-loader.d.ts.map +1 -0
  271. package/typed/layers/schema/carto-properties-tile.d.ts +10 -0
  272. package/typed/layers/schema/carto-properties-tile.d.ts.map +1 -0
  273. package/typed/layers/spatial-index-tile-layer.d.ts +10 -9
  274. package/typed/layers/spatial-index-tile-layer.d.ts.map +1 -1
  275. package/typed/layers/utils.d.ts +11 -0
  276. package/typed/layers/utils.d.ts.map +1 -1
  277. package/typed/layers/vector-tile-layer.d.ts +6 -11
  278. package/typed/layers/vector-tile-layer.d.ts.map +1 -1
  279. package/typed/sources/base-source.d.ts +4 -3
  280. package/typed/sources/base-source.d.ts.map +1 -1
  281. package/typed/sources/boundary-query-source.d.ts +10 -0
  282. package/typed/sources/boundary-query-source.d.ts.map +1 -0
  283. package/typed/sources/boundary-table-source.d.ts +9 -0
  284. package/typed/sources/boundary-table-source.d.ts.map +1 -0
  285. package/typed/sources/boundary-tileset-source.d.ts +6 -0
  286. package/typed/sources/boundary-tileset-source.d.ts.map +1 -0
  287. package/typed/sources/h3-query-source.d.ts +3 -4
  288. package/typed/sources/h3-query-source.d.ts.map +1 -1
  289. package/typed/sources/h3-table-source.d.ts +3 -4
  290. package/typed/sources/h3-table-source.d.ts.map +1 -1
  291. package/typed/sources/h3-tileset-source.d.ts +3 -4
  292. package/typed/sources/h3-tileset-source.d.ts.map +1 -1
  293. package/typed/sources/index.d.ts +28 -22
  294. package/typed/sources/index.d.ts.map +1 -1
  295. package/typed/sources/quadbin-query-source.d.ts +3 -4
  296. package/typed/sources/quadbin-query-source.d.ts.map +1 -1
  297. package/typed/sources/quadbin-table-source.d.ts +3 -4
  298. package/typed/sources/quadbin-table-source.d.ts.map +1 -1
  299. package/typed/sources/quadbin-tileset-source.d.ts +3 -4
  300. package/typed/sources/quadbin-tileset-source.d.ts.map +1 -1
  301. package/typed/sources/raster-source.d.ts +3 -4
  302. package/typed/sources/raster-source.d.ts.map +1 -1
  303. package/typed/sources/{common.d.ts → types.d.ts} +26 -42
  304. package/typed/sources/types.d.ts.map +1 -0
  305. package/typed/sources/vector-query-source.d.ts +3 -4
  306. package/typed/sources/vector-query-source.d.ts.map +1 -1
  307. package/typed/sources/vector-table-source.d.ts +3 -4
  308. package/typed/sources/vector-table-source.d.ts.map +1 -1
  309. package/typed/sources/vector-tileset-source.d.ts +3 -4
  310. package/typed/sources/vector-tileset-source.d.ts.map +1 -1
  311. package/typed/style/color-bins-style.d.ts.map +1 -1
  312. package/typed/style/color-categories-style.d.ts.map +1 -1
  313. package/typed/style/color-continuous-style.d.ts.map +1 -1
  314. package/typed/style/utils.d.ts +0 -1
  315. package/typed/style/utils.d.ts.map +1 -1
  316. package/typed/utils.d.ts +8 -0
  317. package/typed/utils.d.ts.map +1 -1
  318. package/dist/es5/api/maps-api-common.js +0 -77
  319. package/dist/es5/api/maps-api-common.js.map +0 -1
  320. package/dist/es5/api/maps-client.js +0 -220
  321. package/dist/es5/api/maps-client.js.map +0 -1
  322. package/dist/es5/api/maps-v3-client.js +0 -959
  323. package/dist/es5/api/maps-v3-client.js.map +0 -1
  324. package/dist/es5/api/parseMap.js.map +0 -1
  325. package/dist/es5/config.js +0 -84
  326. package/dist/es5/config.js.map +0 -1
  327. package/dist/es5/layers/carto-layer.js +0 -329
  328. package/dist/es5/layers/carto-layer.js.map +0 -1
  329. package/dist/es5/sources/common.js +0 -48
  330. package/dist/es5/sources/common.js.map +0 -1
  331. package/dist/es5/sources/utils.js.map +0 -1
  332. package/dist/esm/api/maps-api-common.js +0 -54
  333. package/dist/esm/api/maps-api-common.js.map +0 -1
  334. package/dist/esm/api/maps-client.js +0 -148
  335. package/dist/esm/api/maps-client.js.map +0 -1
  336. package/dist/esm/api/maps-v3-client.js +0 -638
  337. package/dist/esm/api/maps-v3-client.js.map +0 -1
  338. package/dist/esm/api/parseMap.js.map +0 -1
  339. package/dist/esm/config.js +0 -60
  340. package/dist/esm/config.js.map +0 -1
  341. package/dist/esm/layers/carto-layer.js +0 -233
  342. package/dist/esm/layers/carto-layer.js.map +0 -1
  343. package/dist/esm/sources/common.js +0 -26
  344. package/dist/esm/sources/common.js.map +0 -1
  345. package/dist/esm/sources/utils.js.map +0 -1
  346. package/src/api/maps-api-common.ts +0 -95
  347. package/src/api/maps-client.ts +0 -196
  348. package/src/api/maps-v3-client.ts +0 -659
  349. package/src/config.ts +0 -70
  350. package/src/layers/carto-layer.ts +0 -340
  351. package/src/sources/common.ts +0 -132
  352. package/typed/api/maps-api-common.d.ts +0 -76
  353. package/typed/api/maps-api-common.d.ts.map +0 -1
  354. package/typed/api/maps-client.d.ts +0 -18
  355. package/typed/api/maps-client.d.ts.map +0 -1
  356. package/typed/api/maps-v3-client.d.ts +0 -49
  357. package/typed/api/maps-v3-client.d.ts.map +0 -1
  358. package/typed/api/parseMap.d.ts.map +0 -1
  359. package/typed/config.d.ts +0 -28
  360. package/typed/config.d.ts.map +0 -1
  361. package/typed/layers/carto-layer.d.ts +0 -126
  362. package/typed/layers/carto-layer.d.ts.map +0 -1
  363. package/typed/sources/common.d.ts.map +0 -1
  364. package/typed/sources/utils.d.ts +0 -15
  365. package/typed/sources/utils.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import {registerLoaders} from '@loaders.gl/core';
2
+ import CartoPropertiesTileLoader from './schema/carto-properties-tile-loader';
2
3
  import CartoVectorTileLoader from './schema/carto-vector-tile-loader';
3
- registerLoaders([CartoVectorTileLoader]);
4
+ registerLoaders([CartoPropertiesTileLoader, CartoVectorTileLoader]);
4
5
 
5
6
  import {DefaultProps} from '@deck.gl/core';
6
7
  import {ClipExtension} from '@deck.gl/extensions';
@@ -15,17 +16,15 @@ import {
15
16
  import {GeoJsonLayer} from '@deck.gl/layers';
16
17
  import {binaryToGeojson} from '@loaders.gl/gis';
17
18
  import type {BinaryFeatureCollection} from '@loaders.gl/schema';
18
- import {TileFormat, TILE_FORMATS} from '../api/maps-api-common';
19
19
  import type {Feature} from 'geojson';
20
- import {TilejsonPropType, CartoTilejsonResult} from '../sources/common';
21
- import {injectAccessToken} from './utils';
22
20
 
23
- const defaultTileFormat = TILE_FORMATS.BINARY;
21
+ import type {TilejsonResult} from '../sources/types';
22
+ import {TilejsonPropType, injectAccessToken, mergeBoundaryData} from './utils';
24
23
 
25
24
  const defaultProps: DefaultProps<VectorTileLayerProps> = {
26
25
  ...MVTLayer.defaultProps,
27
26
  data: TilejsonPropType,
28
- formatTiles: defaultTileFormat
27
+ dataComparator: TilejsonPropType.equal
29
28
  };
30
29
 
31
30
  /** All properties supported by VectorTileLayer. */
@@ -33,14 +32,7 @@ export type VectorTileLayerProps = _VectorTileLayerProps & Omit<MVTLayerProps, '
33
32
 
34
33
  /** Properties added by VectorTileLayer. */
35
34
  type _VectorTileLayerProps = {
36
- data: null | CartoTilejsonResult | Promise<CartoTilejsonResult>;
37
- /** Use to override the default tile data format.
38
- *
39
- * Possible values are: `TILE_FORMATS.BINARY`, `TILE_FORMATS.GEOJSON` and `TILE_FORMATS.MVT`.
40
- *
41
- * Only supported when `apiVersion` is `API_VERSIONS.V3` and `format` is `FORMATS.TILEJSON`.
42
- */
43
- formatTiles?: TileFormat;
35
+ data: null | TilejsonResult | Promise<TilejsonResult>;
44
36
  };
45
37
 
46
38
  // TODO Perhaps we can't subclass MVTLayer and keep types. Better to subclass TileLayer instead?
@@ -51,10 +43,13 @@ export default class VectorTileLayer<ExtraProps extends {} = {}> extends MVTLaye
51
43
  static layerName = 'VectorTileLayer';
52
44
  static defaultProps = defaultProps;
53
45
 
46
+ state!: MVTLayer['state'] & {
47
+ mvt: boolean;
48
+ };
49
+
54
50
  initializeState(): void {
55
51
  super.initializeState();
56
- const binary = this.props.formatTiles === TILE_FORMATS.BINARY || TILE_FORMATS.MVT;
57
- this.setState({binary});
52
+ this.setState({binary: true});
58
53
  }
59
54
 
60
55
  updateState(parameters) {
@@ -63,21 +58,23 @@ export default class VectorTileLayer<ExtraProps extends {} = {}> extends MVTLaye
63
58
  super.updateState(parameters);
64
59
 
65
60
  const formatTiles = new URL(props.data.tiles[0]).searchParams.get('formatTiles');
66
- const mvt = formatTiles === TILE_FORMATS.MVT;
61
+ const mvt = formatTiles === 'mvt';
67
62
  this.setState({mvt});
68
63
  }
69
64
  }
70
65
 
71
66
  getLoadOptions(): any {
72
67
  const loadOptions = super.getLoadOptions() || {};
73
- const tileJSON = this.props.data as CartoTilejsonResult;
68
+ const tileJSON = this.props.data as TilejsonResult;
74
69
  injectAccessToken(loadOptions, tileJSON.accessToken);
75
70
  loadOptions.gis = {format: 'binary'}; // Use binary for MVT loading
76
71
  return loadOptions;
77
72
  }
78
73
 
79
- getTileData(tile: TileLoadProps) {
80
- const url = _getURLFromTemplate(this.state.data, tile);
74
+ async getTileData(tile: TileLoadProps) {
75
+ const tileJSON = this.props.data as TilejsonResult;
76
+ const {tiles, properties_tiles} = tileJSON;
77
+ const url = _getURLFromTemplate(tiles, tile);
81
78
  if (!url) {
82
79
  return Promise.reject('Invalid URL');
83
80
  }
@@ -85,7 +82,29 @@ export default class VectorTileLayer<ExtraProps extends {} = {}> extends MVTLaye
85
82
  const loadOptions = this.getLoadOptions();
86
83
  const {fetch} = this.props;
87
84
  const {signal} = tile;
88
- return fetch(url, {propName: 'data', layer: this, loadOptions, signal});
85
+
86
+ // Fetch geometry and attributes separately
87
+ const geometryFetch = fetch(url, {propName: 'data', layer: this, loadOptions, signal});
88
+
89
+ if (!properties_tiles) {
90
+ return await geometryFetch;
91
+ }
92
+
93
+ const propertiesUrl = _getURLFromTemplate(properties_tiles, tile);
94
+ if (!propertiesUrl) {
95
+ return Promise.reject('Invalid properties URL');
96
+ }
97
+
98
+ const attributesFetch = fetch(propertiesUrl, {
99
+ propName: 'data',
100
+ layer: this,
101
+ loadOptions,
102
+ signal
103
+ });
104
+ const [geometry, attributes] = await Promise.all([geometryFetch, attributesFetch]);
105
+ if (!geometry) return null;
106
+
107
+ return mergeBoundaryData(geometry, attributes);
89
108
  }
90
109
 
91
110
  renderSubLayers(
@@ -1,25 +1,39 @@
1
- import type {MapType} from '../api/maps-api-common';
2
- import {APIErrorContext} from '../api/carto-api-error';
3
- import {
4
- CartoSourceOptionalOptions,
5
- CartoSourceRequiredOptions,
6
- CartoTilejsonResult,
1
+ /* eslint-disable camelcase */
2
+ import {DEFAULT_API_BASE_URL, DEFAULT_CLIENT} from '../api/common';
3
+ import {buildSourceUrl} from '../api/endpoints';
4
+ import {requestWithParameters} from '../api/request-with-parameters';
5
+ import type {APIErrorContext, MapType} from '../api/types';
6
+ import type {
7
7
  GeojsonResult,
8
8
  JsonResult,
9
- SOURCE_DEFAULTS,
9
+ SourceOptionalOptions,
10
+ SourceRequiredOptions,
10
11
  Tilejson,
11
- TilejsonMapInstantiation
12
- } from './common';
13
- import {buildApiEndpoint, requestWithParameters} from './utils';
12
+ TilejsonMapInstantiation,
13
+ TilejsonResult
14
+ } from './types';
14
15
 
15
- export async function cartoBaseSource<UrlParameters extends Record<string, string>>(
16
+ export const SOURCE_DEFAULTS: SourceOptionalOptions = {
17
+ apiBaseUrl: DEFAULT_API_BASE_URL,
18
+ clientId: DEFAULT_CLIENT,
19
+ format: 'tilejson',
20
+ headers: {}
21
+ };
22
+
23
+ export async function baseSource<UrlParameters extends Record<string, string>>(
16
24
  endpoint: MapType,
17
- options: Partial<CartoSourceOptionalOptions> & CartoSourceRequiredOptions,
25
+ options: Partial<SourceOptionalOptions> & SourceRequiredOptions,
18
26
  urlParameters: UrlParameters
19
- ): Promise<CartoTilejsonResult | GeojsonResult | JsonResult> {
20
- const mergedOptions = {...SOURCE_DEFAULTS, ...options, endpoint};
21
- const baseUrl = buildApiEndpoint(mergedOptions);
22
- const {accessToken, format} = mergedOptions;
27
+ ): Promise<TilejsonResult | GeojsonResult | JsonResult> {
28
+ const {accessToken, connectionName, cache, ...optionalOptions} = options;
29
+ const mergedOptions = {...SOURCE_DEFAULTS, accessToken, connectionName, endpoint};
30
+ for (const key in optionalOptions) {
31
+ if (optionalOptions[key]) {
32
+ mergedOptions[key] = optionalOptions[key];
33
+ }
34
+ }
35
+ const baseUrl = buildSourceUrl(mergedOptions);
36
+ const {format} = mergedOptions;
23
37
  const headers = {Authorization: `Bearer ${options.accessToken}`, ...options.headers};
24
38
 
25
39
  const errorContext: APIErrorContext = {
@@ -36,15 +50,18 @@ export async function cartoBaseSource<UrlParameters extends Record<string, strin
36
50
  });
37
51
 
38
52
  const dataUrl = mapInstantiation[format].url[0];
53
+ if (cache) {
54
+ cache.value = parseInt(new URL(dataUrl).searchParams.get('cache') || '', 10);
55
+ }
39
56
  errorContext.requestType = 'Map data';
40
57
 
41
58
  if (format === 'tilejson') {
42
- const tilejson = await requestWithParameters<Tilejson>({
59
+ return await requestWithParameters<TilejsonResult>({
60
+ accessToken,
43
61
  baseUrl: dataUrl,
44
62
  headers,
45
63
  errorContext
46
64
  });
47
- return {...tilejson, accessToken};
48
65
  }
49
66
 
50
67
  return await requestWithParameters<GeojsonResult | JsonResult>({
@@ -0,0 +1,31 @@
1
+ import {QueryParameters} from '../api';
2
+ import {baseSource} from './base-source';
3
+ import type {SourceOptions, TilejsonResult} from './types';
4
+
5
+ export type BoundaryQuerySourceOptions = SourceOptions & {
6
+ boundaryId: string;
7
+ matchingColumn?: string;
8
+ sqlQuery: string;
9
+ queryParameters: QueryParameters;
10
+ };
11
+ type UrlParameters = {
12
+ boundaryId: string;
13
+ matchingColumn: string;
14
+ sqlQuery: string;
15
+ queryParameters?: string;
16
+ };
17
+
18
+ export const boundaryQuerySource = async function (
19
+ options: BoundaryQuerySourceOptions
20
+ ): Promise<TilejsonResult> {
21
+ const {boundaryId, matchingColumn = 'id', sqlQuery, queryParameters} = options;
22
+ const urlParameters: UrlParameters = {
23
+ boundaryId,
24
+ matchingColumn,
25
+ sqlQuery
26
+ };
27
+ if (queryParameters) {
28
+ urlParameters.queryParameters = JSON.stringify(queryParameters);
29
+ }
30
+ return baseSource<UrlParameters>('boundary', options, urlParameters) as Promise<TilejsonResult>;
31
+ };
@@ -0,0 +1,31 @@
1
+ import {baseSource} from './base-source';
2
+ import type {SourceOptions, TilejsonResult} from './types';
3
+
4
+ export type BoundaryTableSourceOptions = SourceOptions & {
5
+ boundaryId: string;
6
+ columns?: string[];
7
+ matchingColumn?: string;
8
+ tableName: string;
9
+ };
10
+ type UrlParameters = {
11
+ boundaryId: string;
12
+ columns?: string;
13
+ matchingColumn: string;
14
+ tableName: string;
15
+ };
16
+
17
+ export const boundaryTableSource = async function (
18
+ options: BoundaryTableSourceOptions
19
+ ): Promise<TilejsonResult> {
20
+ const {boundaryId, columns, matchingColumn = 'id', tableName} = options;
21
+ const urlParameters: UrlParameters = {
22
+ boundaryId,
23
+ matchingColumn,
24
+ tableName
25
+ };
26
+
27
+ if (columns) {
28
+ urlParameters.columns = columns.join(',');
29
+ }
30
+ return baseSource<UrlParameters>('boundary', options, urlParameters) as Promise<TilejsonResult>;
31
+ };
@@ -0,0 +1,14 @@
1
+ import {baseSource} from './base-source';
2
+ import type {SourceOptions, TilejsonResult} from './types';
3
+
4
+ export type BoundaryTilesetSourceOptions = SourceOptions & {boundaryId: string};
5
+ type UrlParameters = {boundaryId: string};
6
+
7
+ export const boundaryTilesetSource = async function (
8
+ options: BoundaryTilesetSourceOptions
9
+ ): Promise<TilejsonResult> {
10
+ const {boundaryId} = options;
11
+ const urlParameters: UrlParameters = {boundaryId};
12
+
13
+ return baseSource<UrlParameters>('boundary', options, urlParameters) as Promise<TilejsonResult>;
14
+ };
@@ -1,45 +1,45 @@
1
1
  /* eslint-disable camelcase */
2
- import {cartoBaseSource} from './base-source';
3
- import {
4
- CartoAggregationOptions,
5
- CartoQuerySourceOptions,
6
- CartoSourceOptions,
7
- TilejsonSource
8
- } from './common';
2
+ import {baseSource} from './base-source';
3
+ import type {
4
+ AggregationOptions,
5
+ QuerySourceOptions,
6
+ SourceOptions,
7
+ SpatialDataType,
8
+ TilejsonResult
9
+ } from './types';
9
10
 
10
- export type CartoH3QuerySourceOptions = CartoSourceOptions &
11
- CartoQuerySourceOptions &
12
- CartoAggregationOptions;
11
+ export type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions;
13
12
  type UrlParameters = {
14
13
  aggregationExp: string;
15
14
  aggregationResLevel?: string;
16
- geo_column?: string;
15
+ spatialDataType: SpatialDataType;
16
+ spatialDataColumn?: string;
17
17
  q: string;
18
18
  queryParameters?: string;
19
19
  };
20
20
 
21
- const cartoH3QuerySource: TilejsonSource<CartoH3QuerySourceOptions> = async function (
22
- options: CartoH3QuerySourceOptions
23
- ): Promise<any> {
21
+ export const h3QuerySource = async function (
22
+ options: H3QuerySourceOptions
23
+ ): Promise<TilejsonResult> {
24
24
  const {
25
25
  aggregationExp,
26
26
  aggregationResLevel = 4,
27
27
  sqlQuery,
28
- spatialDataColumn = 'h3:h3',
28
+ spatialDataColumn = 'h3',
29
29
  queryParameters
30
30
  } = options;
31
- const urlParameters: UrlParameters = {aggregationExp, q: sqlQuery};
31
+ const urlParameters: UrlParameters = {
32
+ aggregationExp,
33
+ spatialDataColumn,
34
+ spatialDataType: 'h3',
35
+ q: sqlQuery
36
+ };
32
37
 
33
38
  if (aggregationResLevel) {
34
39
  urlParameters.aggregationResLevel = String(aggregationResLevel);
35
40
  }
36
- if (spatialDataColumn) {
37
- urlParameters.geo_column = spatialDataColumn;
38
- }
39
41
  if (queryParameters) {
40
42
  urlParameters.queryParameters = JSON.stringify(queryParameters);
41
43
  }
42
- return cartoBaseSource<UrlParameters>('query', options, urlParameters);
44
+ return baseSource<UrlParameters>('query', options, urlParameters) as Promise<TilejsonResult>;
43
45
  };
44
-
45
- export {cartoH3QuerySource};
@@ -1,35 +1,40 @@
1
1
  /* eslint-disable camelcase */
2
- import {cartoBaseSource} from './base-source';
3
- import {
4
- CartoAggregationOptions,
5
- CartoSourceOptions,
6
- CartoTableSourceOptions,
7
- TilejsonSource
8
- } from './common';
2
+ import {baseSource} from './base-source';
3
+ import type {
4
+ AggregationOptions,
5
+ SourceOptions,
6
+ SpatialDataType,
7
+ TableSourceOptions,
8
+ TilejsonResult
9
+ } from './types';
9
10
 
10
- export type CartoH3TableSourceOptions = CartoSourceOptions &
11
- CartoTableSourceOptions &
12
- CartoAggregationOptions;
11
+ export type H3TableSourceOptions = SourceOptions & TableSourceOptions & AggregationOptions;
13
12
 
14
13
  type UrlParameters = {
15
14
  aggregationExp: string;
16
15
  aggregationResLevel?: string;
17
16
  columns?: string;
18
- geo_column?: string;
17
+ spatialDataType: SpatialDataType;
18
+ spatialDataColumn?: string;
19
19
  name: string;
20
20
  };
21
21
 
22
- const cartoH3TableSource: TilejsonSource<CartoH3TableSourceOptions> = async function (
23
- options: CartoH3TableSourceOptions
24
- ): Promise<any> {
22
+ export const h3TableSource = async function (
23
+ options: H3TableSourceOptions
24
+ ): Promise<TilejsonResult> {
25
25
  const {
26
26
  aggregationExp,
27
27
  aggregationResLevel = 4,
28
28
  columns,
29
- spatialDataColumn = 'h3:h3',
29
+ spatialDataColumn = 'h3',
30
30
  tableName
31
31
  } = options;
32
- const urlParameters: UrlParameters = {aggregationExp, name: tableName};
32
+ const urlParameters: UrlParameters = {
33
+ aggregationExp,
34
+ name: tableName,
35
+ spatialDataColumn,
36
+ spatialDataType: 'h3'
37
+ };
33
38
 
34
39
  if (aggregationResLevel) {
35
40
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -37,10 +42,5 @@ const cartoH3TableSource: TilejsonSource<CartoH3TableSourceOptions> = async func
37
42
  if (columns) {
38
43
  urlParameters.columns = columns.join(',');
39
44
  }
40
- if (spatialDataColumn) {
41
- urlParameters.geo_column = spatialDataColumn;
42
- }
43
- return cartoBaseSource<UrlParameters>('table', options, urlParameters);
45
+ return baseSource<UrlParameters>('table', options, urlParameters) as Promise<TilejsonResult>;
44
46
  };
45
-
46
- export {cartoH3TableSource};
@@ -1,16 +1,14 @@
1
- import {cartoBaseSource} from './base-source';
2
- import {CartoSourceOptions, CartoTilesetSourceOptions, TilejsonSource} from './common';
1
+ import {baseSource} from './base-source';
2
+ import type {SourceOptions, TilejsonResult, TilesetSourceOptions} from './types';
3
3
 
4
- export type CartoH3TilesetSourceOptions = CartoSourceOptions & CartoTilesetSourceOptions;
4
+ export type H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
5
5
  type UrlParameters = {name: string};
6
6
 
7
- const cartoH3TilesetSource: TilejsonSource<CartoH3TilesetSourceOptions> = async function (
8
- options: CartoH3TilesetSourceOptions
9
- ): Promise<any> {
7
+ export const h3TilesetSource = async function (
8
+ options: H3TilesetSourceOptions
9
+ ): Promise<TilejsonResult> {
10
10
  const {tableName} = options;
11
11
  const urlParameters: UrlParameters = {name: tableName};
12
12
 
13
- return cartoBaseSource<UrlParameters>('tileset', options, urlParameters);
13
+ return baseSource<UrlParameters>('tileset', options, urlParameters) as Promise<TilejsonResult>;
14
14
  };
15
-
16
- export {cartoH3TilesetSource};
@@ -1,32 +1,41 @@
1
- export {SOURCE_DEFAULTS} from './common';
2
- export type {CartoTilejsonResult, GeojsonResult, JsonResult} from './common';
1
+ export {SOURCE_DEFAULTS} from './base-source';
2
+ export type {TilejsonResult, GeojsonResult, JsonResult} from './types';
3
3
 
4
- export {cartoH3QuerySource} from './h3-query-source';
5
- export type {CartoH3QuerySourceOptions} from './h3-query-source';
4
+ export {boundaryQuerySource} from './boundary-query-source';
5
+ export type {BoundaryQuerySourceOptions} from './boundary-query-source';
6
6
 
7
- export {cartoH3TableSource} from './h3-table-source';
8
- export type {CartoH3TableSourceOptions} from './h3-table-source';
7
+ export {boundaryTableSource} from './boundary-table-source';
8
+ export type {BoundaryTableSourceOptions} from './boundary-table-source';
9
9
 
10
- export {cartoH3TilesetSource} from './h3-tileset-source';
11
- export type {CartoH3TilesetSourceOptions} from './h3-tileset-source';
10
+ export {boundaryTilesetSource} from './boundary-tileset-source';
11
+ export type {BoundaryTilesetSourceOptions} from './boundary-tileset-source';
12
12
 
13
- export {cartoRasterSource} from './raster-source';
14
- export type {CartoRasterSourceOptions} from './raster-source';
13
+ export {h3QuerySource} from './h3-query-source';
14
+ export type {H3QuerySourceOptions} from './h3-query-source';
15
15
 
16
- export {cartoQuadbinQuerySource} from './quadbin-query-source';
17
- export type {CartoQuadbinQuerySourceOptions} from './quadbin-query-source';
16
+ export {h3TableSource} from './h3-table-source';
17
+ export type {H3TableSourceOptions} from './h3-table-source';
18
18
 
19
- export {cartoQuadbinTableSource} from './quadbin-table-source';
20
- export type {CartoQuadbinTableSourceOptions} from './quadbin-table-source';
19
+ export {h3TilesetSource} from './h3-tileset-source';
20
+ export type {H3TilesetSourceOptions} from './h3-tileset-source';
21
21
 
22
- export {cartoQuadbinTilesetSource} from './quadbin-tileset-source';
23
- export type {CartoQuadbinTilesetSourceOptions} from './quadbin-tileset-source';
22
+ export {rasterSource} from './raster-source';
23
+ export type {RasterSourceOptions} from './raster-source';
24
24
 
25
- export {cartoVectorQuerySource} from './vector-query-source';
26
- export type {CartoVectorQuerySourceOptions} from './vector-query-source';
25
+ export {quadbinQuerySource} from './quadbin-query-source';
26
+ export type {QuadbinQuerySourceOptions} from './quadbin-query-source';
27
27
 
28
- export {cartoVectorTableSource} from './vector-table-source';
29
- export type {CartoVectorTableSourceOptions} from './vector-table-source';
28
+ export {quadbinTableSource} from './quadbin-table-source';
29
+ export type {QuadbinTableSourceOptions} from './quadbin-table-source';
30
30
 
31
- export {cartoVectorTilesetSource} from './vector-tileset-source';
32
- export type {CartoVectorTilesetSourceOptions} from './vector-tileset-source';
31
+ export {quadbinTilesetSource} from './quadbin-tileset-source';
32
+ export type {QuadbinTilesetSourceOptions} from './quadbin-tileset-source';
33
+
34
+ export {vectorQuerySource} from './vector-query-source';
35
+ export type {VectorQuerySourceOptions} from './vector-query-source';
36
+
37
+ export {vectorTableSource} from './vector-table-source';
38
+ export type {VectorTableSourceOptions} from './vector-table-source';
39
+
40
+ export {vectorTilesetSource} from './vector-tileset-source';
41
+ export type {VectorTilesetSourceOptions} from './vector-tileset-source';
@@ -1,46 +1,46 @@
1
1
  /* eslint-disable camelcase */
2
- import {cartoBaseSource} from './base-source';
3
- import {
4
- CartoAggregationOptions,
5
- CartoQuerySourceOptions,
6
- CartoSourceOptions,
7
- TilejsonSource
8
- } from './common';
2
+ import {baseSource} from './base-source';
3
+ import type {
4
+ AggregationOptions,
5
+ QuerySourceOptions,
6
+ SourceOptions,
7
+ SpatialDataType,
8
+ TilejsonResult
9
+ } from './types';
9
10
 
10
- export type CartoQuadbinQuerySourceOptions = CartoSourceOptions &
11
- CartoQuerySourceOptions &
12
- CartoAggregationOptions;
11
+ export type QuadbinQuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions;
13
12
 
14
13
  type UrlParameters = {
15
14
  aggregationExp: string;
16
15
  aggregationResLevel?: string;
17
- geo_column?: string;
16
+ spatialDataType: SpatialDataType;
17
+ spatialDataColumn?: string;
18
18
  q: string;
19
19
  queryParameters?: string;
20
20
  };
21
21
 
22
- const cartoQuadbinQuerySource: TilejsonSource<CartoQuadbinQuerySourceOptions> = async function (
23
- options: CartoQuadbinQuerySourceOptions
24
- ): Promise<any> {
22
+ export const quadbinQuerySource = async function (
23
+ options: QuadbinQuerySourceOptions
24
+ ): Promise<TilejsonResult> {
25
25
  const {
26
26
  aggregationExp,
27
27
  aggregationResLevel = 6,
28
28
  sqlQuery,
29
- spatialDataColumn = 'quadbin:quadbin',
29
+ spatialDataColumn = 'quadbin',
30
30
  queryParameters
31
31
  } = options;
32
- const urlParameters: UrlParameters = {aggregationExp, q: sqlQuery};
32
+ const urlParameters: UrlParameters = {
33
+ aggregationExp,
34
+ q: sqlQuery,
35
+ spatialDataColumn,
36
+ spatialDataType: 'quadbin'
37
+ };
33
38
 
34
39
  if (aggregationResLevel) {
35
40
  urlParameters.aggregationResLevel = String(aggregationResLevel);
36
41
  }
37
- if (spatialDataColumn) {
38
- urlParameters.geo_column = spatialDataColumn;
39
- }
40
42
  if (queryParameters) {
41
43
  urlParameters.queryParameters = JSON.stringify(queryParameters);
42
44
  }
43
- return cartoBaseSource<UrlParameters>('query', options, urlParameters);
45
+ return baseSource<UrlParameters>('query', options, urlParameters) as Promise<TilejsonResult>;
44
46
  };
45
-
46
- export {cartoQuadbinQuerySource};
@@ -1,35 +1,41 @@
1
1
  /* eslint-disable camelcase */
2
- import {cartoBaseSource} from './base-source';
3
- import {
4
- CartoAggregationOptions,
5
- CartoSourceOptions,
6
- CartoTableSourceOptions,
7
- TilejsonSource
8
- } from './common';
2
+ import {baseSource} from './base-source';
3
+ import type {
4
+ AggregationOptions,
5
+ SourceOptions,
6
+ SpatialDataType,
7
+ TableSourceOptions,
8
+ TilejsonResult
9
+ } from './types';
9
10
 
10
- export type CartoQuadbinTableSourceOptions = CartoSourceOptions &
11
- CartoTableSourceOptions &
12
- CartoAggregationOptions;
11
+ export type QuadbinTableSourceOptions = SourceOptions & TableSourceOptions & AggregationOptions;
13
12
 
14
13
  type UrlParameters = {
15
14
  aggregationExp: string;
16
15
  aggregationResLevel?: string;
17
16
  columns?: string;
18
- geo_column?: string;
17
+ spatialDataType: SpatialDataType;
18
+ spatialDataColumn?: string;
19
19
  name: string;
20
20
  };
21
21
 
22
- const cartoQuadbinTableSource: TilejsonSource<CartoQuadbinTableSourceOptions> = async function (
23
- options: CartoQuadbinTableSourceOptions
24
- ): Promise<any> {
22
+ export const quadbinTableSource = async function (
23
+ options: QuadbinTableSourceOptions
24
+ ): Promise<TilejsonResult> {
25
25
  const {
26
26
  aggregationExp,
27
27
  aggregationResLevel = 6,
28
28
  columns,
29
- spatialDataColumn = 'quadbin:quadbin',
29
+ spatialDataColumn = 'quadbin',
30
30
  tableName
31
31
  } = options;
32
- const urlParameters: UrlParameters = {aggregationExp, name: tableName};
32
+
33
+ const urlParameters: UrlParameters = {
34
+ aggregationExp,
35
+ name: tableName,
36
+ spatialDataColumn,
37
+ spatialDataType: 'quadbin'
38
+ };
33
39
 
34
40
  if (aggregationResLevel) {
35
41
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -37,10 +43,5 @@ const cartoQuadbinTableSource: TilejsonSource<CartoQuadbinTableSourceOptions> =
37
43
  if (columns) {
38
44
  urlParameters.columns = columns.join(',');
39
45
  }
40
- if (spatialDataColumn) {
41
- urlParameters.geo_column = spatialDataColumn;
42
- }
43
- return cartoBaseSource<UrlParameters>('table', options, urlParameters);
46
+ return baseSource<UrlParameters>('table', options, urlParameters) as Promise<TilejsonResult>;
44
47
  };
45
-
46
- export {cartoQuadbinTableSource};