@deck.gl/carto 8.10.0-alpha.6 → 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 +38 -30
- package/dist/cartoSpatialTile-worker.js +38 -30
- package/dist/cartoVectorTile-worker.js +75 -69
- package/dist/dist.dev.js +14001 -14522
- 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 -46
- package/package.json +11 -10
- 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 +5 -5
- package/src/layers/spatial-index-tile-layer.ts +18 -26
- package/src/layers/utils.ts +71 -0
- package/src/layers/vector-tile-layer.ts +42 -23
- 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
package/src/api/types.ts
CHANGED
|
@@ -1,8 +1,57 @@
|
|
|
1
1
|
import {SCALE_TYPE} from './layer-map';
|
|
2
2
|
|
|
3
|
+
export type Format = 'json' | 'geojson' | 'tilejson';
|
|
4
|
+
export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
5
|
+
export type RequestType = 'Map data' | 'Map instantiation' | 'Public map' | 'Tile stats' | 'SQL';
|
|
6
|
+
export type APIErrorContext = {
|
|
7
|
+
requestType: RequestType;
|
|
8
|
+
mapId?: string;
|
|
9
|
+
connection?: string;
|
|
10
|
+
source?: string;
|
|
11
|
+
type?: MapType;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export enum SchemaFieldType {
|
|
15
|
+
Number = 'number',
|
|
16
|
+
Bigint = 'bigint',
|
|
17
|
+
String = 'string',
|
|
18
|
+
Geometry = 'geometry',
|
|
19
|
+
Timestamp = 'timestamp',
|
|
20
|
+
Object = 'object',
|
|
21
|
+
Boolean = 'boolean',
|
|
22
|
+
Variant = 'variant',
|
|
23
|
+
Unknown = 'unknown'
|
|
24
|
+
}
|
|
25
|
+
export interface SchemaField {
|
|
26
|
+
name: string;
|
|
27
|
+
type: SchemaFieldType; // Field type in the CARTO stack, common for all providers
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface MapInstantiation extends MapInstantiationFormats {
|
|
31
|
+
nrows: number;
|
|
32
|
+
size?: number;
|
|
33
|
+
schema: SchemaField[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type MapInstantiationFormats = Record<
|
|
37
|
+
Format,
|
|
38
|
+
{
|
|
39
|
+
url: string[];
|
|
40
|
+
error?: any;
|
|
41
|
+
}
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
export type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
|
|
45
|
+
|
|
46
|
+
export type NamedQueryParameter = Record<string, QueryParameterValue>;
|
|
47
|
+
|
|
48
|
+
export type PositionalQueryParameter = QueryParameterValue[];
|
|
49
|
+
|
|
50
|
+
export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
3
51
|
export type VisualChannelField = {
|
|
4
52
|
name: string;
|
|
5
53
|
type: string;
|
|
54
|
+
colorColumn?: string;
|
|
6
55
|
};
|
|
7
56
|
|
|
8
57
|
export type VisualChannels = {
|
package/src/index.ts
CHANGED
|
@@ -1,53 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {default as H3TileLayer} from './layers/h3-tile-layer';
|
|
2
|
+
import {default as _PointLabelLayer} from './layers/point-label-layer';
|
|
3
|
+
import {default as QuadbinTileLayer} from './layers/quadbin-tile-layer';
|
|
4
|
+
import {default as RasterTileLayer} from './layers/raster-tile-layer';
|
|
5
|
+
import {default as VectorTileLayer} from './layers/vector-tile-layer';
|
|
6
|
+
const CARTO_LAYERS = {
|
|
7
|
+
H3TileLayer,
|
|
8
|
+
_PointLabelLayer,
|
|
9
|
+
QuadbinTileLayer,
|
|
10
|
+
RasterTileLayer,
|
|
11
|
+
VectorTileLayer
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
CARTO_LAYERS,
|
|
15
|
+
H3TileLayer,
|
|
16
|
+
_PointLabelLayer,
|
|
17
|
+
QuadbinTileLayer,
|
|
18
|
+
RasterTileLayer,
|
|
19
|
+
VectorTileLayer
|
|
20
|
+
};
|
|
21
|
+
|
|
8
22
|
export {default as BASEMAP} from './basemap';
|
|
9
23
|
export {default as colorBins} from './style/color-bins-style';
|
|
10
24
|
export {default as colorCategories} from './style/color-categories-style';
|
|
11
25
|
export {default as colorContinuous} from './style/color-continuous-style';
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mapInstantiation as _mapInstantiation
|
|
26
|
+
export {CartoAPIError, fetchMap, query} from './api';
|
|
27
|
+
export type {
|
|
28
|
+
APIErrorContext,
|
|
29
|
+
FetchMapOptions,
|
|
30
|
+
Format,
|
|
31
|
+
MapType,
|
|
32
|
+
RequestType,
|
|
33
|
+
QueryParameters,
|
|
34
|
+
QueryOptions
|
|
22
35
|
} from './api';
|
|
23
|
-
export type {APIErrorContext, QueryParameters} from './api';
|
|
24
|
-
export type {CartoLayerProps} from './layers/carto-layer';
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
import {
|
|
38
|
+
boundaryQuerySource,
|
|
39
|
+
boundaryTableSource,
|
|
40
|
+
boundaryTilesetSource,
|
|
41
|
+
h3QuerySource,
|
|
42
|
+
h3TableSource,
|
|
43
|
+
h3TilesetSource,
|
|
44
|
+
rasterSource,
|
|
45
|
+
quadbinQuerySource,
|
|
46
|
+
quadbinTableSource,
|
|
47
|
+
quadbinTilesetSource,
|
|
48
|
+
vectorQuerySource,
|
|
49
|
+
vectorTableSource,
|
|
50
|
+
vectorTilesetSource,
|
|
37
51
|
SOURCE_DEFAULTS
|
|
38
52
|
} from './sources';
|
|
53
|
+
|
|
54
|
+
const CARTO_SOURCES = {
|
|
55
|
+
boundaryQuerySource,
|
|
56
|
+
boundaryTableSource,
|
|
57
|
+
boundaryTilesetSource,
|
|
58
|
+
h3QuerySource,
|
|
59
|
+
h3TableSource,
|
|
60
|
+
h3TilesetSource,
|
|
61
|
+
rasterSource,
|
|
62
|
+
quadbinQuerySource,
|
|
63
|
+
quadbinTableSource,
|
|
64
|
+
quadbinTilesetSource,
|
|
65
|
+
vectorQuerySource,
|
|
66
|
+
vectorTableSource,
|
|
67
|
+
vectorTilesetSource
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
boundaryQuerySource,
|
|
72
|
+
boundaryTableSource,
|
|
73
|
+
boundaryTilesetSource,
|
|
74
|
+
h3QuerySource,
|
|
75
|
+
h3TableSource,
|
|
76
|
+
h3TilesetSource,
|
|
77
|
+
rasterSource,
|
|
78
|
+
quadbinQuerySource,
|
|
79
|
+
quadbinTableSource,
|
|
80
|
+
quadbinTilesetSource,
|
|
81
|
+
vectorQuerySource,
|
|
82
|
+
vectorTableSource,
|
|
83
|
+
vectorTilesetSource,
|
|
84
|
+
CARTO_SOURCES,
|
|
85
|
+
SOURCE_DEFAULTS
|
|
86
|
+
};
|
|
87
|
+
|
|
39
88
|
export type {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
89
|
+
TilejsonResult,
|
|
90
|
+
BoundaryQuerySourceOptions,
|
|
91
|
+
BoundaryTableSourceOptions,
|
|
92
|
+
BoundaryTilesetSourceOptions,
|
|
93
|
+
H3QuerySourceOptions,
|
|
94
|
+
H3TableSourceOptions,
|
|
95
|
+
H3TilesetSourceOptions,
|
|
96
|
+
RasterSourceOptions,
|
|
97
|
+
QuadbinQuerySourceOptions,
|
|
98
|
+
QuadbinTableSourceOptions,
|
|
99
|
+
QuadbinTilesetSourceOptions,
|
|
100
|
+
VectorQuerySourceOptions,
|
|
101
|
+
VectorTableSourceOptions,
|
|
102
|
+
VectorTilesetSourceOptions,
|
|
51
103
|
GeojsonResult,
|
|
52
104
|
JsonResult
|
|
53
105
|
} from './sources';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {CompositeLayer, CompositeLayerProps, Layer, LayersList, DefaultProps} from '@deck.gl/core';
|
|
2
|
-
import {H3HexagonLayer} from '@deck.gl/geo-layers';
|
|
2
|
+
import {H3HexagonLayer, H3HexagonLayerProps} from '@deck.gl/geo-layers';
|
|
3
3
|
import H3Tileset2D, {getHexagonResolution} from './h3-tileset-2d';
|
|
4
|
-
import SpatialIndexTileLayer from './spatial-index-tile-layer';
|
|
5
|
-
import {
|
|
6
|
-
import {injectAccessToken} from './utils';
|
|
4
|
+
import SpatialIndexTileLayer, {SpatialIndexTileLayerProps} from './spatial-index-tile-layer';
|
|
5
|
+
import type {TilejsonResult} from '../sources/types';
|
|
6
|
+
import {injectAccessToken, TilejsonPropType} from './utils';
|
|
7
7
|
|
|
8
|
-
const renderSubLayers =
|
|
8
|
+
export const renderSubLayers = props => {
|
|
9
9
|
const {data} = props;
|
|
10
10
|
const {index} = props.tile;
|
|
11
11
|
if (!data || !data.length) return null;
|
|
@@ -17,23 +17,18 @@ const renderSubLayers = (props: H3HexagonLayerProps) => {
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const defaultProps: DefaultProps<
|
|
21
|
-
aggregationResLevel: 4,
|
|
20
|
+
const defaultProps: DefaultProps<H3TileLayerProps> = {
|
|
22
21
|
data: TilejsonPropType
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
/** All properties supported by H3TileLayer. */
|
|
26
|
-
export type H3TileLayerProps<DataT =
|
|
27
|
-
|
|
28
|
-
// TODO: use type from h3-hexagon-layer when available
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
type H3HexagonLayerProps<DataT = any> = Record<string, any>;
|
|
25
|
+
export type H3TileLayerProps<DataT = unknown> = _H3TileLayerProps<DataT> & CompositeLayerProps;
|
|
31
26
|
|
|
32
27
|
/** Properties added by H3TileLayer. */
|
|
33
|
-
type _H3TileLayerProps<DataT> = Omit<H3HexagonLayerProps<DataT>, 'data'> &
|
|
34
|
-
data
|
|
35
|
-
|
|
36
|
-
};
|
|
28
|
+
type _H3TileLayerProps<DataT> = Omit<H3HexagonLayerProps<DataT>, 'data'> &
|
|
29
|
+
Omit<SpatialIndexTileLayerProps<DataT>, 'data'> & {
|
|
30
|
+
data: null | TilejsonResult | Promise<TilejsonResult>;
|
|
31
|
+
};
|
|
37
32
|
|
|
38
33
|
export default class H3TileLayer<DataT = any, ExtraPropsT extends {} = {}> extends CompositeLayer<
|
|
39
34
|
ExtraPropsT & Required<_H3TileLayerProps<DataT>>
|
|
@@ -47,14 +42,14 @@ export default class H3TileLayer<DataT = any, ExtraPropsT extends {} = {}> exten
|
|
|
47
42
|
|
|
48
43
|
getLoadOptions(): any {
|
|
49
44
|
const loadOptions = super.getLoadOptions() || {};
|
|
50
|
-
const tileJSON = this.props.data as
|
|
45
|
+
const tileJSON = this.props.data as TilejsonResult;
|
|
51
46
|
injectAccessToken(loadOptions, tileJSON.accessToken);
|
|
52
47
|
loadOptions.cartoSpatialTile = {...loadOptions.cartoSpatialTile, scheme: 'h3'};
|
|
53
48
|
return loadOptions;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
renderLayers(): Layer | null | LayersList {
|
|
57
|
-
const tileJSON = this.props.data as
|
|
52
|
+
const tileJSON = this.props.data as TilejsonResult;
|
|
58
53
|
if (!tileJSON) return null;
|
|
59
54
|
|
|
60
55
|
const {tiles: data} = tileJSON;
|
|
@@ -56,7 +56,7 @@ const defaultProps: DefaultProps<PointLabelLayerProps> = {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
/** All properties supported by PointLabelLayer. */
|
|
59
|
-
export type PointLabelLayerProps<DataT =
|
|
59
|
+
export type PointLabelLayerProps<DataT = unknown> = _PointLabelLayerProps<DataT> &
|
|
60
60
|
TextLayerProps &
|
|
61
61
|
CompositeLayerProps;
|
|
62
62
|
|
|
@@ -6,11 +6,12 @@ import {
|
|
|
6
6
|
import {getQuadbinPolygon} from './quadbin-utils';
|
|
7
7
|
|
|
8
8
|
const defaultProps: DefaultProps<QuadbinLayerProps> = {
|
|
9
|
-
getQuadbin: {type: 'accessor', value: d => d.quadbin}
|
|
9
|
+
getQuadbin: {type: 'accessor', value: (d: any) => d.quadbin}
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/** All properties supported by QuadbinLayer. */
|
|
13
|
-
export type QuadbinLayerProps<DataT =
|
|
13
|
+
export type QuadbinLayerProps<DataT = unknown> = _QuadbinLayerProps<DataT> &
|
|
14
|
+
GeoCellLayerProps<DataT>;
|
|
14
15
|
|
|
15
16
|
/** Properties added by QuadbinLayer. */
|
|
16
17
|
type _QuadbinLayerProps<DataT> = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {CompositeLayer, CompositeLayerProps, Layer, LayersList, DefaultProps} from '@deck.gl/core';
|
|
2
2
|
import QuadbinLayer, {QuadbinLayerProps} from './quadbin-layer';
|
|
3
3
|
import QuadbinTileset2D from './quadbin-tileset-2d';
|
|
4
|
-
import SpatialIndexTileLayer from './spatial-index-tile-layer';
|
|
4
|
+
import SpatialIndexTileLayer, {SpatialIndexTileLayerProps} from './spatial-index-tile-layer';
|
|
5
5
|
import {hexToBigInt} from 'quadbin';
|
|
6
|
-
import {
|
|
7
|
-
import {injectAccessToken} from './utils';
|
|
6
|
+
import type {TilejsonResult} from '../sources/types';
|
|
7
|
+
import {injectAccessToken, TilejsonPropType} from './utils';
|
|
8
8
|
|
|
9
9
|
export const renderSubLayers = props => {
|
|
10
10
|
const {data} = props;
|
|
@@ -16,19 +16,18 @@ export const renderSubLayers = props => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const defaultProps: DefaultProps<QuadbinTileLayerProps> = {
|
|
19
|
-
aggregationResLevel: 6,
|
|
20
19
|
data: TilejsonPropType
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
/** All properties supported by QuadbinTileLayer. */
|
|
24
|
-
export type QuadbinTileLayerProps<DataT =
|
|
23
|
+
export type QuadbinTileLayerProps<DataT = unknown> = _QuadbinTileLayerProps<DataT> &
|
|
25
24
|
CompositeLayerProps;
|
|
26
25
|
|
|
27
26
|
/** Properties added by QuadbinTileLayer. */
|
|
28
|
-
type _QuadbinTileLayerProps<DataT> = Omit<QuadbinLayerProps<DataT>, 'data'> &
|
|
29
|
-
data
|
|
30
|
-
|
|
31
|
-
};
|
|
27
|
+
type _QuadbinTileLayerProps<DataT> = Omit<QuadbinLayerProps<DataT>, 'data'> &
|
|
28
|
+
Omit<SpatialIndexTileLayerProps<DataT>, 'data'> & {
|
|
29
|
+
data: null | TilejsonResult | Promise<TilejsonResult>;
|
|
30
|
+
};
|
|
32
31
|
|
|
33
32
|
export default class QuadbinTileLayer<
|
|
34
33
|
DataT = any,
|
|
@@ -39,14 +38,14 @@ export default class QuadbinTileLayer<
|
|
|
39
38
|
|
|
40
39
|
getLoadOptions(): any {
|
|
41
40
|
const loadOptions = super.getLoadOptions() || {};
|
|
42
|
-
const tileJSON = this.props.data as
|
|
41
|
+
const tileJSON = this.props.data as TilejsonResult;
|
|
43
42
|
injectAccessToken(loadOptions, tileJSON.accessToken);
|
|
44
43
|
loadOptions.cartoSpatialTile = {...loadOptions.cartoSpatialTile, scheme: 'quadbin'};
|
|
45
44
|
return loadOptions;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
renderLayers(): Layer | null | LayersList {
|
|
49
|
-
const tileJSON = this.props.data as
|
|
48
|
+
const tileJSON = this.props.data as TilejsonResult;
|
|
50
49
|
if (!tileJSON) return null;
|
|
51
50
|
|
|
52
51
|
const {tiles: data, maxresolution: maxZoom} = tileJSON;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import GL from '@luma.gl/constants';
|
|
1
|
+
import {GL} from '@luma.gl/constants';
|
|
2
2
|
import {
|
|
3
3
|
Accessor,
|
|
4
4
|
CompositeLayer,
|
|
@@ -65,7 +65,7 @@ class RasterColumnLayer extends ColumnLayer {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** All properties supported by RasterLayer. */
|
|
68
|
-
export type RasterLayerProps<DataT =
|
|
68
|
+
export type RasterLayerProps<DataT = unknown> = _RasterLayerProps &
|
|
69
69
|
ColumnLayerProps<DataT> &
|
|
70
70
|
CompositeLayerProps;
|
|
71
71
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {CompositeLayer, CompositeLayerProps, DefaultProps, Layer, LayersList} from '@deck.gl/core';
|
|
2
2
|
import RasterLayer, {RasterLayerProps} from './raster-layer';
|
|
3
3
|
import QuadbinTileset2D from './quadbin-tileset-2d';
|
|
4
|
-
import SpatialIndexTileLayer from './spatial-index-tile-layer';
|
|
5
|
-
import {
|
|
6
|
-
import {injectAccessToken} from './utils';
|
|
4
|
+
import SpatialIndexTileLayer, {SpatialIndexTileLayerProps} from './spatial-index-tile-layer';
|
|
5
|
+
import type {TilejsonResult} from '../sources/types';
|
|
6
|
+
import {injectAccessToken, TilejsonPropType} from './utils';
|
|
7
7
|
|
|
8
8
|
export const renderSubLayers = props => {
|
|
9
9
|
const tileIndex = props.tile?.index?.q;
|
|
@@ -16,12 +16,14 @@ const defaultProps: DefaultProps<RasterTileLayerProps> = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/** All properties supported by RasterTileLayer. */
|
|
19
|
-
export type RasterTileLayerProps<DataT =
|
|
19
|
+
export type RasterTileLayerProps<DataT = unknown> = _RasterTileLayerProps<DataT> &
|
|
20
|
+
CompositeLayerProps;
|
|
20
21
|
|
|
21
22
|
/** Properties added by RasterTileLayer. */
|
|
22
|
-
type _RasterTileLayerProps<DataT> = Omit<RasterLayerProps<DataT>, 'data'> &
|
|
23
|
-
data
|
|
24
|
-
|
|
23
|
+
type _RasterTileLayerProps<DataT> = Omit<RasterLayerProps<DataT>, 'data'> &
|
|
24
|
+
Omit<SpatialIndexTileLayerProps<DataT>, 'data'> & {
|
|
25
|
+
data: null | TilejsonResult | Promise<TilejsonResult>;
|
|
26
|
+
};
|
|
25
27
|
|
|
26
28
|
export default class RasterTileLayer<
|
|
27
29
|
DataT = any,
|
|
@@ -32,13 +34,13 @@ export default class RasterTileLayer<
|
|
|
32
34
|
|
|
33
35
|
getLoadOptions(): any {
|
|
34
36
|
const loadOptions = super.getLoadOptions() || {};
|
|
35
|
-
const tileJSON = this.props.data as
|
|
37
|
+
const tileJSON = this.props.data as TilejsonResult;
|
|
36
38
|
injectAccessToken(loadOptions, tileJSON.accessToken);
|
|
37
39
|
return loadOptions;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
renderLayers(): Layer | null | LayersList {
|
|
41
|
-
const tileJSON = this.props.data as
|
|
43
|
+
const tileJSON = this.props.data as TilejsonResult;
|
|
42
44
|
if (!tileJSON) return null;
|
|
43
45
|
|
|
44
46
|
const {tiles: data, minzoom: minZoom, maxzoom: maxZoom} = tileJSON;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
2
|
+
|
|
3
|
+
import {Tile, TileReader} from './carto-properties-tile';
|
|
4
|
+
import {parsePbf} from './tile-loader-utils';
|
|
5
|
+
|
|
6
|
+
const CartoPropertiesTileLoader: LoaderWithParser = {
|
|
7
|
+
name: 'CARTO Properties Tile',
|
|
8
|
+
version: '1',
|
|
9
|
+
id: 'cartoPropertiesTile',
|
|
10
|
+
module: 'carto',
|
|
11
|
+
extensions: ['pbf'],
|
|
12
|
+
mimeTypes: ['application/vnd.carto-properties-tile'],
|
|
13
|
+
category: 'geometry',
|
|
14
|
+
worker: false,
|
|
15
|
+
parse: async (arrayBuffer, options) => parseCartoPropertiesTile(arrayBuffer, options),
|
|
16
|
+
parseSync: parseCartoPropertiesTile,
|
|
17
|
+
options: {}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function parseCartoPropertiesTile(arrayBuffer: ArrayBuffer, options?: LoaderOptions): Tile | null {
|
|
21
|
+
if (!arrayBuffer) return null;
|
|
22
|
+
return parsePbf(arrayBuffer, TileReader);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default CartoPropertiesTileLoader;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {NumericProp, NumericPropKeyValueReader, PropertiesReader} from './carto-tile';
|
|
2
|
+
|
|
3
|
+
// Tile ========================================
|
|
4
|
+
|
|
5
|
+
export interface Tile {
|
|
6
|
+
properties: Record<string, string>[];
|
|
7
|
+
numericProps: Record<string, NumericProp>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class TileReader {
|
|
11
|
+
static read(pbf, end?: number): Tile {
|
|
12
|
+
return pbf.readFields(TileReader._readField, {properties: [], numericProps: {}}, end);
|
|
13
|
+
}
|
|
14
|
+
static _readField(this: void, tag: number, obj: Tile, pbf) {
|
|
15
|
+
if (tag === 1) obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
16
|
+
else if (tag === 2) {
|
|
17
|
+
const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
18
|
+
obj.numericProps[entry.key] = entry.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import earcut from 'earcut';
|
|
2
2
|
import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
3
|
-
import type {
|
|
3
|
+
import type {BinaryFeatureCollection, BinaryPolygonFeature, TypedArray} from '@loaders.gl/schema';
|
|
4
4
|
|
|
5
5
|
import {TileReader} from './carto-tile';
|
|
6
6
|
import {parsePbf} from './tile-loader-utils';
|
|
@@ -37,7 +37,7 @@ const CartoVectorTileLoader: LoaderWithParser = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
function triangulatePolygon(
|
|
40
|
-
polygons:
|
|
40
|
+
polygons: BinaryPolygonFeature,
|
|
41
41
|
target: number[],
|
|
42
42
|
{
|
|
43
43
|
startPosition,
|
|
@@ -65,8 +65,8 @@ function triangulatePolygon(
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
function triangulate(polygons:
|
|
69
|
-
const {polygonIndices,
|
|
68
|
+
function triangulate(polygons: BinaryPolygonFeature) {
|
|
69
|
+
const {polygonIndices, primitivePolygonIndices} = polygons;
|
|
70
70
|
const triangles = [];
|
|
71
71
|
|
|
72
72
|
let rangeStart = 0;
|
|
@@ -88,7 +88,7 @@ function triangulate(polygons: BinaryPolygonFeatures) {
|
|
|
88
88
|
function parseCartoVectorTile(
|
|
89
89
|
arrayBuffer: ArrayBuffer,
|
|
90
90
|
options?: CartoVectorTileLoaderOptions
|
|
91
|
-
):
|
|
91
|
+
): BinaryFeatureCollection | null {
|
|
92
92
|
if (!arrayBuffer) return null;
|
|
93
93
|
const tile = parsePbf(arrayBuffer, TileReader);
|
|
94
94
|
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import {registerLoaders} from '@loaders.gl/core';
|
|
2
|
-
import {DefaultProps
|
|
2
|
+
import {DefaultProps} from '@deck.gl/core';
|
|
3
3
|
import CartoRasterTileLoader from './schema/carto-raster-tile-loader';
|
|
4
4
|
import CartoSpatialTileLoader from './schema/carto-spatial-tile-loader';
|
|
5
5
|
registerLoaders([CartoRasterTileLoader, CartoSpatialTileLoader]);
|
|
6
6
|
|
|
7
7
|
import {PickingInfo} from '@deck.gl/core';
|
|
8
|
-
import {TileLayer, _Tile2DHeader as Tile2DHeader} from '@deck.gl/geo-layers';
|
|
8
|
+
import {TileLayer, _Tile2DHeader as Tile2DHeader, TileLayerProps} from '@deck.gl/geo-layers';
|
|
9
9
|
|
|
10
10
|
function isFeatureIdDefined(value: unknown): boolean {
|
|
11
11
|
return value !== undefined && value !== null && value !== '';
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const defaultProps: DefaultProps<SpatialIndexTileLayerProps> = {
|
|
15
|
-
aggregationResLevel: 4
|
|
16
|
-
};
|
|
14
|
+
const defaultProps: DefaultProps<SpatialIndexTileLayerProps> = {};
|
|
17
15
|
|
|
18
16
|
/** All properties supported by SpatialIndexTileLayer. */
|
|
19
|
-
export type SpatialIndexTileLayerProps<DataT =
|
|
20
|
-
|
|
17
|
+
export type SpatialIndexTileLayerProps<DataT = unknown> = _SpatialIndexTileLayerProps &
|
|
18
|
+
TileLayerProps<DataT>;
|
|
21
19
|
|
|
22
20
|
/** Properties added by SpatialIndexTileLayer. */
|
|
23
|
-
type _SpatialIndexTileLayerProps = {
|
|
24
|
-
aggregationResLevel?: number;
|
|
25
|
-
};
|
|
21
|
+
type _SpatialIndexTileLayerProps = {};
|
|
26
22
|
|
|
27
23
|
export default class SpatialIndexTileLayer<
|
|
28
24
|
DataT = any,
|
|
@@ -31,15 +27,10 @@ export default class SpatialIndexTileLayer<
|
|
|
31
27
|
static layerName = 'SpatialIndexTileLayer';
|
|
32
28
|
static defaultProps = defaultProps;
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.setState({tileset: null});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
super.updateState(params);
|
|
42
|
-
}
|
|
30
|
+
state!: TileLayer<DataT>['state'] & {
|
|
31
|
+
hoveredFeatureId: number | null;
|
|
32
|
+
highlightColor: number[];
|
|
33
|
+
};
|
|
43
34
|
|
|
44
35
|
protected _updateAutoHighlight(info: PickingInfo): void {
|
|
45
36
|
const {hoveredFeatureId} = this.state;
|
|
@@ -79,7 +70,7 @@ export default class SpatialIndexTileLayer<
|
|
|
79
70
|
!isFeatureIdPresent ||
|
|
80
71
|
!Array.isArray(data) ||
|
|
81
72
|
// Quick check for whether id is within tile. data.findIndex is expensive
|
|
82
|
-
!this._featureInTile(tile, hoveredFeatureId)
|
|
73
|
+
!this._featureInTile(tile, hoveredFeatureId!)
|
|
83
74
|
) {
|
|
84
75
|
return -1;
|
|
85
76
|
}
|
|
@@ -88,15 +79,16 @@ export default class SpatialIndexTileLayer<
|
|
|
88
79
|
}
|
|
89
80
|
|
|
90
81
|
_featureInTile(tile: Tile2DHeader, featureId: BigInt | number) {
|
|
91
|
-
const
|
|
92
|
-
const tileZoom = getTileZoom(tile.index);
|
|
82
|
+
const tileset = this.state.tileset!;
|
|
83
|
+
const tileZoom = tileset.getTileZoom(tile.index);
|
|
93
84
|
// @ts-ignore
|
|
94
85
|
const KEY = tile.index.q ? 'q' : 'i';
|
|
95
|
-
|
|
96
|
-
let
|
|
86
|
+
// TODO - Tileset2D methods expect tile index in the shape of {x, y, z}
|
|
87
|
+
let featureIndex: any = {[KEY]: featureId};
|
|
88
|
+
let featureZoom = tileset.getTileZoom(featureIndex);
|
|
97
89
|
while (!(featureZoom <= tileZoom)) {
|
|
98
|
-
featureIndex = getParentIndex(featureIndex);
|
|
99
|
-
featureZoom = getTileZoom(featureIndex);
|
|
90
|
+
featureIndex = tileset.getParentIndex(featureIndex);
|
|
91
|
+
featureZoom = tileset.getTileZoom(featureIndex);
|
|
100
92
|
}
|
|
101
93
|
|
|
102
94
|
return featureIndex[KEY] === tile.index[KEY];
|
package/src/layers/utils.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {Tile as PropertiesTile} from './schema/carto-properties-tile';
|
|
2
|
+
import {Tile as VectorTile} from './schema/carto-tile';
|
|
3
|
+
import {_deepEqual as deepEqual} from '@deck.gl/core';
|
|
4
|
+
import type {TilejsonResult} from '../sources/types';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Adds access token to Authorization header in loadOptions
|
|
3
8
|
*/
|
|
@@ -9,3 +14,69 @@ export function injectAccessToken(loadOptions: any, accessToken: string): void {
|
|
|
9
14
|
};
|
|
10
15
|
}
|
|
11
16
|
}
|
|
17
|
+
|
|
18
|
+
export function mergeBoundaryData(geometry: VectorTile, properties: PropertiesTile): VectorTile {
|
|
19
|
+
const mapping = {};
|
|
20
|
+
for (const {geoid, ...rest} of properties.properties) {
|
|
21
|
+
if (geoid in mapping) {
|
|
22
|
+
throw new Error(`Duplicate geoid key in mapping: ${geoid}`);
|
|
23
|
+
}
|
|
24
|
+
mapping[geoid] = rest;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
for (const type of ['points', 'lines', 'polygons']) {
|
|
28
|
+
const geom = geometry[type];
|
|
29
|
+
if (geom.positions.value.length === 0) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
geom.properties = geom.properties.map(({geoid}) => mapping[geoid]);
|
|
34
|
+
|
|
35
|
+
// numericProps need to be filled to match length of positions buffer
|
|
36
|
+
const {positions, globalFeatureIds} = geom;
|
|
37
|
+
let indices: Uint16Array | Uint32Array | null = null;
|
|
38
|
+
if (type === 'lines') indices = geom.pathIndices.value;
|
|
39
|
+
if (type === 'polygons') indices = geom.polygonIndices.value;
|
|
40
|
+
const length = positions.value.length / positions.size;
|
|
41
|
+
for (const key in properties.numericProps) {
|
|
42
|
+
const sourceProp = properties.numericProps[key].value;
|
|
43
|
+
const TypedArray = sourceProp.constructor as
|
|
44
|
+
| Float32ArrayConstructor
|
|
45
|
+
| Float64ArrayConstructor;
|
|
46
|
+
const destProp = new TypedArray(length);
|
|
47
|
+
geom.numericProps[key] = {value: destProp, size: 1};
|
|
48
|
+
|
|
49
|
+
if (!indices) {
|
|
50
|
+
for (let i = 0; i < length; i++) {
|
|
51
|
+
// points
|
|
52
|
+
const featureId = globalFeatureIds.value[i];
|
|
53
|
+
destProp[i] = sourceProp[featureId];
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
// lines|polygons
|
|
57
|
+
for (let i = 0; i < indices.length - 1; i++) {
|
|
58
|
+
const startIndex = indices[i];
|
|
59
|
+
const endIndex = indices[i + 1];
|
|
60
|
+
const featureId = globalFeatureIds.value[startIndex];
|
|
61
|
+
destProp.fill(sourceProp[featureId], startIndex, endIndex);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return geometry;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const TilejsonPropType = {
|
|
71
|
+
type: 'object' as const,
|
|
72
|
+
value: null as null | TilejsonResult,
|
|
73
|
+
validate: (value: TilejsonResult, propType) =>
|
|
74
|
+
(propType.optional && value === null) ||
|
|
75
|
+
(typeof value === 'object' &&
|
|
76
|
+
Array.isArray(value.tiles) &&
|
|
77
|
+
value.tiles.every(url => typeof url === 'string')),
|
|
78
|
+
equal: (value1, value2) => {
|
|
79
|
+
return deepEqual(value1, value2, 2);
|
|
80
|
+
},
|
|
81
|
+
async: true
|
|
82
|
+
};
|