@loaders.gl/core 5.0.0-beta.4 → 5.0.0-beta.6
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/GEOARROW-README.md +1 -1
- package/README.md +1 -1
- package/SCAN-README.md +1 -1
- package/SCHEMA-UTILS-README.md +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
- package/dist/arrow-geometry/geojson-table.cjs +3 -3
- package/dist/arrow-geometry/geojson-table.cjs.map +2 -2
- package/dist/arrow-geometry/geojson-table.js +2 -2
- package/dist/arrow-geometry/geojson-table.js.map +1 -1
- package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
- package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-codecs.js +1 -1
- package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
- package/dist/arrow-geometry/index.cjs +0 -11
- package/dist/arrow-geometry/index.cjs.map +2 -2
- package/dist/arrow-geometry/index.d.ts +0 -1
- package/dist/arrow-geometry/index.d.ts.map +1 -1
- package/dist/arrow-geometry/index.js +0 -1
- package/dist/arrow-geometry/index.js.map +1 -1
- package/dist/arrow-geometry/wkb-builder.cjs +3 -3
- package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
- package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
- package/dist/arrow-geometry/wkb-builder.js +1 -1
- package/dist/arrow-geometry/wkb-builder.js.map +1 -1
- package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
- package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-statistics.js +1 -1
- package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
- package/dist/arrow-worker-transport.cjs +81 -0
- package/dist/arrow-worker-transport.cjs.map +6 -0
- package/dist/arrow-worker-transport.d.ts +9 -0
- package/dist/arrow-worker-transport.d.ts.map +1 -0
- package/dist/arrow-worker-transport.js +60 -0
- package/dist/arrow-worker-transport.js.map +1 -0
- package/dist/cluster-source.cjs +198 -585
- package/dist/cluster-source.cjs.map +3 -3
- package/dist/dist.dev.js +546 -54
- package/dist/dist.min.js +3 -3
- package/dist/federated-table-scan-source.cjs +272 -201
- package/dist/federated-table-scan-source.cjs.map +3 -3
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
- package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-bounds.js +3 -3
- package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
- package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
- package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-capabilities.js +1 -1
- package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +2 -2
- package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
- package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-inspection.js +1 -1
- package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-stream.js +1 -1
- package/dist/geoarrow/geoarrow-stream.js.map +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
- 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.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
- package/dist/index.cjs +8 -11
- package/dist/index.cjs.map +3 -3
- package/dist/lib/init.js +1 -1
- package/dist/loader-utils/index.cjs +251 -33
- package/dist/loader-utils/index.cjs.map +3 -3
- package/dist/loader-utils/index.d.ts +8 -4
- package/dist/loader-utils/index.d.ts.map +1 -1
- package/dist/loader-utils/index.js +4 -2
- package/dist/loader-utils/index.js.map +1 -1
- package/dist/loader-utils/json-loader.js +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
- package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
- package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
- package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
- package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
- package/dist/loader-utils/lib/files/read-range-response.js +62 -0
- package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
- package/dist/loader-utils/lib/log-utils/log.js +1 -1
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +38 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js +96 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
- package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
- package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.js → query-options.js} +1 -1
- package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +12 -17
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +5 -5
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts +33 -3
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +2 -2
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +11 -3
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
- package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.js +50 -1
- package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts +30 -0
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
- package/dist/loader-utils/lib/sources/table-source-collection.js +5 -0
- package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
- package/dist/loader-utils/loader-types.d.ts +5 -5
- package/dist/loader-utils/loader-types.d.ts.map +1 -1
- package/dist/null-loader.js +1 -1
- package/dist/null-worker-node.js +244 -11
- package/dist/null-worker.js +239 -11
- package/dist/scan/arrow-execution/filter-arrow-table.cjs +254 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts +16 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js +222 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
- package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution.cjs +34 -0
- package/dist/scan/arrow-execution.cjs.map +7 -0
- package/dist/scan/arrow-execution.d.ts +4 -0
- package/dist/scan/arrow-execution.d.ts.map +1 -0
- package/dist/scan/arrow-execution.js +6 -0
- package/dist/scan/arrow-execution.js.map +1 -0
- package/dist/scan/arrow-query.cjs.map +1 -1
- package/dist/scan/arrow-query.d.ts +1 -1
- package/dist/scan/arrow-query.d.ts.map +1 -1
- package/dist/scan/catalog-query-source.cjs +122 -0
- package/dist/scan/catalog-query-source.cjs.map +7 -0
- package/dist/scan/catalog-query-source.d.ts +6 -0
- package/dist/scan/catalog-query-source.d.ts.map +1 -0
- package/dist/scan/catalog-query-source.js +115 -0
- package/dist/scan/catalog-query-source.js.map +1 -0
- package/dist/scan/federated-table-scan-source.cjs +4 -4
- package/dist/scan/federated-table-scan-source.cjs.map +2 -2
- package/dist/scan/federated-table-scan-source.d.ts +1 -1
- package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
- package/dist/scan/federated-table-scan-source.js +4 -4
- package/dist/scan/federated-table-scan-source.js.map +1 -1
- package/dist/scan/index.cjs +188 -4
- package/dist/scan/index.cjs.map +4 -4
- package/dist/scan/index.d.ts +9 -2
- package/dist/scan/index.d.ts.map +1 -1
- package/dist/scan/index.js +4 -0
- package/dist/scan/index.js.map +1 -1
- package/dist/scan/parse-sql-predicate.cjs +3 -3
- package/dist/scan/parse-sql-predicate.cjs.map +2 -2
- package/dist/scan/parse-sql-predicate.d.ts +5 -2
- package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
- package/dist/scan/parse-sql-predicate.js +3 -10
- package/dist/scan/parse-sql-predicate.js.map +1 -1
- package/dist/scan/parse-sql-query.cjs +70 -0
- package/dist/scan/parse-sql-query.cjs.map +7 -0
- package/dist/scan/parse-sql-query.d.ts +5 -0
- package/dist/scan/parse-sql-query.d.ts.map +1 -0
- package/dist/scan/parse-sql-query.js +49 -0
- package/dist/scan/parse-sql-query.js.map +1 -0
- package/dist/scan/parse-sql-select.cjs +215 -0
- package/dist/scan/parse-sql-select.cjs.map +7 -0
- package/dist/scan/parse-sql-select.d.ts +38 -0
- package/dist/scan/parse-sql-select.d.ts.map +1 -0
- package/dist/scan/parse-sql-select.js +208 -0
- package/dist/scan/parse-sql-select.js.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.cjs +65 -0
- package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.js +44 -0
- package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
- package/dist/scan/query-arrow-table.cjs +52 -179
- package/dist/scan/query-arrow-table.cjs.map +3 -3
- package/dist/scan/query-arrow-table.d.ts +4 -37
- package/dist/scan/query-arrow-table.d.ts.map +1 -1
- package/dist/scan/query-arrow-table.js +37 -188
- package/dist/scan/query-arrow-table.js.map +1 -1
- package/dist/scan/query.cjs +257 -0
- package/dist/scan/query.cjs.map +7 -0
- package/dist/scan/query.d.ts +44 -0
- package/dist/scan/query.d.ts.map +1 -0
- package/dist/scan/query.js +246 -0
- package/dist/scan/query.js.map +1 -0
- package/dist/scan/resolve-query-source.cjs +59 -0
- package/dist/scan/resolve-query-source.cjs.map +7 -0
- package/dist/scan/resolve-query-source.d.ts +6 -0
- package/dist/scan/resolve-query-source.d.ts.map +1 -0
- package/dist/scan/resolve-query-source.js +37 -0
- package/dist/scan/resolve-query-source.js.map +1 -0
- package/dist/scan/sql-catalog.cjs +110 -0
- package/dist/scan/sql-catalog.cjs.map +7 -0
- package/dist/scan/sql-catalog.d.ts +47 -0
- package/dist/scan/sql-catalog.d.ts.map +1 -0
- package/dist/scan/sql-catalog.js +97 -0
- package/dist/scan/sql-catalog.js.map +1 -0
- package/dist/scan/table-query.cjs.map +2 -2
- package/dist/scan/table-query.d.ts +4 -1
- package/dist/scan/table-query.d.ts.map +1 -1
- package/dist/scan/table-query.js.map +1 -1
- package/dist/schema/geometry/geoarrow.d.ts +3 -6
- package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
- package/dist/vector-table-scan-source.cjs +281 -193
- package/dist/vector-table-scan-source.cjs.map +3 -3
- package/dist/worker-utils/index.cjs +20 -26
- package/dist/worker-utils/index.cjs.map +3 -3
- package/dist/worker-utils/index.d.ts +0 -3
- package/dist/worker-utils/index.d.ts.map +1 -1
- package/dist/worker-utils/index.js +0 -3
- package/dist/worker-utils/index.js.map +1 -1
- package/dist/worker-utils/lib/env-utils/version.js +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.js +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.js +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.js +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -1
- package/dist/worker-utils/null-worker-node.js +243 -10
- package/dist/worker-utils/null-worker-node.js.map +4 -4
- package/dist/worker-utils/null-worker.js +238 -10
- package/dist/worker-utils/null-worker.js.map +4 -4
- package/dist/worker-utils/types.d.ts +1 -1
- package/dist/worker-utils/types.d.ts.map +1 -1
- package/package.json +23 -11
- package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
- package/src/arrow-geometry/geojson-table.ts +2 -2
- package/src/arrow-geometry/geometry-codecs.ts +2 -2
- package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
- package/src/arrow-geometry/index.ts +0 -9
- package/src/arrow-geometry/wkb-builder.ts +2 -2
- package/src/arrow-geometry/wkb-statistics.ts +2 -2
- package/src/arrow-worker-transport.ts +87 -0
- package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
- package/src/geoarrow/geoarrow-bounds.ts +3 -3
- package/src/geoarrow/geoarrow-capabilities.ts +1 -1
- package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
- package/src/geoarrow/geoarrow-inspection.ts +2 -2
- package/src/geoarrow/geoarrow-stream.ts +1 -1
- package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
- package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
- package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
- package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
- package/src/loader-utils/index.ts +31 -7
- package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
- package/src/loader-utils/lib/files/http-file-types.ts +2 -0
- package/src/loader-utils/lib/files/read-range-response.ts +66 -0
- package/src/loader-utils/lib/scan-utils/logical-table-query.ts +164 -0
- package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
- package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +17 -26
- package/src/loader-utils/lib/scan-utils/table-query.ts +49 -8
- package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +25 -9
- package/src/loader-utils/lib/sources/data-source.ts +54 -1
- package/src/loader-utils/lib/sources/table-source-collection.ts +38 -0
- package/src/loader-utils/loader-types.ts +5 -5
- package/src/scan/arrow-execution/filter-arrow-table.ts +293 -0
- package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
- package/src/scan/arrow-execution.ts +7 -0
- package/src/scan/arrow-query.ts +3 -0
- package/src/scan/catalog-query-source.ts +132 -0
- package/src/scan/federated-table-scan-source.ts +19 -19
- package/src/scan/index.ts +28 -4
- package/src/scan/parse-sql-predicate.ts +9 -3
- package/src/scan/parse-sql-query.ts +53 -0
- package/src/scan/parse-sql-select.ts +220 -0
- package/src/scan/query-arrow-table-in-batches.ts +58 -0
- package/src/scan/query-arrow-table.ts +60 -237
- package/src/scan/query.ts +339 -0
- package/src/scan/resolve-query-source.ts +47 -0
- package/src/scan/sql-catalog.ts +167 -0
- package/src/scan/table-query.ts +6 -1
- package/src/schema/geometry/geoarrow.ts +8 -19
- package/src/worker-utils/index.ts +0 -16
- package/src/worker-utils/lib/library-utils/library-utils.ts +1 -1
- package/src/worker-utils/lib/worker-api/create-worker.ts +1 -1
- package/src/worker-utils/lib/worker-api/process-on-worker.ts +1 -6
- package/src/worker-utils/lib/worker-api/task-runtime.ts +1 -1
- package/src/worker-utils/types.ts +1 -1
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
- package/dist/schema-utils/arrow-transport.cjs +0 -691
- package/dist/schema-utils/arrow-transport.cjs.map +0 -6
- package/dist/schema-utils/arrow-transport.d.ts +0 -4
- package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
- package/dist/schema-utils/arrow-transport.js +0 -7
- package/dist/schema-utils/arrow-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
- package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
- package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
- package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
- package/src/schema-utils/arrow-transport.ts +0 -7
- package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
- package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
package/dist/cluster-source.cjs
CHANGED
|
@@ -381,6 +381,8 @@ var DataSource = class _DataSource {
|
|
|
381
381
|
options;
|
|
382
382
|
data;
|
|
383
383
|
url;
|
|
384
|
+
/** Stable query-visible name, resolved without fetching source data. */
|
|
385
|
+
name;
|
|
384
386
|
/** Shared parser options derived from the source options, excluding source-only core controls. */
|
|
385
387
|
loadOptions;
|
|
386
388
|
/** A resolved fetch function extracted from the shared core options. */
|
|
@@ -397,6 +399,7 @@ var DataSource = class _DataSource {
|
|
|
397
399
|
);
|
|
398
400
|
this.data = data;
|
|
399
401
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
402
|
+
this.name = getDataSourceName(data, this.options);
|
|
400
403
|
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
|
|
401
404
|
this.loadOptions = loadOptions;
|
|
402
405
|
const fetch2 = getFetchFunction(loadOptions);
|
|
@@ -405,6 +408,9 @@ var DataSource = class _DataSource {
|
|
|
405
408
|
this.fetch = fetch2;
|
|
406
409
|
}
|
|
407
410
|
setProps(options) {
|
|
411
|
+
var _a;
|
|
412
|
+
if (((_a = options.core) == null ? void 0 : _a.name) !== void 0 && options.core.name !== this.name)
|
|
413
|
+
throw new Error("Data source names are fixed at creation.");
|
|
408
414
|
const mergedOptions = mergeOptions(this.options, options);
|
|
409
415
|
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
|
|
410
416
|
this.options = mergedOptions;
|
|
@@ -454,7 +460,7 @@ function getSourceLoaderOptions(options) {
|
|
|
454
460
|
if (options == null ? void 0 : options.core) {
|
|
455
461
|
loadOptions.core = { ...options.core };
|
|
456
462
|
const parserCore = loadOptions.core;
|
|
457
|
-
for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
463
|
+
for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
458
464
|
delete parserCore[key];
|
|
459
465
|
}
|
|
460
466
|
if (Object.keys(parserCore).length === 0) {
|
|
@@ -489,9 +495,47 @@ function unavailableCoreApiMethod(methodName) {
|
|
|
489
495
|
);
|
|
490
496
|
};
|
|
491
497
|
}
|
|
498
|
+
function getDataSourceName(data, options) {
|
|
499
|
+
var _a, _b, _c;
|
|
500
|
+
const explicitName = (_a = options.core) == null ? void 0 : _a.name;
|
|
501
|
+
if (explicitName !== void 0) {
|
|
502
|
+
if (typeof explicitName !== "string" || !explicitName.trim())
|
|
503
|
+
throw new Error("Data source name must be a non-empty string.");
|
|
504
|
+
return explicitName;
|
|
505
|
+
}
|
|
506
|
+
if (data && typeof data === "object") {
|
|
507
|
+
const named = data;
|
|
508
|
+
if (typeof named.name === "string" && named.name.trim())
|
|
509
|
+
return data instanceof Blob ? removeFileExtension(named.name) : named.name;
|
|
510
|
+
const metadata = (_b = named.schema) == null ? void 0 : _b.metadata;
|
|
511
|
+
const embeddedName = metadata instanceof Map ? metadata.get("name") : metadata == null ? void 0 : metadata.name;
|
|
512
|
+
if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
|
|
513
|
+
}
|
|
514
|
+
if (typeof data === "string") {
|
|
515
|
+
try {
|
|
516
|
+
const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
|
|
517
|
+
if (!["data:", "blob:"].includes(url.protocol)) {
|
|
518
|
+
let basename = url.pathname.split("/").filter(Boolean).pop();
|
|
519
|
+
if (basename) {
|
|
520
|
+
try {
|
|
521
|
+
basename = decodeURIComponent(basename);
|
|
522
|
+
} catch {
|
|
523
|
+
}
|
|
524
|
+
return removeFileExtension(basename);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
} catch {
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
|
|
531
|
+
}
|
|
532
|
+
function removeFileExtension(name) {
|
|
533
|
+
const extension = name.lastIndexOf(".");
|
|
534
|
+
return extension > 0 ? name.slice(0, extension) : name;
|
|
535
|
+
}
|
|
492
536
|
|
|
493
537
|
// src/arrow-geometry/geometry-codecs.ts
|
|
494
|
-
var
|
|
538
|
+
var import_wkb2 = require("@math.gl/arrow/wkb");
|
|
495
539
|
|
|
496
540
|
// src/arrow-geometry/geometry-utils.ts
|
|
497
541
|
function normalizeEmptyPoints(geometry) {
|
|
@@ -512,14 +556,14 @@ function normalizeEmptyPoints(geometry) {
|
|
|
512
556
|
}
|
|
513
557
|
|
|
514
558
|
// src/arrow-geometry/geometry-to-wkt.ts
|
|
515
|
-
var
|
|
559
|
+
var import_wkb = require("@math.gl/arrow/wkb");
|
|
516
560
|
function convertGeometryToWKT(geometry, options) {
|
|
517
561
|
const dimension = getWKTDimension(geometry, options);
|
|
518
562
|
if (geometry.type === "GeometryCollection" && !(options == null ? void 0 : options.dimension) && !(options == null ? void 0 : options.hasZ) && !(options == null ? void 0 : options.hasM) && (hasMixedChildDimensions(geometry) || hasDeclaredChildDimensions(geometry))) {
|
|
519
563
|
if (geometry.geometries.length === 0) return "GEOMETRYCOLLECTION EMPTY";
|
|
520
564
|
return `GEOMETRYCOLLECTION (${geometry.geometries.map((child) => convertGeometryToWKT(child)).join(", ")})`;
|
|
521
565
|
}
|
|
522
|
-
return (0,
|
|
566
|
+
return (0, import_wkb.formatWKT)(normalizeGeometryDimension(geometry, dimension), dimension);
|
|
523
567
|
}
|
|
524
568
|
function normalizeGeometryDimension(geometry, dimension) {
|
|
525
569
|
if (geometry.type === "GeometryCollection") {
|
|
@@ -582,7 +626,7 @@ function getDimensionSize(dimension) {
|
|
|
582
626
|
// src/arrow-geometry/geometry-codecs.ts
|
|
583
627
|
function convertWKBToGeometry(input) {
|
|
584
628
|
const bytes = ArrayBuffer.isView(input) ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength) : new Uint8Array(input);
|
|
585
|
-
return normalizeEmptyPoints((0,
|
|
629
|
+
return normalizeEmptyPoints((0, import_wkb2.parseWKB)(bytes).geometry);
|
|
586
630
|
}
|
|
587
631
|
function convertGeometryToWKB(input, options = {}) {
|
|
588
632
|
const geometry = input.type === "Feature" ? input.geometry : input;
|
|
@@ -593,7 +637,7 @@ function convertGeometryToWKB(input, options = {}) {
|
|
|
593
637
|
}
|
|
594
638
|
function encodeGeometry(geometry, dimension) {
|
|
595
639
|
if (geometry.type !== "GeometryCollection") {
|
|
596
|
-
return (0,
|
|
640
|
+
return (0, import_wkb2.writeWKB)(geometry, dimension);
|
|
597
641
|
}
|
|
598
642
|
const children = geometry.geometries.map(
|
|
599
643
|
(child) => encodeGeometry(
|
|
@@ -601,13 +645,13 @@ function encodeGeometry(geometry, dimension) {
|
|
|
601
645
|
child.__geoarrowDimension ?? dimension
|
|
602
646
|
)
|
|
603
647
|
);
|
|
604
|
-
const headerBuilder = new
|
|
648
|
+
const headerBuilder = new import_wkb2.WKBBuilder({ mode: "measure", dimension });
|
|
605
649
|
headerBuilder.beginGeometry("GeometryCollection", children.length);
|
|
606
650
|
const headerLength = headerBuilder.finishGeometry();
|
|
607
651
|
const bytes = new Uint8Array(
|
|
608
652
|
headerLength + children.reduce((total, child) => total + child.length, 0)
|
|
609
653
|
);
|
|
610
|
-
const writer = new
|
|
654
|
+
const writer = new import_wkb2.WKBBuilder({ mode: "write", target: bytes, dimension });
|
|
611
655
|
writer.beginGeometry("GeometryCollection", children.length);
|
|
612
656
|
let byteOffset = writer.finishGeometry();
|
|
613
657
|
for (const child of children) {
|
|
@@ -633,7 +677,7 @@ function convertWKTToGeometry(input, options) {
|
|
|
633
677
|
}
|
|
634
678
|
const collectionHeader = text.match(/^(\s*GEOMETRYCOLLECTION)\s+(?:ZM|Z|M)(?=\s|\()/i);
|
|
635
679
|
const parseText = collectionHeader && dimension !== "xym" ? text.replace(collectionHeader[0], collectionHeader[1]) : text;
|
|
636
|
-
const parsed = (0,
|
|
680
|
+
const parsed = (0, import_wkb2.parseWKTWithMetadata)(parseText, { inferDimensions: true });
|
|
637
681
|
const geometry = toGeometryWithDimensionMetadata(
|
|
638
682
|
parsed,
|
|
639
683
|
collectionHeader ? dimension : void 0
|
|
@@ -1475,13 +1519,13 @@ function deserializeArrowType(dataType, options) {
|
|
|
1475
1519
|
}
|
|
1476
1520
|
case "large-list": {
|
|
1477
1521
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
1478
|
-
const
|
|
1479
|
-
if (!
|
|
1522
|
+
const LargeList9 = getOptionalArrowConstructor("LargeList");
|
|
1523
|
+
if (!LargeList9) {
|
|
1480
1524
|
throw new Error(
|
|
1481
1525
|
"LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
|
|
1482
1526
|
);
|
|
1483
1527
|
}
|
|
1484
|
-
return new
|
|
1528
|
+
return new LargeList9(field);
|
|
1485
1529
|
}
|
|
1486
1530
|
case "fixed-size-list": {
|
|
1487
1531
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
@@ -1958,8 +2002,8 @@ function parseGeoArrowMetadata(value) {
|
|
|
1958
2002
|
}
|
|
1959
2003
|
|
|
1960
2004
|
// dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js
|
|
1961
|
-
var
|
|
1962
|
-
var
|
|
2005
|
+
var arrow14 = __toESM(require("apache-arrow"), 1);
|
|
2006
|
+
var import_geoarrow_utils = require("@math.gl/arrow/geoarrow-utils");
|
|
1963
2007
|
|
|
1964
2008
|
// dist/geoarrow/lib/geometry-converters/convert-geoarrow-to-geojson.js
|
|
1965
2009
|
function convertGeoArrowGeometryToGeoJSON(arrowCellValue, encoding) {
|
|
@@ -2092,7 +2136,7 @@ function isEmptyArrowCoordinate(arrowCoordinate) {
|
|
|
2092
2136
|
var arrow5 = __toESM(require("apache-arrow"), 1);
|
|
2093
2137
|
|
|
2094
2138
|
// dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js
|
|
2095
|
-
var
|
|
2139
|
+
var import_wkb3 = require("@math.gl/arrow/wkb");
|
|
2096
2140
|
|
|
2097
2141
|
// dist/geoarrow/lib/geometry-converters/wkb/helpers/wkb-types.js
|
|
2098
2142
|
var WKBGeometryType;
|
|
@@ -2132,7 +2176,7 @@ function getWKTGeometryType(input) {
|
|
|
2132
2176
|
}
|
|
2133
2177
|
|
|
2134
2178
|
// dist/geoarrow/geoarrow-inspection.js
|
|
2135
|
-
var
|
|
2179
|
+
var import_wkb4 = require("@math.gl/arrow/wkb");
|
|
2136
2180
|
|
|
2137
2181
|
// dist/geoarrow/lib/kernels/geoarrow-union.js
|
|
2138
2182
|
var arrow4 = __toESM(require("apache-arrow"), 1);
|
|
@@ -2276,7 +2320,7 @@ function inspectGeoArrowVector(column, encoding) {
|
|
|
2276
2320
|
if (encoding === "geoarrow.wkb") {
|
|
2277
2321
|
const bytes = value;
|
|
2278
2322
|
try {
|
|
2279
|
-
const header = (0,
|
|
2323
|
+
const header = (0, import_wkb4.inspectWKBHeader)(bytes);
|
|
2280
2324
|
dimensions.add(header.dimension);
|
|
2281
2325
|
geometryTypes.add(getGeometryTypeName(header.geometryType, header.dimension));
|
|
2282
2326
|
} catch {
|
|
@@ -2452,7 +2496,7 @@ function dimensionFromSize(size) {
|
|
|
2452
2496
|
}
|
|
2453
2497
|
|
|
2454
2498
|
// dist/geoarrow/lib/kernels/decode-wkt-native.js
|
|
2455
|
-
var
|
|
2499
|
+
var arrow7 = __toESM(require("apache-arrow"), 1);
|
|
2456
2500
|
|
|
2457
2501
|
// src/arrow-geometry/geoarrow-builder.ts
|
|
2458
2502
|
var arrow6 = __toESM(require("apache-arrow"), 1);
|
|
@@ -2909,13 +2953,13 @@ function makeListData(child, offsets, fieldName, offsetType) {
|
|
|
2909
2953
|
});
|
|
2910
2954
|
}
|
|
2911
2955
|
function makeLargeListType(field) {
|
|
2912
|
-
const
|
|
2913
|
-
if (!
|
|
2956
|
+
const LargeList9 = getOptionalArrowConstructor2("LargeList");
|
|
2957
|
+
if (!LargeList9) {
|
|
2914
2958
|
throw new Error(
|
|
2915
2959
|
"64-bit GeoArrow offsets require an Apache Arrow runtime that exports LargeList"
|
|
2916
2960
|
);
|
|
2917
2961
|
}
|
|
2918
|
-
return new
|
|
2962
|
+
return new LargeList9(field);
|
|
2919
2963
|
}
|
|
2920
2964
|
function getOptionalArrowConstructor2(typeName) {
|
|
2921
2965
|
return arrow6[typeName];
|
|
@@ -2991,439 +3035,6 @@ function withNulls(data, geometryArray) {
|
|
|
2991
3035
|
);
|
|
2992
3036
|
}
|
|
2993
3037
|
|
|
2994
|
-
// src/arrow-geometry/arrow-geoarrow-adapter.ts
|
|
2995
|
-
var arrow7 = __toESM(require("apache-arrow"), 1);
|
|
2996
|
-
function makeGeoArrowColumnFromArrowVector(vector, options = {}) {
|
|
2997
|
-
const encoding = options.encoding ?? inferGeoArrowEncodingFromArrowType(vector.type);
|
|
2998
|
-
const dimension = options.dimension ?? (isSerializedArrowType(vector.type) ? "xy" : inferGeoArrowDimensionFromArrowType(vector.type));
|
|
2999
|
-
const coordinateLayout = options.coordinateLayout === void 0 ? inferGeoArrowCoordinateLayoutFromArrowType(vector.type) : options.coordinateLayout;
|
|
3000
|
-
return {
|
|
3001
|
-
encoding,
|
|
3002
|
-
dimension,
|
|
3003
|
-
coordinateLayout,
|
|
3004
|
-
chunks: vector.data.map((data) => makeGeoArrowArrayFromArrowData(data)),
|
|
3005
|
-
metadata: options.metadata
|
|
3006
|
-
};
|
|
3007
|
-
}
|
|
3008
|
-
function makeArrowVectorFromGeoArrowColumn(column) {
|
|
3009
|
-
return new arrow7.Vector(
|
|
3010
|
-
column.chunks.map(
|
|
3011
|
-
(chunk) => makeArrowDataFromGeoArrowArray(chunk, column.dimension, column.coordinateLayout)
|
|
3012
|
-
)
|
|
3013
|
-
);
|
|
3014
|
-
}
|
|
3015
|
-
function inferGeoArrowEncodingFromArrowType(type) {
|
|
3016
|
-
if (arrow7.DataType.isDenseUnion(type)) return "geoarrow.geometry";
|
|
3017
|
-
if (arrow7.DataType.isBinary(type) || arrow7.DataType.isLargeBinary(type) || arrow7.DataType.isBinaryView(type)) {
|
|
3018
|
-
return "geoarrow.wkb";
|
|
3019
|
-
}
|
|
3020
|
-
if (arrow7.DataType.isUtf8(type) || arrow7.DataType.isLargeUtf8(type) || arrow7.DataType.isUtf8View(type)) {
|
|
3021
|
-
return "geoarrow.wkt";
|
|
3022
|
-
}
|
|
3023
|
-
const nesting = getArrowListNesting(type);
|
|
3024
|
-
switch (nesting) {
|
|
3025
|
-
case 0:
|
|
3026
|
-
return "geoarrow.point";
|
|
3027
|
-
case 1:
|
|
3028
|
-
return "geoarrow.linestring";
|
|
3029
|
-
case 2:
|
|
3030
|
-
return "geoarrow.polygon";
|
|
3031
|
-
case 3:
|
|
3032
|
-
return "geoarrow.multipolygon";
|
|
3033
|
-
default:
|
|
3034
|
-
throw new Error(`Cannot infer GeoArrow encoding from Arrow type ${type.toString()}`);
|
|
3035
|
-
}
|
|
3036
|
-
}
|
|
3037
|
-
function inferGeoArrowDimensionFromArrowType(type) {
|
|
3038
|
-
var _a;
|
|
3039
|
-
if (arrow7.DataType.isFixedSizeList(type)) {
|
|
3040
|
-
const dimensionName = (_a = type.children[0]) == null ? void 0 : _a.name.toLowerCase();
|
|
3041
|
-
if (isGeoArrowDimension(dimensionName)) return dimensionName;
|
|
3042
|
-
switch (type.listSize) {
|
|
3043
|
-
case 2:
|
|
3044
|
-
return "xy";
|
|
3045
|
-
case 3:
|
|
3046
|
-
return "xyz";
|
|
3047
|
-
case 4:
|
|
3048
|
-
return "xyzm";
|
|
3049
|
-
default:
|
|
3050
|
-
throw new Error(
|
|
3051
|
-
`GeoArrow coordinates require 2, 3, or 4 values, received ${type.listSize}`
|
|
3052
|
-
);
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
if (arrow7.DataType.isStruct(type)) {
|
|
3056
|
-
const names = type.children.map((field) => field.name.toLowerCase());
|
|
3057
|
-
if (names[0] === "x" && names[1] === "y") {
|
|
3058
|
-
if (names[2] === "m") return "xym";
|
|
3059
|
-
if (names[2] === "z" && names[3] === "m") return "xyzm";
|
|
3060
|
-
if (names[2] === "z") return "xyz";
|
|
3061
|
-
return "xy";
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3064
|
-
if (arrow7.DataType.isList(type) || arrow7.DataType.isLargeList(type)) {
|
|
3065
|
-
return inferGeoArrowDimensionFromArrowType(type.children[0].type);
|
|
3066
|
-
}
|
|
3067
|
-
if (arrow7.DataType.isDenseUnion(type)) {
|
|
3068
|
-
return type.children.reduce(
|
|
3069
|
-
(dimension, field) => mergeGeoArrowDimensions(dimension, inferGeoArrowDimensionFromUnionChild(field)),
|
|
3070
|
-
"xy"
|
|
3071
|
-
);
|
|
3072
|
-
}
|
|
3073
|
-
throw new Error(`Cannot infer GeoArrow dimension from Arrow type ${type.toString()}`);
|
|
3074
|
-
}
|
|
3075
|
-
function inferGeoArrowCoordinateLayoutFromArrowType(type) {
|
|
3076
|
-
if (arrow7.DataType.isFixedSizeList(type)) return "interleaved";
|
|
3077
|
-
if (arrow7.DataType.isStruct(type)) return "separated";
|
|
3078
|
-
if (arrow7.DataType.isList(type) || arrow7.DataType.isLargeList(type)) {
|
|
3079
|
-
return inferGeoArrowCoordinateLayoutFromArrowType(type.children[0].type);
|
|
3080
|
-
}
|
|
3081
|
-
if (arrow7.DataType.isDenseUnion(type)) {
|
|
3082
|
-
for (const field of type.children) {
|
|
3083
|
-
const layout = inferGeoArrowCoordinateLayoutFromArrowType(field.type);
|
|
3084
|
-
if (layout) return layout;
|
|
3085
|
-
}
|
|
3086
|
-
}
|
|
3087
|
-
return null;
|
|
3088
|
-
}
|
|
3089
|
-
function makeGeoArrowArrayFromArrowData(data) {
|
|
3090
|
-
const validity = makeGeoArrowValidity(data);
|
|
3091
|
-
if (arrow7.DataType.isFixedSizeList(data.type)) {
|
|
3092
|
-
return {
|
|
3093
|
-
kind: "fixed-size-list",
|
|
3094
|
-
length: data.length,
|
|
3095
|
-
size: data.type.listSize,
|
|
3096
|
-
child: makeGeoArrowArrayFromArrowData(data.children[0]),
|
|
3097
|
-
validity
|
|
3098
|
-
};
|
|
3099
|
-
}
|
|
3100
|
-
if (arrow7.DataType.isList(data.type) || arrow7.DataType.isLargeList(data.type)) {
|
|
3101
|
-
return {
|
|
3102
|
-
kind: "list",
|
|
3103
|
-
length: data.length,
|
|
3104
|
-
offsets: data.valueOffsets,
|
|
3105
|
-
child: makeGeoArrowArrayFromArrowData(data.children[0]),
|
|
3106
|
-
validity
|
|
3107
|
-
};
|
|
3108
|
-
}
|
|
3109
|
-
if (arrow7.DataType.isStruct(data.type)) {
|
|
3110
|
-
const children = {};
|
|
3111
|
-
for (let childIndex = 0; childIndex < data.type.children.length; childIndex++) {
|
|
3112
|
-
children[data.type.children[childIndex].name] = makeGeoArrowArrayFromArrowData(
|
|
3113
|
-
data.children[childIndex]
|
|
3114
|
-
);
|
|
3115
|
-
}
|
|
3116
|
-
return { kind: "struct", length: data.length, children, validity };
|
|
3117
|
-
}
|
|
3118
|
-
if (arrow7.DataType.isDenseUnion(data.type)) {
|
|
3119
|
-
const unionType = data.type;
|
|
3120
|
-
return {
|
|
3121
|
-
kind: "dense-union",
|
|
3122
|
-
length: data.length,
|
|
3123
|
-
typeIds: data.typeIds,
|
|
3124
|
-
valueOffsets: data.valueOffsets,
|
|
3125
|
-
children: unionType.children.map((field, childIndex) => ({
|
|
3126
|
-
name: field.name,
|
|
3127
|
-
typeId: unionType.typeIds[childIndex],
|
|
3128
|
-
encoding: inferGeoArrowEncodingFromUnionChild(field),
|
|
3129
|
-
dimension: inferGeoArrowDimensionFromUnionChild(field),
|
|
3130
|
-
coordinateLayout: inferGeoArrowCoordinateLayoutFromArrowType(field.type),
|
|
3131
|
-
data: makeGeoArrowArrayFromArrowData(data.children[childIndex])
|
|
3132
|
-
}))
|
|
3133
|
-
};
|
|
3134
|
-
}
|
|
3135
|
-
if (arrow7.DataType.isBinaryView(data.type) || arrow7.DataType.isUtf8View(data.type)) {
|
|
3136
|
-
const viewBytes = data.values;
|
|
3137
|
-
return {
|
|
3138
|
-
kind: "serialized",
|
|
3139
|
-
encoding: arrow7.DataType.isBinaryView(data.type) ? "binary" : "utf8",
|
|
3140
|
-
length: data.length,
|
|
3141
|
-
offsets: new Int32Array(0),
|
|
3142
|
-
values: new Uint8Array(0),
|
|
3143
|
-
views: new Uint32Array(
|
|
3144
|
-
viewBytes.buffer,
|
|
3145
|
-
viewBytes.byteOffset,
|
|
3146
|
-
Math.floor(viewBytes.byteLength / Uint32Array.BYTES_PER_ELEMENT)
|
|
3147
|
-
),
|
|
3148
|
-
dataBuffers: data.variadicBuffers,
|
|
3149
|
-
validity
|
|
3150
|
-
};
|
|
3151
|
-
}
|
|
3152
|
-
if (isOffsetSerializedArrowType(data.type)) {
|
|
3153
|
-
return {
|
|
3154
|
-
kind: "serialized",
|
|
3155
|
-
encoding: arrow7.DataType.isBinary(data.type) || arrow7.DataType.isLargeBinary(data.type) ? "binary" : "utf8",
|
|
3156
|
-
length: data.length,
|
|
3157
|
-
offsets: data.valueOffsets,
|
|
3158
|
-
values: data.values,
|
|
3159
|
-
validity
|
|
3160
|
-
};
|
|
3161
|
-
}
|
|
3162
|
-
if (arrow7.DataType.isInt(data.type) || arrow7.DataType.isFloat(data.type)) {
|
|
3163
|
-
return {
|
|
3164
|
-
kind: "primitive",
|
|
3165
|
-
length: data.length,
|
|
3166
|
-
values: data.values,
|
|
3167
|
-
validity
|
|
3168
|
-
};
|
|
3169
|
-
}
|
|
3170
|
-
throw new Error(`Unsupported GeoArrow physical Arrow type ${data.type.toString()}`);
|
|
3171
|
-
}
|
|
3172
|
-
function makeGeoArrowValidity(data) {
|
|
3173
|
-
if (data.nullCount === 0 || !data.nullBitmap || data.nullBitmap.length === 0) return void 0;
|
|
3174
|
-
return { values: data.nullBitmap, bitOffset: data.offset };
|
|
3175
|
-
}
|
|
3176
|
-
function makeArrowDataFromGeoArrowArray(array, dimension, coordinateLayout) {
|
|
3177
|
-
const validity = makeCompactValidity(array.validity, array.length);
|
|
3178
|
-
const nullCount = validity ? -1 : 0;
|
|
3179
|
-
const validityBuffers = validity ? { [arrow7.BufferType.VALIDITY]: validity } : {};
|
|
3180
|
-
switch (array.kind) {
|
|
3181
|
-
case "primitive": {
|
|
3182
|
-
const values = makePackedPrimitiveValues(array);
|
|
3183
|
-
return new arrow7.Data(getArrowTypeForValues(values), 0, array.length, nullCount, {
|
|
3184
|
-
...validityBuffers,
|
|
3185
|
-
[arrow7.BufferType.DATA]: values
|
|
3186
|
-
});
|
|
3187
|
-
}
|
|
3188
|
-
case "fixed-size-list": {
|
|
3189
|
-
const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
|
|
3190
|
-
const childStart = (array.offset ?? 0) * array.size;
|
|
3191
|
-
const slicedChild = childStart === 0 && child.length === array.length * array.size ? child : child.slice(childStart, array.length * array.size);
|
|
3192
|
-
const type = new arrow7.FixedSizeList(
|
|
3193
|
-
array.size,
|
|
3194
|
-
new arrow7.Field("value", slicedChild.type, true)
|
|
3195
|
-
);
|
|
3196
|
-
return new arrow7.Data(type, 0, array.length, nullCount, validityBuffers, [slicedChild]);
|
|
3197
|
-
}
|
|
3198
|
-
case "list": {
|
|
3199
|
-
const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
|
|
3200
|
-
const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
|
|
3201
|
-
const field = new arrow7.Field("value", child.type, true);
|
|
3202
|
-
const type = offsets instanceof BigInt64Array ? new arrow7.LargeList(field) : new arrow7.List(field);
|
|
3203
|
-
return new arrow7.Data(
|
|
3204
|
-
type,
|
|
3205
|
-
0,
|
|
3206
|
-
array.length,
|
|
3207
|
-
nullCount,
|
|
3208
|
-
{ ...validityBuffers, [arrow7.BufferType.OFFSET]: offsets },
|
|
3209
|
-
[child]
|
|
3210
|
-
);
|
|
3211
|
-
}
|
|
3212
|
-
case "struct": {
|
|
3213
|
-
const fields = [];
|
|
3214
|
-
const children = [];
|
|
3215
|
-
for (const [name, childArray] of Object.entries(array.children)) {
|
|
3216
|
-
let child = makeArrowDataFromGeoArrowArray(childArray, dimension, coordinateLayout);
|
|
3217
|
-
const childOffset = array.offset ?? 0;
|
|
3218
|
-
if (childOffset > 0 || child.length !== array.length) {
|
|
3219
|
-
child = child.slice(childOffset, array.length);
|
|
3220
|
-
}
|
|
3221
|
-
fields.push(new arrow7.Field(name, child.type, true));
|
|
3222
|
-
children.push(child);
|
|
3223
|
-
}
|
|
3224
|
-
return new arrow7.Data(
|
|
3225
|
-
new arrow7.Struct(fields),
|
|
3226
|
-
0,
|
|
3227
|
-
array.length,
|
|
3228
|
-
nullCount,
|
|
3229
|
-
validityBuffers,
|
|
3230
|
-
children
|
|
3231
|
-
);
|
|
3232
|
-
}
|
|
3233
|
-
case "dense-union":
|
|
3234
|
-
return makeArrowDenseUnionData(array, dimension, coordinateLayout);
|
|
3235
|
-
case "serialized": {
|
|
3236
|
-
if (array.views) {
|
|
3237
|
-
const type2 = array.encoding === "binary" ? new arrow7.BinaryView() : new arrow7.Utf8View();
|
|
3238
|
-
const viewBytes = new Uint8Array(
|
|
3239
|
-
array.views.buffer,
|
|
3240
|
-
array.views.byteOffset,
|
|
3241
|
-
array.views.byteLength
|
|
3242
|
-
);
|
|
3243
|
-
return new arrow7.Data(
|
|
3244
|
-
type2,
|
|
3245
|
-
0,
|
|
3246
|
-
array.length,
|
|
3247
|
-
nullCount,
|
|
3248
|
-
{ ...validityBuffers, [arrow7.BufferType.DATA]: viewBytes },
|
|
3249
|
-
[],
|
|
3250
|
-
void 0,
|
|
3251
|
-
array.dataBuffers
|
|
3252
|
-
);
|
|
3253
|
-
}
|
|
3254
|
-
const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
|
|
3255
|
-
const type = getSerializedArrowType(array.encoding, offsets);
|
|
3256
|
-
return new arrow7.Data(type, 0, array.length, nullCount, {
|
|
3257
|
-
...validityBuffers,
|
|
3258
|
-
[arrow7.BufferType.OFFSET]: offsets,
|
|
3259
|
-
[arrow7.BufferType.DATA]: array.values
|
|
3260
|
-
});
|
|
3261
|
-
}
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3264
|
-
function makeArrowDenseUnionData(array, dimension, coordinateLayout) {
|
|
3265
|
-
var _a;
|
|
3266
|
-
const offset = array.offset ?? 0;
|
|
3267
|
-
const sourceTypeIds = array.typeIds.subarray(offset, offset + array.length);
|
|
3268
|
-
const typeIds = sourceTypeIds instanceof Int8Array ? sourceTypeIds : new Int8Array(sourceTypeIds.buffer, sourceTypeIds.byteOffset, sourceTypeIds.byteLength);
|
|
3269
|
-
const valueOffsets = array.valueOffsets.subarray(offset, offset + array.length);
|
|
3270
|
-
const children = array.children.map(
|
|
3271
|
-
(child) => makeArrowDataFromGeoArrowArray(
|
|
3272
|
-
child.data,
|
|
3273
|
-
child.dimension ?? dimension,
|
|
3274
|
-
child.coordinateLayout === void 0 ? coordinateLayout : child.coordinateLayout
|
|
3275
|
-
)
|
|
3276
|
-
);
|
|
3277
|
-
if (array.validity) {
|
|
3278
|
-
for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
|
|
3279
|
-
if (isGeoArrowValueValid(array.validity, rowIndex)) continue;
|
|
3280
|
-
const childIndex = array.children.findIndex((child) => child.typeId === typeIds[rowIndex]);
|
|
3281
|
-
const childOffset = valueOffsets[rowIndex];
|
|
3282
|
-
const childValidity = (_a = array.children[childIndex]) == null ? void 0 : _a.data.validity;
|
|
3283
|
-
if (childIndex < 0 || childOffset < 0 || childOffset >= children[childIndex].length || !childValidity || isGeoArrowValueValid(childValidity, childOffset)) {
|
|
3284
|
-
throw new Error("GeoArrow dense-union null does not reference a nullable child value");
|
|
3285
|
-
}
|
|
3286
|
-
}
|
|
3287
|
-
}
|
|
3288
|
-
const fields = array.children.map(
|
|
3289
|
-
(child, childIndex) => new arrow7.Field(
|
|
3290
|
-
getArrowUnionChildName(child.name, child.dimension ?? dimension),
|
|
3291
|
-
children[childIndex].type,
|
|
3292
|
-
true
|
|
3293
|
-
)
|
|
3294
|
-
);
|
|
3295
|
-
const type = new arrow7.DenseUnion(
|
|
3296
|
-
Int32Array.from(array.children.map((child) => child.typeId)),
|
|
3297
|
-
fields
|
|
3298
|
-
);
|
|
3299
|
-
return new arrow7.Data(
|
|
3300
|
-
type,
|
|
3301
|
-
0,
|
|
3302
|
-
array.length,
|
|
3303
|
-
0,
|
|
3304
|
-
{ [arrow7.BufferType.TYPE]: typeIds, [arrow7.BufferType.OFFSET]: valueOffsets },
|
|
3305
|
-
children
|
|
3306
|
-
);
|
|
3307
|
-
}
|
|
3308
|
-
function makePackedPrimitiveValues(array) {
|
|
3309
|
-
const offset = array.offset ?? 0;
|
|
3310
|
-
const stride = array.stride ?? 1;
|
|
3311
|
-
if (stride === 1) {
|
|
3312
|
-
return array.values.subarray(offset, offset + array.length);
|
|
3313
|
-
}
|
|
3314
|
-
const ValuesConstructor = array.values.constructor;
|
|
3315
|
-
const values = new ValuesConstructor(array.length);
|
|
3316
|
-
for (let index = 0; index < array.length; index++) {
|
|
3317
|
-
values[index] = array.values[offset + index * stride];
|
|
3318
|
-
}
|
|
3319
|
-
return values;
|
|
3320
|
-
}
|
|
3321
|
-
function getArrowTypeForValues(values) {
|
|
3322
|
-
if (values instanceof Int8Array) return new arrow7.Int8();
|
|
3323
|
-
if (values instanceof Uint8Array || values instanceof Uint8ClampedArray) return new arrow7.Uint8();
|
|
3324
|
-
if (values instanceof Int16Array) return new arrow7.Int16();
|
|
3325
|
-
if (values instanceof Uint16Array) return new arrow7.Uint16();
|
|
3326
|
-
if (values instanceof Int32Array) return new arrow7.Int32();
|
|
3327
|
-
if (values instanceof Uint32Array) return new arrow7.Uint32();
|
|
3328
|
-
if (values instanceof BigInt64Array) return new arrow7.Int64();
|
|
3329
|
-
if (values instanceof BigUint64Array) return new arrow7.Uint64();
|
|
3330
|
-
if (values instanceof Float32Array) return new arrow7.Float32();
|
|
3331
|
-
if (values instanceof Float64Array) return new arrow7.Float64();
|
|
3332
|
-
throw new Error(`Unsupported GeoArrow primitive values ${values.constructor.name}`);
|
|
3333
|
-
}
|
|
3334
|
-
function makeArrowOffsets(offsets, offset = 0, length, offsetBase = 0) {
|
|
3335
|
-
const source = offsets.subarray(offset, offset + length + 1);
|
|
3336
|
-
if (offsetBase === 0 || offsetBase === 0n) return source;
|
|
3337
|
-
const normalized = offsets instanceof BigInt64Array ? new BigInt64Array(source.length) : new Int32Array(source.length);
|
|
3338
|
-
for (let index = 0; index < source.length; index++) {
|
|
3339
|
-
if (normalized instanceof BigInt64Array) {
|
|
3340
|
-
normalized[index] = BigInt(source[index]) - BigInt(offsetBase);
|
|
3341
|
-
} else {
|
|
3342
|
-
normalized[index] = Number(source[index]) - Number(offsetBase);
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
return normalized;
|
|
3346
|
-
}
|
|
3347
|
-
function makeCompactValidity(validity, length) {
|
|
3348
|
-
if (!validity) return void 0;
|
|
3349
|
-
const bitOffset = validity.bitOffset ?? 0;
|
|
3350
|
-
if (bitOffset === 0 && validity.values.length === Math.ceil(length / 8)) {
|
|
3351
|
-
return validity.values;
|
|
3352
|
-
}
|
|
3353
|
-
const values = new Uint8Array(Math.ceil(length / 8));
|
|
3354
|
-
let nullCount = 0;
|
|
3355
|
-
for (let index = 0; index < length; index++) {
|
|
3356
|
-
if (isGeoArrowValueValid(validity, index)) values[index >> 3] |= 1 << (index & 7);
|
|
3357
|
-
else nullCount++;
|
|
3358
|
-
}
|
|
3359
|
-
return nullCount > 0 ? values : void 0;
|
|
3360
|
-
}
|
|
3361
|
-
function isGeoArrowValueValid(validity, index) {
|
|
3362
|
-
const bitIndex = (validity.bitOffset ?? 0) + index;
|
|
3363
|
-
return Boolean(validity.values[bitIndex >> 3] & 1 << (bitIndex & 7));
|
|
3364
|
-
}
|
|
3365
|
-
function inferGeoArrowEncodingFromUnionChild(field) {
|
|
3366
|
-
const normalizedName = field.name.replace(/[^a-z]/gi, "").toLowerCase();
|
|
3367
|
-
const names = {
|
|
3368
|
-
point: "geoarrow.point",
|
|
3369
|
-
linestring: "geoarrow.linestring",
|
|
3370
|
-
polygon: "geoarrow.polygon",
|
|
3371
|
-
multipoint: "geoarrow.multipoint",
|
|
3372
|
-
multilinestring: "geoarrow.multilinestring",
|
|
3373
|
-
multipolygon: "geoarrow.multipolygon",
|
|
3374
|
-
geometrycollection: "geoarrow.geometrycollection"
|
|
3375
|
-
};
|
|
3376
|
-
for (const [name, encoding] of Object.entries(names)) {
|
|
3377
|
-
if (normalizedName.startsWith(name)) return encoding;
|
|
3378
|
-
}
|
|
3379
|
-
return inferGeoArrowEncodingFromArrowType(field.type);
|
|
3380
|
-
}
|
|
3381
|
-
function inferGeoArrowDimensionFromUnionChild(field) {
|
|
3382
|
-
if (/\sZM$/i.test(field.name)) return "xyzm";
|
|
3383
|
-
if (/\sM$/i.test(field.name)) return "xym";
|
|
3384
|
-
if (/\sZ$/i.test(field.name)) return "xyz";
|
|
3385
|
-
return inferGeoArrowDimensionFromArrowType(field.type);
|
|
3386
|
-
}
|
|
3387
|
-
function getArrowUnionChildName(name, dimension) {
|
|
3388
|
-
if (/\s(?:Z|M|ZM)$/i.test(name) || dimension === "xy") return name;
|
|
3389
|
-
const suffix = dimension === "xyz" ? "Z" : dimension === "xym" ? "M" : "ZM";
|
|
3390
|
-
return `${name} ${suffix}`;
|
|
3391
|
-
}
|
|
3392
|
-
function getArrowListNesting(type) {
|
|
3393
|
-
let nesting = 0;
|
|
3394
|
-
let currentType = type;
|
|
3395
|
-
while (arrow7.DataType.isList(currentType) || arrow7.DataType.isLargeList(currentType)) {
|
|
3396
|
-
nesting++;
|
|
3397
|
-
currentType = currentType.children[0].type;
|
|
3398
|
-
}
|
|
3399
|
-
if (arrow7.DataType.isFixedSizeList(currentType) || arrow7.DataType.isStruct(currentType)) {
|
|
3400
|
-
return nesting;
|
|
3401
|
-
}
|
|
3402
|
-
throw new Error(`GeoArrow type does not terminate in coordinates: ${type.toString()}`);
|
|
3403
|
-
}
|
|
3404
|
-
function getSerializedArrowType(encoding, offsets) {
|
|
3405
|
-
if (encoding === "binary") {
|
|
3406
|
-
return offsets instanceof BigInt64Array ? new arrow7.LargeBinary() : new arrow7.Binary();
|
|
3407
|
-
}
|
|
3408
|
-
return offsets instanceof BigInt64Array ? new arrow7.LargeUtf8() : new arrow7.Utf8();
|
|
3409
|
-
}
|
|
3410
|
-
function isOffsetSerializedArrowType(type) {
|
|
3411
|
-
return arrow7.DataType.isBinary(type) || arrow7.DataType.isLargeBinary(type) || arrow7.DataType.isUtf8(type) || arrow7.DataType.isLargeUtf8(type);
|
|
3412
|
-
}
|
|
3413
|
-
function isSerializedArrowType(type) {
|
|
3414
|
-
return isOffsetSerializedArrowType(type) || arrow7.DataType.isBinaryView(type) || arrow7.DataType.isUtf8View(type);
|
|
3415
|
-
}
|
|
3416
|
-
function isGeoArrowDimension(value) {
|
|
3417
|
-
return value === "xy" || value === "xyz" || value === "xym" || value === "xyzm";
|
|
3418
|
-
}
|
|
3419
|
-
function mergeGeoArrowDimensions(left, right) {
|
|
3420
|
-
if (left === right) return left;
|
|
3421
|
-
if (left === "xy") return right;
|
|
3422
|
-
if (right === "xy") return left;
|
|
3423
|
-
if (left === "xyzm" || right === "xyzm") return "xyzm";
|
|
3424
|
-
return left === "xym" && right === "xym" ? "xym" : "xyzm";
|
|
3425
|
-
}
|
|
3426
|
-
|
|
3427
3038
|
// dist/geoarrow/lib/kernels/decode-wkt-native.js
|
|
3428
3039
|
var UNION_GEOMETRY_KINDS = [
|
|
3429
3040
|
"Point",
|
|
@@ -3471,7 +3082,7 @@ function decodeWKTNativeVector(column, targetEncoding, dimension, coordinates =
|
|
|
3471
3082
|
coordinateLayout: coordinates,
|
|
3472
3083
|
offsetType
|
|
3473
3084
|
});
|
|
3474
|
-
return
|
|
3085
|
+
return arrow7.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
|
|
3475
3086
|
}
|
|
3476
3087
|
function decodeWKTUnionVector(column, dimension, coordinates = "interleaved", offsetType = "int32", geometryTypes, maxGeometryCollectionDepth = 64) {
|
|
3477
3088
|
const parsedRows = [];
|
|
@@ -3552,7 +3163,7 @@ function makeWKTUnionVector(parsedRows, dimension, coordinates, offsetType, geom
|
|
|
3552
3163
|
const collectionVector = makeWKTCollectionVector(rows, dimension, coordinates, offsetType, geometryTypes);
|
|
3553
3164
|
if (!collectionVector)
|
|
3554
3165
|
return null;
|
|
3555
|
-
fields.push(new
|
|
3166
|
+
fields.push(new arrow7.Field(getWKTUnionFieldName(child), collectionVector.type, true));
|
|
3556
3167
|
childData.push(collectionVector.data[0]);
|
|
3557
3168
|
continue;
|
|
3558
3169
|
}
|
|
@@ -3563,12 +3174,12 @@ function makeWKTUnionVector(parsedRows, dimension, coordinates, offsetType, geom
|
|
|
3563
3174
|
coordinateLayout: coordinates,
|
|
3564
3175
|
offsetType
|
|
3565
3176
|
});
|
|
3566
|
-
const childVector =
|
|
3567
|
-
fields.push(new
|
|
3177
|
+
const childVector = arrow7.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
|
|
3178
|
+
fields.push(new arrow7.Field(getWKTUnionFieldName(child), childVector.type, true));
|
|
3568
3179
|
childData.push(childVector.data[0]);
|
|
3569
3180
|
}
|
|
3570
|
-
const unionType = new
|
|
3571
|
-
return
|
|
3181
|
+
const unionType = new arrow7.DenseUnion(orderedChildren.map(getWKTUnionTypeId), fields);
|
|
3182
|
+
return arrow7.makeVector(arrow7.makeData({
|
|
3572
3183
|
type: unionType,
|
|
3573
3184
|
length: parsedRows.length,
|
|
3574
3185
|
nullCount: 0,
|
|
@@ -3599,9 +3210,9 @@ function makeWKTCollectionVector(parsedRows, dimension, coordinates, offsetType,
|
|
|
3599
3210
|
const unionVector = makeWKTUnionVector(flattenedChildren, dimension, coordinates, offsetType, geometryTypes == null ? void 0 : geometryTypes.filter((geometryType) => !geometryType.toLowerCase().startsWith("geometrycollection")), false);
|
|
3600
3211
|
if (!unionVector)
|
|
3601
3212
|
return null;
|
|
3602
|
-
const listField = new
|
|
3603
|
-
const listType = offsetType === "int64" ? new
|
|
3604
|
-
return
|
|
3213
|
+
const listField = new arrow7.Field("geometries", unionVector.type, true);
|
|
3214
|
+
const listType = offsetType === "int64" ? new arrow7.LargeList(listField) : new arrow7.List(listField);
|
|
3215
|
+
return arrow7.makeVector(arrow7.makeData({
|
|
3605
3216
|
type: listType,
|
|
3606
3217
|
length: parsedRows.length,
|
|
3607
3218
|
nullCount,
|
|
@@ -3990,8 +3601,8 @@ function isCoordinate(value) {
|
|
|
3990
3601
|
}
|
|
3991
3602
|
|
|
3992
3603
|
// dist/geoarrow/lib/kernels/encode-geoarrow-box.js
|
|
3993
|
-
var
|
|
3994
|
-
var
|
|
3604
|
+
var arrow8 = __toESM(require("apache-arrow"), 1);
|
|
3605
|
+
var import_wkb5 = require("@math.gl/arrow/wkb");
|
|
3995
3606
|
function encodeGeoArrowBoxVector(column, sourceEncoding, dimension) {
|
|
3996
3607
|
const coordinateSize = dimension ? getDimensionSize2(dimension) : inferDimension2(column, sourceEncoding);
|
|
3997
3608
|
const effectiveDimension = dimension || getDimensionName(coordinateSize);
|
|
@@ -4002,9 +3613,9 @@ function encodeGeoArrowBoxVector(column, sourceEncoding, dimension) {
|
|
|
4002
3613
|
bounds.push(rowBounds && normalizeBounds(rowBounds, coordinateSize));
|
|
4003
3614
|
}
|
|
4004
3615
|
const fieldNames = getBoxFieldNames2(effectiveDimension);
|
|
4005
|
-
const boxType = new
|
|
4006
|
-
const children = fieldNames.map((_, fieldIndex) =>
|
|
4007
|
-
type: new
|
|
3616
|
+
const boxType = new arrow8.Struct(fieldNames.map((name) => new arrow8.Field(name, new arrow8.Float64(), true)));
|
|
3617
|
+
const children = fieldNames.map((_, fieldIndex) => arrow8.makeData({
|
|
3618
|
+
type: new arrow8.Float64(),
|
|
4008
3619
|
data: Float64Array.from(bounds, (rowBounds) => (rowBounds == null ? void 0 : rowBounds[fieldIndex]) ?? Number.NaN)
|
|
4009
3620
|
}));
|
|
4010
3621
|
const nullBitmap = new Uint8Array(Math.ceil(column.length / 8));
|
|
@@ -4015,7 +3626,7 @@ function encodeGeoArrowBoxVector(column, sourceEncoding, dimension) {
|
|
|
4015
3626
|
else
|
|
4016
3627
|
nullCount++;
|
|
4017
3628
|
}
|
|
4018
|
-
return
|
|
3629
|
+
return arrow8.makeVector(arrow8.makeData({
|
|
4019
3630
|
type: boxType,
|
|
4020
3631
|
length: column.length,
|
|
4021
3632
|
nullCount,
|
|
@@ -4028,7 +3639,7 @@ function getRowBounds(value, sourceEncoding, dimension) {
|
|
|
4028
3639
|
return null;
|
|
4029
3640
|
if (sourceEncoding === "geoarrow.wkb") {
|
|
4030
3641
|
const bytes = value;
|
|
4031
|
-
const statistics = (0,
|
|
3642
|
+
const statistics = (0, import_wkb5.scanWKB)(bytes);
|
|
4032
3643
|
return statistics.bounds ? boundsFromRecord(statistics.bounds, dimension) : null;
|
|
4033
3644
|
}
|
|
4034
3645
|
if (sourceEncoding === "geoarrow.wkt") {
|
|
@@ -4151,14 +3762,14 @@ function inferDimension2(column, sourceEncoding) {
|
|
|
4151
3762
|
if (value == null)
|
|
4152
3763
|
continue;
|
|
4153
3764
|
const bytes = value;
|
|
4154
|
-
const statistics = (0,
|
|
3765
|
+
const statistics = (0, import_wkb5.scanWKB)(bytes);
|
|
4155
3766
|
const hasZ = ((_a = statistics.bounds) == null ? void 0 : _a.zmin) !== void 0;
|
|
4156
3767
|
const hasM = ((_b = statistics.bounds) == null ? void 0 : _b.mmin) !== void 0;
|
|
4157
3768
|
coordinateSize = Math.max(coordinateSize, hasZ && hasM ? 4 : hasZ || hasM ? 3 : 2);
|
|
4158
3769
|
}
|
|
4159
3770
|
return coordinateSize;
|
|
4160
3771
|
}
|
|
4161
|
-
if (column.type instanceof
|
|
3772
|
+
if (column.type instanceof arrow8.Struct) {
|
|
4162
3773
|
const names = column.type.children.map((child) => child.name);
|
|
4163
3774
|
if (names.includes("mmin") && names.includes("zmin"))
|
|
4164
3775
|
return 4;
|
|
@@ -4210,7 +3821,7 @@ function getBoxFieldNames2(dimension) {
|
|
|
4210
3821
|
}
|
|
4211
3822
|
|
|
4212
3823
|
// dist/geoarrow/lib/kernels/encode-geoarrow-wkt.js
|
|
4213
|
-
var
|
|
3824
|
+
var arrow9 = __toESM(require("apache-arrow"), 1);
|
|
4214
3825
|
function encodeGeoArrowWKTVector(column, sourceEncoding, dimension) {
|
|
4215
3826
|
if (!isNativeGeometryEncoding(sourceEncoding))
|
|
4216
3827
|
return null;
|
|
@@ -4228,7 +3839,7 @@ function encodeGeoArrowWKTVector(column, sourceEncoding, dimension) {
|
|
|
4228
3839
|
return null;
|
|
4229
3840
|
values.push(wkt);
|
|
4230
3841
|
}
|
|
4231
|
-
return
|
|
3842
|
+
return arrow9.vectorFromArray(values, new arrow9.Utf8());
|
|
4232
3843
|
}
|
|
4233
3844
|
function isNativeGeometryEncoding(encoding) {
|
|
4234
3845
|
return encoding === "geoarrow.point" || encoding === "geoarrow.linestring" || encoding === "geoarrow.polygon" || encoding === "geoarrow.multipoint" || encoding === "geoarrow.multilinestring" || encoding === "geoarrow.multipolygon" || encoding === "geoarrow.geometry" || encoding === "geoarrow.geometrycollection";
|
|
@@ -4400,7 +4011,7 @@ function getUnionTypeId2(vector, rowIndex) {
|
|
|
4400
4011
|
}
|
|
4401
4012
|
function getUnionField(vector, rowIndex) {
|
|
4402
4013
|
const unionType = vector.type;
|
|
4403
|
-
if (!(unionType instanceof
|
|
4014
|
+
if (!(unionType instanceof arrow9.DenseUnion))
|
|
4404
4015
|
return void 0;
|
|
4405
4016
|
const typeId = getUnionTypeId2(vector, rowIndex);
|
|
4406
4017
|
const childIndex = unionType.typeIds.indexOf(typeId);
|
|
@@ -4413,10 +4024,10 @@ function inferDimensionFromTypeId(column, rowIndex, sourceEncoding) {
|
|
|
4413
4024
|
return getGeoArrowUnionDimension(field == null ? void 0 : field.name, field == null ? void 0 : field.type, typeId) || "xy";
|
|
4414
4025
|
}
|
|
4415
4026
|
let type = column.type;
|
|
4416
|
-
while (type instanceof
|
|
4027
|
+
while (type instanceof arrow9.List || type instanceof arrow9.LargeList) {
|
|
4417
4028
|
type = type.children[0].type;
|
|
4418
4029
|
}
|
|
4419
|
-
if (type instanceof
|
|
4030
|
+
if (type instanceof arrow9.Struct) {
|
|
4420
4031
|
const names = new Set(type.children.map((field) => field.name));
|
|
4421
4032
|
if (names.has("z") && names.has("m"))
|
|
4422
4033
|
return "xyzm";
|
|
@@ -4425,7 +4036,7 @@ function inferDimensionFromTypeId(column, rowIndex, sourceEncoding) {
|
|
|
4425
4036
|
if (names.has("z"))
|
|
4426
4037
|
return "xyz";
|
|
4427
4038
|
}
|
|
4428
|
-
if (type instanceof
|
|
4039
|
+
if (type instanceof arrow9.FixedSizeList) {
|
|
4429
4040
|
return type.listSize === 4 ? "xyzm" : type.listSize === 3 ? "xyz" : "xy";
|
|
4430
4041
|
}
|
|
4431
4042
|
return "xy";
|
|
@@ -4481,11 +4092,11 @@ function isVectorLike3(value) {
|
|
|
4481
4092
|
}
|
|
4482
4093
|
|
|
4483
4094
|
// dist/geoarrow/get-geoarrow-vertex-count.js
|
|
4484
|
-
var
|
|
4485
|
-
var
|
|
4095
|
+
var arrow13 = __toESM(require("apache-arrow"), 1);
|
|
4096
|
+
var import_wkb6 = require("@math.gl/arrow/wkb");
|
|
4486
4097
|
|
|
4487
4098
|
// dist/geoarrow/geoarrow-functions.js
|
|
4488
|
-
var
|
|
4099
|
+
var arrow10 = __toESM(require("apache-arrow"), 1);
|
|
4489
4100
|
var import_type = require("apache-arrow/type");
|
|
4490
4101
|
function isGeoArrowBox(type) {
|
|
4491
4102
|
if (!import_type.DataType.isStruct(type))
|
|
@@ -4567,18 +4178,18 @@ function isGeoArrowMultiPolygon(type) {
|
|
|
4567
4178
|
return true;
|
|
4568
4179
|
}
|
|
4569
4180
|
function isGeoArrowList(type) {
|
|
4570
|
-
const
|
|
4571
|
-
return type instanceof import_type.List || Boolean(
|
|
4181
|
+
const LargeList9 = getOptionalArrowListConstructor("LargeList");
|
|
4182
|
+
return type instanceof import_type.List || Boolean(LargeList9 && type instanceof LargeList9);
|
|
4572
4183
|
}
|
|
4573
4184
|
function getOptionalArrowListConstructor(typeName) {
|
|
4574
|
-
return
|
|
4185
|
+
return arrow10[typeName];
|
|
4575
4186
|
}
|
|
4576
4187
|
|
|
4577
4188
|
// dist/geoarrow/get-geoarrow-geometry-info.js
|
|
4578
|
-
var
|
|
4189
|
+
var arrow12 = __toESM(require("apache-arrow"), 1);
|
|
4579
4190
|
|
|
4580
4191
|
// dist/geoarrow/geoarrow-layout.js
|
|
4581
|
-
var
|
|
4192
|
+
var arrow11 = __toESM(require("apache-arrow"), 1);
|
|
4582
4193
|
var NATIVE_LAYOUTS = {
|
|
4583
4194
|
point: { depth: 0, encoding: "geoarrow.point" },
|
|
4584
4195
|
linestring: { depth: 1, encoding: "geoarrow.linestring" },
|
|
@@ -4642,11 +4253,11 @@ function inspectGeoArrowLayout(field) {
|
|
|
4642
4253
|
function visitType(type, path, state) {
|
|
4643
4254
|
const storage = getStorageKind(type);
|
|
4644
4255
|
state.storageKinds.push(storage);
|
|
4645
|
-
if (type instanceof
|
|
4646
|
-
state.offsetTypes.push(type instanceof
|
|
4647
|
-
} else if (type instanceof
|
|
4648
|
-
state.offsetTypes.push(type instanceof
|
|
4649
|
-
} else if (type instanceof
|
|
4256
|
+
if (type instanceof arrow11.List || type instanceof arrow11.LargeList) {
|
|
4257
|
+
state.offsetTypes.push(type instanceof arrow11.LargeList ? "int64" : "int32");
|
|
4258
|
+
} else if (type instanceof arrow11.Binary || type instanceof arrow11.LargeBinary) {
|
|
4259
|
+
state.offsetTypes.push(type instanceof arrow11.LargeBinary ? "int64" : "int32");
|
|
4260
|
+
} else if (type instanceof arrow11.DenseUnion) {
|
|
4650
4261
|
state.unionTypeIds.push(...Array.from(type.typeIds));
|
|
4651
4262
|
for (let childIndex = 0; childIndex < type.children.length; childIndex++) {
|
|
4652
4263
|
const child = type.children[childIndex];
|
|
@@ -4682,10 +4293,10 @@ function visitType(type, path, state) {
|
|
|
4682
4293
|
}
|
|
4683
4294
|
function classifyField(type, encoding, path, state, issues) {
|
|
4684
4295
|
var _a;
|
|
4685
|
-
if (type instanceof
|
|
4296
|
+
if (type instanceof arrow11.Binary || type instanceof arrow11.LargeBinary || type instanceof arrow11.BinaryView) {
|
|
4686
4297
|
return "wkb";
|
|
4687
4298
|
}
|
|
4688
|
-
if (type instanceof
|
|
4299
|
+
if (type instanceof arrow11.Utf8 || type instanceof arrow11.LargeUtf8 || type instanceof arrow11.Utf8View) {
|
|
4689
4300
|
return "wkt";
|
|
4690
4301
|
}
|
|
4691
4302
|
if (isBoxType(type)) {
|
|
@@ -4694,7 +4305,7 @@ function classifyField(type, encoding, path, state, issues) {
|
|
|
4694
4305
|
recordCoordinateSemantics(type, state, "separated");
|
|
4695
4306
|
return "box";
|
|
4696
4307
|
}
|
|
4697
|
-
if (type instanceof
|
|
4308
|
+
if (type instanceof arrow11.DenseUnion) {
|
|
4698
4309
|
validateUnionType(type, path, state, issues);
|
|
4699
4310
|
if (encoding === "geoarrow.geometrycollection") {
|
|
4700
4311
|
issues.push({
|
|
@@ -4706,7 +4317,7 @@ function classifyField(type, encoding, path, state, issues) {
|
|
|
4706
4317
|
validateUnionChildren(type, path, issues, true);
|
|
4707
4318
|
return "geometry-union";
|
|
4708
4319
|
}
|
|
4709
|
-
if ((type instanceof
|
|
4320
|
+
if ((type instanceof arrow11.List || type instanceof arrow11.LargeList) && ((_a = type.children[0]) == null ? void 0 : _a.type) instanceof arrow11.DenseUnion) {
|
|
4710
4321
|
validateUnionType(type.children[0].type, `${path}.child[0]`, state, issues);
|
|
4711
4322
|
validateUnionChildren(type.children[0].type, `${path}.child[0]`, issues, false);
|
|
4712
4323
|
return "geometrycollection";
|
|
@@ -4765,8 +4376,8 @@ function validateDeclaredEncoding(type, encoding, path, state, issues) {
|
|
|
4765
4376
|
});
|
|
4766
4377
|
}
|
|
4767
4378
|
}
|
|
4768
|
-
if (encoding === "geoarrow.geometrycollection" && type instanceof
|
|
4769
|
-
if (!(((_a = type.children[0]) == null ? void 0 : _a.type) instanceof
|
|
4379
|
+
if (encoding === "geoarrow.geometrycollection" && type instanceof arrow11.List) {
|
|
4380
|
+
if (!(((_a = type.children[0]) == null ? void 0 : _a.type) instanceof arrow11.DenseUnion)) {
|
|
4770
4381
|
addWrongPhysicalType(path, encoding, issues);
|
|
4771
4382
|
}
|
|
4772
4383
|
}
|
|
@@ -4774,7 +4385,7 @@ function validateDeclaredEncoding(type, encoding, path, state, issues) {
|
|
|
4774
4385
|
function validateNativeType(type, expectedDepth, path, state, issues) {
|
|
4775
4386
|
let current = type;
|
|
4776
4387
|
for (let depth = 0; depth < expectedDepth; depth++) {
|
|
4777
|
-
if (!(current instanceof
|
|
4388
|
+
if (!(current instanceof arrow11.List || current instanceof arrow11.LargeList)) {
|
|
4778
4389
|
issues.push({
|
|
4779
4390
|
code: "wrong-child-count",
|
|
4780
4391
|
path,
|
|
@@ -4795,7 +4406,7 @@ function validateNativeType(type, expectedDepth, path, state, issues) {
|
|
|
4795
4406
|
validateCoordinateType(current, path, state, issues);
|
|
4796
4407
|
}
|
|
4797
4408
|
function validateCoordinateType(type, path, state, issues) {
|
|
4798
|
-
if (type instanceof
|
|
4409
|
+
if (type instanceof arrow11.FixedSizeList) {
|
|
4799
4410
|
if (type.children.length !== 1 || !type.children[0]) {
|
|
4800
4411
|
issues.push({
|
|
4801
4412
|
code: "wrong-child-count",
|
|
@@ -4817,7 +4428,7 @@ function validateCoordinateType(type, path, state, issues) {
|
|
|
4817
4428
|
recordFloatPrecision(type.children[0].type, `${path}.child[0]`, state, issues);
|
|
4818
4429
|
return;
|
|
4819
4430
|
}
|
|
4820
|
-
if (type instanceof
|
|
4431
|
+
if (type instanceof arrow11.Struct) {
|
|
4821
4432
|
const names = type.children.map((child) => child.name);
|
|
4822
4433
|
const dimension = getSeparatedDimension(names);
|
|
4823
4434
|
if (!dimension) {
|
|
@@ -4849,7 +4460,7 @@ function validateCoordinateType(type, path, state, issues) {
|
|
|
4849
4460
|
});
|
|
4850
4461
|
}
|
|
4851
4462
|
function recordFloatPrecision(type, path, state, issues) {
|
|
4852
|
-
if (!(type instanceof
|
|
4463
|
+
if (!(type instanceof arrow11.Float)) {
|
|
4853
4464
|
issues.push({
|
|
4854
4465
|
code: "wrong-coordinate-precision",
|
|
4855
4466
|
path,
|
|
@@ -4857,7 +4468,7 @@ function recordFloatPrecision(type, path, state, issues) {
|
|
|
4857
4468
|
});
|
|
4858
4469
|
return;
|
|
4859
4470
|
}
|
|
4860
|
-
const precision = type.precision ===
|
|
4471
|
+
const precision = type.precision === arrow11.Precision.HALF ? "float16" : type.precision === arrow11.Precision.SINGLE ? "float32" : "float64";
|
|
4861
4472
|
state.precisions.push(precision);
|
|
4862
4473
|
if (precision === "float16") {
|
|
4863
4474
|
issues.push({
|
|
@@ -4868,7 +4479,7 @@ function recordFloatPrecision(type, path, state, issues) {
|
|
|
4868
4479
|
}
|
|
4869
4480
|
}
|
|
4870
4481
|
function validateBoxType(type, path, issues) {
|
|
4871
|
-
if (!(type instanceof
|
|
4482
|
+
if (!(type instanceof arrow11.Struct))
|
|
4872
4483
|
return;
|
|
4873
4484
|
const names = type.children.map((child) => child.name);
|
|
4874
4485
|
if (!getBoxDimension(names)) {
|
|
@@ -4879,7 +4490,7 @@ function validateBoxType(type, path, issues) {
|
|
|
4879
4490
|
});
|
|
4880
4491
|
}
|
|
4881
4492
|
for (let childIndex = 0; childIndex < type.children.length; childIndex++) {
|
|
4882
|
-
if (!(type.children[childIndex].type instanceof
|
|
4493
|
+
if (!(type.children[childIndex].type instanceof arrow11.Float)) {
|
|
4883
4494
|
issues.push({
|
|
4884
4495
|
code: "wrong-coordinate-precision",
|
|
4885
4496
|
path: `${path}.child[${childIndex}]`,
|
|
@@ -4934,7 +4545,7 @@ function validateUnionChildren(type, path, issues, allowGeometryCollection) {
|
|
|
4934
4545
|
});
|
|
4935
4546
|
continue;
|
|
4936
4547
|
}
|
|
4937
|
-
if (!(child.type instanceof
|
|
4548
|
+
if (!(child.type instanceof arrow11.List || child.type instanceof arrow11.LargeList) || !(((_a = child.type.children[0]) == null ? void 0 : _a.type) instanceof arrow11.DenseUnion)) {
|
|
4938
4549
|
issues.push({
|
|
4939
4550
|
code: "wrong-physical-type",
|
|
4940
4551
|
path: childPath,
|
|
@@ -4963,27 +4574,27 @@ function validateUnionChildren(type, path, issues, allowGeometryCollection) {
|
|
|
4963
4574
|
}
|
|
4964
4575
|
}
|
|
4965
4576
|
function recordCoordinateSemantics(type, state, coordinates) {
|
|
4966
|
-
if (!(type instanceof
|
|
4577
|
+
if (!(type instanceof arrow11.Struct))
|
|
4967
4578
|
return;
|
|
4968
4579
|
const dimension = getBoxDimension(type.children.map((child) => child.name));
|
|
4969
4580
|
if (dimension) {
|
|
4970
4581
|
state.dimensions.push(dimension);
|
|
4971
4582
|
state.coordinates.push(coordinates);
|
|
4972
4583
|
for (const child of type.children) {
|
|
4973
|
-
if (child.type instanceof
|
|
4974
|
-
state.precisions.push(child.type.precision ===
|
|
4584
|
+
if (child.type instanceof arrow11.Float) {
|
|
4585
|
+
state.precisions.push(child.type.precision === arrow11.Precision.SINGLE ? "float32" : "float64");
|
|
4975
4586
|
}
|
|
4976
4587
|
}
|
|
4977
4588
|
}
|
|
4978
4589
|
}
|
|
4979
4590
|
function isPotentialNativeType(type) {
|
|
4980
|
-
return type instanceof
|
|
4591
|
+
return type instanceof arrow11.FixedSizeList || type instanceof arrow11.Struct || type instanceof arrow11.List || type instanceof arrow11.LargeList;
|
|
4981
4592
|
}
|
|
4982
4593
|
function getListDepth(type) {
|
|
4983
4594
|
var _a;
|
|
4984
4595
|
let depth = 0;
|
|
4985
4596
|
let current = type;
|
|
4986
|
-
while (current instanceof
|
|
4597
|
+
while (current instanceof arrow11.List || current instanceof arrow11.LargeList) {
|
|
4987
4598
|
depth++;
|
|
4988
4599
|
current = (_a = current.children[0]) == null ? void 0 : _a.type;
|
|
4989
4600
|
if (!current)
|
|
@@ -4995,7 +4606,7 @@ function getNativeKind(type, encoding) {
|
|
|
4995
4606
|
const encodingKind = encoding ? encodingToKind(encoding) : null;
|
|
4996
4607
|
if (isNativeLayoutKind(encodingKind))
|
|
4997
4608
|
return encodingKind;
|
|
4998
|
-
if (type instanceof
|
|
4609
|
+
if (type instanceof arrow11.FixedSizeList || isCoordinateStruct(type))
|
|
4999
4610
|
return "point";
|
|
5000
4611
|
return null;
|
|
5001
4612
|
}
|
|
@@ -5040,34 +4651,34 @@ function addWrongPhysicalType(path, encoding, issues) {
|
|
|
5040
4651
|
});
|
|
5041
4652
|
}
|
|
5042
4653
|
function getStorageKind(type) {
|
|
5043
|
-
if (type instanceof
|
|
4654
|
+
if (type instanceof arrow11.FixedSizeList)
|
|
5044
4655
|
return "fixed-size-list";
|
|
5045
|
-
if (type instanceof
|
|
4656
|
+
if (type instanceof arrow11.List)
|
|
5046
4657
|
return "list";
|
|
5047
|
-
if (type instanceof
|
|
4658
|
+
if (type instanceof arrow11.LargeList)
|
|
5048
4659
|
return "large-list";
|
|
5049
|
-
if (type instanceof
|
|
4660
|
+
if (type instanceof arrow11.Struct)
|
|
5050
4661
|
return "struct";
|
|
5051
|
-
if (type instanceof
|
|
4662
|
+
if (type instanceof arrow11.DenseUnion)
|
|
5052
4663
|
return "dense-union";
|
|
5053
|
-
if (type instanceof
|
|
4664
|
+
if (type instanceof arrow11.Binary)
|
|
5054
4665
|
return "binary";
|
|
5055
|
-
if (type instanceof
|
|
4666
|
+
if (type instanceof arrow11.LargeBinary)
|
|
5056
4667
|
return "large-binary";
|
|
5057
|
-
if (type instanceof
|
|
4668
|
+
if (type instanceof arrow11.BinaryView)
|
|
5058
4669
|
return "binary-view";
|
|
5059
|
-
if (type instanceof
|
|
4670
|
+
if (type instanceof arrow11.Utf8)
|
|
5060
4671
|
return "utf8";
|
|
5061
|
-
if (type instanceof
|
|
4672
|
+
if (type instanceof arrow11.LargeUtf8)
|
|
5062
4673
|
return "large-utf8";
|
|
5063
|
-
if (type instanceof
|
|
4674
|
+
if (type instanceof arrow11.Utf8View)
|
|
5064
4675
|
return "utf8-view";
|
|
5065
|
-
if (type instanceof
|
|
4676
|
+
if (type instanceof arrow11.Float || type instanceof arrow11.Int)
|
|
5066
4677
|
return "scalar";
|
|
5067
4678
|
return "unknown";
|
|
5068
4679
|
}
|
|
5069
4680
|
function isCoordinateStruct(type) {
|
|
5070
|
-
return type instanceof
|
|
4681
|
+
return type instanceof arrow11.Struct && getSeparatedDimension(type.children.map((child) => child.name)) !== null;
|
|
5071
4682
|
}
|
|
5072
4683
|
function getSeparatedDimension(names) {
|
|
5073
4684
|
if (sameNames(names, ["x", "y"]))
|
|
@@ -5093,7 +4704,7 @@ function getBoxDimension(names) {
|
|
|
5093
4704
|
return null;
|
|
5094
4705
|
}
|
|
5095
4706
|
function isBoxType(type) {
|
|
5096
|
-
return type instanceof
|
|
4707
|
+
return type instanceof arrow11.Struct && getBoxDimension(type.children.map((child) => child.name)) !== null && type.children.every((child) => child.type instanceof arrow11.Float);
|
|
5097
4708
|
}
|
|
5098
4709
|
function getCommonValue(values) {
|
|
5099
4710
|
const firstValue = values[0];
|
|
@@ -5171,7 +4782,7 @@ function getNesting(kind, type) {
|
|
|
5171
4782
|
function getListDepth2(type) {
|
|
5172
4783
|
let depth = 0;
|
|
5173
4784
|
let currentType = type;
|
|
5174
|
-
while (currentType instanceof
|
|
4785
|
+
while (currentType instanceof arrow12.List || currentType instanceof arrow12.LargeList) {
|
|
5175
4786
|
depth++;
|
|
5176
4787
|
currentType = currentType.children[0].type;
|
|
5177
4788
|
}
|
|
@@ -5180,13 +4791,13 @@ function getListDepth2(type) {
|
|
|
5180
4791
|
|
|
5181
4792
|
// dist/geoarrow/get-geoarrow-vertex-count.js
|
|
5182
4793
|
function getGeoarrowVertexCount(input) {
|
|
5183
|
-
if (input instanceof
|
|
4794
|
+
if (input instanceof arrow13.Table) {
|
|
5184
4795
|
return getGeoarrowTableVertexCount(input);
|
|
5185
4796
|
}
|
|
5186
|
-
if (input instanceof
|
|
4797
|
+
if (input instanceof arrow13.Vector) {
|
|
5187
4798
|
return getGeoarrowVectorVertexCount(input);
|
|
5188
4799
|
}
|
|
5189
|
-
if (input instanceof
|
|
4800
|
+
if (input instanceof arrow13.Data) {
|
|
5190
4801
|
return getGeoarrowDataVertexCount(input);
|
|
5191
4802
|
}
|
|
5192
4803
|
throw new Error("Expected an Apache Arrow Table, Vector, or Data instance.");
|
|
@@ -5213,16 +4824,16 @@ function getGeoarrowVectorVertexCount(vector) {
|
|
|
5213
4824
|
}
|
|
5214
4825
|
function getGeoarrowDataVertexCount(data) {
|
|
5215
4826
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
5216
|
-
if (data.type instanceof
|
|
4827
|
+
if (data.type instanceof arrow13.Binary || data.type instanceof arrow13.LargeBinary || data.type instanceof arrow13.BinaryView) {
|
|
5217
4828
|
return getWKBDataVertexCount(data);
|
|
5218
4829
|
}
|
|
5219
|
-
if (data.type instanceof
|
|
4830
|
+
if (data.type instanceof arrow13.Utf8 || data.type instanceof arrow13.LargeUtf8 || data.type instanceof arrow13.Utf8View) {
|
|
5220
4831
|
throw new Error("WKT vertex counting is not supported.");
|
|
5221
4832
|
}
|
|
5222
|
-
if (data.type instanceof
|
|
4833
|
+
if (data.type instanceof arrow13.DenseUnion) {
|
|
5223
4834
|
return data.children.reduce((vertexCount, child) => vertexCount + getGeoarrowDataVertexCount(child), 0);
|
|
5224
4835
|
}
|
|
5225
|
-
if ((data.type instanceof
|
|
4836
|
+
if ((data.type instanceof arrow13.List || data.type instanceof arrow13.LargeList) && ((_a = data.children[0]) == null ? void 0 : _a.type) instanceof arrow13.DenseUnion) {
|
|
5226
4837
|
return getGeoarrowDataVertexCount(data.children[0]);
|
|
5227
4838
|
}
|
|
5228
4839
|
if (isGeoArrowBox(data.type)) {
|
|
@@ -5243,16 +4854,16 @@ function getGeoarrowDataVertexCount(data) {
|
|
|
5243
4854
|
throw new Error(`Unsupported GeoArrow data type: ${data.type}`);
|
|
5244
4855
|
}
|
|
5245
4856
|
function getGeoarrowWKTVertexCount(input) {
|
|
5246
|
-
if (input instanceof
|
|
4857
|
+
if (input instanceof arrow13.Vector) {
|
|
5247
4858
|
return input.data.reduce((vertexCount, data) => vertexCount + getWKTDataVertexCount(data), 0);
|
|
5248
4859
|
}
|
|
5249
|
-
if (input instanceof
|
|
4860
|
+
if (input instanceof arrow13.Data) {
|
|
5250
4861
|
return getWKTDataVertexCount(input);
|
|
5251
4862
|
}
|
|
5252
4863
|
throw new Error("Expected an Apache Arrow Vector or Data instance.");
|
|
5253
4864
|
}
|
|
5254
4865
|
function getWKTDataVertexCount(data) {
|
|
5255
|
-
const vector = new
|
|
4866
|
+
const vector = new arrow13.Vector([data]);
|
|
5256
4867
|
let vertexCount = 0;
|
|
5257
4868
|
for (let rowIndex = 0; rowIndex < vector.length; rowIndex++) {
|
|
5258
4869
|
const value = vector.get(rowIndex);
|
|
@@ -5283,7 +4894,7 @@ function countGeometryVertices(geometry) {
|
|
|
5283
4894
|
}
|
|
5284
4895
|
}
|
|
5285
4896
|
function getWKBDataVertexCount(data) {
|
|
5286
|
-
const vector = new
|
|
4897
|
+
const vector = new arrow13.Vector([data]);
|
|
5287
4898
|
let vertexCount = 0;
|
|
5288
4899
|
for (let rowIndex = 0; rowIndex < vector.length; rowIndex++) {
|
|
5289
4900
|
const value = vector.get(rowIndex);
|
|
@@ -5295,7 +4906,7 @@ function getWKBDataVertexCount(data) {
|
|
|
5295
4906
|
}
|
|
5296
4907
|
function getWKBVertexCount(wkb) {
|
|
5297
4908
|
try {
|
|
5298
|
-
return (0,
|
|
4909
|
+
return (0, import_wkb6.scanWKB)(wkb).coordinateCount;
|
|
5299
4910
|
} catch (error) {
|
|
5300
4911
|
if (error instanceof Error && error.message.startsWith("Unsupported WKB geometry type")) {
|
|
5301
4912
|
throw new Error("Unsupported geometry type");
|
|
@@ -5352,6 +4963,7 @@ function getVariableLengthByteCount(column, sourceEncoding) {
|
|
|
5352
4963
|
}
|
|
5353
4964
|
|
|
5354
4965
|
// dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js
|
|
4966
|
+
var import_geoarrow = require("@math.gl/arrow/geoarrow");
|
|
5355
4967
|
var DEFAULT_MAX_GEOMETRY_COLLECTION_DEPTH = 64;
|
|
5356
4968
|
function convertGeoArrowVector(column, sourceEncoding, targetEncoding, options) {
|
|
5357
4969
|
const maxGeometryCollectionDepth = getMaxGeometryCollectionDepth(options);
|
|
@@ -5436,7 +5048,7 @@ function convertGeoArrowGeometry(table, targetEncoding, options) {
|
|
|
5436
5048
|
const convertedVector = convertedColumns.get(field.name);
|
|
5437
5049
|
return convertedEncoding && convertedVector ? createConvertedField(field, convertedVector.type, convertedEncoding, (_a2 = conversionOptions.get(field.name)) == null ? void 0 : _a2.geometryTypes, conversionOptions.get(field.name), (_b2 = geoMetadata == null ? void 0 : geoMetadata.columns) == null ? void 0 : _b2[field.name]) : field;
|
|
5438
5050
|
});
|
|
5439
|
-
const nextSchema = new
|
|
5051
|
+
const nextSchema = new arrow14.Schema(nextFields, nextSchemaMetadata);
|
|
5440
5052
|
let rowOffset = 0;
|
|
5441
5053
|
const nextBatches = table.batches.map((batch) => {
|
|
5442
5054
|
const children = table.schema.fields.map((field) => {
|
|
@@ -5455,14 +5067,14 @@ function convertGeoArrowGeometry(table, targetEncoding, options) {
|
|
|
5455
5067
|
return batchVector.data[0];
|
|
5456
5068
|
});
|
|
5457
5069
|
rowOffset += batch.numRows;
|
|
5458
|
-
return new
|
|
5459
|
-
type: new
|
|
5070
|
+
return new arrow14.RecordBatch(nextSchema, arrow14.makeData({
|
|
5071
|
+
type: new arrow14.Struct(nextFields),
|
|
5460
5072
|
length: batch.numRows,
|
|
5461
5073
|
nullCount: 0,
|
|
5462
5074
|
children
|
|
5463
5075
|
}));
|
|
5464
5076
|
});
|
|
5465
|
-
return new
|
|
5077
|
+
return new arrow14.Table(nextSchema, nextBatches);
|
|
5466
5078
|
}
|
|
5467
5079
|
function inferGeometryTypes(table, geometryColumn, sourceEncoding) {
|
|
5468
5080
|
if (sourceEncoding !== "geoarrow.wkb" && sourceEncoding !== "geoarrow.wkt") {
|
|
@@ -5529,7 +5141,7 @@ function convertGeometryColumn(column, sourceEncoding, targetEncoding, geometryC
|
|
|
5529
5141
|
}
|
|
5530
5142
|
const targetValues = geometries.map((geometry) => convertGeometryValue(geometry, targetEncoding, targetDimension, geometryColumn, options));
|
|
5531
5143
|
const nativeValues = (options == null ? void 0 : options.coordinates) === "separated" ? targetValues.map((value) => separateCoordinateValues(value, targetDimension, targetDimensionName)) : targetValues;
|
|
5532
|
-
return
|
|
5144
|
+
return arrow14.vectorFromArray(nativeValues, getTargetArrowType(targetEncoding, targetDimension, options, (options == null ? void 0 : options.dimension) || getDimensionFromGeometryTypes(options == null ? void 0 : options.geometryTypes)));
|
|
5533
5145
|
}
|
|
5534
5146
|
function convertGeometryColumnWithMath(column, sourceEncoding, targetEncoding, options) {
|
|
5535
5147
|
const sourceIsNative = isMathGeoArrowNativeEncoding(sourceEncoding);
|
|
@@ -5538,20 +5150,20 @@ function convertGeometryColumnWithMath(column, sourceEncoding, targetEncoding, o
|
|
|
5538
5150
|
if (!supportsConversion)
|
|
5539
5151
|
return null;
|
|
5540
5152
|
const declaredDimension = getDimensionFromGeometryTypes(options == null ? void 0 : options.geometryTypes);
|
|
5541
|
-
const sourceColumn = makeGeoArrowColumnFromArrowVector(column, {
|
|
5153
|
+
const sourceColumn = (0, import_geoarrow.makeGeoArrowColumnFromArrowVector)(column, {
|
|
5542
5154
|
encoding: sourceEncoding,
|
|
5543
5155
|
dimension: sourceEncoding === "geoarrow.wkb" ? declaredDimension || "xy" : declaredDimension || (targetEncoding === "geoarrow.wkb" ? options == null ? void 0 : options.dimension : void 0)
|
|
5544
5156
|
});
|
|
5545
5157
|
if (sourceEncoding === "geoarrow.wkb") {
|
|
5546
5158
|
try {
|
|
5547
|
-
const decodedColumn = (0,
|
|
5159
|
+
const decodedColumn = (0, import_geoarrow_utils.decodeGeoArrowWKB)(sourceColumn, {
|
|
5548
5160
|
encoding: targetEncoding,
|
|
5549
5161
|
dimension: (options == null ? void 0 : options.dimension) || declaredDimension || "infer",
|
|
5550
5162
|
coordinateLayout: (options == null ? void 0 : options.coordinates) || "interleaved",
|
|
5551
5163
|
offsetType: (options == null ? void 0 : options.offsetType) || "int32",
|
|
5552
5164
|
traversal: { maximumDepth: options == null ? void 0 : options.maxGeometryCollectionDepth }
|
|
5553
5165
|
});
|
|
5554
|
-
return makeArrowVectorFromGeoArrowColumn(decodedColumn);
|
|
5166
|
+
return (0, import_geoarrow.makeArrowVectorFromGeoArrowColumn)(decodedColumn);
|
|
5555
5167
|
} catch (error) {
|
|
5556
5168
|
if ((options == null ? void 0 : options.maxGeometryCollectionDepth) !== void 0 && error instanceof Error && error.message.includes("nesting exceeds maximumDepth")) {
|
|
5557
5169
|
throw new Error(`GeometryCollection nesting exceeds maxGeometryCollectionDepth (${options.maxGeometryCollectionDepth}).`);
|
|
@@ -5560,15 +5172,15 @@ function convertGeometryColumnWithMath(column, sourceEncoding, targetEncoding, o
|
|
|
5560
5172
|
}
|
|
5561
5173
|
}
|
|
5562
5174
|
if (targetEncoding === "geoarrow.wkb") {
|
|
5563
|
-
return makeArrowVectorFromGeoArrowColumn((0,
|
|
5175
|
+
return (0, import_geoarrow.makeArrowVectorFromGeoArrowColumn)((0, import_geoarrow_utils.encodeGeoArrowWKB)(sourceColumn));
|
|
5564
5176
|
}
|
|
5565
|
-
const convertedColumn = (0,
|
|
5177
|
+
const convertedColumn = (0, import_geoarrow_utils.convertGeoArrowColumn)(sourceColumn, {
|
|
5566
5178
|
encoding: targetEncoding,
|
|
5567
5179
|
dimension: options == null ? void 0 : options.dimension,
|
|
5568
5180
|
coordinateLayout: (options == null ? void 0 : options.coordinates) || "preserve",
|
|
5569
5181
|
offsetType: (options == null ? void 0 : options.offsetType) || "preserve"
|
|
5570
5182
|
});
|
|
5571
|
-
return convertedColumn === sourceColumn ? column : makeArrowVectorFromGeoArrowColumn(convertedColumn);
|
|
5183
|
+
return convertedColumn === sourceColumn ? column : (0, import_geoarrow.makeArrowVectorFromGeoArrowColumn)(convertedColumn);
|
|
5572
5184
|
}
|
|
5573
5185
|
function isMathGeoArrowNativeEncoding(encoding) {
|
|
5574
5186
|
return encoding === "geoarrow.point" || encoding === "geoarrow.linestring" || encoding === "geoarrow.polygon" || encoding === "geoarrow.multipoint" || encoding === "geoarrow.multilinestring" || encoding === "geoarrow.multipolygon" || encoding === "geoarrow.geometry" || encoding === "geoarrow.geometrycollection";
|
|
@@ -5702,13 +5314,13 @@ function createGeometryUnionVector(geometries, targetDimension, allowGeometryCol
|
|
|
5702
5314
|
childValues[childKind].push(geometry ? convertGeometryToUnionChildValue(geometry, targetDimension, geometryColumn) : null);
|
|
5703
5315
|
}
|
|
5704
5316
|
const orderedKinds = [...usedKinds].sort((leftKind, rightKind) => getUnionTypeId3(leftKind, targetDimension, targetDimensionName) - getUnionTypeId3(rightKind, targetDimension, targetDimensionName));
|
|
5705
|
-
const fields = orderedKinds.map((kind) => new
|
|
5317
|
+
const fields = orderedKinds.map((kind) => new arrow14.Field(getUnionFieldName(kind, targetDimension, targetDimensionName), getUnionChildType(kind, targetDimension, options, geometryCollectionDepth, targetDimensionName), true));
|
|
5706
5318
|
const children = orderedKinds.map((kind) => {
|
|
5707
5319
|
const values = childValues[kind] || [];
|
|
5708
5320
|
return createUnionChildVector(kind, values, targetDimension, geometryColumn, options, geometryCollectionDepth, targetDimensionName).data[0];
|
|
5709
5321
|
});
|
|
5710
|
-
const unionType = new
|
|
5711
|
-
return
|
|
5322
|
+
const unionType = new arrow14.DenseUnion(orderedKinds.map((kind) => getUnionTypeId3(kind, targetDimension, targetDimensionName)), fields);
|
|
5323
|
+
return arrow14.makeVector(arrow14.makeData({
|
|
5712
5324
|
type: unionType,
|
|
5713
5325
|
length: geometries.length,
|
|
5714
5326
|
nullCount: 0,
|
|
@@ -5735,7 +5347,7 @@ function createGeometryCollectionVector(geometries, targetDimension, geometryCol
|
|
|
5735
5347
|
valueOffsets.push(flattenedGeometries.length);
|
|
5736
5348
|
}
|
|
5737
5349
|
const memberUnionVector = createGeometryUnionVector(flattenedGeometries, targetDimension, false, geometryColumn, options, 0, targetDimensionName);
|
|
5738
|
-
const listType = createListType(new
|
|
5350
|
+
const listType = createListType(new arrow14.Field("geometries", memberUnionVector.type, true), options == null ? void 0 : options.offsetType);
|
|
5739
5351
|
const listData = {
|
|
5740
5352
|
length: geometries.length,
|
|
5741
5353
|
nullCount: validity.filter((isValid) => !isValid).length,
|
|
@@ -5743,16 +5355,16 @@ function createGeometryCollectionVector(geometries, targetDimension, geometryCol
|
|
|
5743
5355
|
valueOffsets: createOffsetArray(valueOffsets, options == null ? void 0 : options.offsetType),
|
|
5744
5356
|
child: memberUnionVector.data[0]
|
|
5745
5357
|
};
|
|
5746
|
-
const listDataValue = listType instanceof
|
|
5358
|
+
const listDataValue = listType instanceof arrow14.LargeList ? arrow14.makeData({
|
|
5747
5359
|
type: listType,
|
|
5748
5360
|
...listData,
|
|
5749
5361
|
valueOffsets: BigInt64Array.from(valueOffsets, BigInt)
|
|
5750
|
-
}) :
|
|
5362
|
+
}) : arrow14.makeData({
|
|
5751
5363
|
type: listType,
|
|
5752
5364
|
...listData,
|
|
5753
5365
|
valueOffsets: Int32Array.from(valueOffsets)
|
|
5754
5366
|
});
|
|
5755
|
-
return
|
|
5367
|
+
return arrow14.makeVector(listDataValue);
|
|
5756
5368
|
}
|
|
5757
5369
|
function convertGeometryToUnionChildValue(geometry, targetDimension, geometryColumn) {
|
|
5758
5370
|
switch (geometry.type) {
|
|
@@ -5777,7 +5389,7 @@ function createUnionChildVector(geometryKind, values, targetDimension, geometryC
|
|
|
5777
5389
|
return createGeometryCollectionVector(values, targetDimension, geometryColumn, options, Math.max(geometryCollectionDepth - 1, 0), dimensionName);
|
|
5778
5390
|
}
|
|
5779
5391
|
const nativeValues = (options == null ? void 0 : options.coordinates) === "separated" ? values.map((value) => separateCoordinateValues(value, targetDimension, dimensionName)) : values;
|
|
5780
|
-
return
|
|
5392
|
+
return arrow14.vectorFromArray(nativeValues, getUnionChildType(geometryKind, targetDimension, options, geometryCollectionDepth, dimensionName));
|
|
5781
5393
|
}
|
|
5782
5394
|
function convertUnionValueToGeometry(value, geometryKind) {
|
|
5783
5395
|
if (value == null)
|
|
@@ -5834,7 +5446,7 @@ function getUnionBufferIndex(bufferLength, offset, rowIndex, useLogicalIndex) {
|
|
|
5834
5446
|
}
|
|
5835
5447
|
function getDenseUnionGeometryKind(vector, rowIndex) {
|
|
5836
5448
|
var _a;
|
|
5837
|
-
if (!(vector.type instanceof
|
|
5449
|
+
if (!(vector.type instanceof arrow14.DenseUnion)) {
|
|
5838
5450
|
throw new Error("GeoArrow geometry storage requires a DenseUnion vector.");
|
|
5839
5451
|
}
|
|
5840
5452
|
const { typeId } = getDenseUnionCellInfo(vector, rowIndex);
|
|
@@ -5961,7 +5573,7 @@ function createConvertedField(field, type, targetEncoding, geometryTypes, option
|
|
|
5961
5573
|
extensionMetadata.geometry_types = [...effectiveGeometryTypes];
|
|
5962
5574
|
metadata.set("ARROW:extension:metadata", JSON.stringify(extensionMetadata));
|
|
5963
5575
|
}
|
|
5964
|
-
return new
|
|
5576
|
+
return new arrow14.Field(field.name, type, field.nullable, metadata);
|
|
5965
5577
|
}
|
|
5966
5578
|
function getPreservedFieldMetadata(sourceGeoColumnMetadata) {
|
|
5967
5579
|
if (!sourceGeoColumnMetadata)
|
|
@@ -6069,18 +5681,18 @@ function getTargetArrowType(targetEncoding, targetDimension, options, dimensionN
|
|
|
6069
5681
|
return coordinateType;
|
|
6070
5682
|
case "geoarrow.linestring":
|
|
6071
5683
|
case "geoarrow.multipoint":
|
|
6072
|
-
return createList(new
|
|
5684
|
+
return createList(new arrow14.Field("value", coordinateType, true));
|
|
6073
5685
|
case "geoarrow.polygon":
|
|
6074
5686
|
case "geoarrow.multilinestring":
|
|
6075
|
-
return createList(new
|
|
5687
|
+
return createList(new arrow14.Field("value", createList(new arrow14.Field("value", coordinateType, true)), true));
|
|
6076
5688
|
case "geoarrow.multipolygon":
|
|
6077
|
-
return createList(new
|
|
5689
|
+
return createList(new arrow14.Field("value", createList(new arrow14.Field("value", createList(new arrow14.Field("value", coordinateType, true)), true)), true));
|
|
6078
5690
|
case "geoarrow.box":
|
|
6079
|
-
return new
|
|
5691
|
+
return new arrow14.Struct(getBoxFieldNames3((options == null ? void 0 : options.dimension) || getDimensionName2(targetDimension)).map((name) => new arrow14.Field(name, new arrow14.Float64(), true)));
|
|
6080
5692
|
case "geoarrow.wkb":
|
|
6081
|
-
return new
|
|
5693
|
+
return new arrow14.Binary();
|
|
6082
5694
|
case "geoarrow.wkt":
|
|
6083
|
-
return new
|
|
5695
|
+
return new arrow14.Utf8();
|
|
6084
5696
|
default:
|
|
6085
5697
|
throw new Error(`Unsupported GeoArrow target encoding "${targetEncoding}".`);
|
|
6086
5698
|
}
|
|
@@ -6104,9 +5716,9 @@ function canReuseGeoArrowVector(column, encoding, options) {
|
|
|
6104
5716
|
return true;
|
|
6105
5717
|
}
|
|
6106
5718
|
function getCoordinateLayout(type) {
|
|
6107
|
-
if (type instanceof
|
|
5719
|
+
if (type instanceof arrow14.FixedSizeList)
|
|
6108
5720
|
return "interleaved";
|
|
6109
|
-
if (type instanceof
|
|
5721
|
+
if (type instanceof arrow14.Struct) {
|
|
6110
5722
|
const names = type.children.map((child) => child.name);
|
|
6111
5723
|
if (names[0] === "x" && names[1] === "y")
|
|
6112
5724
|
return "separated";
|
|
@@ -6117,10 +5729,10 @@ function getCoordinateLayout(type) {
|
|
|
6117
5729
|
}
|
|
6118
5730
|
return null;
|
|
6119
5731
|
}
|
|
6120
|
-
if (type instanceof
|
|
5732
|
+
if (type instanceof arrow14.List || type instanceof arrow14.LargeList) {
|
|
6121
5733
|
return getCoordinateLayout(type.children[0].type);
|
|
6122
5734
|
}
|
|
6123
|
-
if (type instanceof
|
|
5735
|
+
if (type instanceof arrow14.DenseUnion) {
|
|
6124
5736
|
for (const child of type.children) {
|
|
6125
5737
|
const layout = getCoordinateLayout(child.type);
|
|
6126
5738
|
if (layout)
|
|
@@ -6130,18 +5742,18 @@ function getCoordinateLayout(type) {
|
|
|
6130
5742
|
return null;
|
|
6131
5743
|
}
|
|
6132
5744
|
function getVectorOffsetType(type) {
|
|
6133
|
-
if (type instanceof
|
|
5745
|
+
if (type instanceof arrow14.List)
|
|
6134
5746
|
return "int32";
|
|
6135
|
-
if (type instanceof
|
|
5747
|
+
if (type instanceof arrow14.LargeList)
|
|
6136
5748
|
return "int64";
|
|
6137
|
-
if (type instanceof
|
|
5749
|
+
if (type instanceof arrow14.Struct) {
|
|
6138
5750
|
for (const child of type.children) {
|
|
6139
5751
|
const offsetType = getVectorOffsetType(child.type);
|
|
6140
5752
|
if (offsetType)
|
|
6141
5753
|
return offsetType;
|
|
6142
5754
|
}
|
|
6143
5755
|
}
|
|
6144
|
-
if (type instanceof
|
|
5756
|
+
if (type instanceof arrow14.DenseUnion) {
|
|
6145
5757
|
for (const child of type.children) {
|
|
6146
5758
|
const offsetType = getVectorOffsetType(child.type);
|
|
6147
5759
|
if (offsetType)
|
|
@@ -6225,10 +5837,10 @@ function buildGeometryUnionType(targetDimension, allowGeometryCollections, optio
|
|
|
6225
5837
|
if (allowGeometryCollections && geometryCollectionDepth > 0) {
|
|
6226
5838
|
geometryKinds.push("GeometryCollection");
|
|
6227
5839
|
}
|
|
6228
|
-
return new
|
|
5840
|
+
return new arrow14.DenseUnion(geometryKinds.map((geometryKind) => getUnionTypeId3(geometryKind, targetDimension, dimensionName)), geometryKinds.map((geometryKind) => new arrow14.Field(getUnionFieldName(geometryKind, targetDimension, dimensionName), getUnionChildType(geometryKind, targetDimension, options, geometryCollectionDepth, dimensionName), true)));
|
|
6229
5841
|
}
|
|
6230
5842
|
function buildGeometryCollectionType(targetDimension, options, geometryCollectionDepth = 0, dimensionName = getDimensionName2(targetDimension)) {
|
|
6231
|
-
return createListType(new
|
|
5843
|
+
return createListType(new arrow14.Field("geometries", buildGeometryUnionType(targetDimension, geometryCollectionDepth > 0, options, geometryCollectionDepth, dimensionName), true), options == null ? void 0 : options.offsetType);
|
|
6232
5844
|
}
|
|
6233
5845
|
function getUnionBaseTypeId(geometryKind) {
|
|
6234
5846
|
switch (geometryKind) {
|
|
@@ -6321,13 +5933,13 @@ function getBoxFieldNames3(dimension) {
|
|
|
6321
5933
|
}
|
|
6322
5934
|
function getCoordinateType(targetDimension, coordinates = "interleaved", dimensionName = getDimensionName2(targetDimension)) {
|
|
6323
5935
|
if (coordinates === "interleaved") {
|
|
6324
|
-
return new
|
|
5936
|
+
return new arrow14.FixedSizeList(targetDimension, new arrow14.Field("value", new arrow14.Float64(), true));
|
|
6325
5937
|
}
|
|
6326
5938
|
const coordinateNames = dimensionName === "xy" ? ["x", "y"] : dimensionName === "xyz" ? ["x", "y", "z"] : dimensionName === "xym" ? ["x", "y", "m"] : ["x", "y", "z", "m"];
|
|
6327
|
-
return new
|
|
5939
|
+
return new arrow14.Struct(coordinateNames.map((name) => new arrow14.Field(name, new arrow14.Float64(), true)));
|
|
6328
5940
|
}
|
|
6329
5941
|
function createListType(field, offsetType = "int32") {
|
|
6330
|
-
return offsetType === "int64" ? new
|
|
5942
|
+
return offsetType === "int64" ? new arrow14.LargeList(field) : new arrow14.List(field);
|
|
6331
5943
|
}
|
|
6332
5944
|
function createOffsetArray(offsets, offsetType = "int32") {
|
|
6333
5945
|
return offsetType === "int64" ? BigInt64Array.from(offsets, BigInt) : Int32Array.from(offsets);
|
|
@@ -6424,17 +6036,18 @@ function padPosition(position, targetDimension) {
|
|
|
6424
6036
|
}
|
|
6425
6037
|
|
|
6426
6038
|
// dist/geoarrow/geoarrow-bounds.js
|
|
6427
|
-
var
|
|
6428
|
-
var
|
|
6039
|
+
var import_wkb7 = require("@math.gl/arrow/wkb");
|
|
6040
|
+
var import_geoarrow2 = require("@math.gl/arrow/geoarrow");
|
|
6041
|
+
var import_geoarrow_utils3 = require("@math.gl/arrow/geoarrow-utils");
|
|
6429
6042
|
|
|
6430
6043
|
// dist/geoarrow/binary-polygon-to-geoarrow.js
|
|
6431
|
-
var
|
|
6044
|
+
var import_geoarrow_utils2 = require("@math.gl/arrow/geoarrow-utils");
|
|
6432
6045
|
function makeGeoArrowColumnFromBinaryPolygon(geometry, options) {
|
|
6433
6046
|
const { dimension } = options;
|
|
6434
6047
|
if (!["xy", "xyz", "xym", "xyzm"].includes(dimension)) {
|
|
6435
6048
|
throw new Error("Binary polygon dimension must be xy, xyz, xym, or xyzm.");
|
|
6436
6049
|
}
|
|
6437
|
-
const coordinateSize = (0,
|
|
6050
|
+
const coordinateSize = (0, import_geoarrow_utils2.getGeoArrowDimensionSize)(dimension);
|
|
6438
6051
|
const positions = geometry.positions.value;
|
|
6439
6052
|
if (!(positions instanceof Float32Array || positions instanceof Float64Array) || geometry.positions.size !== coordinateSize || positions.length % coordinateSize !== 0) {
|
|
6440
6053
|
throw new Error("Binary polygon positions must be floating-point tuples matching dimension.");
|
|
@@ -6503,7 +6116,7 @@ function getGeoArrowRowBounds(column, encodingOrOptions) {
|
|
|
6503
6116
|
if (typeof encodingOrOptions === "string") {
|
|
6504
6117
|
throw new Error("Binary polygon bounds require an explicit dimension option.");
|
|
6505
6118
|
}
|
|
6506
|
-
return (0,
|
|
6119
|
+
return (0, import_geoarrow_utils3.getGeoArrowRowBounds)(makeGeoArrowColumnFromBinaryPolygon(column, encodingOrOptions));
|
|
6507
6120
|
}
|
|
6508
6121
|
if (typeof encodingOrOptions !== "string") {
|
|
6509
6122
|
throw new Error("Arrow vector bounds require a GeoArrow encoding.");
|
|
@@ -6512,7 +6125,7 @@ function getGeoArrowRowBounds(column, encodingOrOptions) {
|
|
|
6512
6125
|
if (encoding !== "geoarrow.wkb" && encoding !== "geoarrow.wkt") {
|
|
6513
6126
|
const names = encoding === "geoarrow.box" ? column.type.children.map((field) => field.name) : [];
|
|
6514
6127
|
const dimension = encoding === "geoarrow.box" ? names.includes("zmin") ? names.includes("mmin") ? "xyzm" : "xyz" : names.includes("mmin") ? "xym" : "xy" : void 0;
|
|
6515
|
-
return (0,
|
|
6128
|
+
return (0, import_geoarrow_utils3.getGeoArrowRowBounds)((0, import_geoarrow2.makeGeoArrowColumnFromArrowVector)(column, { encoding, dimension }));
|
|
6516
6129
|
}
|
|
6517
6130
|
const bounds = [];
|
|
6518
6131
|
for (let rowIndex = 0; rowIndex < column.length; rowIndex++) {
|
|
@@ -6525,7 +6138,7 @@ function getGeoArrowBounds(value, encoding) {
|
|
|
6525
6138
|
return null;
|
|
6526
6139
|
if (encoding === "geoarrow.wkb") {
|
|
6527
6140
|
const bytes = value;
|
|
6528
|
-
const statistics = (0,
|
|
6141
|
+
const statistics = (0, import_wkb7.scanWKB)(bytes);
|
|
6529
6142
|
return statistics.bounds ? [
|
|
6530
6143
|
statistics.bounds.xmin,
|
|
6531
6144
|
statistics.bounds.ymin,
|