@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.
- package/dist/cartoRasterTile-worker.js +32 -24
- package/dist/cartoSpatialTile-worker.js +32 -24
- package/dist/cartoVectorTile-worker.js +69 -63
- package/dist/dist.dev.js +12055 -12562
- package/dist/es5/api/carto-api-error.js.map +1 -1
- package/dist/es5/api/common.js +25 -0
- package/dist/es5/api/common.js.map +1 -0
- package/dist/es5/api/endpoints.js +40 -0
- package/dist/es5/api/endpoints.js.map +1 -0
- package/dist/es5/api/fetch-map.js +560 -0
- package/dist/es5/api/fetch-map.js.map +1 -0
- package/dist/es5/api/index.js +5 -49
- package/dist/es5/api/index.js.map +1 -1
- package/dist/es5/api/layer-map.js +43 -45
- package/dist/es5/api/layer-map.js.map +1 -1
- package/dist/es5/api/{parseMap.js → parse-map.js} +5 -3
- package/dist/es5/api/parse-map.js.map +1 -0
- package/dist/es5/api/query.js +78 -0
- package/dist/es5/api/query.js.map +1 -0
- package/dist/es5/{sources/utils.js → api/request-with-parameters.js} +60 -46
- package/dist/es5/api/request-with-parameters.js.map +1 -0
- package/dist/es5/api/types.js +19 -0
- package/dist/es5/api/types.js.map +1 -1
- package/dist/es5/index.js +66 -80
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/layers/h3-tile-layer.js +3 -5
- package/dist/es5/layers/h3-tile-layer.js.map +1 -1
- package/dist/es5/layers/point-label-layer.js.map +1 -1
- package/dist/es5/layers/quadbin-layer.js.map +1 -1
- package/dist/es5/layers/quadbin-tile-layer.js +1 -4
- package/dist/es5/layers/quadbin-tile-layer.js.map +1 -1
- package/dist/es5/layers/raster-layer.js +2 -0
- package/dist/es5/layers/raster-layer.js.map +1 -1
- package/dist/es5/layers/raster-tile-layer.js +1 -3
- package/dist/es5/layers/raster-tile-layer.js.map +1 -1
- package/dist/es5/layers/schema/carto-properties-tile-loader.js +60 -0
- package/dist/es5/layers/schema/carto-properties-tile-loader.js.map +1 -0
- package/dist/es5/layers/schema/carto-properties-tile.js +38 -0
- package/dist/es5/layers/schema/carto-properties-tile.js.map +1 -0
- package/dist/es5/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/es5/layers/schema/carto-raster-tile-loader.js.map +1 -1
- package/dist/es5/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/es5/layers/schema/carto-spatial-tile-loader.js.map +1 -1
- package/dist/es5/layers/schema/carto-vector-tile-loader.js +1 -2
- package/dist/es5/layers/schema/carto-vector-tile-loader.js.map +1 -1
- package/dist/es5/layers/spatial-index-tile-layer.js +16 -26
- package/dist/es5/layers/spatial-index-tile-layer.js.map +1 -1
- package/dist/es5/layers/utils.js +102 -0
- package/dist/es5/layers/utils.js.map +1 -1
- package/dist/es5/layers/vector-tile-layer.js +112 -27
- package/dist/es5/layers/vector-tile-layer.js.map +1 -1
- package/dist/es5/sources/base-source.js +56 -28
- package/dist/es5/sources/base-source.js.map +1 -1
- package/dist/es5/sources/boundary-query-source.js +51 -0
- package/dist/es5/sources/boundary-query-source.js.map +1 -0
- package/dist/es5/sources/boundary-table-source.js +51 -0
- package/dist/es5/sources/boundary-table-source.js.map +1 -0
- package/dist/es5/sources/boundary-tileset-source.js +43 -0
- package/dist/es5/sources/boundary-tileset-source.js.map +1 -0
- package/dist/es5/sources/h3-query-source.js +9 -11
- package/dist/es5/sources/h3-query-source.js.map +1 -1
- package/dist/es5/sources/h3-table-source.js +10 -12
- package/dist/es5/sources/h3-table-source.js.map +1 -1
- package/dist/es5/sources/h3-tileset-source.js +5 -5
- package/dist/es5/sources/h3-tileset-source.js.map +1 -1
- package/dist/es5/sources/index.js +46 -22
- package/dist/es5/sources/index.js.map +1 -1
- package/dist/es5/sources/quadbin-query-source.js +10 -12
- package/dist/es5/sources/quadbin-query-source.js.map +1 -1
- package/dist/es5/sources/quadbin-table-source.js +10 -12
- package/dist/es5/sources/quadbin-table-source.js.map +1 -1
- package/dist/es5/sources/quadbin-tileset-source.js +5 -5
- package/dist/es5/sources/quadbin-tileset-source.js.map +1 -1
- package/dist/es5/sources/raster-source.js +5 -5
- package/dist/es5/sources/raster-source.js.map +1 -1
- package/dist/es5/sources/types.js +2 -0
- package/dist/es5/sources/types.js.map +1 -0
- package/dist/es5/sources/vector-query-source.js +11 -12
- package/dist/es5/sources/vector-query-source.js.map +1 -1
- package/dist/es5/sources/vector-table-source.js +12 -13
- package/dist/es5/sources/vector-table-source.js.map +1 -1
- package/dist/es5/sources/vector-tileset-source.js +5 -5
- package/dist/es5/sources/vector-tileset-source.js.map +1 -1
- package/dist/es5/style/color-bins-style.js +4 -2
- package/dist/es5/style/color-bins-style.js.map +1 -1
- package/dist/es5/style/color-categories-style.js +4 -2
- package/dist/es5/style/color-categories-style.js.map +1 -1
- package/dist/es5/style/color-continuous-style.js +4 -2
- package/dist/es5/style/color-continuous-style.js.map +1 -1
- package/dist/es5/style/palette.js +1 -1
- package/dist/es5/style/palette.js.map +1 -1
- package/dist/es5/style/utils.js +4 -11
- package/dist/es5/style/utils.js.map +1 -1
- package/dist/es5/utils.js +30 -1
- package/dist/es5/utils.js.map +1 -1
- package/dist/esm/api/carto-api-error.js.map +1 -1
- package/dist/esm/api/common.js +13 -0
- package/dist/esm/api/common.js.map +1 -0
- package/dist/esm/api/endpoints.js +28 -0
- package/dist/esm/api/endpoints.js.map +1 -0
- package/dist/esm/api/fetch-map.js +291 -0
- package/dist/esm/api/fetch-map.js.map +1 -0
- package/dist/esm/api/index.js +2 -3
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/layer-map.js +43 -35
- package/dist/esm/api/layer-map.js.map +1 -1
- package/dist/esm/api/{parseMap.js → parse-map.js} +3 -2
- package/dist/esm/api/parse-map.js.map +1 -0
- package/dist/esm/api/query.js +38 -0
- package/dist/esm/api/query.js.map +1 -0
- package/dist/esm/{sources/utils.js → api/request-with-parameters.js} +25 -12
- package/dist/esm/api/request-with-parameters.js.map +1 -0
- package/dist/esm/api/types.js +13 -1
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/index.js +31 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layers/h3-tile-layer.js +2 -6
- package/dist/esm/layers/h3-tile-layer.js.map +1 -1
- package/dist/esm/layers/point-label-layer.js.map +1 -1
- package/dist/esm/layers/quadbin-layer.js.map +1 -1
- package/dist/esm/layers/quadbin-tile-layer.js +1 -3
- package/dist/esm/layers/quadbin-tile-layer.js.map +1 -1
- package/dist/esm/layers/raster-layer.js +1 -0
- package/dist/esm/layers/raster-layer.js.map +1 -1
- package/dist/esm/layers/raster-tile-layer.js +1 -2
- package/dist/esm/layers/raster-tile-layer.js.map +1 -1
- package/dist/esm/layers/schema/carto-properties-tile-loader.js +23 -0
- package/dist/esm/layers/schema/carto-properties-tile-loader.js.map +1 -0
- package/dist/esm/layers/schema/carto-properties-tile.js +18 -0
- package/dist/esm/layers/schema/carto-properties-tile.js.map +1 -0
- package/dist/esm/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/esm/layers/schema/carto-raster-tile-loader.js.map +1 -1
- package/dist/esm/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/esm/layers/schema/carto-spatial-tile-loader.js.map +1 -1
- package/dist/esm/layers/schema/carto-vector-tile-loader.js +1 -2
- package/dist/esm/layers/schema/carto-vector-tile-loader.js.map +1 -1
- package/dist/esm/layers/spatial-index-tile-layer.js +9 -24
- package/dist/esm/layers/spatial-index-tile-layer.js.map +1 -1
- package/dist/esm/layers/utils.js +70 -0
- package/dist/esm/layers/utils.js.map +1 -1
- package/dist/esm/layers/vector-tile-layer.js +40 -12
- package/dist/esm/layers/vector-tile-layer.js.map +1 -1
- package/dist/esm/sources/base-source.js +33 -10
- package/dist/esm/sources/base-source.js.map +1 -1
- package/dist/esm/sources/boundary-query-source.js +21 -0
- package/dist/esm/sources/boundary-query-source.js.map +1 -0
- package/dist/esm/sources/boundary-table-source.js +21 -0
- package/dist/esm/sources/boundary-table-source.js.map +1 -0
- package/dist/esm/sources/boundary-tileset-source.js +11 -0
- package/dist/esm/sources/boundary-tileset-source.js.map +1 -0
- package/dist/esm/sources/h3-query-source.js +6 -11
- package/dist/esm/sources/h3-query-source.js.map +1 -1
- package/dist/esm/sources/h3-table-source.js +7 -12
- package/dist/esm/sources/h3-table-source.js.map +1 -1
- package/dist/esm/sources/h3-tileset-source.js +3 -6
- package/dist/esm/sources/h3-tileset-source.js.map +1 -1
- package/dist/esm/sources/index.js +14 -11
- package/dist/esm/sources/index.js.map +1 -1
- package/dist/esm/sources/quadbin-query-source.js +7 -12
- package/dist/esm/sources/quadbin-query-source.js.map +1 -1
- package/dist/esm/sources/quadbin-table-source.js +7 -12
- package/dist/esm/sources/quadbin-table-source.js.map +1 -1
- package/dist/esm/sources/quadbin-tileset-source.js +3 -6
- package/dist/esm/sources/quadbin-tileset-source.js.map +1 -1
- package/dist/esm/sources/raster-source.js +3 -6
- package/dist/esm/sources/raster-source.js.map +1 -1
- package/dist/esm/sources/types.js +2 -0
- package/dist/esm/sources/types.js.map +1 -0
- package/dist/esm/sources/vector-query-source.js +6 -11
- package/dist/esm/sources/vector-query-source.js.map +1 -1
- package/dist/esm/sources/vector-table-source.js +7 -12
- package/dist/esm/sources/vector-table-source.js.map +1 -1
- package/dist/esm/sources/vector-tileset-source.js +3 -6
- package/dist/esm/sources/vector-tileset-source.js.map +1 -1
- package/dist/esm/style/color-bins-style.js +2 -1
- package/dist/esm/style/color-bins-style.js.map +1 -1
- package/dist/esm/style/color-categories-style.js +2 -1
- package/dist/esm/style/color-categories-style.js.map +1 -1
- package/dist/esm/style/color-continuous-style.js +2 -1
- package/dist/esm/style/color-continuous-style.js.map +1 -1
- package/dist/esm/style/palette.js +1 -1
- package/dist/esm/style/palette.js.map +1 -1
- package/dist/esm/style/utils.js +1 -5
- package/dist/esm/style/utils.js.map +1 -1
- package/dist/esm/utils.js +24 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist.min.js +42 -41
- package/package.json +10 -9
- package/src/.DS_Store +0 -0
- package/src/api/carto-api-error.ts +1 -9
- package/src/api/common.ts +14 -0
- package/src/api/endpoints.ts +38 -0
- package/src/api/fetch-map.ts +287 -0
- package/src/api/index.ts +5 -5
- package/src/api/layer-map.ts +40 -36
- package/src/api/{parseMap.ts → parse-map.ts} +2 -2
- package/src/api/query.ts +34 -0
- package/src/{sources/utils.ts → api/request-with-parameters.ts} +22 -17
- package/src/api/types.ts +49 -0
- package/src/index.ts +93 -41
- package/src/layers/h3-tile-layer.ts +13 -18
- package/src/layers/point-label-layer.ts +1 -1
- package/src/layers/quadbin-layer.ts +3 -2
- package/src/layers/quadbin-tile-layer.ts +10 -11
- package/src/layers/raster-layer.ts +2 -2
- package/src/layers/raster-tile-layer.ts +11 -9
- package/src/layers/schema/carto-properties-tile-loader.ts +25 -0
- package/src/layers/schema/carto-properties-tile.ts +21 -0
- package/src/layers/schema/carto-vector-tile-loader.ts +1 -1
- package/src/layers/spatial-index-tile-layer.ts +18 -26
- package/src/layers/utils.ts +71 -0
- package/src/layers/vector-tile-layer.ts +40 -21
- package/src/sources/base-source.ts +35 -18
- package/src/sources/boundary-query-source.ts +31 -0
- package/src/sources/boundary-table-source.ts +31 -0
- package/src/sources/boundary-tileset-source.ts +14 -0
- package/src/sources/h3-query-source.ts +22 -22
- package/src/sources/h3-table-source.ts +22 -22
- package/src/sources/h3-tileset-source.ts +7 -9
- package/src/sources/index.ts +31 -22
- package/src/sources/quadbin-query-source.ts +22 -22
- package/src/sources/quadbin-table-source.ts +23 -22
- package/src/sources/quadbin-tileset-source.ts +7 -9
- package/src/sources/raster-source.ts +5 -9
- package/src/sources/types.ts +98 -0
- package/src/sources/vector-query-source.ts +15 -15
- package/src/sources/vector-table-source.ts +15 -15
- package/src/sources/vector-tileset-source.ts +7 -9
- package/src/style/color-bins-style.ts +2 -1
- package/src/style/color-categories-style.ts +2 -1
- package/src/style/color-continuous-style.ts +2 -1
- package/src/style/palette.ts +1 -1
- package/src/style/utils.ts +1 -6
- package/src/utils.ts +25 -1
- package/typed/api/carto-api-error.d.ts +1 -8
- package/typed/api/carto-api-error.d.ts.map +1 -1
- package/typed/api/common.d.ts +13 -0
- package/typed/api/common.d.ts.map +1 -0
- package/typed/api/endpoints.d.ts +12 -0
- package/typed/api/endpoints.d.ts.map +1 -0
- package/typed/api/fetch-map.d.ts +22 -0
- package/typed/api/fetch-map.d.ts.map +1 -0
- package/typed/api/index.d.ts +5 -5
- package/typed/api/index.d.ts.map +1 -1
- package/typed/api/layer-map.d.ts +6 -9
- package/typed/api/layer-map.d.ts.map +1 -1
- package/typed/api/{parseMap.d.ts → parse-map.d.ts} +1 -1
- package/typed/api/parse-map.d.ts.map +1 -0
- package/typed/api/query.d.ts +4 -0
- package/typed/api/query.d.ts.map +1 -0
- package/typed/api/request-with-parameters.d.ts +9 -0
- package/typed/api/request-with-parameters.d.ts.map +1 -0
- package/typed/api/types.d.ts +40 -0
- package/typed/api/types.d.ts.map +1 -1
- package/typed/index.d.ts +33 -12
- package/typed/index.d.ts.map +1 -1
- package/typed/layers/h3-tile-layer.d.ts +12 -7
- package/typed/layers/h3-tile-layer.d.ts.map +1 -1
- package/typed/layers/point-label-layer.d.ts +2 -2
- package/typed/layers/point-label-layer.d.ts.map +1 -1
- package/typed/layers/quadbin-layer.d.ts +2 -2
- package/typed/layers/quadbin-layer.d.ts.map +1 -1
- package/typed/layers/quadbin-tile-layer.d.ts +6 -6
- package/typed/layers/quadbin-tile-layer.d.ts.map +1 -1
- package/typed/layers/raster-layer.d.ts +2 -2
- package/typed/layers/raster-layer.d.ts.map +1 -1
- package/typed/layers/raster-tile-layer.d.ts +6 -5
- package/typed/layers/raster-tile-layer.d.ts.map +1 -1
- package/typed/layers/schema/carto-properties-tile-loader.d.ts +4 -0
- package/typed/layers/schema/carto-properties-tile-loader.d.ts.map +1 -0
- package/typed/layers/schema/carto-properties-tile.d.ts +10 -0
- package/typed/layers/schema/carto-properties-tile.d.ts.map +1 -0
- package/typed/layers/spatial-index-tile-layer.d.ts +10 -9
- package/typed/layers/spatial-index-tile-layer.d.ts.map +1 -1
- package/typed/layers/utils.d.ts +11 -0
- package/typed/layers/utils.d.ts.map +1 -1
- package/typed/layers/vector-tile-layer.d.ts +6 -11
- package/typed/layers/vector-tile-layer.d.ts.map +1 -1
- package/typed/sources/base-source.d.ts +4 -3
- package/typed/sources/base-source.d.ts.map +1 -1
- package/typed/sources/boundary-query-source.d.ts +10 -0
- package/typed/sources/boundary-query-source.d.ts.map +1 -0
- package/typed/sources/boundary-table-source.d.ts +9 -0
- package/typed/sources/boundary-table-source.d.ts.map +1 -0
- package/typed/sources/boundary-tileset-source.d.ts +6 -0
- package/typed/sources/boundary-tileset-source.d.ts.map +1 -0
- package/typed/sources/h3-query-source.d.ts +3 -4
- package/typed/sources/h3-query-source.d.ts.map +1 -1
- package/typed/sources/h3-table-source.d.ts +3 -4
- package/typed/sources/h3-table-source.d.ts.map +1 -1
- package/typed/sources/h3-tileset-source.d.ts +3 -4
- package/typed/sources/h3-tileset-source.d.ts.map +1 -1
- package/typed/sources/index.d.ts +28 -22
- package/typed/sources/index.d.ts.map +1 -1
- package/typed/sources/quadbin-query-source.d.ts +3 -4
- package/typed/sources/quadbin-query-source.d.ts.map +1 -1
- package/typed/sources/quadbin-table-source.d.ts +3 -4
- package/typed/sources/quadbin-table-source.d.ts.map +1 -1
- package/typed/sources/quadbin-tileset-source.d.ts +3 -4
- package/typed/sources/quadbin-tileset-source.d.ts.map +1 -1
- package/typed/sources/raster-source.d.ts +3 -4
- package/typed/sources/raster-source.d.ts.map +1 -1
- package/typed/sources/{common.d.ts → types.d.ts} +26 -42
- package/typed/sources/types.d.ts.map +1 -0
- package/typed/sources/vector-query-source.d.ts +3 -4
- package/typed/sources/vector-query-source.d.ts.map +1 -1
- package/typed/sources/vector-table-source.d.ts +3 -4
- package/typed/sources/vector-table-source.d.ts.map +1 -1
- package/typed/sources/vector-tileset-source.d.ts +3 -4
- package/typed/sources/vector-tileset-source.d.ts.map +1 -1
- package/typed/style/color-bins-style.d.ts.map +1 -1
- package/typed/style/color-categories-style.d.ts.map +1 -1
- package/typed/style/color-continuous-style.d.ts.map +1 -1
- package/typed/style/utils.d.ts +0 -1
- package/typed/style/utils.d.ts.map +1 -1
- package/typed/utils.d.ts +8 -0
- package/typed/utils.d.ts.map +1 -1
- package/dist/es5/api/maps-api-common.js +0 -77
- package/dist/es5/api/maps-api-common.js.map +0 -1
- package/dist/es5/api/maps-client.js +0 -220
- package/dist/es5/api/maps-client.js.map +0 -1
- package/dist/es5/api/maps-v3-client.js +0 -959
- package/dist/es5/api/maps-v3-client.js.map +0 -1
- package/dist/es5/api/parseMap.js.map +0 -1
- package/dist/es5/config.js +0 -84
- package/dist/es5/config.js.map +0 -1
- package/dist/es5/layers/carto-layer.js +0 -329
- package/dist/es5/layers/carto-layer.js.map +0 -1
- package/dist/es5/sources/common.js +0 -48
- package/dist/es5/sources/common.js.map +0 -1
- package/dist/es5/sources/utils.js.map +0 -1
- package/dist/esm/api/maps-api-common.js +0 -54
- package/dist/esm/api/maps-api-common.js.map +0 -1
- package/dist/esm/api/maps-client.js +0 -148
- package/dist/esm/api/maps-client.js.map +0 -1
- package/dist/esm/api/maps-v3-client.js +0 -638
- package/dist/esm/api/maps-v3-client.js.map +0 -1
- package/dist/esm/api/parseMap.js.map +0 -1
- package/dist/esm/config.js +0 -60
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/layers/carto-layer.js +0 -233
- package/dist/esm/layers/carto-layer.js.map +0 -1
- package/dist/esm/sources/common.js +0 -26
- package/dist/esm/sources/common.js.map +0 -1
- package/dist/esm/sources/utils.js.map +0 -1
- package/src/api/maps-api-common.ts +0 -95
- package/src/api/maps-client.ts +0 -196
- package/src/api/maps-v3-client.ts +0 -659
- package/src/config.ts +0 -70
- package/src/layers/carto-layer.ts +0 -340
- package/src/sources/common.ts +0 -132
- package/typed/api/maps-api-common.d.ts +0 -76
- package/typed/api/maps-api-common.d.ts.map +0 -1
- package/typed/api/maps-client.d.ts +0 -18
- package/typed/api/maps-client.d.ts.map +0 -1
- package/typed/api/maps-v3-client.d.ts +0 -49
- package/typed/api/maps-v3-client.d.ts.map +0 -1
- package/typed/api/parseMap.d.ts.map +0 -1
- package/typed/config.d.ts +0 -28
- package/typed/config.d.ts.map +0 -1
- package/typed/layers/carto-layer.d.ts +0 -126
- package/typed/layers/carto-layer.d.ts.map +0 -1
- package/typed/sources/common.d.ts.map +0 -1
- package/typed/sources/utils.d.ts +0 -15
- package/typed/sources/utils.d.ts.map +0 -1
|
@@ -1,638 +0,0 @@
|
|
|
1
|
-
import { getDefaultCredentials, buildMapsUrlFromBase, buildStatsUrlFromBase } from '../config';
|
|
2
|
-
import { API_VERSIONS, COLUMNS_SUPPORT, encodeParameter, FORMATS, GEO_COLUMN_SUPPORT, MAP_TYPES, REQUEST_TYPES, TILE_FORMATS } from './maps-api-common';
|
|
3
|
-
import { CartoAPIError } from './carto-api-error';
|
|
4
|
-
import { parseMap } from './parseMap';
|
|
5
|
-
import { log } from '@deck.gl/core';
|
|
6
|
-
import { assert } from '../utils';
|
|
7
|
-
const MAX_GET_LENGTH = 8192;
|
|
8
|
-
const DEFAULT_CLIENT = 'deck-gl-carto';
|
|
9
|
-
const V3_MINOR_VERSION = '3.2';
|
|
10
|
-
|
|
11
|
-
async function request({
|
|
12
|
-
method,
|
|
13
|
-
url,
|
|
14
|
-
headers: customHeaders,
|
|
15
|
-
accessToken,
|
|
16
|
-
body,
|
|
17
|
-
errorContext
|
|
18
|
-
}) {
|
|
19
|
-
const headers = { ...customHeaders,
|
|
20
|
-
Accept: 'application/json'
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
if (accessToken) {
|
|
24
|
-
headers.Authorization = `Bearer ${accessToken}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (method === 'POST') {
|
|
28
|
-
headers['Content-Type'] = 'application/json';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
return await fetch(url, {
|
|
33
|
-
method,
|
|
34
|
-
headers,
|
|
35
|
-
body
|
|
36
|
-
});
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw new CartoAPIError(error, errorContext);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function requestJson({
|
|
43
|
-
method,
|
|
44
|
-
url,
|
|
45
|
-
headers,
|
|
46
|
-
accessToken,
|
|
47
|
-
body,
|
|
48
|
-
errorContext
|
|
49
|
-
}) {
|
|
50
|
-
const response = await request({
|
|
51
|
-
method,
|
|
52
|
-
url,
|
|
53
|
-
headers,
|
|
54
|
-
accessToken,
|
|
55
|
-
body,
|
|
56
|
-
errorContext
|
|
57
|
-
});
|
|
58
|
-
let json;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
json = await response.json();
|
|
62
|
-
} catch (error) {
|
|
63
|
-
json = {
|
|
64
|
-
error: ''
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!response.ok) {
|
|
69
|
-
throw new CartoAPIError(json.error, errorContext, response);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return json;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function requestData({
|
|
76
|
-
method,
|
|
77
|
-
url,
|
|
78
|
-
accessToken,
|
|
79
|
-
format,
|
|
80
|
-
body,
|
|
81
|
-
errorContext
|
|
82
|
-
}) {
|
|
83
|
-
const data = await requestJson({
|
|
84
|
-
method,
|
|
85
|
-
url,
|
|
86
|
-
accessToken,
|
|
87
|
-
body,
|
|
88
|
-
errorContext
|
|
89
|
-
});
|
|
90
|
-
return data.rows ? data.rows : data;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function getParameters({
|
|
94
|
-
type,
|
|
95
|
-
source,
|
|
96
|
-
geoColumn,
|
|
97
|
-
columns,
|
|
98
|
-
clientId,
|
|
99
|
-
aggregationExp,
|
|
100
|
-
aggregationResLevel,
|
|
101
|
-
queryParameters
|
|
102
|
-
}) {
|
|
103
|
-
const parameters = {
|
|
104
|
-
client: clientId || DEFAULT_CLIENT,
|
|
105
|
-
v: V3_MINOR_VERSION
|
|
106
|
-
};
|
|
107
|
-
const sourceName = type === MAP_TYPES.QUERY ? 'q' : 'name';
|
|
108
|
-
parameters[sourceName] = source;
|
|
109
|
-
|
|
110
|
-
if (queryParameters) {
|
|
111
|
-
parameters.queryParameters = queryParameters;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (geoColumn) {
|
|
115
|
-
parameters.geo_column = geoColumn;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (columns) {
|
|
119
|
-
parameters.columns = columns.join(',');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (aggregationExp) {
|
|
123
|
-
parameters.aggregationExp = aggregationExp;
|
|
124
|
-
} else if (isSpatialIndexGeoColumn(geoColumn)) {
|
|
125
|
-
parameters.aggregationExp = '1 AS value';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (aggregationResLevel) {
|
|
129
|
-
parameters.aggregationResLevel = aggregationResLevel;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return parameters;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function isSpatialIndexGeoColumn(geoColumn) {
|
|
136
|
-
const spatialIndex = geoColumn === null || geoColumn === void 0 ? void 0 : geoColumn.split(':')[0];
|
|
137
|
-
return spatialIndex === 'h3' || spatialIndex === 'quadbin';
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export async function mapInstantiation({
|
|
141
|
-
type,
|
|
142
|
-
source,
|
|
143
|
-
connection,
|
|
144
|
-
credentials,
|
|
145
|
-
geoColumn,
|
|
146
|
-
columns,
|
|
147
|
-
clientId,
|
|
148
|
-
headers,
|
|
149
|
-
aggregationExp,
|
|
150
|
-
aggregationResLevel,
|
|
151
|
-
queryParameters
|
|
152
|
-
}) {
|
|
153
|
-
const baseUrl = `${credentials.mapsUrl}/${connection}/${type}`;
|
|
154
|
-
const parameters = getParameters({
|
|
155
|
-
type,
|
|
156
|
-
source,
|
|
157
|
-
geoColumn,
|
|
158
|
-
columns,
|
|
159
|
-
clientId,
|
|
160
|
-
aggregationResLevel,
|
|
161
|
-
aggregationExp,
|
|
162
|
-
queryParameters
|
|
163
|
-
});
|
|
164
|
-
const encodedParameters = Object.entries(parameters).map(([key, value]) => {
|
|
165
|
-
if (typeof value !== 'string') {
|
|
166
|
-
value = JSON.stringify(value);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return encodeParameter(key, value);
|
|
170
|
-
});
|
|
171
|
-
const url = `${baseUrl}?${encodedParameters.join('&')}`;
|
|
172
|
-
const {
|
|
173
|
-
accessToken
|
|
174
|
-
} = credentials;
|
|
175
|
-
const errorContext = {
|
|
176
|
-
requestType: REQUEST_TYPES.INSTANTIATION,
|
|
177
|
-
connection,
|
|
178
|
-
type,
|
|
179
|
-
source
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
if (url.length > MAX_GET_LENGTH && type === MAP_TYPES.QUERY) {
|
|
183
|
-
return await requestJson({
|
|
184
|
-
method: 'POST',
|
|
185
|
-
url: baseUrl,
|
|
186
|
-
headers,
|
|
187
|
-
accessToken,
|
|
188
|
-
body: JSON.stringify(parameters),
|
|
189
|
-
errorContext
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return await requestJson({
|
|
194
|
-
url,
|
|
195
|
-
headers,
|
|
196
|
-
accessToken,
|
|
197
|
-
errorContext
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function getUrlFromMetadata(metadata, format) {
|
|
202
|
-
const m = metadata[format];
|
|
203
|
-
|
|
204
|
-
if (m && !m.error && m.url) {
|
|
205
|
-
return m.url[0];
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function checkFetchLayerDataParameters({
|
|
212
|
-
type,
|
|
213
|
-
source,
|
|
214
|
-
connection,
|
|
215
|
-
credentials,
|
|
216
|
-
geoColumn,
|
|
217
|
-
columns,
|
|
218
|
-
aggregationExp,
|
|
219
|
-
aggregationResLevel
|
|
220
|
-
}) {
|
|
221
|
-
assert(connection, 'Must define connection');
|
|
222
|
-
assert(type, 'Must define a type');
|
|
223
|
-
assert(source, 'Must define a source');
|
|
224
|
-
assert(credentials.apiVersion === API_VERSIONS.V3, 'Method only available for v3');
|
|
225
|
-
assert(credentials.apiBaseUrl, 'Must define apiBaseUrl');
|
|
226
|
-
assert(credentials.accessToken, 'Must define an accessToken');
|
|
227
|
-
|
|
228
|
-
if (columns) {
|
|
229
|
-
assert(COLUMNS_SUPPORT.includes(type), `The columns parameter is not supported by type ${type}`);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (geoColumn) {
|
|
233
|
-
assert(GEO_COLUMN_SUPPORT.includes(type), `The geoColumn parameter is not supported by type ${type}`);
|
|
234
|
-
} else {
|
|
235
|
-
assert(!aggregationExp, 'Have aggregationExp, but geoColumn parameter is missing');
|
|
236
|
-
assert(!aggregationResLevel, 'Have aggregationResLevel, but geoColumn parameter is missing');
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export async function fetchLayerData({
|
|
241
|
-
type,
|
|
242
|
-
source,
|
|
243
|
-
connection,
|
|
244
|
-
credentials,
|
|
245
|
-
geoColumn,
|
|
246
|
-
columns,
|
|
247
|
-
format,
|
|
248
|
-
formatTiles,
|
|
249
|
-
clientId,
|
|
250
|
-
headers,
|
|
251
|
-
aggregationExp,
|
|
252
|
-
aggregationResLevel,
|
|
253
|
-
queryParameters
|
|
254
|
-
}) {
|
|
255
|
-
const {
|
|
256
|
-
url,
|
|
257
|
-
accessToken,
|
|
258
|
-
mapFormat,
|
|
259
|
-
metadata
|
|
260
|
-
} = await _fetchDataUrl({
|
|
261
|
-
type,
|
|
262
|
-
source,
|
|
263
|
-
connection,
|
|
264
|
-
credentials,
|
|
265
|
-
geoColumn,
|
|
266
|
-
columns,
|
|
267
|
-
format,
|
|
268
|
-
formatTiles,
|
|
269
|
-
clientId,
|
|
270
|
-
headers,
|
|
271
|
-
aggregationExp,
|
|
272
|
-
aggregationResLevel,
|
|
273
|
-
queryParameters
|
|
274
|
-
});
|
|
275
|
-
const errorContext = {
|
|
276
|
-
requestType: REQUEST_TYPES.DATA,
|
|
277
|
-
connection,
|
|
278
|
-
type,
|
|
279
|
-
source
|
|
280
|
-
};
|
|
281
|
-
const data = await requestData({
|
|
282
|
-
url,
|
|
283
|
-
format: mapFormat,
|
|
284
|
-
accessToken,
|
|
285
|
-
errorContext
|
|
286
|
-
});
|
|
287
|
-
const result = {
|
|
288
|
-
data,
|
|
289
|
-
format: mapFormat,
|
|
290
|
-
schema: metadata.schema
|
|
291
|
-
};
|
|
292
|
-
return result;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
async function _fetchDataUrl({
|
|
296
|
-
type,
|
|
297
|
-
source,
|
|
298
|
-
connection,
|
|
299
|
-
credentials,
|
|
300
|
-
geoColumn,
|
|
301
|
-
columns,
|
|
302
|
-
format,
|
|
303
|
-
formatTiles,
|
|
304
|
-
clientId,
|
|
305
|
-
headers,
|
|
306
|
-
aggregationExp,
|
|
307
|
-
aggregationResLevel,
|
|
308
|
-
queryParameters
|
|
309
|
-
}) {
|
|
310
|
-
const defaultCredentials = getDefaultCredentials();
|
|
311
|
-
const localCreds = { ...(defaultCredentials.apiVersion === API_VERSIONS.V3 && defaultCredentials),
|
|
312
|
-
...credentials
|
|
313
|
-
};
|
|
314
|
-
checkFetchLayerDataParameters({
|
|
315
|
-
type,
|
|
316
|
-
source,
|
|
317
|
-
connection,
|
|
318
|
-
credentials: localCreds,
|
|
319
|
-
geoColumn,
|
|
320
|
-
columns,
|
|
321
|
-
aggregationExp,
|
|
322
|
-
aggregationResLevel
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
if (!localCreds.mapsUrl) {
|
|
326
|
-
localCreds.mapsUrl = buildMapsUrlFromBase(localCreds.apiBaseUrl);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
const metadata = await mapInstantiation({
|
|
330
|
-
type,
|
|
331
|
-
source,
|
|
332
|
-
connection,
|
|
333
|
-
credentials: localCreds,
|
|
334
|
-
geoColumn,
|
|
335
|
-
columns,
|
|
336
|
-
clientId,
|
|
337
|
-
headers,
|
|
338
|
-
aggregationExp,
|
|
339
|
-
aggregationResLevel,
|
|
340
|
-
queryParameters
|
|
341
|
-
});
|
|
342
|
-
let url = null;
|
|
343
|
-
let mapFormat;
|
|
344
|
-
|
|
345
|
-
if (format) {
|
|
346
|
-
mapFormat = format;
|
|
347
|
-
url = getUrlFromMetadata(metadata, format);
|
|
348
|
-
assert(url, `Format ${format} not available`);
|
|
349
|
-
} else {
|
|
350
|
-
const prioritizedFormats = [FORMATS.GEOJSON, FORMATS.JSON, FORMATS.TILEJSON];
|
|
351
|
-
|
|
352
|
-
for (const f of prioritizedFormats) {
|
|
353
|
-
url = getUrlFromMetadata(metadata, f);
|
|
354
|
-
|
|
355
|
-
if (url) {
|
|
356
|
-
mapFormat = f;
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
assert(url && mapFormat, 'Unsupported data formats received from backend.');
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
if (format === FORMATS.TILEJSON && formatTiles) {
|
|
365
|
-
log.assert(Object.values(TILE_FORMATS).includes(formatTiles), `Invalid value for formatTiles: ${formatTiles}. Use value from TILE_FORMATS`);
|
|
366
|
-
url += `&${encodeParameter('formatTiles', formatTiles)}`;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const {
|
|
370
|
-
accessToken
|
|
371
|
-
} = localCreds;
|
|
372
|
-
return {
|
|
373
|
-
url,
|
|
374
|
-
accessToken,
|
|
375
|
-
mapFormat,
|
|
376
|
-
metadata
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
async function _fetchMapDataset(dataset, accessToken, credentials, clientId, headers) {
|
|
381
|
-
const {
|
|
382
|
-
aggregationExp,
|
|
383
|
-
aggregationResLevel,
|
|
384
|
-
connectionName: connection,
|
|
385
|
-
columns,
|
|
386
|
-
format,
|
|
387
|
-
geoColumn,
|
|
388
|
-
source,
|
|
389
|
-
type,
|
|
390
|
-
queryParameters
|
|
391
|
-
} = dataset;
|
|
392
|
-
const {
|
|
393
|
-
url,
|
|
394
|
-
mapFormat
|
|
395
|
-
} = await _fetchDataUrl({
|
|
396
|
-
aggregationExp,
|
|
397
|
-
aggregationResLevel,
|
|
398
|
-
clientId,
|
|
399
|
-
credentials: { ...credentials,
|
|
400
|
-
accessToken
|
|
401
|
-
},
|
|
402
|
-
connection,
|
|
403
|
-
columns,
|
|
404
|
-
format,
|
|
405
|
-
geoColumn,
|
|
406
|
-
headers,
|
|
407
|
-
source,
|
|
408
|
-
type,
|
|
409
|
-
queryParameters
|
|
410
|
-
});
|
|
411
|
-
const cache = parseInt(new URL(url).searchParams.get('cache') || '', 10);
|
|
412
|
-
|
|
413
|
-
if (cache && dataset.cache === cache) {
|
|
414
|
-
return false;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
dataset.cache = cache;
|
|
418
|
-
const errorContext = {
|
|
419
|
-
requestType: REQUEST_TYPES.DATA,
|
|
420
|
-
connection,
|
|
421
|
-
type,
|
|
422
|
-
source
|
|
423
|
-
};
|
|
424
|
-
dataset.data = await requestData({
|
|
425
|
-
url,
|
|
426
|
-
format: mapFormat,
|
|
427
|
-
accessToken,
|
|
428
|
-
errorContext
|
|
429
|
-
});
|
|
430
|
-
return true;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
async function _fetchTilestats(attribute, dataset, accessToken, credentials) {
|
|
434
|
-
const {
|
|
435
|
-
connectionName: connection,
|
|
436
|
-
source,
|
|
437
|
-
type
|
|
438
|
-
} = dataset;
|
|
439
|
-
const statsUrl = buildStatsUrlFromBase(credentials.apiBaseUrl);
|
|
440
|
-
let baseUrl = `${statsUrl}/${connection}/`;
|
|
441
|
-
|
|
442
|
-
if (type === MAP_TYPES.QUERY) {
|
|
443
|
-
baseUrl += attribute;
|
|
444
|
-
} else {
|
|
445
|
-
baseUrl += `${source}/${attribute}`;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const errorContext = {
|
|
449
|
-
requestType: REQUEST_TYPES.TILE_STATS,
|
|
450
|
-
connection,
|
|
451
|
-
type,
|
|
452
|
-
source
|
|
453
|
-
};
|
|
454
|
-
let url = baseUrl;
|
|
455
|
-
|
|
456
|
-
if (type === MAP_TYPES.QUERY) {
|
|
457
|
-
url += `?${encodeParameter('q', source)}`;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
let stats;
|
|
461
|
-
|
|
462
|
-
if (url.length > MAX_GET_LENGTH && type === MAP_TYPES.QUERY) {
|
|
463
|
-
stats = await requestJson({
|
|
464
|
-
method: 'POST',
|
|
465
|
-
url: baseUrl,
|
|
466
|
-
accessToken,
|
|
467
|
-
body: JSON.stringify({
|
|
468
|
-
q: source
|
|
469
|
-
}),
|
|
470
|
-
errorContext
|
|
471
|
-
});
|
|
472
|
-
} else {
|
|
473
|
-
stats = await requestJson({
|
|
474
|
-
url,
|
|
475
|
-
accessToken,
|
|
476
|
-
errorContext
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
const {
|
|
481
|
-
attributes
|
|
482
|
-
} = dataset.data.tilestats.layers[0];
|
|
483
|
-
const index = attributes.findIndex(d => d.attribute === attribute);
|
|
484
|
-
attributes[index] = stats;
|
|
485
|
-
return true;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
async function fillInMapDatasets({
|
|
489
|
-
datasets,
|
|
490
|
-
token
|
|
491
|
-
}, clientId, credentials, headers) {
|
|
492
|
-
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials, clientId, headers));
|
|
493
|
-
return await Promise.all(promises);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
async function fillInTileStats({
|
|
497
|
-
datasets,
|
|
498
|
-
keplerMapConfig,
|
|
499
|
-
token
|
|
500
|
-
}, credentials) {
|
|
501
|
-
const attributes = [];
|
|
502
|
-
const {
|
|
503
|
-
layers
|
|
504
|
-
} = keplerMapConfig.config.visState;
|
|
505
|
-
|
|
506
|
-
for (const layer of layers) {
|
|
507
|
-
for (const channel of Object.keys(layer.visualChannels)) {
|
|
508
|
-
var _layer$visualChannels;
|
|
509
|
-
|
|
510
|
-
const attribute = (_layer$visualChannels = layer.visualChannels[channel]) === null || _layer$visualChannels === void 0 ? void 0 : _layer$visualChannels.name;
|
|
511
|
-
|
|
512
|
-
if (attribute) {
|
|
513
|
-
const dataset = datasets.find(d => d.id === layer.config.dataId);
|
|
514
|
-
|
|
515
|
-
if (dataset.data.tilestats && dataset.type !== MAP_TYPES.TILESET) {
|
|
516
|
-
attributes.push({
|
|
517
|
-
attribute,
|
|
518
|
-
dataset
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
const filteredAttributes = [];
|
|
526
|
-
|
|
527
|
-
for (const a of attributes) {
|
|
528
|
-
if (!filteredAttributes.find(({
|
|
529
|
-
attribute,
|
|
530
|
-
dataset
|
|
531
|
-
}) => attribute === a.attribute && dataset === a.dataset)) {
|
|
532
|
-
filteredAttributes.push(a);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
const promises = filteredAttributes.map(({
|
|
537
|
-
attribute,
|
|
538
|
-
dataset
|
|
539
|
-
}) => _fetchTilestats(attribute, dataset, token, credentials));
|
|
540
|
-
return await Promise.all(promises);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
export async function fetchMap({
|
|
544
|
-
cartoMapId,
|
|
545
|
-
clientId,
|
|
546
|
-
credentials,
|
|
547
|
-
headers,
|
|
548
|
-
autoRefresh,
|
|
549
|
-
onNewData
|
|
550
|
-
}) {
|
|
551
|
-
const defaultCredentials = getDefaultCredentials();
|
|
552
|
-
const localCreds = { ...(defaultCredentials.apiVersion === API_VERSIONS.V3 && defaultCredentials),
|
|
553
|
-
...credentials
|
|
554
|
-
};
|
|
555
|
-
const {
|
|
556
|
-
accessToken
|
|
557
|
-
} = localCreds;
|
|
558
|
-
assert(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
|
|
559
|
-
assert(localCreds.apiVersion === API_VERSIONS.V3, 'Method only available for v3');
|
|
560
|
-
assert(localCreds.apiBaseUrl, 'Must define apiBaseUrl');
|
|
561
|
-
|
|
562
|
-
if (!localCreds.mapsUrl) {
|
|
563
|
-
localCreds.mapsUrl = buildMapsUrlFromBase(localCreds.apiBaseUrl);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
if (autoRefresh || onNewData) {
|
|
567
|
-
assert(onNewData, 'Must define `onNewData` when using autoRefresh');
|
|
568
|
-
assert(typeof onNewData === 'function', '`onNewData` must be a function');
|
|
569
|
-
assert(typeof autoRefresh === 'number' && autoRefresh > 0, '`autoRefresh` must be a positive number');
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
const url = `${localCreds.mapsUrl}/public/${cartoMapId}`;
|
|
573
|
-
const errorContext = {
|
|
574
|
-
requestType: REQUEST_TYPES.PUBLIC_MAP,
|
|
575
|
-
mapId: cartoMapId
|
|
576
|
-
};
|
|
577
|
-
const map = await requestJson({
|
|
578
|
-
url,
|
|
579
|
-
headers,
|
|
580
|
-
accessToken,
|
|
581
|
-
errorContext
|
|
582
|
-
});
|
|
583
|
-
let stopAutoRefresh;
|
|
584
|
-
|
|
585
|
-
if (autoRefresh) {
|
|
586
|
-
const intervalId = setInterval(async () => {
|
|
587
|
-
const changed = await fillInMapDatasets(map, clientId, localCreds, headers);
|
|
588
|
-
|
|
589
|
-
if (onNewData && changed.some(v => v === true)) {
|
|
590
|
-
onNewData(parseMap(map));
|
|
591
|
-
}
|
|
592
|
-
}, autoRefresh * 1000);
|
|
593
|
-
|
|
594
|
-
stopAutoRefresh = () => {
|
|
595
|
-
clearInterval(intervalId);
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
const geojsonLayers = map.keplerMapConfig.config.visState.layers.filter(({
|
|
600
|
-
type
|
|
601
|
-
}) => type === 'geojson' || type === 'point');
|
|
602
|
-
const geojsonDatasetIds = geojsonLayers.map(({
|
|
603
|
-
config
|
|
604
|
-
}) => config.dataId);
|
|
605
|
-
map.datasets.forEach(dataset => {
|
|
606
|
-
if (geojsonDatasetIds.includes(dataset.id)) {
|
|
607
|
-
const {
|
|
608
|
-
config
|
|
609
|
-
} = geojsonLayers.find(({
|
|
610
|
-
config
|
|
611
|
-
}) => config.dataId === dataset.id);
|
|
612
|
-
dataset.format = 'geojson';
|
|
613
|
-
|
|
614
|
-
if (!dataset.geoColumn && config.columns.geojson) {
|
|
615
|
-
dataset.geoColumn = config.columns.geojson;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
await fillInMapDatasets(map, clientId, localCreds, headers);
|
|
620
|
-
await fillInTileStats(map, localCreds);
|
|
621
|
-
const out = { ...parseMap(map),
|
|
622
|
-
...{
|
|
623
|
-
stopAutoRefresh
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
const textLayers = out.layers.filter(layer => {
|
|
627
|
-
const pointType = layer.props.pointType || '';
|
|
628
|
-
return pointType.includes('text');
|
|
629
|
-
});
|
|
630
|
-
|
|
631
|
-
if (textLayers.length && window.FontFace && !document.fonts.check('12px Inter')) {
|
|
632
|
-
const font = new FontFace('Inter', 'url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2)');
|
|
633
|
-
await font.load().then(f => document.fonts.add(f));
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
return out;
|
|
637
|
-
}
|
|
638
|
-
//# sourceMappingURL=maps-v3-client.js.map
|