@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,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
|
-
|
|
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
|
-
|
|
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 |
|
|
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
|
-
|
|
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 ===
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
+
SourceOptionalOptions,
|
|
10
|
+
SourceRequiredOptions,
|
|
10
11
|
Tilejson,
|
|
11
|
-
TilejsonMapInstantiation
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
TilejsonMapInstantiation,
|
|
13
|
+
TilejsonResult
|
|
14
|
+
} from './types';
|
|
14
15
|
|
|
15
|
-
export
|
|
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<
|
|
25
|
+
options: Partial<SourceOptionalOptions> & SourceRequiredOptions,
|
|
18
26
|
urlParameters: UrlParameters
|
|
19
|
-
): Promise<
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
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
|
-
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
11
|
-
CartoQuerySourceOptions &
|
|
12
|
-
CartoAggregationOptions;
|
|
11
|
+
export type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions;
|
|
13
12
|
type UrlParameters = {
|
|
14
13
|
aggregationExp: string;
|
|
15
14
|
aggregationResLevel?: string;
|
|
16
|
-
|
|
15
|
+
spatialDataType: SpatialDataType;
|
|
16
|
+
spatialDataColumn?: string;
|
|
17
17
|
q: string;
|
|
18
18
|
queryParameters?: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
options:
|
|
23
|
-
): Promise<
|
|
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
|
|
28
|
+
spatialDataColumn = 'h3',
|
|
29
29
|
queryParameters
|
|
30
30
|
} = options;
|
|
31
|
-
const urlParameters: UrlParameters = {
|
|
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
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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
|
-
|
|
17
|
+
spatialDataType: SpatialDataType;
|
|
18
|
+
spatialDataColumn?: string;
|
|
19
19
|
name: string;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
options:
|
|
24
|
-
): Promise<
|
|
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
|
|
29
|
+
spatialDataColumn = 'h3',
|
|
30
30
|
tableName
|
|
31
31
|
} = options;
|
|
32
|
-
const urlParameters: UrlParameters = {
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
1
|
+
import {baseSource} from './base-source';
|
|
2
|
+
import type {SourceOptions, TilejsonResult, TilesetSourceOptions} from './types';
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
5
5
|
type UrlParameters = {name: string};
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
options:
|
|
9
|
-
): Promise<
|
|
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
|
|
13
|
+
return baseSource<UrlParameters>('tileset', options, urlParameters) as Promise<TilejsonResult>;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
export {cartoH3TilesetSource};
|
package/src/sources/index.ts
CHANGED
|
@@ -1,32 +1,41 @@
|
|
|
1
|
-
export {SOURCE_DEFAULTS} from './
|
|
2
|
-
export type {
|
|
1
|
+
export {SOURCE_DEFAULTS} from './base-source';
|
|
2
|
+
export type {TilejsonResult, GeojsonResult, JsonResult} from './types';
|
|
3
3
|
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
4
|
+
export {boundaryQuerySource} from './boundary-query-source';
|
|
5
|
+
export type {BoundaryQuerySourceOptions} from './boundary-query-source';
|
|
6
6
|
|
|
7
|
-
export {
|
|
8
|
-
export type {
|
|
7
|
+
export {boundaryTableSource} from './boundary-table-source';
|
|
8
|
+
export type {BoundaryTableSourceOptions} from './boundary-table-source';
|
|
9
9
|
|
|
10
|
-
export {
|
|
11
|
-
export type {
|
|
10
|
+
export {boundaryTilesetSource} from './boundary-tileset-source';
|
|
11
|
+
export type {BoundaryTilesetSourceOptions} from './boundary-tileset-source';
|
|
12
12
|
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
13
|
+
export {h3QuerySource} from './h3-query-source';
|
|
14
|
+
export type {H3QuerySourceOptions} from './h3-query-source';
|
|
15
15
|
|
|
16
|
-
export {
|
|
17
|
-
export type {
|
|
16
|
+
export {h3TableSource} from './h3-table-source';
|
|
17
|
+
export type {H3TableSourceOptions} from './h3-table-source';
|
|
18
18
|
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
19
|
+
export {h3TilesetSource} from './h3-tileset-source';
|
|
20
|
+
export type {H3TilesetSourceOptions} from './h3-tileset-source';
|
|
21
21
|
|
|
22
|
-
export {
|
|
23
|
-
export type {
|
|
22
|
+
export {rasterSource} from './raster-source';
|
|
23
|
+
export type {RasterSourceOptions} from './raster-source';
|
|
24
24
|
|
|
25
|
-
export {
|
|
26
|
-
export type {
|
|
25
|
+
export {quadbinQuerySource} from './quadbin-query-source';
|
|
26
|
+
export type {QuadbinQuerySourceOptions} from './quadbin-query-source';
|
|
27
27
|
|
|
28
|
-
export {
|
|
29
|
-
export type {
|
|
28
|
+
export {quadbinTableSource} from './quadbin-table-source';
|
|
29
|
+
export type {QuadbinTableSourceOptions} from './quadbin-table-source';
|
|
30
30
|
|
|
31
|
-
export {
|
|
32
|
-
export type {
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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
|
-
|
|
16
|
+
spatialDataType: SpatialDataType;
|
|
17
|
+
spatialDataColumn?: string;
|
|
18
18
|
q: string;
|
|
19
19
|
queryParameters?: string;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
options:
|
|
24
|
-
): Promise<
|
|
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
|
|
29
|
+
spatialDataColumn = 'quadbin',
|
|
30
30
|
queryParameters
|
|
31
31
|
} = options;
|
|
32
|
-
const urlParameters: UrlParameters = {
|
|
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
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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
|
-
|
|
17
|
+
spatialDataType: SpatialDataType;
|
|
18
|
+
spatialDataColumn?: string;
|
|
19
19
|
name: string;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
options:
|
|
24
|
-
): Promise<
|
|
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
|
|
29
|
+
spatialDataColumn = 'quadbin',
|
|
30
30
|
tableName
|
|
31
31
|
} = options;
|
|
32
|
-
|
|
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
|
-
|
|
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};
|