@luma.gl/graph 10.0.0-alpha.8 → 10.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -4
- package/THIRD-PARTY-NOTICES.md +19 -0
- package/dist/arrow/arrow-colors.cjs +99 -18
- package/dist/arrow/arrow-colors.d.ts +27 -10
- package/dist/arrow/arrow-colors.d.ts.map +1 -1
- package/dist/arrow/arrow-colors.js +107 -24
- package/dist/arrow/arrow-colors.js.map +1 -1
- package/dist/arrow/arrow-utils/arrow-paths.cjs +4 -3
- package/dist/arrow/arrow-utils/arrow-paths.d.ts.map +1 -1
- package/dist/arrow/arrow-utils/arrow-paths.js +5 -4
- package/dist/arrow/arrow-utils/arrow-paths.js.map +1 -1
- package/dist/arrow/cpu/arrow-coordinate-projection.cjs +30 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.d.ts +5 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.js +9 -0
- package/dist/arrow/cpu/arrow-coordinate-projection.js.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.cjs +31 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts +2 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.js +5 -0
- package/dist/arrow/cpu/arrow-cpu-pipelines.js.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.cjs +99 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts +9 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.d.ts.map +1 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.js +100 -0
- package/dist/arrow/cpu/arrow-cpu-vector-adapters.js.map +1 -0
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.cjs +9 -371
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts +8 -28
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.d.ts.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js +4 -381
- package/dist/arrow/geoarrow/arrow-geoarrow-adapter.js.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.cjs +11 -11
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts +2 -0
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.d.ts.map +1 -1
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js +4 -4
- package/dist/arrow/geoarrow/arrow-geoarrow-conversion.js.map +1 -1
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.cjs +2 -2
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.js +1 -1
- package/dist/arrow/geoarrow/arrow-polygon-tessellation.js.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.cjs +27 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts +11 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.js +33 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +68 -3
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +9 -2
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +76 -3
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.cjs +8 -6
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts +1 -0
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js +17 -7
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +35 -5
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +6 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +40 -5
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +19 -2
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +5 -2
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +4 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/arrow/internal.cjs.map +2 -2
- package/dist/dist.dev.js +3820 -1646
- package/dist/dist.min.js +450 -136
- package/dist/experimental/index.cjs.map +1 -1
- package/dist/experimental/simulation/index.cjs.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.cjs +2 -15
- package/dist/geospatial/gpu-point-spatial-query.d.ts.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.js +2 -15
- package/dist/geospatial/gpu-point-spatial-query.js.map +1 -1
- package/dist/geospatial/index.cjs.map +2 -2
- package/dist/gpu-a5/index.cjs.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.cjs +47 -0
- package/dist/gpu-core/compiled-gpu-graph.d.ts +5 -0
- package/dist/gpu-core/compiled-gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/compiled-gpu-graph.js +54 -1
- package/dist/gpu-core/compiled-gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.cjs +11 -2
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts +2 -1
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.js +13 -2
- package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts +16 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph.cjs +34 -11
- package/dist/gpu-core/gpu-command-graph.d.ts +17 -8
- package/dist/gpu-core/gpu-command-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph.js +39 -11
- package/dist/gpu-core/gpu-command-graph.js.map +1 -1
- package/dist/gpu-core/gpu-cpu-execution.cjs +279 -0
- package/dist/gpu-core/gpu-cpu-execution.d.ts +22 -0
- package/dist/gpu-core/gpu-cpu-execution.d.ts.map +1 -0
- package/dist/gpu-core/gpu-cpu-execution.js +294 -0
- package/dist/gpu-core/gpu-cpu-execution.js.map +1 -0
- package/dist/gpu-core/gpu-cpu-operation.cjs +54 -0
- package/dist/gpu-core/gpu-cpu-operation.d.ts +40 -0
- package/dist/gpu-core/gpu-cpu-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-cpu-operation.js +35 -0
- package/dist/gpu-core/gpu-cpu-operation.js.map +1 -0
- package/dist/gpu-core/gpu-dispatch-utils.cjs +7 -3
- package/dist/gpu-core/gpu-dispatch-utils.d.ts +2 -0
- package/dist/gpu-core/gpu-dispatch-utils.d.ts.map +1 -1
- package/dist/gpu-core/gpu-dispatch-utils.js +4 -1
- package/dist/gpu-core/gpu-dispatch-utils.js.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.cjs +2 -2
- package/dist/gpu-core/gpu-expression-operation.d.ts +1 -1
- package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.js +1 -1
- package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.cjs +5 -1
- package/dist/gpu-core/gpu-expression-plan.d.ts +3 -2
- package/dist/gpu-core/gpu-expression-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-plan.js +7 -1
- package/dist/gpu-core/gpu-expression-plan.js.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.cjs +48 -0
- package/dist/gpu-core/gpu-graph-compiler.d.ts +1 -0
- package/dist/gpu-core/gpu-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph-compiler.js +50 -0
- package/dist/gpu-core/gpu-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-graph.d.ts +2 -2
- package/dist/gpu-core/gpu-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-graph.js.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.cjs +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.js +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.cjs +2 -5
- package/dist/gpu-core/gpu-grid-binning.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.js +2 -5
- package/dist/gpu-core/gpu-grid-binning.js.map +1 -1
- package/dist/gpu-core/gpu-grid-coordinate.cjs +41 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts +7 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts.map +1 -0
- package/dist/gpu-core/gpu-grid-coordinate.js +24 -0
- package/dist/gpu-core/gpu-grid-coordinate.js.map +1 -0
- package/dist/gpu-core/gpu-grid-index-internals.cjs +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-internals.js +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.js.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.cjs +2 -16
- package/dist/gpu-core/gpu-grid-index-query.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.js +2 -16
- package/dist/gpu-core/gpu-grid-index-query.js.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.cjs +7 -15
- package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.js +7 -18
- package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-operation.d.ts +4 -4
- package/dist/gpu-core/gpu-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-operation.js.map +1 -1
- package/dist/gpu-core/gpu-reduction.cjs +6 -14
- package/dist/gpu-core/gpu-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-reduction.js +6 -15
- package/dist/gpu-core/gpu-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-render-operation.cjs +39 -0
- package/dist/gpu-core/gpu-render-operation.d.ts +21 -0
- package/dist/gpu-core/gpu-render-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-render-operation.js +22 -0
- package/dist/gpu-core/gpu-render-operation.js.map +1 -0
- package/dist/gpu-core/gpu-scan.cjs +46 -32
- package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-scan.js +56 -44
- package/dist/gpu-core/gpu-scan.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.cjs +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.d.ts +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.js +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.cjs +73 -16
- package/dist/gpu-core/gpu-segmented-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.js +73 -16
- package/dist/gpu-core/gpu-segmented-scan.js.map +1 -1
- package/dist/gpu-core/gpu-semantic-aggregation-operation.cjs +112 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts +71 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.js +92 -0
- package/dist/gpu-core/gpu-semantic-aggregation-operation.js.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.cjs +267 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.d.ts +29 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.d.ts.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.js +260 -0
- package/dist/gpu-core/gpu-shader-pass-kernel.js.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-operation.cjs +85 -0
- package/dist/gpu-core/gpu-shader-pass-operation.d.ts +32 -0
- package/dist/gpu-core/gpu-shader-pass-operation.d.ts.map +1 -0
- package/dist/gpu-core/gpu-shader-pass-operation.js +74 -0
- package/dist/gpu-core/gpu-shader-pass-operation.js.map +1 -0
- package/dist/gpu-core/gpu-texture-plan.d.ts +3 -2
- package/dist/gpu-core/gpu-texture-plan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-texture-plan.js.map +1 -1
- package/dist/gpu-core/index.cjs +32 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +21 -1
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +10 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-data/color-conversion.cjs +105 -0
- package/dist/gpu-data/color-conversion.d.ts +30 -0
- package/dist/gpu-data/color-conversion.d.ts.map +1 -0
- package/dist/gpu-data/color-conversion.js +109 -0
- package/dist/gpu-data/color-conversion.js.map +1 -0
- package/dist/gpu-data/cpu-data.cjs +60 -0
- package/dist/gpu-data/cpu-data.d.ts +28 -0
- package/dist/gpu-data/cpu-data.d.ts.map +1 -0
- package/dist/gpu-data/cpu-data.js +41 -0
- package/dist/gpu-data/cpu-data.js.map +1 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.cjs +98 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts +9 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.d.ts.map +1 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.js +85 -0
- package/dist/gpu-data/cpu-gpu-vector-transfer.js.map +1 -0
- package/dist/gpu-data/cpu-vector.cjs +42 -0
- package/dist/gpu-data/cpu-vector.d.ts +17 -0
- package/dist/gpu-data/cpu-vector.d.ts.map +1 -0
- package/dist/gpu-data/cpu-vector.js +21 -0
- package/dist/gpu-data/cpu-vector.js.map +1 -0
- package/dist/gpu-data/gpu-data-buffer-props.cjs +41 -0
- package/dist/gpu-data/gpu-data-buffer-props.d.ts +5 -0
- package/dist/gpu-data/gpu-data-buffer-props.d.ts.map +1 -0
- package/dist/gpu-data/gpu-data-buffer-props.js +19 -0
- package/dist/gpu-data/gpu-data-buffer-props.js.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.cjs +50 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts +41 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js +45 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js.map +1 -0
- package/dist/gpu-data/index.cjs +21 -2
- package/dist/gpu-data/index.cjs.map +3 -3
- package/dist/gpu-data/index.d.ts +6 -0
- package/dist/gpu-data/index.d.ts.map +1 -1
- package/dist/gpu-data/index.js +5 -0
- package/dist/gpu-data/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +1 -16
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +1 -23
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +91 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts +37 -0
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +106 -0
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +12 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +4 -0
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +2 -0
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +103 -0
- package/dist/gpu-dataframe/portable-expression.d.ts +19 -0
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -0
- package/dist/gpu-dataframe/portable-expression.js +98 -0
- package/dist/gpu-dataframe/portable-expression.js.map +1 -0
- package/dist/gpu-dggs/benchmarks.cjs.map +1 -1
- package/dist/gpu-dggs/index.cjs.map +1 -1
- package/dist/gpu-geometry/index.cjs.map +1 -1
- package/dist/gpu-graph/index.cjs +8 -0
- package/dist/gpu-graph/index.cjs.map +3 -3
- package/dist/gpu-graph/index.d.ts +4 -0
- package/dist/gpu-graph/index.d.ts.map +1 -1
- package/dist/gpu-graph/index.js +2 -0
- package/dist/gpu-graph/index.js.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.cjs +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js.map +1 -1
- package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
- package/dist/gpu-h3/index.cjs.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +162 -2
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +25 -0
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +181 -2
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs.map +2 -2
- package/dist/gpu-physics/index.d.ts +1 -0
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +24 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.js +28 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +2 -2
- package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.js +2 -2
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.cjs +90 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +35 -0
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-vehicle.js +66 -0
- package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -0
- package/dist/gpu-pointcloud/index.cjs.map +1 -1
- package/dist/gpu-project/benchmarks.cjs.map +2 -2
- package/dist/gpu-project/coordinate-projection-graph.cjs +59 -0
- package/dist/gpu-project/coordinate-projection-graph.d.ts +23 -0
- package/dist/gpu-project/coordinate-projection-graph.d.ts.map +1 -0
- package/dist/gpu-project/coordinate-projection-graph.js +40 -0
- package/dist/gpu-project/coordinate-projection-graph.js.map +1 -0
- package/dist/gpu-project/cpu-geoarrow.cjs +112 -0
- package/dist/gpu-project/cpu-geoarrow.d.ts +10 -0
- package/dist/gpu-project/cpu-geoarrow.d.ts.map +1 -0
- package/dist/gpu-project/cpu-geoarrow.js +103 -0
- package/dist/gpu-project/cpu-geoarrow.js.map +1 -0
- package/dist/gpu-project/cpu-geometry-pipelines.cjs +134 -0
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts +19 -0
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts.map +1 -0
- package/dist/gpu-project/cpu-geometry-pipelines.js +114 -0
- package/dist/gpu-project/cpu-geometry-pipelines.js.map +1 -0
- package/dist/gpu-project/cpu-projection-operation.cjs +54 -0
- package/dist/gpu-project/cpu-projection-operation.d.ts +14 -0
- package/dist/gpu-project/cpu-projection-operation.d.ts.map +1 -0
- package/dist/gpu-project/cpu-projection-operation.js +37 -0
- package/dist/gpu-project/cpu-projection-operation.js.map +1 -0
- package/dist/gpu-project/crs.cjs.map +2 -2
- package/dist/gpu-project/geoarrow.cjs +36 -0
- package/dist/gpu-project/geoarrow.cjs.map +6 -0
- package/dist/gpu-project/geoarrow.d.ts +3 -0
- package/dist/gpu-project/geoarrow.d.ts.map +1 -0
- package/dist/gpu-project/geoarrow.js +7 -0
- package/dist/gpu-project/geoarrow.js.map +1 -0
- package/dist/gpu-project/graph.cjs +27 -0
- package/dist/gpu-project/graph.cjs.map +6 -0
- package/dist/gpu-project/graph.d.ts +2 -0
- package/dist/gpu-project/graph.d.ts.map +1 -0
- package/dist/gpu-project/graph.js +6 -0
- package/dist/gpu-project/graph.js.map +1 -0
- package/dist/gpu-project/index.cjs +3 -0
- package/dist/gpu-project/index.cjs.map +3 -3
- package/dist/gpu-project/index.d.ts +1 -0
- package/dist/gpu-project/index.d.ts.map +1 -1
- package/dist/gpu-project/index.js +1 -0
- package/dist/gpu-project/index.js.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.cjs +75 -5
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts +5 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js +86 -6
- package/dist/gpu-simple-graph/compiled-gpu-expression-graph.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.cjs +9 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts +2 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js +10 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-lowering.js.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.cjs +126 -10
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts +36 -11
- package/dist/gpu-simple-graph/gpu-simple-graph.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph.js +137 -12
- package/dist/gpu-simple-graph/gpu-simple-graph.js.map +1 -1
- package/dist/gpu-simple-graph/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/index.d.ts +1 -1
- package/dist/gpu-simple-graph/index.d.ts.map +1 -1
- package/dist/gpu-simple-graph/index.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.cjs +25 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +6 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js +28 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.cjs +7 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts +2 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js +7 -0
- package/dist/gpu-simple-graph/operation/gpu-vector-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.cjs +6 -6
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts +5 -1
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.js +12 -7
- package/dist/gpu-simple-graph/operations/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.cjs +16 -33
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js +22 -35
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgl/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.cjs +31 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js +42 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/index.cjs.map +1 -1
- package/dist/gpu-sql/gpu-sql.cjs +376 -0
- package/dist/gpu-sql/gpu-sql.d.ts +36 -0
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -0
- package/dist/gpu-sql/gpu-sql.js +374 -0
- package/dist/gpu-sql/gpu-sql.js.map +1 -0
- package/dist/gpu-sql/index.cjs +5 -5
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-sql/index.d.ts +2 -2
- package/dist/gpu-sql/index.d.ts.map +1 -1
- package/dist/gpu-sql/index.js +1 -1
- package/dist/gpu-sql/index.js.map +1 -1
- package/dist/gpu-tables/index.cjs.map +2 -2
- package/dist/gpu-tables/table/gpu-table.cjs +2 -2
- package/dist/gpu-tables/table/gpu-table.d.ts.map +1 -1
- package/dist/gpu-tables/table/gpu-table.js +2 -2
- package/dist/gpu-tables/table/gpu-table.js.map +1 -1
- package/dist/gpu-timeseries/index.cjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +21 -7
- package/src/arrow/arrow-colors.ts +194 -33
- package/src/arrow/arrow-utils/arrow-paths.ts +5 -3
- package/src/arrow/cpu/arrow-coordinate-projection.ts +18 -0
- package/src/arrow/cpu/arrow-cpu-pipelines.ts +9 -0
- package/src/arrow/cpu/arrow-cpu-vector-adapters.ts +153 -0
- package/src/arrow/geoarrow/arrow-geoarrow-adapter.ts +21 -493
- package/src/arrow/geoarrow/arrow-geoarrow-conversion.ts +7 -5
- package/src/arrow/geoarrow/arrow-polygon-tessellation.ts +1 -1
- package/src/arrow/gpu/arrow-column-gpu-vector.ts +67 -14
- package/src/arrow/gpu/arrow-gpu-table-conversion.ts +96 -4
- package/src/arrow/gpu/arrow-gpu-vector-adapters.ts +20 -7
- package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +49 -6
- package/src/arrow/index.ts +14 -0
- package/src/geospatial/gpu-point-spatial-query.ts +2 -15
- package/src/gpu-core/compiled-gpu-graph.ts +73 -1
- package/src/gpu-core/gpu-command-graph-compiler.ts +25 -2
- package/src/gpu-core/gpu-command-graph-types.ts +20 -0
- package/src/gpu-core/gpu-command-graph.ts +48 -11
- package/src/gpu-core/gpu-cpu-execution.ts +345 -0
- package/src/gpu-core/gpu-cpu-operation.ts +65 -0
- package/src/gpu-core/gpu-dispatch-utils.ts +13 -1
- package/src/gpu-core/gpu-expression-operation.ts +1 -1
- package/src/gpu-core/gpu-expression-plan.ts +11 -3
- package/src/gpu-core/gpu-graph-compiler.ts +61 -0
- package/src/gpu-core/gpu-graph.ts +3 -3
- package/src/gpu-core/gpu-grid-aggregation.ts +2 -5
- package/src/gpu-core/gpu-grid-binning.ts +2 -5
- package/src/gpu-core/gpu-grid-coordinate.ts +24 -0
- package/src/gpu-core/gpu-grid-index-internals.ts +2 -15
- package/src/gpu-core/gpu-grid-index-query.ts +2 -16
- package/src/gpu-core/gpu-group-aggregation.ts +38 -50
- package/src/gpu-core/gpu-operation.ts +9 -7
- package/src/gpu-core/gpu-reduction.ts +32 -42
- package/src/gpu-core/gpu-render-operation.ts +42 -0
- package/src/gpu-core/gpu-scan.ts +59 -45
- package/src/gpu-core/gpu-segmented-reduction.ts +20 -10
- package/src/gpu-core/gpu-segmented-scan.ts +82 -17
- package/src/gpu-core/gpu-semantic-aggregation-operation.ts +150 -0
- package/src/gpu-core/gpu-shader-pass-kernel.ts +307 -0
- package/src/gpu-core/gpu-shader-pass-operation.ts +103 -0
- package/src/gpu-core/gpu-texture-plan.ts +3 -2
- package/src/gpu-core/index.ts +39 -0
- package/src/gpu-data/color-conversion.ts +158 -0
- package/src/gpu-data/cpu-data.ts +62 -0
- package/src/gpu-data/cpu-gpu-vector-transfer.ts +110 -0
- package/src/gpu-data/cpu-vector.ts +31 -0
- package/src/gpu-data/gpu-data-buffer-props.ts +25 -0
- package/src/gpu-data/gpu-vector-wgsl-layout.ts +79 -0
- package/src/gpu-data/index.ts +15 -0
- package/src/gpu-dataframe/gpu-data-frame-query.ts +6 -26
- package/src/gpu-dataframe/gpu-expression.ts +135 -0
- package/src/gpu-dataframe/index.ts +11 -0
- package/src/gpu-dataframe/portable-expression.ts +117 -0
- package/src/gpu-graph/index.ts +17 -0
- package/src/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.ts +2 -15
- package/src/gpu-physics/gpu-rigid-body-world.ts +227 -2
- package/src/gpu-physics/index.ts +1 -0
- package/src/gpu-physics/rigid-body-parallel-shaders.ts +32 -9
- package/src/gpu-physics/rigid-body-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-vehicle.ts +99 -0
- package/src/gpu-project/README.md +4 -4
- package/src/gpu-project/coordinate-projection-graph.ts +59 -0
- package/src/gpu-project/cpu-geoarrow.ts +135 -0
- package/src/gpu-project/cpu-geometry-pipelines.ts +159 -0
- package/src/gpu-project/cpu-projection-operation.ts +49 -0
- package/src/gpu-project/geoarrow.ts +11 -0
- package/src/gpu-project/graph.ts +10 -0
- package/src/gpu-project/index.ts +2 -0
- package/src/gpu-simple-graph/compiled-gpu-expression-graph.ts +97 -6
- package/src/gpu-simple-graph/gpu-simple-graph-lowering.ts +11 -0
- package/src/gpu-simple-graph/gpu-simple-graph.ts +163 -19
- package/src/gpu-simple-graph/index.ts +1 -0
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +24 -0
- package/src/gpu-simple-graph/operation/gpu-vector-evaluator.ts +7 -0
- package/src/gpu-simple-graph/operations/convert-colors.ts +22 -7
- package/src/gpu-simple-graph/operations/cpu/convert-colors.ts +31 -48
- package/src/gpu-simple-graph/operations/webgpu/convert-colors.ts +47 -13
- package/src/gpu-sql/gpu-sql.ts +494 -0
- package/src/gpu-sql/index.ts +2 -2
- package/src/gpu-tables/table/gpu-table.ts +2 -1
- package/src/index.ts +21 -0
- package/dist/gpu-sql/lu-sql.cjs +0 -499
- package/dist/gpu-sql/lu-sql.d.ts +0 -36
- package/dist/gpu-sql/lu-sql.d.ts.map +0 -1
- package/dist/gpu-sql/lu-sql.js +0 -497
- package/dist/gpu-sql/lu-sql.js.map +0 -1
- package/src/gpu-sql/lu-sql.ts +0 -599
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {assert} from '@luma.gl/core';
|
|
6
|
+
import {CPUData, CPUVector, getGPUVectorFormatInfo} from '@luma.gl/graph/gpu-data';
|
|
7
|
+
import {
|
|
8
|
+
BufferType,
|
|
9
|
+
Data,
|
|
10
|
+
DataType,
|
|
11
|
+
Field,
|
|
12
|
+
FixedSizeList,
|
|
13
|
+
List,
|
|
14
|
+
Float16,
|
|
15
|
+
Float32,
|
|
16
|
+
Int32,
|
|
17
|
+
Uint32,
|
|
18
|
+
Int16,
|
|
19
|
+
Uint16,
|
|
20
|
+
Int8,
|
|
21
|
+
Uint8,
|
|
22
|
+
Vector
|
|
23
|
+
} from 'apache-arrow';
|
|
24
|
+
import {getGPUVectorFormatFromArrowDataType} from '../gpu/arrow-gpu-vector-adapters';
|
|
25
|
+
import {
|
|
26
|
+
getArrowDataBufferSource,
|
|
27
|
+
getArrowVariableLengthAttributeDataBufferSource,
|
|
28
|
+
getArrowGPUDataReadbackMetadata
|
|
29
|
+
} from '../gpu/arrow-gpu-data';
|
|
30
|
+
import type {
|
|
31
|
+
AttributeArrowType,
|
|
32
|
+
VariableLengthAttributeArrowType
|
|
33
|
+
} from '../arrow-utils/arrow-types';
|
|
34
|
+
|
|
35
|
+
/** Borrow Arrow numeric payloads while normalizing sliced list offsets and validity to chunk-local rows. */
|
|
36
|
+
export function makeCPUVectorFromArrow(vector: Vector, options: {name?: string} = {}): CPUVector {
|
|
37
|
+
const format = getGPUVectorFormatFromArrowDataType(vector.type);
|
|
38
|
+
const info = getGPUVectorFormatInfo(format);
|
|
39
|
+
const data = vector.data.map(chunk => {
|
|
40
|
+
// CPUData stores parent validity only; reject nullable nested elements rather than dropping it.
|
|
41
|
+
const validateChildren = (data: Data): void => {
|
|
42
|
+
for (const child of data.children) {
|
|
43
|
+
assert(child.nullCount === 0);
|
|
44
|
+
validateChildren(child);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
validateChildren(chunk);
|
|
48
|
+
const metadata = getArrowGPUDataReadbackMetadata(chunk);
|
|
49
|
+
if (metadata?.kind === 'fixed-size-list') assert(!metadata.childNullCount);
|
|
50
|
+
const variable = DataType.isList(chunk.type);
|
|
51
|
+
const buffer = variable
|
|
52
|
+
? getArrowVariableLengthAttributeDataBufferSource(
|
|
53
|
+
chunk as Data<VariableLengthAttributeArrowType>
|
|
54
|
+
)
|
|
55
|
+
: getArrowDataBufferSource(chunk as Data<AttributeArrowType>);
|
|
56
|
+
const offsets =
|
|
57
|
+
metadata?.kind === 'variable-length-attribute' ? metadata.valueOffsets : undefined;
|
|
58
|
+
return new CPUData({
|
|
59
|
+
buffer,
|
|
60
|
+
format,
|
|
61
|
+
length: chunk.length,
|
|
62
|
+
valueLength: variable ? buffer.byteLength / info.elementByteLength : undefined,
|
|
63
|
+
valueOffsets: offsets,
|
|
64
|
+
nullBitmap: metadata?.nullBitmap
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return new CPUVector({name: options.name, format, data});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Reconstruct numeric Arrow vectors, preserving CPU chunk boundaries and parent-row validity. */
|
|
71
|
+
export function makeArrowVectorFromCPUVector(vector: CPUVector): Vector {
|
|
72
|
+
const info = getGPUVectorFormatInfo(vector.format);
|
|
73
|
+
const scalar =
|
|
74
|
+
info.signedDataType === 'float16'
|
|
75
|
+
? new Float16()
|
|
76
|
+
: info.signedDataType === 'float32'
|
|
77
|
+
? new Float32()
|
|
78
|
+
: info.signedDataType === 'sint32'
|
|
79
|
+
? new Int32()
|
|
80
|
+
: info.signedDataType === 'uint32'
|
|
81
|
+
? new Uint32()
|
|
82
|
+
: info.signedDataType === 'sint16'
|
|
83
|
+
? new Int16()
|
|
84
|
+
: info.signedDataType === 'uint16'
|
|
85
|
+
? new Uint16()
|
|
86
|
+
: info.signedDataType === 'sint8'
|
|
87
|
+
? new Int8()
|
|
88
|
+
: new Uint8();
|
|
89
|
+
assert(
|
|
90
|
+
!info.normalized &&
|
|
91
|
+
['float16', 'float32', 'sint32', 'uint32', 'sint16', 'uint16', 'sint8', 'uint8'].includes(
|
|
92
|
+
info.signedDataType
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
const width = info.components * (info.listSize ?? 1);
|
|
96
|
+
const element =
|
|
97
|
+
width === 1 ? scalar : new FixedSizeList(width, new Field('value', scalar, false));
|
|
98
|
+
const variable = info.vertexList || info.valueList;
|
|
99
|
+
const type = variable ? new List(new Field('value', element, false)) : element;
|
|
100
|
+
const ValueType = scalar.ArrayType;
|
|
101
|
+
const chunks = vector.data.map(chunk => {
|
|
102
|
+
const count = variable ? chunk.valueLength : chunk.length;
|
|
103
|
+
let bytes: Uint8Array;
|
|
104
|
+
if (chunk.byteStride === info.byteLength && chunk.rowByteLength === info.byteLength)
|
|
105
|
+
bytes = new Uint8Array(chunk.buffer, chunk.byteOffset, count * info.byteLength);
|
|
106
|
+
else {
|
|
107
|
+
bytes = new Uint8Array(count * info.byteLength);
|
|
108
|
+
for (let index = 0; index < count; index++)
|
|
109
|
+
bytes.set(
|
|
110
|
+
new Uint8Array(
|
|
111
|
+
chunk.buffer,
|
|
112
|
+
chunk.byteOffset + index * chunk.byteStride,
|
|
113
|
+
info.byteLength
|
|
114
|
+
),
|
|
115
|
+
index * info.byteLength
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
// Typed Arrow arrays require aligned payloads; strided packing already produces aligned bytes.
|
|
119
|
+
if (bytes.byteOffset % ValueType.BYTES_PER_ELEMENT) bytes = bytes.slice();
|
|
120
|
+
const values = new ValueType(
|
|
121
|
+
bytes.buffer,
|
|
122
|
+
bytes.byteOffset,
|
|
123
|
+
bytes.byteLength / ValueType.BYTES_PER_ELEMENT
|
|
124
|
+
);
|
|
125
|
+
const primitive = new Data(scalar, 0, count * width, 0, {[BufferType.DATA]: values});
|
|
126
|
+
const rows = width === 1 ? primitive : new Data(element, 0, count, 0, {}, [primitive]);
|
|
127
|
+
const nullCount = chunk.nullBitmap
|
|
128
|
+
? Array.from({length: chunk.length}, (_, index) =>
|
|
129
|
+
chunk.nullBitmap![index >> 3] & (1 << (index & 7)) ? 0 : 1
|
|
130
|
+
).reduce<number>((sum, value) => sum + value, 0)
|
|
131
|
+
: 0;
|
|
132
|
+
if (variable) {
|
|
133
|
+
assert(chunk.valueOffsets && chunk.valueOffsets.length === chunk.length + 1);
|
|
134
|
+
return new Data(
|
|
135
|
+
type,
|
|
136
|
+
0,
|
|
137
|
+
chunk.length,
|
|
138
|
+
nullCount,
|
|
139
|
+
{[BufferType.OFFSET]: chunk.valueOffsets, [BufferType.VALIDITY]: chunk.nullBitmap},
|
|
140
|
+
[rows]
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return width === 1
|
|
144
|
+
? new Data(scalar, 0, chunk.length, nullCount, {
|
|
145
|
+
[BufferType.DATA]: values,
|
|
146
|
+
[BufferType.VALIDITY]: chunk.nullBitmap
|
|
147
|
+
})
|
|
148
|
+
: new Data(element, 0, chunk.length, nullCount, {[BufferType.VALIDITY]: chunk.nullBitmap}, [
|
|
149
|
+
primitive
|
|
150
|
+
]);
|
|
151
|
+
});
|
|
152
|
+
return new Vector(chunks.length ? chunks : [new Data(type, 0, 0, 0)]);
|
|
153
|
+
}
|
|
@@ -2,88 +2,35 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
GeoArrowBatchView,
|
|
7
|
-
GeoArrowRowView,
|
|
8
|
-
GeoArrowArray,
|
|
9
|
-
GeoArrowColumn,
|
|
10
|
-
GeoArrowCoordinateLayout,
|
|
11
|
-
GeoArrowDenseUnion,
|
|
12
|
-
GeoArrowDimension,
|
|
13
|
-
GeoArrowEncoding,
|
|
14
|
-
GeoArrowNumericArray,
|
|
15
|
-
GeoArrowOffsets,
|
|
16
|
-
GeoArrowValidity
|
|
17
|
-
} from '@math.gl/geospatial/geoarrow';
|
|
5
|
+
import type {DataType, Vector} from 'apache-arrow';
|
|
18
6
|
import {
|
|
7
|
+
makeGeoArrowColumnFromArrowVector as makeGeoArrowColumn,
|
|
8
|
+
type MakeGeoArrowColumnFromArrowVectorOptions,
|
|
19
9
|
getGeoArrowRowView,
|
|
20
10
|
iterateGeoArrowBatches,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Int64,
|
|
37
|
-
List,
|
|
38
|
-
Struct,
|
|
39
|
-
Uint8,
|
|
40
|
-
Uint16,
|
|
41
|
-
Uint32,
|
|
42
|
-
Uint64,
|
|
43
|
-
Utf8,
|
|
44
|
-
Vector,
|
|
45
|
-
vectorFromArray,
|
|
46
|
-
type DataType as ArrowDataType
|
|
47
|
-
} from 'apache-arrow';
|
|
48
|
-
|
|
49
|
-
/** Options for adapting one Apache Arrow vector to math.gl's runtime-neutral GeoArrow ABI. */
|
|
50
|
-
export type MakeGeoArrowColumnFromArrowVectorOptions = {
|
|
51
|
-
/** GeoArrow extension encoding. Inferred from the physical type when omitted. */
|
|
52
|
-
encoding?: GeoArrowEncoding;
|
|
53
|
-
/** Semantic coordinate dimension. Inferred from coordinate field names when omitted. */
|
|
54
|
-
dimension?: GeoArrowDimension;
|
|
55
|
-
/** Coordinate organization. Inferred from the physical type when omitted. */
|
|
56
|
-
coordinateLayout?: GeoArrowCoordinateLayout | null;
|
|
57
|
-
/** Opaque extension metadata retained on the descriptor envelope. */
|
|
58
|
-
metadata?: Readonly<Record<string, unknown>>;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Adapts Apache Arrow physical buffers to the borrowed descriptor ABI used by
|
|
63
|
-
* `@math.gl/geospatial/geoarrow`.
|
|
64
|
-
*/
|
|
65
|
-
export function makeGeoArrowColumnFromArrowVector<T extends ArrowDataType>(
|
|
11
|
+
type GeoArrowBatchView,
|
|
12
|
+
type GeoArrowColumn,
|
|
13
|
+
type GeoArrowRowView
|
|
14
|
+
} from '@math.gl/core/arrow';
|
|
15
|
+
|
|
16
|
+
export type {MakeGeoArrowColumnFromArrowVectorOptions} from '@math.gl/core/arrow';
|
|
17
|
+
export {
|
|
18
|
+
makeArrowVectorFromGeoArrowColumn,
|
|
19
|
+
inferGeoArrowEncodingFromArrowType,
|
|
20
|
+
inferGeoArrowDimensionFromArrowType,
|
|
21
|
+
inferGeoArrowCoordinateLayoutFromArrowType
|
|
22
|
+
} from '@math.gl/core/arrow';
|
|
23
|
+
|
|
24
|
+
/** Adapts borrowed Arrow buffers using math.gl's shared GeoArrow adapter. */
|
|
25
|
+
export function makeGeoArrowColumnFromArrowVector<T extends DataType>(
|
|
66
26
|
vector: Vector<T>,
|
|
67
27
|
options: MakeGeoArrowColumnFromArrowVectorOptions = {}
|
|
68
28
|
): GeoArrowColumn {
|
|
69
|
-
|
|
70
|
-
const dimension = options.dimension ?? inferGeoArrowDimensionFromArrowType(vector.type);
|
|
71
|
-
const coordinateLayout =
|
|
72
|
-
options.coordinateLayout === undefined
|
|
73
|
-
? inferGeoArrowCoordinateLayoutFromArrowType(vector.type)
|
|
74
|
-
: options.coordinateLayout;
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
encoding,
|
|
78
|
-
dimension,
|
|
79
|
-
coordinateLayout,
|
|
80
|
-
chunks: vector.data.map(data => makeGeoArrowArrayFromArrowData(data)),
|
|
81
|
-
metadata: options.metadata
|
|
82
|
-
};
|
|
29
|
+
return makeGeoArrowColumn(vector, options);
|
|
83
30
|
}
|
|
84
31
|
|
|
85
32
|
/** Iterates borrowed batch views while retaining Arrow chunk boundaries and buffers. */
|
|
86
|
-
export function iterateGeoArrowBatchesFromArrowVector<T extends
|
|
33
|
+
export function iterateGeoArrowBatchesFromArrowVector<T extends DataType>(
|
|
87
34
|
vector: Vector<T>,
|
|
88
35
|
options: MakeGeoArrowColumnFromArrowVectorOptions = {}
|
|
89
36
|
): IterableIterator<GeoArrowBatchView> {
|
|
@@ -91,429 +38,10 @@ export function iterateGeoArrowBatchesFromArrowVector<T extends ArrowDataType>(
|
|
|
91
38
|
}
|
|
92
39
|
|
|
93
40
|
/** Gets a borrowed row view by logical index across Arrow chunks. */
|
|
94
|
-
export function getGeoArrowRowViewFromArrowVector<T extends
|
|
41
|
+
export function getGeoArrowRowViewFromArrowVector<T extends DataType>(
|
|
95
42
|
vector: Vector<T>,
|
|
96
43
|
rowIndex: number,
|
|
97
44
|
options: MakeGeoArrowColumnFromArrowVectorOptions = {}
|
|
98
45
|
): GeoArrowRowView {
|
|
99
46
|
return getGeoArrowRowView(makeGeoArrowColumnFromArrowVector(vector, options), rowIndex);
|
|
100
47
|
}
|
|
101
|
-
|
|
102
|
-
/** Converts a math.gl GeoArrow descriptor back to an Apache Arrow vector. */
|
|
103
|
-
export function makeArrowVectorFromGeoArrowColumn(column: GeoArrowColumn): Vector {
|
|
104
|
-
return new Vector(
|
|
105
|
-
column.chunks.map(chunk =>
|
|
106
|
-
makeArrowDataFromGeoArrowArray(chunk, column.dimension, column.coordinateLayout)
|
|
107
|
-
)
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** Infers a native GeoArrow encoding from an Apache Arrow physical type. */
|
|
112
|
-
export function inferGeoArrowEncodingFromArrowType(type: ArrowDataType): GeoArrowEncoding {
|
|
113
|
-
if (DataType.isDenseUnion(type)) return 'geoarrow.geometry';
|
|
114
|
-
if (DataType.isBinary(type)) return 'geoarrow.wkb';
|
|
115
|
-
if (DataType.isUtf8(type)) return 'geoarrow.wkt';
|
|
116
|
-
|
|
117
|
-
const nesting = getArrowListNesting(type);
|
|
118
|
-
switch (nesting) {
|
|
119
|
-
case 0:
|
|
120
|
-
return 'geoarrow.point';
|
|
121
|
-
case 1:
|
|
122
|
-
return 'geoarrow.linestring';
|
|
123
|
-
case 2:
|
|
124
|
-
return 'geoarrow.polygon';
|
|
125
|
-
case 3:
|
|
126
|
-
return 'geoarrow.multipolygon';
|
|
127
|
-
default:
|
|
128
|
-
throw new Error(`Cannot infer GeoArrow encoding from Arrow type ${type.toString()}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Infers the semantic GeoArrow coordinate dimension from Arrow coordinate field names. */
|
|
133
|
-
export function inferGeoArrowDimensionFromArrowType(type: ArrowDataType): GeoArrowDimension {
|
|
134
|
-
if (DataType.isFixedSizeList(type)) {
|
|
135
|
-
const dimensionName = type.children[0]?.name.toLowerCase();
|
|
136
|
-
if (isGeoArrowDimension(dimensionName)) return dimensionName;
|
|
137
|
-
switch (type.listSize) {
|
|
138
|
-
case 2:
|
|
139
|
-
return 'xy';
|
|
140
|
-
case 3:
|
|
141
|
-
return 'xyz';
|
|
142
|
-
case 4:
|
|
143
|
-
return 'xyzm';
|
|
144
|
-
default:
|
|
145
|
-
throw new Error(
|
|
146
|
-
`GeoArrow coordinates require 2, 3, or 4 values, received ${type.listSize}`
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (DataType.isStruct(type)) {
|
|
151
|
-
const names = type.children.map(field => field.name.toLowerCase());
|
|
152
|
-
if (names[0] === 'x' && names[1] === 'y') {
|
|
153
|
-
if (names[2] === 'm') return 'xym';
|
|
154
|
-
if (names[2] === 'z' && names[3] === 'm') return 'xyzm';
|
|
155
|
-
if (names[2] === 'z') return 'xyz';
|
|
156
|
-
return 'xy';
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (DataType.isList(type)) {
|
|
160
|
-
return inferGeoArrowDimensionFromArrowType(type.children[0].type);
|
|
161
|
-
}
|
|
162
|
-
if (DataType.isDenseUnion(type)) {
|
|
163
|
-
return type.children.reduce<GeoArrowDimension>(
|
|
164
|
-
(dimension, field) =>
|
|
165
|
-
mergeGeoArrowDimensions(dimension, inferGeoArrowDimensionFromArrowType(field.type)),
|
|
166
|
-
'xy'
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
throw new Error(`Cannot infer GeoArrow dimension from Arrow type ${type.toString()}`);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/** Infers whether Arrow coordinate leaves are interleaved or separated. */
|
|
173
|
-
export function inferGeoArrowCoordinateLayoutFromArrowType(
|
|
174
|
-
type: ArrowDataType
|
|
175
|
-
): GeoArrowCoordinateLayout | null {
|
|
176
|
-
if (DataType.isFixedSizeList(type)) return 'interleaved';
|
|
177
|
-
if (DataType.isStruct(type)) return 'separated';
|
|
178
|
-
if (DataType.isList(type)) {
|
|
179
|
-
return inferGeoArrowCoordinateLayoutFromArrowType(type.children[0].type);
|
|
180
|
-
}
|
|
181
|
-
if (DataType.isDenseUnion(type)) {
|
|
182
|
-
for (const field of type.children) {
|
|
183
|
-
const layout = inferGeoArrowCoordinateLayoutFromArrowType(field.type);
|
|
184
|
-
if (layout) return layout;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function makeGeoArrowArrayFromArrowData(data: Data): GeoArrowArray {
|
|
191
|
-
const validity = makeGeoArrowValidity(data);
|
|
192
|
-
if (DataType.isFixedSizeList(data.type)) {
|
|
193
|
-
return {
|
|
194
|
-
kind: 'fixed-size-list',
|
|
195
|
-
length: data.length,
|
|
196
|
-
size: data.type.listSize,
|
|
197
|
-
child: makeGeoArrowArrayFromArrowData(data.children[0]),
|
|
198
|
-
validity
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
if (DataType.isList(data.type)) {
|
|
202
|
-
return {
|
|
203
|
-
kind: 'list',
|
|
204
|
-
length: data.length,
|
|
205
|
-
offsets: data.valueOffsets as GeoArrowOffsets,
|
|
206
|
-
child: makeGeoArrowArrayFromArrowData(data.children[0]),
|
|
207
|
-
validity
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
if (DataType.isStruct(data.type)) {
|
|
211
|
-
const children: Record<string, GeoArrowArray> = {};
|
|
212
|
-
for (let childIndex = 0; childIndex < data.type.children.length; childIndex++) {
|
|
213
|
-
children[data.type.children[childIndex].name] = makeGeoArrowArrayFromArrowData(
|
|
214
|
-
data.children[childIndex]
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
return {kind: 'struct', length: data.length, children, validity};
|
|
218
|
-
}
|
|
219
|
-
if (DataType.isDenseUnion(data.type)) {
|
|
220
|
-
const unionType = data.type;
|
|
221
|
-
return {
|
|
222
|
-
kind: 'dense-union',
|
|
223
|
-
length: data.length,
|
|
224
|
-
typeIds: data.typeIds as Int8Array | Uint8Array,
|
|
225
|
-
valueOffsets: data.valueOffsets,
|
|
226
|
-
children: unionType.children.map((field, childIndex) => ({
|
|
227
|
-
name: field.name,
|
|
228
|
-
typeId: unionType.typeIds[childIndex],
|
|
229
|
-
encoding: inferGeoArrowEncodingFromUnionChild(field),
|
|
230
|
-
dimension: inferGeoArrowDimensionFromArrowType(field.type),
|
|
231
|
-
coordinateLayout: inferGeoArrowCoordinateLayoutFromArrowType(field.type),
|
|
232
|
-
data: makeGeoArrowArrayFromArrowData(data.children[childIndex])
|
|
233
|
-
})),
|
|
234
|
-
validity
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
if (DataType.isBinary(data.type) || DataType.isUtf8(data.type)) {
|
|
238
|
-
return {
|
|
239
|
-
kind: 'serialized',
|
|
240
|
-
encoding: DataType.isBinary(data.type) ? 'binary' : 'utf8',
|
|
241
|
-
length: data.length,
|
|
242
|
-
offsets: data.valueOffsets as GeoArrowOffsets,
|
|
243
|
-
values: data.values as Uint8Array,
|
|
244
|
-
validity
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
if (DataType.isInt(data.type) || DataType.isFloat(data.type)) {
|
|
248
|
-
return {
|
|
249
|
-
kind: 'primitive',
|
|
250
|
-
length: data.length,
|
|
251
|
-
values: data.values as GeoArrowNumericArray,
|
|
252
|
-
validity
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
throw new Error(`Unsupported GeoArrow physical Arrow type ${data.type.toString()}`);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function makeGeoArrowValidity(data: Data): GeoArrowValidity | undefined {
|
|
259
|
-
if (data.nullCount <= 0 || !data.nullBitmap || data.nullBitmap.length === 0) return undefined;
|
|
260
|
-
return {values: data.nullBitmap, bitOffset: data.offset};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function makeArrowDataFromGeoArrowArray(
|
|
264
|
-
array: GeoArrowArray,
|
|
265
|
-
dimension: GeoArrowDimension,
|
|
266
|
-
coordinateLayout: GeoArrowCoordinateLayout | null
|
|
267
|
-
): Data {
|
|
268
|
-
const validity = makeCompactValidity(array.validity, array.length);
|
|
269
|
-
const nullCount = validity ? -1 : 0;
|
|
270
|
-
const validityBuffers = validity ? {[BufferType.VALIDITY]: validity} : {};
|
|
271
|
-
|
|
272
|
-
switch (array.kind) {
|
|
273
|
-
case 'primitive': {
|
|
274
|
-
const values = makePackedPrimitiveValues(array);
|
|
275
|
-
const type = getArrowTypeForValues(values);
|
|
276
|
-
return new Data(type, 0, array.length, nullCount, {
|
|
277
|
-
...validityBuffers,
|
|
278
|
-
[BufferType.DATA]: values
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
case 'fixed-size-list': {
|
|
282
|
-
const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
|
|
283
|
-
const childStart = (array.offset ?? 0) * array.size;
|
|
284
|
-
const slicedChild =
|
|
285
|
-
childStart === 0 && child.length === array.length * array.size
|
|
286
|
-
? child
|
|
287
|
-
: child.slice(childStart, array.length * array.size);
|
|
288
|
-
const type = new FixedSizeList(array.size, new Field(dimension, slicedChild.type, false));
|
|
289
|
-
return new Data(type, 0, array.length, nullCount, validityBuffers, [slicedChild]);
|
|
290
|
-
}
|
|
291
|
-
case 'list': {
|
|
292
|
-
if (array.offsets instanceof BigInt64Array) {
|
|
293
|
-
throw new Error('Apache Arrow JS does not expose LargeList in this supported version');
|
|
294
|
-
}
|
|
295
|
-
const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
|
|
296
|
-
const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
|
|
297
|
-
const type = new List(new Field('values', child.type, true));
|
|
298
|
-
return new Data(
|
|
299
|
-
type,
|
|
300
|
-
0,
|
|
301
|
-
array.length,
|
|
302
|
-
nullCount,
|
|
303
|
-
{...validityBuffers, [BufferType.OFFSET]: offsets},
|
|
304
|
-
[child]
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
case 'struct': {
|
|
308
|
-
const fields: Field[] = [];
|
|
309
|
-
const children: Data[] = [];
|
|
310
|
-
for (const [name, childArray] of Object.entries(array.children)) {
|
|
311
|
-
let child = makeArrowDataFromGeoArrowArray(childArray, dimension, coordinateLayout);
|
|
312
|
-
const childOffset = array.offset ?? 0;
|
|
313
|
-
if (childOffset > 0 || child.length !== array.length) {
|
|
314
|
-
child = child.slice(childOffset, array.length);
|
|
315
|
-
}
|
|
316
|
-
fields.push(new Field(name, child.type, true));
|
|
317
|
-
children.push(child);
|
|
318
|
-
}
|
|
319
|
-
return new Data(new Struct(fields), 0, array.length, nullCount, validityBuffers, children);
|
|
320
|
-
}
|
|
321
|
-
case 'dense-union':
|
|
322
|
-
return makeArrowDenseUnionData(array, dimension, coordinateLayout);
|
|
323
|
-
case 'serialized': {
|
|
324
|
-
if (array.offsets instanceof BigInt64Array) {
|
|
325
|
-
throw new Error('Large GeoArrow serialized output is not supported by this adapter');
|
|
326
|
-
}
|
|
327
|
-
const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
|
|
328
|
-
const type = array.encoding === 'binary' ? new Binary() : new Utf8();
|
|
329
|
-
return new Data(type, 0, array.length, nullCount, {
|
|
330
|
-
...validityBuffers,
|
|
331
|
-
[BufferType.OFFSET]: offsets,
|
|
332
|
-
[BufferType.DATA]: array.values
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function makeArrowDenseUnionData(
|
|
339
|
-
array: GeoArrowDenseUnion,
|
|
340
|
-
dimension: GeoArrowDimension,
|
|
341
|
-
coordinateLayout: GeoArrowCoordinateLayout | null
|
|
342
|
-
): Data {
|
|
343
|
-
const offset = array.offset ?? 0;
|
|
344
|
-
const typeIds = array.typeIds.slice(offset, offset + array.length);
|
|
345
|
-
const valueOffsets = array.valueOffsets.slice(offset, offset + array.length);
|
|
346
|
-
const children = array.children.map(child =>
|
|
347
|
-
makeArrowDataFromGeoArrowArray(
|
|
348
|
-
child.data,
|
|
349
|
-
child.dimension ?? dimension,
|
|
350
|
-
child.coordinateLayout === undefined ? coordinateLayout : child.coordinateLayout
|
|
351
|
-
)
|
|
352
|
-
);
|
|
353
|
-
|
|
354
|
-
if (array.validity && array.children.length > 0) {
|
|
355
|
-
const nullChildIndex = 0;
|
|
356
|
-
const nullChild = children[nullChildIndex];
|
|
357
|
-
const nullValueOffset = nullChild.length;
|
|
358
|
-
children[nullChildIndex] = appendNullToArrowData(nullChild);
|
|
359
|
-
for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
|
|
360
|
-
if (!isGeoArrowValueValid(array.validity, rowIndex)) {
|
|
361
|
-
typeIds[rowIndex] = array.children[nullChildIndex].typeId;
|
|
362
|
-
valueOffsets[rowIndex] = nullValueOffset;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
const fields = array.children.map(
|
|
368
|
-
(child, childIndex) => new Field(child.name, children[childIndex].type, true)
|
|
369
|
-
);
|
|
370
|
-
const type = new DenseUnion(Int32Array.from(array.children.map(child => child.typeId)), fields);
|
|
371
|
-
return new Data(
|
|
372
|
-
type,
|
|
373
|
-
0,
|
|
374
|
-
array.length,
|
|
375
|
-
0,
|
|
376
|
-
{[BufferType.TYPE]: Int8Array.from(typeIds), [BufferType.OFFSET]: valueOffsets},
|
|
377
|
-
children
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function appendNullToArrowData(data: Data): Data {
|
|
382
|
-
const vector = new Vector([data]);
|
|
383
|
-
const values: unknown[] = [];
|
|
384
|
-
for (let index = 0; index < vector.length; index++) {
|
|
385
|
-
values.push(materializeArrowValue(vector.get(index)));
|
|
386
|
-
}
|
|
387
|
-
values.push(null);
|
|
388
|
-
return vectorFromArray(values, data.type).data[0];
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function materializeArrowValue(value: unknown): unknown {
|
|
392
|
-
if (value === null || value === undefined) return null;
|
|
393
|
-
if (ArrayBuffer.isView(value)) {
|
|
394
|
-
return Array.from(value as unknown as ArrayLike<number | bigint>);
|
|
395
|
-
}
|
|
396
|
-
if (Array.isArray(value)) return value.map(materializeArrowValue);
|
|
397
|
-
if (isArrowVectorLike(value)) {
|
|
398
|
-
const values: unknown[] = [];
|
|
399
|
-
for (let index = 0; index < value.length; index++) {
|
|
400
|
-
values.push(materializeArrowValue(value.get(index)));
|
|
401
|
-
}
|
|
402
|
-
return values;
|
|
403
|
-
}
|
|
404
|
-
return value;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
function isArrowVectorLike(
|
|
408
|
-
value: unknown
|
|
409
|
-
): value is {length: number; get: (index: number) => unknown} {
|
|
410
|
-
return Boolean(
|
|
411
|
-
value &&
|
|
412
|
-
typeof value === 'object' &&
|
|
413
|
-
'length' in value &&
|
|
414
|
-
'get' in value &&
|
|
415
|
-
typeof (value as {get?: unknown}).get === 'function'
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function makePackedPrimitiveValues(
|
|
420
|
-
array: Extract<GeoArrowArray, {kind: 'primitive'}>
|
|
421
|
-
): GeoArrowNumericArray {
|
|
422
|
-
const offset = array.offset ?? 0;
|
|
423
|
-
const stride = array.stride ?? 1;
|
|
424
|
-
if (stride === 1) {
|
|
425
|
-
return array.values.subarray(offset, offset + array.length) as GeoArrowNumericArray;
|
|
426
|
-
}
|
|
427
|
-
const ValuesConstructor = array.values.constructor as {
|
|
428
|
-
new (length: number): GeoArrowNumericArray;
|
|
429
|
-
};
|
|
430
|
-
const values = new ValuesConstructor(array.length);
|
|
431
|
-
for (let index = 0; index < array.length; index++) {
|
|
432
|
-
values[index] = array.values[offset + index * stride] as never;
|
|
433
|
-
}
|
|
434
|
-
return values;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function getArrowTypeForValues(values: GeoArrowNumericArray): ArrowDataType {
|
|
438
|
-
if (values instanceof Int8Array) return new Int8();
|
|
439
|
-
if (values instanceof Uint8Array || values instanceof Uint8ClampedArray) return new Uint8();
|
|
440
|
-
if (values instanceof Int16Array) return new Int16();
|
|
441
|
-
if (values instanceof Uint16Array) return new Uint16();
|
|
442
|
-
if (values instanceof Int32Array) return new Int32();
|
|
443
|
-
if (values instanceof Uint32Array) return new Uint32();
|
|
444
|
-
if (values instanceof BigInt64Array) return new Int64();
|
|
445
|
-
if (values instanceof BigUint64Array) return new Uint64();
|
|
446
|
-
if (values instanceof Float32Array) return new Float32();
|
|
447
|
-
if (values instanceof Float64Array) return new Float64();
|
|
448
|
-
throw new Error(`Unsupported GeoArrow primitive values ${(values as object).constructor.name}`);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function makeArrowOffsets(
|
|
452
|
-
offsets: GeoArrowOffsets,
|
|
453
|
-
offset = 0,
|
|
454
|
-
length: number,
|
|
455
|
-
offsetBase: number | bigint = 0
|
|
456
|
-
): Int32Array {
|
|
457
|
-
const source = offsets.subarray(offset, offset + length + 1);
|
|
458
|
-
if (offsetBase === 0) return source as Int32Array;
|
|
459
|
-
const normalized = new Int32Array(source.length);
|
|
460
|
-
for (let index = 0; index < source.length; index++) {
|
|
461
|
-
normalized[index] = Number(source[index]) - Number(offsetBase);
|
|
462
|
-
}
|
|
463
|
-
return normalized;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
function makeCompactValidity(
|
|
467
|
-
validity: GeoArrowValidity | undefined,
|
|
468
|
-
length: number
|
|
469
|
-
): Uint8Array | undefined {
|
|
470
|
-
if (!validity) return undefined;
|
|
471
|
-
const bitOffset = validity.bitOffset ?? 0;
|
|
472
|
-
const values = new Uint8Array(Math.ceil(length / 8));
|
|
473
|
-
let nullCount = 0;
|
|
474
|
-
for (let index = 0; index < length; index++) {
|
|
475
|
-
if (isGeoArrowValueValid(validity, index)) {
|
|
476
|
-
values[index >> 3] |= 1 << (index & 7);
|
|
477
|
-
} else {
|
|
478
|
-
nullCount++;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return nullCount > 0 || bitOffset > 0 ? values : undefined;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
function isGeoArrowValueValid(validity: GeoArrowValidity, index: number): boolean {
|
|
485
|
-
const bitIndex = (validity.bitOffset ?? 0) + index;
|
|
486
|
-
return Boolean(validity.values[bitIndex >> 3] & (1 << (bitIndex & 7)));
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
function inferGeoArrowEncodingFromUnionChild(field: Field): GeoArrowEncoding {
|
|
490
|
-
const normalizedName = field.name.replace(/[^a-z]/gi, '').toLowerCase();
|
|
491
|
-
const names: Record<string, GeoArrowEncoding> = {
|
|
492
|
-
point: 'geoarrow.point',
|
|
493
|
-
linestring: 'geoarrow.linestring',
|
|
494
|
-
polygon: 'geoarrow.polygon',
|
|
495
|
-
multipoint: 'geoarrow.multipoint',
|
|
496
|
-
multilinestring: 'geoarrow.multilinestring',
|
|
497
|
-
multipolygon: 'geoarrow.multipolygon',
|
|
498
|
-
geometrycollection: 'geoarrow.geometrycollection'
|
|
499
|
-
};
|
|
500
|
-
for (const [name, encoding] of Object.entries(names)) {
|
|
501
|
-
if (normalizedName.startsWith(name)) return encoding;
|
|
502
|
-
}
|
|
503
|
-
return inferGeoArrowEncodingFromArrowType(field.type);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function getArrowListNesting(type: ArrowDataType): number {
|
|
507
|
-
let nesting = 0;
|
|
508
|
-
let currentType = type;
|
|
509
|
-
while (DataType.isList(currentType)) {
|
|
510
|
-
nesting++;
|
|
511
|
-
currentType = currentType.children[0].type;
|
|
512
|
-
}
|
|
513
|
-
if (DataType.isFixedSizeList(currentType) || DataType.isStruct(currentType)) return nesting;
|
|
514
|
-
throw new Error(`GeoArrow type does not terminate in coordinates: ${type.toString()}`);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function isGeoArrowDimension(value: string | undefined): value is GeoArrowDimension {
|
|
518
|
-
return value === 'xy' || value === 'xyz' || value === 'xym' || value === 'xyzm';
|
|
519
|
-
}
|