@loaders.gl/core 5.0.0-rc.2 → 5.0.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/dist/api.cjs +4129 -0
- package/dist/api.cjs.map +6 -0
- package/dist/api.d.ts +34 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +50 -0
- package/dist/api.js.map +1 -0
- package/dist/arrow-geometry/geometry-codecs.cjs +51 -50
- package/dist/arrow-geometry/geometry-codecs.cjs.map +3 -3
- package/dist/arrow-geometry/geometry-codecs.d.ts +1 -1
- package/dist/arrow-geometry/geometry-codecs.d.ts.map +1 -1
- package/dist/arrow-geometry/geometry-codecs.js +27 -60
- package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
- package/dist/arrow-geometry/index.cjs +5 -2
- package/dist/arrow-geometry/index.cjs.map +2 -2
- package/dist/arrow-geometry/index.d.ts +1 -0
- package/dist/arrow-geometry/index.d.ts.map +1 -1
- package/dist/arrow-geometry/index.js +1 -0
- package/dist/arrow-geometry/index.js.map +1 -1
- package/dist/arrow-geometry/triangulate-wkb-geometry-column.cjs +100 -0
- package/dist/arrow-geometry/triangulate-wkb-geometry-column.cjs.map +7 -0
- package/dist/arrow-geometry/triangulate-wkb-geometry-column.d.ts +15 -0
- package/dist/arrow-geometry/triangulate-wkb-geometry-column.d.ts.map +1 -0
- package/dist/arrow-geometry/triangulate-wkb-geometry-column.js +87 -0
- package/dist/arrow-geometry/triangulate-wkb-geometry-column.js.map +1 -0
- package/dist/arrow-geometry/triangulate-wkb.cjs +33 -118
- package/dist/arrow-geometry/triangulate-wkb.cjs.map +2 -2
- package/dist/arrow-geometry/triangulate-wkb.d.ts.map +1 -1
- package/dist/arrow-geometry/triangulate-wkb.js +39 -142
- package/dist/arrow-geometry/triangulate-wkb.js.map +1 -1
- package/dist/constants/index.cjs +2 -2
- package/dist/constants/index.d.ts +4 -4
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +2 -2
- package/dist/constants/index.js.map +1 -1
- package/dist/dist.dev.js +460 -541
- package/dist/dist.min.js +3 -3
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +15 -0
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +19 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs +6 -27
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.d.ts.map +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.js +9 -24
- package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
- package/dist/geoarrow/index.cjs +1 -1
- package/dist/geoarrow/index.cjs.map +1 -1
- package/dist/geoarrow/index.d.ts +2 -2
- package/dist/geoarrow/index.d.ts.map +1 -1
- package/dist/geoarrow/index.js +1 -1
- package/dist/geoarrow/index.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -5
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.d.ts +2 -24
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.d.ts.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +6 -28
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
- package/dist/geoarrow/lib/kernels/decode-wkt-native.cjs +21 -227
- package/dist/geoarrow/lib/kernels/decode-wkt-native.cjs.map +2 -2
- package/dist/geoarrow/lib/kernels/decode-wkt-native.d.ts +2 -3
- package/dist/geoarrow/lib/kernels/decode-wkt-native.d.ts.map +1 -1
- package/dist/geoarrow/lib/kernels/decode-wkt-native.js +24 -265
- package/dist/geoarrow/lib/kernels/decode-wkt-native.js.map +1 -1
- package/dist/index.cjs +67 -4114
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -46
- package/dist/index.js.map +1 -1
- package/dist/lib/api/encode-table.d.ts +4 -4
- package/dist/lib/api/encode-table.d.ts.map +1 -1
- package/dist/lib/api/encode-table.js +21 -3
- package/dist/lib/api/encode-table.js.map +1 -1
- package/dist/lib/api/encode.d.ts +6 -6
- package/dist/lib/api/encode.d.ts.map +1 -1
- package/dist/lib/api/encode.js +46 -7
- package/dist/lib/api/encode.js.map +1 -1
- package/dist/lib/init.js +1 -1
- package/dist/lib/init.js.map +1 -1
- package/dist/loader-utils/index.cjs +96 -239
- package/dist/loader-utils/index.cjs.map +3 -3
- package/dist/loader-utils/index.d.ts +1 -1
- package/dist/loader-utils/index.d.ts.map +1 -1
- package/dist/loader-utils/index.js +1 -1
- package/dist/loader-utils/index.js.map +1 -1
- package/dist/loader-utils/json-loader-metadata.cjs +85 -0
- package/dist/loader-utils/json-loader-metadata.cjs.map +6 -0
- package/dist/loader-utils/json-loader-metadata.d.ts +51 -0
- package/dist/loader-utils/json-loader-metadata.d.ts.map +1 -0
- package/dist/loader-utils/json-loader-metadata.js +31 -0
- package/dist/loader-utils/json-loader-metadata.js.map +1 -0
- package/dist/loader-utils/json-loader.cjs +80 -0
- package/dist/loader-utils/json-loader.cjs.map +6 -0
- package/dist/loader-utils/json-loader.d.ts +4 -4
- package/dist/loader-utils/json-loader.d.ts.map +1 -1
- package/dist/loader-utils/json-loader.js +3 -17
- package/dist/loader-utils/json-loader.js.map +1 -1
- package/dist/loader-utils/lib/log-utils/log.js +1 -1
- package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
- package/dist/loader-utils/lib/request-utils/authentication.d.ts +2 -0
- package/dist/loader-utils/lib/request-utils/authentication.d.ts.map +1 -1
- package/dist/loader-utils/lib/request-utils/authentication.js +12 -0
- package/dist/loader-utils/lib/request-utils/authentication.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/columnar-predicate.d.ts +4 -52
- package/dist/loader-utils/lib/scan-utils/columnar-predicate.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/columnar-predicate.js +16 -236
- package/dist/loader-utils/lib/scan-utils/columnar-predicate.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/relational-query.d.ts +2 -0
- package/dist/loader-utils/lib/scan-utils/relational-query.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/relational-query.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.d.ts +1 -1
- package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/raster-source.d.ts +4 -0
- package/dist/loader-utils/lib/sources/raster-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/utils/utils.d.ts +1 -1
- package/dist/loader-utils/lib/sources/utils/utils.d.ts.map +1 -1
- package/dist/loader-utils/tile-grid.d.ts +2 -1
- package/dist/loader-utils/tile-grid.d.ts.map +1 -1
- package/dist/loader-utils/tile-grid.js +1 -1
- package/dist/loader-utils/tile-grid.js.map +1 -1
- package/dist/loader-utils/writer-types.d.ts +2 -0
- package/dist/loader-utils/writer-types.d.ts.map +1 -1
- package/dist/null-loader-metadata.cjs +89 -0
- package/dist/null-loader-metadata.cjs.map +6 -0
- package/dist/null-loader-metadata.d.ts +48 -0
- package/dist/null-loader-metadata.d.ts.map +1 -0
- package/dist/null-loader-metadata.js +30 -0
- package/dist/null-loader-metadata.js.map +1 -0
- package/dist/null-loader.cjs +84 -0
- package/dist/null-loader.cjs.map +6 -0
- package/dist/null-loader.d.ts +6 -6
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +2 -15
- package/dist/null-loader.js.map +1 -1
- package/dist/null-worker-node.js +58 -28
- package/dist/null-worker.js +58 -28
- package/dist/scan/arrow-execution/expressions.cjs +9 -78
- package/dist/scan/arrow-execution/expressions.cjs.map +3 -3
- package/dist/scan/arrow-execution/expressions.d.ts +3 -9
- package/dist/scan/arrow-execution/expressions.d.ts.map +1 -1
- package/dist/scan/arrow-execution/expressions.js +2 -55
- package/dist/scan/arrow-execution/expressions.js.map +1 -1
- package/dist/scan/arrow-execution/filter-arrow-table.cjs +41 -179
- package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +3 -3
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts +1 -5
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -1
- package/dist/scan/arrow-execution/filter-arrow-table.js +44 -190
- package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -1
- package/dist/scan/arrow-execution.cjs +2 -2
- package/dist/scan/arrow-execution.cjs.map +2 -2
- package/dist/scan/arrow-execution.d.ts +1 -1
- package/dist/scan/arrow-execution.d.ts.map +1 -1
- package/dist/scan/arrow-execution.js +1 -1
- package/dist/scan/arrow-execution.js.map +1 -1
- package/dist/scan/arrow-query.cjs +3 -3
- package/dist/scan/arrow-query.cjs.map +2 -2
- package/dist/scan/arrow-query.d.ts +2 -2
- package/dist/scan/arrow-query.d.ts.map +1 -1
- package/dist/scan/arrow-query.js +2 -2
- package/dist/scan/arrow-query.js.map +1 -1
- package/dist/scan/federated-table-scan-source.cjs +3 -3
- package/dist/scan/federated-table-scan-source.cjs.map +2 -2
- package/dist/scan/federated-table-scan-source.js +1 -1
- package/dist/scan/federated-table-scan-source.js.map +1 -1
- package/dist/scan/index.cjs +25 -53
- package/dist/scan/index.cjs.map +3 -3
- package/dist/scan/index.d.ts +7 -4
- package/dist/scan/index.d.ts.map +1 -1
- package/dist/scan/index.js +6 -4
- package/dist/scan/index.js.map +1 -1
- package/dist/scan/plan-arrow-table-query.cjs +271 -0
- package/dist/scan/plan-arrow-table-query.cjs.map +7 -0
- package/dist/scan/plan-arrow-table-query.d.ts +50 -0
- package/dist/scan/plan-arrow-table-query.d.ts.map +1 -0
- package/dist/scan/plan-arrow-table-query.js +257 -0
- package/dist/scan/plan-arrow-table-query.js.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.cjs +7 -56
- package/dist/scan/query-arrow-table-in-batches.cjs.map +2 -2
- package/dist/scan/query-arrow-table-in-batches.d.ts +1 -1
- package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -1
- package/dist/scan/query-arrow-table-in-batches.js +7 -45
- package/dist/scan/query-arrow-table-in-batches.js.map +1 -1
- package/dist/scan/query-arrow-table.cjs +7 -443
- package/dist/scan/query-arrow-table.cjs.map +3 -3
- package/dist/scan/query-arrow-table.d.ts +6 -54
- package/dist/scan/query-arrow-table.d.ts.map +1 -1
- package/dist/scan/query-arrow-table.js +6 -475
- package/dist/scan/query-arrow-table.js.map +1 -1
- package/dist/scan/query-executor.cjs +202 -0
- package/dist/scan/query-executor.cjs.map +7 -0
- package/dist/scan/query-executor.d.ts +27 -0
- package/dist/scan/query-executor.d.ts.map +1 -0
- package/dist/scan/query-executor.js +203 -0
- package/dist/scan/query-executor.js.map +1 -0
- package/dist/scan/query-pushdown.cjs +3 -4
- package/dist/scan/query-pushdown.cjs.map +2 -2
- package/dist/scan/query-pushdown.js +4 -5
- package/dist/scan/query-pushdown.js.map +1 -1
- package/dist/scan/query.cjs +92 -204
- package/dist/scan/query.cjs.map +3 -3
- package/dist/scan/query.d.ts +5 -4
- package/dist/scan/query.d.ts.map +1 -1
- package/dist/scan/query.js +94 -229
- package/dist/scan/query.js.map +1 -1
- package/dist/scan/scan-engine.cjs +14 -7
- package/dist/scan/scan-engine.cjs.map +2 -2
- package/dist/scan/scan-engine.d.ts +1 -1
- package/dist/scan/scan-engine.d.ts.map +1 -1
- package/dist/scan/scan-engine.js +4 -9
- package/dist/scan/scan-engine.js.map +1 -1
- package/dist/scan/vector-table-scan-source.cjs +14 -3
- package/dist/scan/vector-table-scan-source.cjs.map +2 -2
- package/dist/scan/vector-table-scan-source.d.ts +1 -1
- package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
- package/dist/scan/vector-table-scan-source.js +2 -1
- package/dist/scan/vector-table-scan-source.js.map +1 -1
- package/dist/schema-utils/index.cjs +193 -47
- package/dist/schema-utils/index.cjs.map +3 -3
- package/dist/schema-utils/index.d.ts +3 -0
- package/dist/schema-utils/index.d.ts.map +1 -1
- package/dist/schema-utils/index.js +3 -0
- package/dist/schema-utils/index.js.map +1 -1
- package/dist/schema-utils/lib/arrow/arrow-converter.d.ts +24 -0
- package/dist/schema-utils/lib/arrow/arrow-converter.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/arrow-converter.js +43 -0
- package/dist/schema-utils/lib/arrow/arrow-converter.js.map +1 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +2 -4
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -1
- package/dist/schema-utils/lib/arrow/arrow-metadata.js +2 -43
- package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -1
- package/dist/schema-utils/lib/arrow/convert-arrow-variable-width.d.ts +29 -0
- package/dist/schema-utils/lib/arrow/convert-arrow-variable-width.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/convert-arrow-variable-width.js +89 -0
- package/dist/schema-utils/lib/arrow/convert-arrow-variable-width.js.map +1 -0
- package/dist/schema-utils/lib/arrow/convert-arrow.d.ts +17 -0
- package/dist/schema-utils/lib/arrow/convert-arrow.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/convert-arrow.js +24 -0
- package/dist/schema-utils/lib/arrow/convert-arrow.js.map +1 -0
- package/dist/schema-utils/lib/arrow/tighten-arrow-table-schema-nullability.d.ts +4 -0
- package/dist/schema-utils/lib/arrow/tighten-arrow-table-schema-nullability.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/tighten-arrow-table-schema-nullability.js +51 -0
- package/dist/schema-utils/lib/arrow/tighten-arrow-table-schema-nullability.js.map +1 -0
- package/dist/wkt/twkb/index.cjs +68 -5
- package/dist/wkt/twkb/index.cjs.map +3 -3
- package/dist/wkt/twkb/index.d.ts +10 -2
- package/dist/wkt/twkb/index.d.ts.map +1 -1
- package/dist/wkt/twkb/index.js +49 -2
- package/dist/wkt/twkb/index.js.map +1 -1
- package/dist/worker-utils/index.cjs +4 -4
- package/dist/worker-utils/index.cjs.map +1 -1
- package/dist/worker-utils/lib/env-utils/version.js +1 -1
- package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
- package/package.json +49 -23
- package/src/api.ts +99 -0
- package/src/arrow-geometry/geometry-codecs.ts +35 -78
- package/src/arrow-geometry/index.ts +5 -0
- package/src/arrow-geometry/triangulate-wkb-geometry-column.ts +122 -0
- package/src/arrow-geometry/triangulate-wkb.ts +37 -169
- package/src/constants/index.ts +2 -2
- package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +22 -1
- package/src/geoarrow/get-geoarrow-vertex-count.ts +7 -32
- package/src/geoarrow/index.ts +2 -2
- package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +6 -30
- package/src/geoarrow/lib/kernels/decode-wkt-native.ts +24 -270
- package/src/index.ts +2 -94
- package/src/lib/api/encode-table.ts +31 -6
- package/src/lib/api/encode.ts +61 -11
- package/src/loader-utils/index.ts +1 -0
- package/src/loader-utils/json-loader-metadata.ts +35 -0
- package/src/loader-utils/json-loader.ts +3 -18
- package/src/loader-utils/lib/request-utils/authentication.ts +17 -0
- package/src/loader-utils/lib/scan-utils/columnar-predicate.ts +46 -363
- package/src/loader-utils/lib/scan-utils/relational-query.ts +7 -1
- package/src/loader-utils/lib/sources/raster-source.ts +4 -0
- package/src/loader-utils/tile-grid.ts +16 -1
- package/src/loader-utils/writer-types.ts +2 -0
- package/src/null-loader-metadata.ts +32 -0
- package/src/null-loader.ts +2 -17
- package/src/scan/arrow-execution/expressions.ts +2 -86
- package/src/scan/arrow-execution/filter-arrow-table.ts +54 -238
- package/src/scan/arrow-execution.ts +1 -1
- package/src/scan/arrow-query.ts +2 -2
- package/src/scan/federated-table-scan-source.ts +1 -1
- package/src/scan/index.ts +24 -4
- package/src/scan/plan-arrow-table-query.ts +367 -0
- package/src/scan/query-arrow-table-in-batches.ts +8 -54
- package/src/scan/query-arrow-table.ts +10 -626
- package/src/scan/query-executor.ts +286 -0
- package/src/scan/query-pushdown.ts +3 -4
- package/src/scan/query.ts +112 -293
- package/src/scan/scan-engine.ts +4 -11
- package/src/scan/vector-table-scan-source.ts +2 -1
- package/src/schema-utils/index.ts +14 -0
- package/src/schema-utils/lib/arrow/arrow-converter.ts +74 -0
- package/src/schema-utils/lib/arrow/arrow-metadata.ts +2 -50
- package/src/schema-utils/lib/arrow/convert-arrow-variable-width.ts +121 -0
- package/src/schema-utils/lib/arrow/convert-arrow.ts +52 -0
- package/src/schema-utils/lib/arrow/tighten-arrow-table-schema-nullability.ts +83 -0
- package/src/wkt/twkb/index.ts +63 -2
- package/dist/cluster-source.cjs +0 -6606
- package/dist/cluster-source.cjs.map +0 -6
- package/dist/cluster-source.d.ts +0 -2
- package/dist/cluster-source.d.ts.map +0 -1
- package/dist/cluster-source.js +0 -2
- package/dist/cluster-source.js.map +0 -1
- package/dist/federated-table-scan-source.cjs +0 -2303
- package/dist/federated-table-scan-source.cjs.map +0 -6
- package/dist/federated-table-scan-source.d.ts +0 -2
- package/dist/federated-table-scan-source.d.ts.map +0 -1
- package/dist/federated-table-scan-source.js +0 -2
- package/dist/federated-table-scan-source.js.map +0 -1
- package/dist/geoarrow/geoarrow-builder.cjs +0 -31
- package/dist/geoarrow/geoarrow-builder.cjs.map +0 -7
- package/dist/geoarrow/geoarrow-builder.d.ts +0 -3
- package/dist/geoarrow/geoarrow-builder.d.ts.map +0 -1
- package/dist/geoarrow/geoarrow-builder.js +0 -5
- package/dist/geoarrow/geoarrow-builder.js.map +0 -1
- package/dist/scan/arrow-execution/portable-predicate-compatibility.cjs +0 -41
- package/dist/scan/arrow-execution/portable-predicate-compatibility.cjs.map +0 -7
- package/dist/scan/arrow-execution/portable-predicate-compatibility.d.ts +0 -5
- package/dist/scan/arrow-execution/portable-predicate-compatibility.d.ts.map +0 -1
- package/dist/scan/arrow-execution/portable-predicate-compatibility.js +0 -23
- package/dist/scan/arrow-execution/portable-predicate-compatibility.js.map +0 -1
- package/dist/scan/arrow-execution/project-arrow-table.cjs +0 -70
- package/dist/scan/arrow-execution/project-arrow-table.cjs.map +0 -7
- package/dist/scan/arrow-execution/project-arrow-table.d.ts +0 -8
- package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +0 -1
- package/dist/scan/arrow-execution/project-arrow-table.js +0 -39
- package/dist/scan/arrow-execution/project-arrow-table.js.map +0 -1
- package/dist/scan/query-arrow-table-math.cjs +0 -41
- package/dist/scan/query-arrow-table-math.cjs.map +0 -7
- package/dist/scan/query-arrow-table-math.d.ts +0 -5
- package/dist/scan/query-arrow-table-math.d.ts.map +0 -1
- package/dist/scan/query-arrow-table-math.js +0 -14
- package/dist/scan/query-arrow-table-math.js.map +0 -1
- package/dist/vector-table-scan-source.cjs +0 -1660
- package/dist/vector-table-scan-source.cjs.map +0 -6
- package/dist/vector-table-scan-source.d.ts +0 -2
- package/dist/vector-table-scan-source.d.ts.map +0 -1
- package/dist/vector-table-scan-source.js +0 -2
- package/dist/vector-table-scan-source.js.map +0 -1
- package/dist/wkt/twkb/convert-geometry-to-twkb.cjs +0 -211
- package/dist/wkt/twkb/convert-geometry-to-twkb.cjs.map +0 -7
- package/dist/wkt/twkb/convert-geometry-to-twkb.d.ts +0 -6
- package/dist/wkt/twkb/convert-geometry-to-twkb.d.ts.map +0 -1
- package/dist/wkt/twkb/convert-geometry-to-twkb.js +0 -204
- package/dist/wkt/twkb/convert-geometry-to-twkb.js.map +0 -1
- package/dist/wkt/twkb/convert-twkb-to-geometry.cjs +0 -251
- package/dist/wkt/twkb/convert-twkb-to-geometry.cjs.map +0 -7
- package/dist/wkt/twkb/convert-twkb-to-geometry.d.ts +0 -10
- package/dist/wkt/twkb/convert-twkb-to-geometry.d.ts.map +0 -1
- package/dist/wkt/twkb/convert-twkb-to-geometry.js +0 -261
- package/dist/wkt/twkb/convert-twkb-to-geometry.js.map +0 -1
- package/dist/wkt/twkb/twkb-io.cjs +0 -102
- package/dist/wkt/twkb/twkb-io.cjs.map +0 -7
- package/dist/wkt/twkb/twkb-io.d.ts +0 -33
- package/dist/wkt/twkb/twkb-io.d.ts.map +0 -1
- package/dist/wkt/twkb/twkb-io.js +0 -78
- package/dist/wkt/twkb/twkb-io.js.map +0 -1
- package/dist/wkt/twkb/twkb-types.cjs +0 -40
- package/dist/wkt/twkb/twkb-types.cjs.map +0 -7
- package/dist/wkt/twkb/twkb-types.d.ts +0 -11
- package/dist/wkt/twkb/twkb-types.d.ts.map +0 -1
- package/dist/wkt/twkb/twkb-types.js +0 -15
- package/dist/wkt/twkb/twkb-types.js.map +0 -1
- package/src/cluster-source.ts +0 -1
- package/src/federated-table-scan-source.ts +0 -1
- package/src/geoarrow/geoarrow-builder.ts +0 -21
- package/src/scan/arrow-execution/portable-predicate-compatibility.ts +0 -27
- package/src/scan/arrow-execution/project-arrow-table.ts +0 -53
- package/src/scan/query-arrow-table-math.ts +0 -23
- package/src/vector-table-scan-source.ts +0 -1
- package/src/wkt/twkb/convert-geometry-to-twkb.ts +0 -317
- package/src/wkt/twkb/convert-twkb-to-geometry.ts +0 -373
- package/src/wkt/twkb/twkb-io.ts +0 -85
- package/src/wkt/twkb/twkb-types.ts +0 -14
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import * as arrow from 'apache-arrow';
|
|
6
|
+
import {
|
|
7
|
+
deserializeArrowType,
|
|
8
|
+
serializeArrowType,
|
|
9
|
+
type ArrowSchemaConversionOptions
|
|
10
|
+
} from '../schema/convert-arrow-schema';
|
|
11
|
+
|
|
12
|
+
/** Options controlling conversion between standard and view-based Arrow variable-width types. */
|
|
13
|
+
export type ConvertArrowVariableWidthOptions = ArrowSchemaConversionOptions;
|
|
14
|
+
|
|
15
|
+
type ArrowVariableWidthTypeName = 'binary' | 'binary-view' | 'utf8' | 'utf8-view';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Converts an Arrow Utf8, Utf8View, Binary, or BinaryView vector to the requested storage layout.
|
|
19
|
+
*
|
|
20
|
+
* `viewTypes: 'never'` produces Utf8 or Binary. `viewTypes: 'prefer'` produces the corresponding
|
|
21
|
+
* view type when the installed Arrow runtime supports it and otherwise produces the standard
|
|
22
|
+
* type. `viewTypes: 'require'` produces a view type or throws when the runtime lacks support.
|
|
23
|
+
* Existing vectors already using the selected type are returned without copying.
|
|
24
|
+
*
|
|
25
|
+
* @param vector - Arrow variable-width vector to convert.
|
|
26
|
+
* @param options - Target variable-width storage layout.
|
|
27
|
+
* @returns The original vector or a converted vector with the same values and chunk boundaries.
|
|
28
|
+
*/
|
|
29
|
+
export function convertArrowVariableWidthVector(
|
|
30
|
+
vector: arrow.Vector,
|
|
31
|
+
options: ConvertArrowVariableWidthOptions = {}
|
|
32
|
+
): arrow.Vector {
|
|
33
|
+
const sourceTypeName = getArrowVariableWidthTypeName(vector.type);
|
|
34
|
+
const targetTypeName = getTargetArrowVariableWidthTypeName(sourceTypeName);
|
|
35
|
+
const targetType = deserializeArrowType(targetTypeName, options);
|
|
36
|
+
|
|
37
|
+
if (vector.type.typeId === targetType.typeId) {
|
|
38
|
+
return vector;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const convertedData = vector.data.flatMap(data => {
|
|
42
|
+
const chunk = new arrow.Vector([data]);
|
|
43
|
+
return arrow.vectorFromArray(Array.from(chunk), targetType as never).data;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return new arrow.Vector(convertedData);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Converts every top-level Utf8, Utf8View, Binary, and BinaryView column in an Arrow table.
|
|
51
|
+
*
|
|
52
|
+
* Non-variable-width columns are preserved without copying. Table schema metadata, field metadata,
|
|
53
|
+
* nullability, row values, and source chunk boundaries are retained.
|
|
54
|
+
*
|
|
55
|
+
* @param table - Arrow table whose top-level variable-width columns should be converted.
|
|
56
|
+
* @param options - Target variable-width storage layout.
|
|
57
|
+
* @returns The original table when no column changes, otherwise a table with converted columns.
|
|
58
|
+
*/
|
|
59
|
+
export function convertArrowTableVariableWidthTypes(
|
|
60
|
+
table: arrow.Table,
|
|
61
|
+
options: ConvertArrowVariableWidthOptions = {}
|
|
62
|
+
): arrow.Table {
|
|
63
|
+
const columns: Record<string, arrow.Vector> = {};
|
|
64
|
+
const fields: arrow.Field[] = [];
|
|
65
|
+
let changed = false;
|
|
66
|
+
|
|
67
|
+
for (const field of table.schema.fields) {
|
|
68
|
+
const column = table.getChild(field.name);
|
|
69
|
+
if (!column) {
|
|
70
|
+
throw new Error(`Missing Arrow column for ${field.name}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const convertedColumn = isArrowVariableWidthType(field.type)
|
|
74
|
+
? convertArrowVariableWidthVector(column, options)
|
|
75
|
+
: column;
|
|
76
|
+
changed ||= convertedColumn !== column;
|
|
77
|
+
columns[field.name] = convertedColumn;
|
|
78
|
+
fields.push(
|
|
79
|
+
convertedColumn === column
|
|
80
|
+
? field
|
|
81
|
+
: new arrow.Field(field.name, convertedColumn.type, field.nullable, field.metadata)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!changed) {
|
|
86
|
+
return table;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const schema = new arrow.Schema(fields as never, table.schema.metadata);
|
|
90
|
+
return new (arrow.Table as any)(schema, columns) as arrow.Table;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function isArrowVariableWidthType(type: arrow.DataType): boolean {
|
|
94
|
+
try {
|
|
95
|
+
getArrowVariableWidthTypeName(type);
|
|
96
|
+
return true;
|
|
97
|
+
} catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getArrowVariableWidthTypeName(type: arrow.DataType): ArrowVariableWidthTypeName {
|
|
103
|
+
const typeName = serializeArrowType(type);
|
|
104
|
+
switch (typeName) {
|
|
105
|
+
case 'binary':
|
|
106
|
+
case 'binary-view':
|
|
107
|
+
case 'utf8':
|
|
108
|
+
case 'utf8-view':
|
|
109
|
+
return typeName;
|
|
110
|
+
default:
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Expected an Arrow Utf8, Utf8View, Binary, or BinaryView vector, received ${type}`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getTargetArrowVariableWidthTypeName(
|
|
118
|
+
sourceTypeName: ArrowVariableWidthTypeName
|
|
119
|
+
): 'binary' | 'utf8' {
|
|
120
|
+
return sourceTypeName === 'binary' || sourceTypeName === 'binary-view' ? 'binary' : 'utf8';
|
|
121
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type * as arrow from 'apache-arrow';
|
|
6
|
+
import type {
|
|
7
|
+
Table,
|
|
8
|
+
ArrayRowTable,
|
|
9
|
+
ObjectRowTable,
|
|
10
|
+
ColumnarTable,
|
|
11
|
+
GeoJSONTable
|
|
12
|
+
} from '@loaders.gl/core/schema';
|
|
13
|
+
import {convertArrowToTable, convertTableToArrow} from '../../deprecated';
|
|
14
|
+
import {isArrowTable} from '../../../lib/loader-utils/native-arrow';
|
|
15
|
+
import type {ArrowConvertFromOptions, ArrowConvertToOptions} from './arrow-converter';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Converts between Apache Arrow tables and loaders.gl table shapes.
|
|
19
|
+
*/
|
|
20
|
+
export function convertArrow(input: arrow.Table, shape: 'arrow'): arrow.Table;
|
|
21
|
+
export function convertArrow(input: arrow.Table, shape: 'array-row-table'): ArrayRowTable;
|
|
22
|
+
export function convertArrow(input: arrow.Table, shape: 'object-row-table'): ObjectRowTable;
|
|
23
|
+
export function convertArrow(input: arrow.Table, shape: 'columnar-table'): ColumnarTable;
|
|
24
|
+
export function convertArrow(input: arrow.Table, shape: 'geojson-table'): GeoJSONTable;
|
|
25
|
+
export function convertArrow(
|
|
26
|
+
input: Table,
|
|
27
|
+
shape: 'arrow',
|
|
28
|
+
options?: ArrowConvertFromOptions
|
|
29
|
+
): arrow.Table;
|
|
30
|
+
export function convertArrow(
|
|
31
|
+
input: arrow.Table | Table,
|
|
32
|
+
shape: 'arrow' | 'object-row-table' | 'array-row-table' | 'columnar-table' | 'geojson-table',
|
|
33
|
+
options?: ArrowConvertFromOptions | ArrowConvertToOptions
|
|
34
|
+
): Table | arrow.Table {
|
|
35
|
+
if (isApacheArrowTable(input)) {
|
|
36
|
+
if (shape === 'arrow') {
|
|
37
|
+
return input;
|
|
38
|
+
}
|
|
39
|
+
return convertArrowToTable(input, shape);
|
|
40
|
+
}
|
|
41
|
+
if (shape !== 'arrow') {
|
|
42
|
+
throw new Error(`Unsupported Arrow conversion target: ${shape}`);
|
|
43
|
+
}
|
|
44
|
+
return convertTableToArrow(input, options as ArrowConvertFromOptions | undefined);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Checks whether a value is an Apache Arrow table instance rather than a loaders.gl table wrapper.
|
|
49
|
+
*/
|
|
50
|
+
export function isApacheArrowTable(input: arrow.Table | Table): input is arrow.Table {
|
|
51
|
+
return isArrowTable(input);
|
|
52
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import * as arrow from 'apache-arrow';
|
|
6
|
+
|
|
7
|
+
/** Updates nullable Arrow table fields to non-nullable when their columns contain no null values. */
|
|
8
|
+
export function tightenArrowTableSchemaNullability(table: arrow.Table): arrow.Table {
|
|
9
|
+
const fieldNullability = getTightenedArrowFieldNullability(table);
|
|
10
|
+
if (!doesSchemaHaveTightenedFieldNullability(table.schema, fieldNullability)) {
|
|
11
|
+
return table;
|
|
12
|
+
}
|
|
13
|
+
const schema = tightenApacheArrowSchemaNullability(table.schema, fieldNullability);
|
|
14
|
+
const batches = table.batches.map(
|
|
15
|
+
batch =>
|
|
16
|
+
new arrow.RecordBatch(
|
|
17
|
+
tightenApacheArrowSchemaNullability(batch.schema, fieldNullability),
|
|
18
|
+
batch.data,
|
|
19
|
+
new Map(batch.metadata)
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
return new arrow.Table(schema, batches);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Returns true when a nullable field can be marked as non-nullable. */
|
|
26
|
+
function doesSchemaHaveTightenedFieldNullability(
|
|
27
|
+
arrowSchema: arrow.Schema,
|
|
28
|
+
fieldNullability: boolean[]
|
|
29
|
+
): boolean {
|
|
30
|
+
return arrowSchema.fields.some(
|
|
31
|
+
(field, fieldIndex) => field.nullable && !fieldNullability[fieldIndex]
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Returns field nullability after checking nullable columns for actual null values. */
|
|
36
|
+
function getTightenedArrowFieldNullability(arrowTable: arrow.Table): boolean[] {
|
|
37
|
+
return arrowTable.schema.fields.map((field, fieldIndex) => {
|
|
38
|
+
if (!field.nullable) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const column = arrowTable.getChildAt(fieldIndex);
|
|
43
|
+
return column ? doesArrowColumnHaveNulls(column) : true;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Returns true when an Arrow vector contains at least one null value. */
|
|
48
|
+
function doesArrowColumnHaveNulls(column: arrow.Vector): boolean {
|
|
49
|
+
if (column.nullCount === 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (column.nullCount > 0) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (let rowIndex = 0; rowIndex < column.length; rowIndex++) {
|
|
58
|
+
if (!column.isValid(rowIndex)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Returns an Apache Arrow schema with matching fields marked non-nullable. */
|
|
67
|
+
function tightenApacheArrowSchemaNullability(
|
|
68
|
+
arrowSchema: arrow.Schema,
|
|
69
|
+
fieldNullability: boolean[]
|
|
70
|
+
): arrow.Schema {
|
|
71
|
+
const fields = arrowSchema.fields.map((field, fieldIndex) =>
|
|
72
|
+
field.nullable === fieldNullability[fieldIndex]
|
|
73
|
+
? field
|
|
74
|
+
: field.clone({nullable: fieldNullability[fieldIndex]})
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return new arrow.Schema(
|
|
78
|
+
fields,
|
|
79
|
+
new Map(arrowSchema.metadata),
|
|
80
|
+
new Map(arrowSchema.dictionaries),
|
|
81
|
+
arrowSchema.metadataVersion
|
|
82
|
+
);
|
|
83
|
+
}
|
package/src/wkt/twkb/index.ts
CHANGED
|
@@ -2,5 +2,66 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import {parseTWKB, writeTWKB, type WellKnownDimension} from '@math.gl/core/twkb';
|
|
6
|
+
import {ensureArrayBuffer} from '../../loader-utils/lib/binary-utils/memory-conversion-utils';
|
|
7
|
+
import type {Geometry} from '@loaders.gl/core/schema';
|
|
8
|
+
|
|
9
|
+
/** Checks the TWKB family nibble in a potential binary payload. */
|
|
10
|
+
export function isTWKB(input: ArrayBufferLike): boolean {
|
|
11
|
+
if (input.byteLength < 2) return false;
|
|
12
|
+
const type = new Uint8Array(input, 0, 1)[0] & 15;
|
|
13
|
+
return type >= 1 && type <= 7;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Decodes a TWKB payload as GeoJSON geometry. */
|
|
17
|
+
export function convertTWKBToGeometry(input: ArrayBuffer): Geometry {
|
|
18
|
+
return parseTWKB(input).geometry as Geometry;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Encodes a geometry using the loader's explicit Z and M options. */
|
|
22
|
+
export function convertGeometryToTWKB(
|
|
23
|
+
geometry: Geometry,
|
|
24
|
+
options?: {hasZ?: boolean; hasM?: boolean}
|
|
25
|
+
): ArrayBuffer {
|
|
26
|
+
const dimension: WellKnownDimension = options?.hasZ
|
|
27
|
+
? options.hasM
|
|
28
|
+
? 'xyzm'
|
|
29
|
+
: 'xyz'
|
|
30
|
+
: options?.hasM
|
|
31
|
+
? 'xym'
|
|
32
|
+
: 'xy';
|
|
33
|
+
return ensureArrayBuffer(writeTWKB(normalizeGeometry(geometry, dimension), {dimension}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Adapts legacy coordinate tuples to the selected TWKB dimension. */
|
|
37
|
+
function normalizeGeometry(geometry: Geometry, dimension: WellKnownDimension): Geometry {
|
|
38
|
+
if (geometry.type === 'GeometryCollection') {
|
|
39
|
+
return {
|
|
40
|
+
...geometry,
|
|
41
|
+
geometries: geometry.geometries.map(child => normalizeGeometry(child, dimension))
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (!Array.isArray(geometry.coordinates)) throw new Error('unsupported geometry type');
|
|
45
|
+
return {
|
|
46
|
+
...geometry,
|
|
47
|
+
coordinates: normalizeCoordinates(geometry.coordinates, dimension)
|
|
48
|
+
} as Geometry;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Visits nested coordinates, retaining the legacy fourth-slot measure when present. */
|
|
52
|
+
function normalizeCoordinates(
|
|
53
|
+
coordinates: readonly unknown[],
|
|
54
|
+
dimension: WellKnownDimension
|
|
55
|
+
): readonly unknown[] {
|
|
56
|
+
if (!coordinates.length) return coordinates;
|
|
57
|
+
if (typeof coordinates[0] !== 'number') {
|
|
58
|
+
const children = coordinates.map(child =>
|
|
59
|
+
normalizeCoordinates(child as readonly unknown[], dimension)
|
|
60
|
+
);
|
|
61
|
+
return children.every(child => child.length === 0) ? [] : children;
|
|
62
|
+
}
|
|
63
|
+
return Array.from(
|
|
64
|
+
dimension,
|
|
65
|
+
(axis, index) => coordinates[axis === 'm' && coordinates.length === 4 ? 3 : index] ?? 0
|
|
66
|
+
);
|
|
67
|
+
}
|