@loaders.gl/tiles-3d 5.0.0-beta.10 → 5.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +169 -581
- package/dist/3d-tiles/dist.min.js +16 -16
- package/dist/3d-tiles/index.cjs +115 -390
- package/dist/3d-tiles/index.cjs.map +3 -3
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -2
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js +3 -4
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts +4 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts.map +1 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js +36 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js.map +1 -0
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js +3 -4
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts +9 -5
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js +15 -12
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +0 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js +2 -4
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -2
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js +7 -7
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -2
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js +1 -2
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +13 -13
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js +22 -23
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles/types.d.ts +7 -3
- package/dist/3d-tiles/types.d.ts.map +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/copc/copc-loader.d.ts.map +1 -1
- package/dist/copc/copc-loader.js +10 -7
- package/dist/copc/copc-loader.js.map +1 -1
- package/dist/copc/copc-writer.d.ts +5 -4
- package/dist/copc/copc-writer.d.ts.map +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/copc-writer.js.map +1 -1
- package/dist/copc/index.cjs +809 -124
- package/dist/copc/index.cjs.map +3 -3
- package/dist/dist.dev.js +45 -77
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +11915 -12119
- package/dist/i3s/dist.min.js +25 -25
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-mesh-attributes.d.ts +2 -2
- package/dist/i3s/i3s-mesh-attributes.d.ts.map +1 -1
- package/dist/i3s/i3s-mesh-attributes.js +6 -11
- package/dist/i3s/i3s-mesh-attributes.js.map +1 -1
- package/dist/i3s/i3s-mesh-writer.js +2 -3
- package/dist/i3s/i3s-mesh-writer.js.map +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +314 -442
- package/dist/i3s/index.cjs.map +3 -3
- package/dist/i3s/lib/parsers/constants.d.ts +0 -3
- package/dist/i3s/lib/parsers/constants.d.ts.map +1 -1
- package/dist/i3s/lib/parsers/constants.js +0 -8
- package/dist/i3s/lib/parsers/constants.js.map +1 -1
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.js +1 -2
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/i3s/types.d.ts +0 -1
- package/dist/i3s/types.d.ts.map +1 -1
- package/dist/i3s-content-worker-node.js +11 -11
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +485 -879
- package/dist/i3s-lepcc-worker-node.js +2 -2
- package/dist/i3s-lepcc-worker.js +2 -2
- package/dist/i3s-mesh-writer.cjs +87 -206
- package/dist/i3s-mesh-writer.cjs.map +3 -3
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +44 -41
- package/dist/index.cjs.map +1 -1
- package/dist/point-cloud-tile-loader-types.js +1 -1
- package/dist/point-cloud-tile-loader.cjs +17 -28
- package/dist/point-cloud-tile-loader.cjs.map +1 -1
- package/dist/point-cloud-tile-source.cjs +16 -27
- package/dist/point-cloud-tile-source.cjs.map +1 -1
- package/dist/point-cloud-tile-source.js +2 -2
- package/dist/point-cloud-tile-source.js.map +1 -1
- package/dist/potree/dist.dev.js +985 -139
- package/dist/potree/dist.min.js +28 -28
- package/dist/potree/index.cjs +813 -140
- package/dist/potree/index.cjs.map +3 -3
- package/dist/potree/lib/potree-node-source.d.ts.map +1 -1
- package/dist/potree/lib/potree-node-source.js +2 -14
- package/dist/potree/lib/potree-node-source.js.map +1 -1
- package/dist/potree/parsers/parse-potree-bin.js +3 -3
- package/dist/potree/parsers/parse-potree-bin.js.map +1 -1
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-writer.d.ts +3 -3
- package/dist/potree/potree-writer.d.ts.map +1 -1
- package/dist/potree/potree-writer.js +2 -2
- package/dist/potree/potree-writer.js.map +1 -1
- package/dist/potree/potree2-source.d.ts +1 -1
- package/dist/potree/potree2-source.d.ts.map +1 -1
- package/dist/potree/potree2-source.js +6 -3
- package/dist/potree/potree2-source.js.map +1 -1
- package/dist/potree-loader.cjs +817 -153
- package/dist/potree-loader.cjs.map +3 -3
- package/dist/tileset-3d/helpers/frame-state.d.ts +2 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.js +41 -15
- package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.ts +3 -4
- package/src/3d-tiles/lib/classes/helpers/tile-component-types.ts +39 -0
- package/src/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.ts +3 -4
- package/src/3d-tiles/lib/classes/tile-3d-feature-table.ts +38 -14
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.ts +2 -5
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.ts +10 -10
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.ts +0 -2
- package/src/3d-tiles/lib/parsers/parse-3d-tile-batched-model.ts +1 -2
- package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +19 -19
- package/src/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.ts +22 -23
- package/src/3d-tiles/types.ts +4 -3
- package/src/copc/copc-loader.ts +8 -8
- package/src/copc/copc-writer.ts +6 -5
- package/src/i3s/i3s-mesh-attributes.ts +9 -17
- package/src/i3s/i3s-mesh-writer.ts +4 -3
- package/src/i3s/lib/parsers/constants.ts +0 -9
- package/src/i3s/lib/parsers/parse-i3s-tile-content.ts +1 -2
- package/src/i3s/types.ts +0 -1
- package/src/point-cloud-tile-source.ts +2 -2
- package/src/potree/lib/potree-node-source.ts +2 -15
- package/src/potree/parsers/parse-potree-bin.ts +3 -3
- package/src/potree/potree-writer.ts +6 -11
- package/src/potree/potree2-source.ts +6 -3
- package/src/tileset-3d/helpers/frame-state.ts +43 -15
- package/src/types.ts +15 -0
package/dist/potree/dist.dev.js
CHANGED
|
@@ -5997,6 +5997,10 @@ var __exports__ = (() => {
|
|
|
5997
5997
|
}
|
|
5998
5998
|
});
|
|
5999
5999
|
}
|
|
6000
|
+
function isColumnarPredicateParameter(value2) {
|
|
6001
|
+
const parameterValue = value2;
|
|
6002
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2) && Object.keys(value2).length === 1 && Object.hasOwn(value2, "parameter") && typeof parameterValue.parameter === "string" && parameterValue.parameter.length > 0;
|
|
6003
|
+
}
|
|
6000
6004
|
function filterColumnarRowIndices(predicate, columns, rowCount) {
|
|
6001
6005
|
if (!predicate) return Array.from({ length: rowCount }, (_, index) => index);
|
|
6002
6006
|
const result = [];
|
|
@@ -6826,6 +6830,13 @@ var __exports__ = (() => {
|
|
|
6826
6830
|
});
|
|
6827
6831
|
|
|
6828
6832
|
// ../core/src/loader-utils/lib/scan-utils/scan-query-metadata.ts
|
|
6833
|
+
function emitQueryComplete(callback, summary) {
|
|
6834
|
+
if (!callback) return;
|
|
6835
|
+
try {
|
|
6836
|
+
callback(summary);
|
|
6837
|
+
} catch {
|
|
6838
|
+
}
|
|
6839
|
+
}
|
|
6829
6840
|
function createScanQueryMetadata(options) {
|
|
6830
6841
|
validateScanExecutionSupport(options.queryType, options.execution);
|
|
6831
6842
|
const schema = Object.freeze({
|
|
@@ -6858,6 +6869,7 @@ var __exports__ = (() => {
|
|
|
6858
6869
|
columns: Object.freeze(columns),
|
|
6859
6870
|
capabilities: queryCapabilities,
|
|
6860
6871
|
queryCapabilities,
|
|
6872
|
+
...options.hasDefaultRowWindow ? { hasDefaultRowWindow: true } : {},
|
|
6861
6873
|
spatial: options.spatial ? Object.freeze({
|
|
6862
6874
|
...options.spatial,
|
|
6863
6875
|
bounds: options.spatial.bounds ? Object.freeze({
|
|
@@ -6908,6 +6920,26 @@ var __exports__ = (() => {
|
|
|
6908
6920
|
});
|
|
6909
6921
|
|
|
6910
6922
|
// ../core/src/loader-utils/lib/scan-utils/table-query.ts
|
|
6923
|
+
function planTableQuery(sourceColumnNames, options = {}) {
|
|
6924
|
+
validateTableQueryOptions(sourceColumnNames, options);
|
|
6925
|
+
const outputColumnNames = options.columns ? [...options.columns] : [...sourceColumnNames];
|
|
6926
|
+
const predicateColumnNames = options.predicate ? getColumnarPredicateColumns(options.predicate) : [];
|
|
6927
|
+
const requiredColumnNames = /* @__PURE__ */ new Set([...outputColumnNames, ...predicateColumnNames]);
|
|
6928
|
+
const scanColumnNames = sourceColumnNames.filter(
|
|
6929
|
+
(columnName) => requiredColumnNames.has(columnName)
|
|
6930
|
+
);
|
|
6931
|
+
const steps = [
|
|
6932
|
+
Object.freeze({ kind: "scan", columns: Object.freeze(scanColumnNames) })
|
|
6933
|
+
];
|
|
6934
|
+
if (options.predicate) {
|
|
6935
|
+
steps.push(Object.freeze({ kind: "filter", predicate: options.predicate }));
|
|
6936
|
+
}
|
|
6937
|
+
steps.push(Object.freeze({ kind: "project", columns: Object.freeze(outputColumnNames) }));
|
|
6938
|
+
if (options.limit !== void 0) {
|
|
6939
|
+
steps.push(Object.freeze({ kind: "limit", limit: options.limit }));
|
|
6940
|
+
}
|
|
6941
|
+
return Object.freeze(steps);
|
|
6942
|
+
}
|
|
6911
6943
|
function validateTableQueryOptions(sourceColumnNames, options) {
|
|
6912
6944
|
const availableColumnNames = new Set(sourceColumnNames);
|
|
6913
6945
|
const outputColumnNames = options.columns ?? sourceColumnNames;
|
|
@@ -6931,6 +6963,11 @@ var __exports__ = (() => {
|
|
|
6931
6963
|
throw new Error("Table query limit must be a non-negative safe integer.");
|
|
6932
6964
|
}
|
|
6933
6965
|
}
|
|
6966
|
+
function validateTableQueryOffset(offset) {
|
|
6967
|
+
if (offset !== void 0 && (!Number.isSafeInteger(offset) || offset < 0)) {
|
|
6968
|
+
throw new Error("Table query offset must be a non-negative safe integer.");
|
|
6969
|
+
}
|
|
6970
|
+
}
|
|
6934
6971
|
var init_table_query = __esm({
|
|
6935
6972
|
"../core/src/loader-utils/lib/scan-utils/table-query.ts"() {
|
|
6936
6973
|
"use strict";
|
|
@@ -6938,6 +6975,175 @@ var __exports__ = (() => {
|
|
|
6938
6975
|
}
|
|
6939
6976
|
});
|
|
6940
6977
|
|
|
6978
|
+
// ../core/src/loader-utils/lib/scan-utils/table-scan-batch.ts
|
|
6979
|
+
async function* executeTableScanBatches(readBatches, options = {}, operators = {}) {
|
|
6980
|
+
validateTableQueryLimit(options.limit);
|
|
6981
|
+
validateTableQueryOffset(options.offset);
|
|
6982
|
+
let skip = options.offset ?? 0;
|
|
6983
|
+
const startedAt = Date.now();
|
|
6984
|
+
let sourcesRead = 0;
|
|
6985
|
+
let batchesRead = 0;
|
|
6986
|
+
let rowsRead = 0;
|
|
6987
|
+
let rowsTested = 0;
|
|
6988
|
+
let rowsRetained = 0;
|
|
6989
|
+
let rowsReturned = 0;
|
|
6990
|
+
let bytesFetched = 0;
|
|
6991
|
+
let status = "early-terminated";
|
|
6992
|
+
let earlyTerminationReason;
|
|
6993
|
+
let executionError;
|
|
6994
|
+
let remaining = options.limit === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, options.limit);
|
|
6995
|
+
try {
|
|
6996
|
+
options.signal?.throwIfAborted();
|
|
6997
|
+
if (remaining <= 0) {
|
|
6998
|
+
earlyTerminationReason = "limit";
|
|
6999
|
+
return;
|
|
7000
|
+
}
|
|
7001
|
+
sourcesRead = 1;
|
|
7002
|
+
for await (const batch of readBatches(
|
|
7003
|
+
options.signal,
|
|
7004
|
+
(byteLength) => bytesFetched += byteLength
|
|
7005
|
+
)) {
|
|
7006
|
+
if (remaining <= 0) {
|
|
7007
|
+
earlyTerminationReason = "limit";
|
|
7008
|
+
return;
|
|
7009
|
+
}
|
|
7010
|
+
options.signal?.throwIfAborted();
|
|
7011
|
+
batchesRead++;
|
|
7012
|
+
const rowCount = getScanBatchRowCount(batch);
|
|
7013
|
+
rowsRead += rowCount;
|
|
7014
|
+
if (options.predicate && !operators.filter && !("shape" in batch)) {
|
|
7015
|
+
throw new Error("Native Arrow scans require a filter kernel for residual predicates.");
|
|
7016
|
+
}
|
|
7017
|
+
const filteredBatch = operators.filter ? await operators.filter(batch, options.predicate, options.signal) : "shape" in batch ? filterTableBatch(batch, options.predicate) : batch;
|
|
7018
|
+
options.signal?.throwIfAborted();
|
|
7019
|
+
const filteredRowCount = getScanBatchRowCount(filteredBatch);
|
|
7020
|
+
if (options.predicate) {
|
|
7021
|
+
rowsTested += rowCount;
|
|
7022
|
+
rowsRetained += filteredRowCount;
|
|
7023
|
+
}
|
|
7024
|
+
if (skip >= filteredRowCount && (skip > 0 || options.skipEmptyBatches)) {
|
|
7025
|
+
skip -= filteredRowCount;
|
|
7026
|
+
continue;
|
|
7027
|
+
}
|
|
7028
|
+
const end = Math.min(filteredRowCount, skip + remaining);
|
|
7029
|
+
const window3 = skip || end < filteredRowCount ? "shape" in filteredBatch ? sliceTableBatch(filteredBatch, skip, end) : filteredBatch.slice(skip, end) : filteredBatch;
|
|
7030
|
+
skip = 0;
|
|
7031
|
+
const output2 = operators.project ? operators.project(window3, options.columns) : projectTableBatch(window3, options.columns);
|
|
7032
|
+
remaining -= getScanBatchRowCount(window3);
|
|
7033
|
+
rowsReturned += getScanBatchRowCount(output2);
|
|
7034
|
+
if (remaining === 0) earlyTerminationReason = "limit";
|
|
7035
|
+
yield output2;
|
|
7036
|
+
if (remaining === 0) return;
|
|
7037
|
+
options.signal?.throwIfAborted();
|
|
7038
|
+
}
|
|
7039
|
+
status = "completed";
|
|
7040
|
+
} catch (error62) {
|
|
7041
|
+
status = options.signal?.aborted ? "cancelled" : "failed";
|
|
7042
|
+
executionError = error62;
|
|
7043
|
+
throw error62;
|
|
7044
|
+
} finally {
|
|
7045
|
+
if (status === "early-terminated" && !earlyTerminationReason) {
|
|
7046
|
+
earlyTerminationReason = "consumer-return";
|
|
7047
|
+
}
|
|
7048
|
+
emitQueryComplete(
|
|
7049
|
+
options.onQueryComplete,
|
|
7050
|
+
Object.freeze({
|
|
7051
|
+
status,
|
|
7052
|
+
sourcesPlanned: 1,
|
|
7053
|
+
sourcesRead,
|
|
7054
|
+
batchesRead,
|
|
7055
|
+
batchesDecoded: batchesRead,
|
|
7056
|
+
rowsRead,
|
|
7057
|
+
rowsTested: rowsTested || void 0,
|
|
7058
|
+
rowsRetained: rowsRetained || void 0,
|
|
7059
|
+
rowsReturned,
|
|
7060
|
+
bytesRead: bytesFetched,
|
|
7061
|
+
bytesFetched,
|
|
7062
|
+
filesOpened: sourcesRead,
|
|
7063
|
+
tasksOpened: sourcesRead,
|
|
7064
|
+
durationMilliseconds: Date.now() - startedAt,
|
|
7065
|
+
earlyTerminationReason,
|
|
7066
|
+
...executionError === void 0 ? {} : { error: executionError }
|
|
7067
|
+
})
|
|
7068
|
+
);
|
|
7069
|
+
}
|
|
7070
|
+
}
|
|
7071
|
+
function getScanBatchRowCount(batch) {
|
|
7072
|
+
return "shape" in batch ? batch.length : batch.numRows;
|
|
7073
|
+
}
|
|
7074
|
+
function sliceTableBatch(batch, start, end) {
|
|
7075
|
+
const length = end - start;
|
|
7076
|
+
if (batch.shape === "object-row-table" || batch.shape === "array-row-table") {
|
|
7077
|
+
return { ...batch, data: batch.data.slice(start, end), length };
|
|
7078
|
+
}
|
|
7079
|
+
if (batch.shape === "columnar-table") {
|
|
7080
|
+
return {
|
|
7081
|
+
...batch,
|
|
7082
|
+
data: Object.fromEntries(
|
|
7083
|
+
Object.entries(batch.data).map(([name, values]) => [
|
|
7084
|
+
name,
|
|
7085
|
+
Array.from(values).slice(start, end)
|
|
7086
|
+
])
|
|
7087
|
+
),
|
|
7088
|
+
length
|
|
7089
|
+
};
|
|
7090
|
+
}
|
|
7091
|
+
return { ...batch, features: batch.features.slice(start, end), length };
|
|
7092
|
+
}
|
|
7093
|
+
function projectTableBatch(batch, columns) {
|
|
7094
|
+
if (columns === void 0) return batch;
|
|
7095
|
+
if (!("shape" in batch)) {
|
|
7096
|
+
const indices = columns.map((column) => batch.schema.fields.findIndex((field) => field.name === column)).filter((index) => index >= 0);
|
|
7097
|
+
return batch.selectAt(indices);
|
|
7098
|
+
}
|
|
7099
|
+
const schema = projectTableSchema(batch, columns);
|
|
7100
|
+
if (batch.shape === "object-row-table") {
|
|
7101
|
+
return {
|
|
7102
|
+
...batch,
|
|
7103
|
+
schema,
|
|
7104
|
+
data: batch.data.map((row) => Object.fromEntries(columns.map((column) => [column, row[column]])))
|
|
7105
|
+
};
|
|
7106
|
+
}
|
|
7107
|
+
if (batch.shape === "columnar-table") {
|
|
7108
|
+
return {
|
|
7109
|
+
...batch,
|
|
7110
|
+
schema,
|
|
7111
|
+
data: Object.fromEntries(columns.map((column) => [column, batch.data[column]]))
|
|
7112
|
+
};
|
|
7113
|
+
}
|
|
7114
|
+
return batch;
|
|
7115
|
+
}
|
|
7116
|
+
function projectTableSchema(batch, columns) {
|
|
7117
|
+
if (!batch.schema) return void 0;
|
|
7118
|
+
const fieldsByName = new Map(batch.schema.fields.map((field) => [field.name, field]));
|
|
7119
|
+
return {
|
|
7120
|
+
...batch.schema,
|
|
7121
|
+
fields: columns.flatMap((column) => {
|
|
7122
|
+
const field = fieldsByName.get(column);
|
|
7123
|
+
return field ? [field] : [];
|
|
7124
|
+
})
|
|
7125
|
+
};
|
|
7126
|
+
}
|
|
7127
|
+
function filterTableBatch(batch, predicate) {
|
|
7128
|
+
if (!predicate || batch.shape !== "object-row-table") return batch;
|
|
7129
|
+
const rows = batch.data;
|
|
7130
|
+
const columnNames = new Set(batch.schema?.fields.map((field) => field.name) || []);
|
|
7131
|
+
validateColumnarPredicate(predicate, columnNames);
|
|
7132
|
+
const columns = Object.fromEntries(
|
|
7133
|
+
[...columnNames].map((name) => [name, rows.map((row) => row[name])])
|
|
7134
|
+
);
|
|
7135
|
+
const rowIndices = filterColumnarRowIndices(predicate, columns, rows.length);
|
|
7136
|
+
return { ...batch, data: rowIndices.map((rowIndex) => rows[rowIndex]), length: rowIndices.length };
|
|
7137
|
+
}
|
|
7138
|
+
var init_table_scan_batch = __esm({
|
|
7139
|
+
"../core/src/loader-utils/lib/scan-utils/table-scan-batch.ts"() {
|
|
7140
|
+
"use strict";
|
|
7141
|
+
init_scan_query_metadata();
|
|
7142
|
+
init_columnar_predicate();
|
|
7143
|
+
init_table_query();
|
|
7144
|
+
}
|
|
7145
|
+
});
|
|
7146
|
+
|
|
6941
7147
|
// ../core/src/loader-utils/lib/scan-utils/point-cloud-query.ts
|
|
6942
7148
|
function validatePointCloudQueryOptions(sourceColumnNames, options) {
|
|
6943
7149
|
validateTableQueryOptions(sourceColumnNames, options);
|
|
@@ -7015,6 +7221,37 @@ var __exports__ = (() => {
|
|
|
7015
7221
|
}
|
|
7016
7222
|
});
|
|
7017
7223
|
|
|
7224
|
+
// ../core/src/loader-utils/lib/scan-utils/table-query-explain.ts
|
|
7225
|
+
function explainTableQuery(sourceColumnNames, options, capabilities) {
|
|
7226
|
+
const plan = planTableQuery(sourceColumnNames, options);
|
|
7227
|
+
const outputColumns = options.columns ? [...options.columns] : [...sourceColumnNames];
|
|
7228
|
+
const predicateColumns = options.predicate ? getColumnarPredicateColumns(options.predicate) : [];
|
|
7229
|
+
const requiredColumns = [...plan[0].kind === "scan" ? plan[0].columns : []];
|
|
7230
|
+
return Object.freeze({
|
|
7231
|
+
sourceColumns: Object.freeze([...sourceColumnNames]),
|
|
7232
|
+
outputColumns: Object.freeze(outputColumns),
|
|
7233
|
+
requiredColumns: Object.freeze(requiredColumns),
|
|
7234
|
+
predicateColumns: Object.freeze(predicateColumns),
|
|
7235
|
+
plan,
|
|
7236
|
+
capabilities: Object.freeze({ ...capabilities }),
|
|
7237
|
+
operators: Object.freeze({
|
|
7238
|
+
projection: createOperatorExplanation(options.columns !== void 0, capabilities.projection),
|
|
7239
|
+
predicate: createOperatorExplanation(options.predicate !== void 0, capabilities.predicate),
|
|
7240
|
+
limit: createOperatorExplanation(options.limit !== void 0, capabilities.limit)
|
|
7241
|
+
})
|
|
7242
|
+
});
|
|
7243
|
+
}
|
|
7244
|
+
function createOperatorExplanation(enabled, support) {
|
|
7245
|
+
return Object.freeze({ enabled, support });
|
|
7246
|
+
}
|
|
7247
|
+
var init_table_query_explain = __esm({
|
|
7248
|
+
"../core/src/loader-utils/lib/scan-utils/table-query-explain.ts"() {
|
|
7249
|
+
"use strict";
|
|
7250
|
+
init_columnar_predicate();
|
|
7251
|
+
init_table_query();
|
|
7252
|
+
}
|
|
7253
|
+
});
|
|
7254
|
+
|
|
7018
7255
|
// ../../node_modules/@math.gl/core/dist/lib/math-utils.js
|
|
7019
7256
|
var PI_OVER_TWO, PI_OVER_FOUR, PI_OVER_SIX, TWO_PI;
|
|
7020
7257
|
var init_math_utils = __esm({
|
|
@@ -10480,8 +10717,10 @@ var __exports__ = (() => {
|
|
|
10480
10717
|
init_file_aliases();
|
|
10481
10718
|
init_data_source();
|
|
10482
10719
|
init_columnar_predicate();
|
|
10720
|
+
init_table_scan_batch();
|
|
10483
10721
|
init_scan_query_metadata();
|
|
10484
10722
|
init_point_cloud_query();
|
|
10723
|
+
init_table_query_explain();
|
|
10485
10724
|
init_read_range_response();
|
|
10486
10725
|
init_pace_batch_iterator();
|
|
10487
10726
|
}
|
|
@@ -25917,7 +26156,7 @@ return true;`);
|
|
|
25917
26156
|
});
|
|
25918
26157
|
|
|
25919
26158
|
// ../core/src/lib/loader-utils/native-arrow.ts
|
|
25920
|
-
function
|
|
26159
|
+
function isArrowTable2(value2) {
|
|
25921
26160
|
return Boolean(
|
|
25922
26161
|
value2 && typeof value2 === "object" && "schema" in value2 && "batches" in value2 && Array.isArray(value2.batches) && "numRows" in value2 && typeof value2.numRows === "number" && "getChildAt" in value2 && typeof value2.getChildAt === "function"
|
|
25923
26162
|
);
|
|
@@ -25932,23 +26171,31 @@ return true;`);
|
|
|
25932
26171
|
function snapshotArrowSchema(schema) {
|
|
25933
26172
|
return deserializeArrowSchema(serializeArrowSchema(schema));
|
|
25934
26173
|
}
|
|
26174
|
+
function snapshotArrowBatch(batch, schema) {
|
|
26175
|
+
const snapshot = new RecordBatch3(
|
|
26176
|
+
snapshotArrowSchema(schema),
|
|
26177
|
+
batch.data,
|
|
26178
|
+
new Map(batch.metadata)
|
|
26179
|
+
);
|
|
26180
|
+
if (snapshot.numRows !== batch.numRows) {
|
|
26181
|
+
Object.defineProperty(snapshot, "data", { value: batch.data });
|
|
26182
|
+
}
|
|
26183
|
+
return snapshot;
|
|
26184
|
+
}
|
|
25935
26185
|
function updateArrowTableSchema(table, schema) {
|
|
25936
26186
|
const snapshot = snapshotArrowSchema(schema);
|
|
25937
|
-
const batches = table.batches.map(
|
|
25938
|
-
(batch) => new RecordBatch3(snapshotArrowSchema(snapshot), batch.data, new Map(batch.metadata))
|
|
25939
|
-
);
|
|
26187
|
+
const batches = table.batches.map((batch) => snapshotArrowBatch(batch, snapshot));
|
|
25940
26188
|
return new Table(
|
|
25941
26189
|
snapshot,
|
|
25942
26190
|
batches.length ? batches : [new RecordBatch3(snapshotArrowSchema(snapshot), void 0)]
|
|
25943
26191
|
);
|
|
25944
26192
|
}
|
|
25945
|
-
function
|
|
26193
|
+
function updateNativeArrowTableMetadata(table, metadata) {
|
|
25946
26194
|
const schema = new Schema2(
|
|
25947
|
-
table.
|
|
25948
|
-
new Map([...table.
|
|
26195
|
+
table.schema.fields,
|
|
26196
|
+
new Map([...table.schema.metadata, ...Object.entries(metadata)])
|
|
25949
26197
|
);
|
|
25950
|
-
|
|
25951
|
-
return { ...table, data, schema: serializeArrowSchema(data.schema) };
|
|
26198
|
+
return updateArrowTableSchema(table, schema);
|
|
25952
26199
|
}
|
|
25953
26200
|
function makeArrowMetadataBatch(schema) {
|
|
25954
26201
|
return new RecordBatch3(snapshotArrowSchema(schema), void 0);
|
|
@@ -26237,7 +26484,7 @@ return true;`);
|
|
|
26237
26484
|
});
|
|
26238
26485
|
|
|
26239
26486
|
// ../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts
|
|
26240
|
-
function
|
|
26487
|
+
function convertMeshToArrowTable(mesh) {
|
|
26241
26488
|
return makeMeshArrowTable(mesh.attributes, {
|
|
26242
26489
|
schema: mesh.schema,
|
|
26243
26490
|
topology: mesh.topology,
|
|
@@ -26258,22 +26505,14 @@ return true;`);
|
|
|
26258
26505
|
fields.push(
|
|
26259
26506
|
getAttributeArrowField(options.schema, attributeName, column, attribute.componentType)
|
|
26260
26507
|
);
|
|
26261
|
-
if (attributeName ===
|
|
26508
|
+
if (attributeName === attributeNames[0] && options.indices?.value?.length) {
|
|
26262
26509
|
const indicesField = indexedMeshArrowSchema.fields.find((field) => field.name === "indices");
|
|
26263
26510
|
columns.indices = getIndicesVector(options.indices.value, column.length, indicesField.type);
|
|
26264
26511
|
fields.push(indicesField);
|
|
26265
26512
|
}
|
|
26266
26513
|
}
|
|
26267
26514
|
const arrowSchema = new Schema2(fields, getMeshArrowMetadata(options));
|
|
26268
|
-
|
|
26269
|
-
const schema = serializeArrowSchema(table.schema);
|
|
26270
|
-
return {
|
|
26271
|
-
shape: "arrow-table",
|
|
26272
|
-
schema,
|
|
26273
|
-
data: table,
|
|
26274
|
-
topology: options.topology || "point-list",
|
|
26275
|
-
indices: options.indices
|
|
26276
|
-
};
|
|
26515
|
+
return columns[attributeNames[0]]?.length === 0 ? new Table(arrowSchema) : new Table(arrowSchema, columns);
|
|
26277
26516
|
}
|
|
26278
26517
|
function getAttributeArrowVector(value2, size, componentType) {
|
|
26279
26518
|
if (componentType === "float16") {
|
|
@@ -26398,18 +26637,10 @@ return true;`);
|
|
|
26398
26637
|
|
|
26399
26638
|
// ../core/src/schema-utils/lib/mesh/convert-table-to-mesh.ts
|
|
26400
26639
|
function convertTableToMesh(table) {
|
|
26401
|
-
if (
|
|
26402
|
-
|
|
26403
|
-
// case 'columnar-table':
|
|
26404
|
-
// return convertColumnarTableToMesh(table);
|
|
26405
|
-
case "arrow-table":
|
|
26406
|
-
return convertArrowTableToMesh(table);
|
|
26407
|
-
default:
|
|
26408
|
-
throw new Error(table.shape);
|
|
26409
|
-
}
|
|
26640
|
+
if (isArrowTable2(table)) return convertArrowTableToMesh(table);
|
|
26641
|
+
throw new Error(table.shape);
|
|
26410
26642
|
}
|
|
26411
|
-
function convertArrowTableToMesh(
|
|
26412
|
-
const arrowTable = isNativeArrowTable(table) ? table : table.data;
|
|
26643
|
+
function convertArrowTableToMesh(arrowTable) {
|
|
26413
26644
|
const schema = serializeArrowSchema(arrowTable.schema);
|
|
26414
26645
|
const localBounds = arrowTable.batches.length === 1 ? arrowTable.batches[0].metadata.get("boundingBox") : void 0;
|
|
26415
26646
|
if (localBounds) schema.metadata = { ...schema.metadata, boundingBox: localBounds };
|
|
@@ -26513,13 +26744,18 @@ return true;`);
|
|
|
26513
26744
|
if (!(attributeData.type instanceof FixedSizeList2)) {
|
|
26514
26745
|
return attributeData.toArray();
|
|
26515
26746
|
}
|
|
26516
|
-
|
|
26747
|
+
if (attributeData.length === 0) {
|
|
26748
|
+
const EmptyStorage = attributeData.type.valueType.ArrayType;
|
|
26749
|
+
return new EmptyStorage(0);
|
|
26750
|
+
}
|
|
26751
|
+
const values = attributeData.data.find((chunk) => chunk.length > 0).children[0].values;
|
|
26517
26752
|
const TypedArrayConstructor = values.constructor;
|
|
26518
26753
|
const typedArray = new TypedArrayConstructor(attributeData.length * size);
|
|
26519
26754
|
let targetOffset = 0;
|
|
26520
26755
|
for (const data of attributeData.data) {
|
|
26521
|
-
const child2 = data.children[0];
|
|
26522
26756
|
const sourceLength = data.length * size;
|
|
26757
|
+
if (sourceLength === 0) continue;
|
|
26758
|
+
const child2 = data.children[0];
|
|
26523
26759
|
const sourceOffset = child2.offset || data.offset * size;
|
|
26524
26760
|
const sourceStart = sourceOffset + sourceLength <= child2.values.length ? sourceOffset : 0;
|
|
26525
26761
|
const source = child2.values.subarray(sourceStart, sourceStart + sourceLength);
|
|
@@ -26626,11 +26862,13 @@ return true;`);
|
|
|
26626
26862
|
var init_schema_utils = __esm({
|
|
26627
26863
|
"../core/src/schema-utils/index.ts"() {
|
|
26628
26864
|
"use strict";
|
|
26865
|
+
init_convert_arrow_schema();
|
|
26629
26866
|
init_convert_mesh_to_table();
|
|
26630
26867
|
init_convert_table_to_mesh();
|
|
26631
26868
|
init_deduce_mesh_schema();
|
|
26632
26869
|
init_arrow_table_builder();
|
|
26633
26870
|
init_arrow_metadata();
|
|
26871
|
+
init_native_arrow();
|
|
26634
26872
|
}
|
|
26635
26873
|
});
|
|
26636
26874
|
|
|
@@ -26828,7 +27066,7 @@ return true;`);
|
|
|
26828
27066
|
}
|
|
26829
27067
|
return { ...mesh, attributes };
|
|
26830
27068
|
}
|
|
26831
|
-
var VERSION3, DEFAULT_LAS_SHAPE, LAS_LOADER_METADATA;
|
|
27069
|
+
var VERSION3, DEFAULT_LAS_SHAPE, LAS_LOADER_METADATA, LAS_SOURCE_METADATA;
|
|
26832
27070
|
var init_las_loader_shared = __esm({
|
|
26833
27071
|
"../pointclouds/src/las/las-loader-shared.ts"() {
|
|
26834
27072
|
"use strict";
|
|
@@ -26857,6 +27095,49 @@ return true;`);
|
|
|
26857
27095
|
}
|
|
26858
27096
|
}
|
|
26859
27097
|
};
|
|
27098
|
+
LAS_SOURCE_METADATA = {
|
|
27099
|
+
type: "las-source",
|
|
27100
|
+
fromUrl: true,
|
|
27101
|
+
fromBlob: true,
|
|
27102
|
+
testURL: (url2) => /\.(?:las|laz)(?:$|[?#])/i.test(url2)
|
|
27103
|
+
};
|
|
27104
|
+
}
|
|
27105
|
+
});
|
|
27106
|
+
|
|
27107
|
+
// ../core/src/scan/arrow-execution/project-arrow-table.ts
|
|
27108
|
+
function projectArrowTable(source, selections) {
|
|
27109
|
+
const outputNames = /* @__PURE__ */ new Set();
|
|
27110
|
+
const indices = [];
|
|
27111
|
+
const fields = selections.map((selection) => {
|
|
27112
|
+
const column = typeof selection === "string" ? selection : selection.column;
|
|
27113
|
+
const name = typeof selection === "string" ? selection : selection.as === void 0 ? column : selection.as;
|
|
27114
|
+
const index = source.schema.fields.findIndex((field) => field.name === column);
|
|
27115
|
+
if (index < 0) throw new Error(`Arrow projection column not found: ${column}`);
|
|
27116
|
+
if (typeof name !== "string" || typeof selection !== "string" && selection.as !== void 0 && !name.length || outputNames.has(name)) {
|
|
27117
|
+
throw new Error(`Invalid or duplicate Arrow projection output name: ${name}`);
|
|
27118
|
+
}
|
|
27119
|
+
outputNames.add(name);
|
|
27120
|
+
indices.push(index);
|
|
27121
|
+
return source.schema.fields[index].clone({ name });
|
|
27122
|
+
});
|
|
27123
|
+
const schema = new Schema2(fields, source.schema.metadata);
|
|
27124
|
+
const batches = source.batches.map(
|
|
27125
|
+
(batch) => new RecordBatch3(
|
|
27126
|
+
schema,
|
|
27127
|
+
makeData({
|
|
27128
|
+
type: new Struct(fields),
|
|
27129
|
+
length: batch.numRows,
|
|
27130
|
+
children: indices.map((index) => batch.data.children[index])
|
|
27131
|
+
}),
|
|
27132
|
+
batch.metadata
|
|
27133
|
+
)
|
|
27134
|
+
);
|
|
27135
|
+
return new Table(schema, batches);
|
|
27136
|
+
}
|
|
27137
|
+
var init_project_arrow_table = __esm({
|
|
27138
|
+
"../core/src/scan/arrow-execution/project-arrow-table.ts"() {
|
|
27139
|
+
"use strict";
|
|
27140
|
+
init_Arrow_dom();
|
|
26860
27141
|
}
|
|
26861
27142
|
});
|
|
26862
27143
|
|
|
@@ -26912,20 +27193,34 @@ return true;`);
|
|
|
26912
27193
|
}
|
|
26913
27194
|
});
|
|
26914
27195
|
|
|
27196
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
27197
|
+
function isArrowTable3(value2) {
|
|
27198
|
+
const table = value2;
|
|
27199
|
+
return Boolean(table && Number.isInteger(table.numRows) && Array.isArray(table.batches) && Array.isArray(table.schema?.fields) && typeof table.get === "function" && typeof table.getChild === "function");
|
|
27200
|
+
}
|
|
27201
|
+
function isArrowRecordBatch3(value2) {
|
|
27202
|
+
const batch = value2;
|
|
27203
|
+
return Boolean(batch && Number.isInteger(batch.numRows) && Array.isArray(batch.schema?.fields) && Array.isArray(batch.data?.children) && typeof batch.get === "function" && typeof batch.getChild === "function");
|
|
27204
|
+
}
|
|
27205
|
+
var init_arrow_column_utils = __esm({
|
|
27206
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
27207
|
+
}
|
|
27208
|
+
});
|
|
27209
|
+
|
|
26915
27210
|
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
26916
27211
|
function splitArrowBuffers(input2, options = {}) {
|
|
26917
27212
|
const retainedBuffers = /* @__PURE__ */ new Set();
|
|
26918
27213
|
const visited = /* @__PURE__ */ new Set();
|
|
26919
27214
|
for (const retained of options.retain ?? []) {
|
|
26920
|
-
const chunks =
|
|
27215
|
+
const chunks = isArrowTable3(retained) ? retained.batches.map((batch) => batch.data) : isArrowVector2(retained) ? retained.data : [isArrowRecordBatch3(retained) ? retained.data : retained];
|
|
26921
27216
|
for (const data of chunks)
|
|
26922
27217
|
collectArrowBuffers(data, retainedBuffers, visited);
|
|
26923
27218
|
}
|
|
26924
27219
|
const context = { ...options, copies: /* @__PURE__ */ new WeakMap(), retainedBuffers };
|
|
26925
|
-
if (
|
|
27220
|
+
if (isArrowTable3(input2)) {
|
|
26926
27221
|
return splitArrowTableBuffersInternal(input2, context);
|
|
26927
27222
|
}
|
|
26928
|
-
if (
|
|
27223
|
+
if (isArrowRecordBatch3(input2)) {
|
|
26929
27224
|
return splitArrowRecordBatchBuffers(input2, context);
|
|
26930
27225
|
}
|
|
26931
27226
|
if (isArrowVector2(input2)) {
|
|
@@ -26933,12 +27228,6 @@ return true;`);
|
|
|
26933
27228
|
}
|
|
26934
27229
|
return splitArrowDataBuffers(input2, context);
|
|
26935
27230
|
}
|
|
26936
|
-
function isArrowTable2(input2) {
|
|
26937
|
-
return "batches" in input2;
|
|
26938
|
-
}
|
|
26939
|
-
function isArrowRecordBatch2(input2) {
|
|
26940
|
-
return "schema" in input2 && "data" in input2 && !Array.isArray(input2.data);
|
|
26941
|
-
}
|
|
26942
27231
|
function isArrowVector2(input2) {
|
|
26943
27232
|
return "data" in input2 && Array.isArray(input2.data);
|
|
26944
27233
|
}
|
|
@@ -27010,12 +27299,180 @@ return true;`);
|
|
|
27010
27299
|
init_Arrow_dom();
|
|
27011
27300
|
init_arrow_record_batch();
|
|
27012
27301
|
init_arrow_data();
|
|
27302
|
+
init_arrow_column_utils();
|
|
27013
27303
|
}
|
|
27014
27304
|
});
|
|
27015
27305
|
|
|
27016
27306
|
// ../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js
|
|
27307
|
+
function takeArrowTableRows(arrowTable, indexes) {
|
|
27308
|
+
const offsets = [0];
|
|
27309
|
+
for (const batch of arrowTable.batches)
|
|
27310
|
+
offsets.push(offsets[offsets.length - 1] + batch.numRows);
|
|
27311
|
+
const runs = [];
|
|
27312
|
+
for (const index of indexes) {
|
|
27313
|
+
let lower = 0;
|
|
27314
|
+
let upper = arrowTable.batches.length - 1;
|
|
27315
|
+
while (lower < upper) {
|
|
27316
|
+
const middle = Math.floor((lower + upper) / 2);
|
|
27317
|
+
if (index >= offsets[middle + 1])
|
|
27318
|
+
lower = middle + 1;
|
|
27319
|
+
else
|
|
27320
|
+
upper = middle;
|
|
27321
|
+
}
|
|
27322
|
+
let run = runs[runs.length - 1];
|
|
27323
|
+
if (!run || run.batchIndex !== lower) {
|
|
27324
|
+
run = { batchIndex: lower, indexes: [] };
|
|
27325
|
+
runs.push(run);
|
|
27326
|
+
}
|
|
27327
|
+
run.indexes.push(index - offsets[lower]);
|
|
27328
|
+
}
|
|
27329
|
+
const context = { dictionaries: /* @__PURE__ */ new WeakMap(), variadicBuffers: /* @__PURE__ */ new WeakMap() };
|
|
27330
|
+
const batches = runs.map((run) => {
|
|
27331
|
+
const source = arrowTable.batches[run.batchIndex];
|
|
27332
|
+
const children2 = source.data.children.map((child2) => takeArrowDataRows(child2, run.indexes, context));
|
|
27333
|
+
const data = new Data(new Struct(arrowTable.schema.fields), 0, run.indexes.length, 0, void 0, children2);
|
|
27334
|
+
return new RecordBatch3(arrowTable.schema, data);
|
|
27335
|
+
});
|
|
27336
|
+
return new Table(arrowTable.schema, batches);
|
|
27337
|
+
}
|
|
27338
|
+
function takeArrowDataRows(data, indexes, context) {
|
|
27339
|
+
const type = data.type;
|
|
27340
|
+
if (DataType.isUnion(type))
|
|
27341
|
+
return takeArrowUnionRows(data, indexes, context);
|
|
27342
|
+
const { bitmap, nullCount } = takeArrowValidity(data, indexes);
|
|
27343
|
+
const buffers = { [BufferType.VALIDITY]: bitmap };
|
|
27344
|
+
if (DataType.isNull(type))
|
|
27345
|
+
return createArrowData(type, 0, indexes.length, indexes.length, buffers, []);
|
|
27346
|
+
if (DataType.isStruct(type)) {
|
|
27347
|
+
return createArrowData(type, 0, indexes.length, nullCount, buffers, data.children.map((child2) => takeArrowDataRows(child2, indexes, context)));
|
|
27348
|
+
}
|
|
27349
|
+
if (DataType.isFixedSizeList(type)) {
|
|
27350
|
+
const childIndexes = [];
|
|
27351
|
+
for (const index of indexes) {
|
|
27352
|
+
for (let coordinate = 0; coordinate < type.listSize; coordinate++)
|
|
27353
|
+
childIndexes.push(index * type.listSize + coordinate);
|
|
27354
|
+
}
|
|
27355
|
+
return createArrowData(type, 0, indexes.length, nullCount, buffers, [
|
|
27356
|
+
takeArrowDataRows(data.children[0], childIndexes, context)
|
|
27357
|
+
]);
|
|
27358
|
+
}
|
|
27359
|
+
if (data.valueOffsets && data.children.length === 1) {
|
|
27360
|
+
const offsets = makeArrowOffsets(data.valueOffsets, indexes.length + 1);
|
|
27361
|
+
const childIndexes = [];
|
|
27362
|
+
const vector = new Vector([data]);
|
|
27363
|
+
indexes.forEach((index, outputIndex) => {
|
|
27364
|
+
if (vector.isValid(index)) {
|
|
27365
|
+
const begin = Number(data.valueOffsets[index]);
|
|
27366
|
+
const end = Number(data.valueOffsets[index + 1]);
|
|
27367
|
+
for (let childIndex = begin; childIndex < end; childIndex++)
|
|
27368
|
+
childIndexes.push(childIndex);
|
|
27369
|
+
}
|
|
27370
|
+
setArrowOffset(offsets, outputIndex + 1, childIndexes.length);
|
|
27371
|
+
});
|
|
27372
|
+
buffers[BufferType.OFFSET] = offsets;
|
|
27373
|
+
return createArrowData(type, 0, indexes.length, nullCount, buffers, [
|
|
27374
|
+
takeArrowDataRows(data.children[0], childIndexes, context)
|
|
27375
|
+
]);
|
|
27376
|
+
}
|
|
27377
|
+
if (DataType.isBool(type)) {
|
|
27378
|
+
const values = new Uint8Array(Math.ceil(indexes.length / 8));
|
|
27379
|
+
indexes.forEach((index, outputIndex) => {
|
|
27380
|
+
const bitIndex = data.offset + index;
|
|
27381
|
+
if (data.values[bitIndex >> 3] & 1 << (bitIndex & 7))
|
|
27382
|
+
values[outputIndex >> 3] |= 1 << (outputIndex & 7);
|
|
27383
|
+
});
|
|
27384
|
+
buffers[BufferType.DATA] = values;
|
|
27385
|
+
} else if (data.valueOffsets) {
|
|
27386
|
+
const offsets = makeArrowOffsets(data.valueOffsets, indexes.length + 1);
|
|
27387
|
+
const ranges = [];
|
|
27388
|
+
const vector = new Vector([data]);
|
|
27389
|
+
let length = 0;
|
|
27390
|
+
indexes.forEach((index, outputIndex) => {
|
|
27391
|
+
const begin = vector.isValid(index) ? Number(data.valueOffsets[index]) : 0;
|
|
27392
|
+
const end = vector.isValid(index) ? Number(data.valueOffsets[index + 1]) : 0;
|
|
27393
|
+
ranges.push([begin, end]);
|
|
27394
|
+
length += end - begin;
|
|
27395
|
+
setArrowOffset(offsets, outputIndex + 1, length);
|
|
27396
|
+
});
|
|
27397
|
+
const values = new Uint8Array(length);
|
|
27398
|
+
let cursor = 0;
|
|
27399
|
+
for (const [begin, end] of ranges) {
|
|
27400
|
+
values.set(data.values.subarray(begin, end), cursor);
|
|
27401
|
+
cursor += end - begin;
|
|
27402
|
+
}
|
|
27403
|
+
buffers[BufferType.OFFSET] = offsets;
|
|
27404
|
+
buffers[BufferType.DATA] = values;
|
|
27405
|
+
} else {
|
|
27406
|
+
const values = new type.ArrayType(indexes.length * data.stride);
|
|
27407
|
+
indexes.forEach((index, outputIndex) => {
|
|
27408
|
+
values.set(data.values.subarray(index * data.stride, (index + 1) * data.stride), outputIndex * data.stride);
|
|
27409
|
+
});
|
|
27410
|
+
buffers[BufferType.DATA] = values;
|
|
27411
|
+
}
|
|
27412
|
+
let dictionary;
|
|
27413
|
+
if (data.dictionary) {
|
|
27414
|
+
dictionary = context.dictionaries.get(data.dictionary);
|
|
27415
|
+
if (!dictionary) {
|
|
27416
|
+
dictionary = indexes.length ? splitArrowBuffers(data.dictionary, { copy: "all" }) : new Vector([takeArrowDataRows(data.dictionary.data[0], [], context)]);
|
|
27417
|
+
if (indexes.length)
|
|
27418
|
+
context.dictionaries.set(data.dictionary, dictionary);
|
|
27419
|
+
}
|
|
27420
|
+
}
|
|
27421
|
+
const variadicBuffers = getArrowVariadicBuffers(data).map((buffer) => {
|
|
27422
|
+
let copy = context.variadicBuffers.get(buffer);
|
|
27423
|
+
if (!copy) {
|
|
27424
|
+
copy = new Uint8Array(buffer);
|
|
27425
|
+
context.variadicBuffers.set(buffer, copy);
|
|
27426
|
+
}
|
|
27427
|
+
return copy;
|
|
27428
|
+
});
|
|
27429
|
+
return createArrowData(type, 0, indexes.length, nullCount, buffers, [], dictionary, variadicBuffers);
|
|
27430
|
+
}
|
|
27431
|
+
function takeArrowUnionRows(data, indexes, context) {
|
|
27432
|
+
const type = data.type;
|
|
27433
|
+
const dense = type.mode === UnionMode.Dense;
|
|
27434
|
+
const typeIds = new Int8Array(indexes.length);
|
|
27435
|
+
const offsets = dense ? new Int32Array(indexes.length) : void 0;
|
|
27436
|
+
const childIndexes = data.children.map(() => []);
|
|
27437
|
+
indexes.forEach((index, outputIndex) => {
|
|
27438
|
+
const typeId = data.typeIds[index];
|
|
27439
|
+
typeIds[outputIndex] = typeId;
|
|
27440
|
+
if (dense) {
|
|
27441
|
+
const selected = childIndexes[type.typeIdToChildIndex[typeId]];
|
|
27442
|
+
offsets[outputIndex] = selected.length;
|
|
27443
|
+
selected.push(data.valueOffsets[index]);
|
|
27444
|
+
}
|
|
27445
|
+
});
|
|
27446
|
+
const children2 = data.children.map((child2, childIndex) => takeArrowDataRows(child2, dense ? childIndexes[childIndex] : indexes, context));
|
|
27447
|
+
return createArrowData(type, 0, indexes.length, 0, { [BufferType.TYPE]: typeIds, [BufferType.OFFSET]: offsets }, children2);
|
|
27448
|
+
}
|
|
27449
|
+
function takeArrowValidity(data, indexes) {
|
|
27450
|
+
const vector = new Vector([data]);
|
|
27451
|
+
const bitmap = new Uint8Array(Math.ceil(indexes.length / 8));
|
|
27452
|
+
let nullCount = 0;
|
|
27453
|
+
indexes.forEach((index, outputIndex) => {
|
|
27454
|
+
if (vector.isValid(index))
|
|
27455
|
+
bitmap[outputIndex >> 3] |= 1 << (outputIndex & 7);
|
|
27456
|
+
else
|
|
27457
|
+
nullCount++;
|
|
27458
|
+
});
|
|
27459
|
+
return { bitmap: nullCount ? bitmap : void 0, nullCount };
|
|
27460
|
+
}
|
|
27461
|
+
function makeArrowOffsets(source, length) {
|
|
27462
|
+
return source instanceof BigInt64Array ? new BigInt64Array(length) : new Int32Array(length);
|
|
27463
|
+
}
|
|
27464
|
+
function setArrowOffset(offsets, index, value2) {
|
|
27465
|
+
if (offsets instanceof BigInt64Array)
|
|
27466
|
+
offsets[index] = BigInt(value2);
|
|
27467
|
+
else {
|
|
27468
|
+
if (value2 > 2147483647)
|
|
27469
|
+
throw new RangeError("Selected Arrow values exceed 32-bit offset capacity.");
|
|
27470
|
+
offsets[index] = value2;
|
|
27471
|
+
}
|
|
27472
|
+
}
|
|
27017
27473
|
var init_take_arrow_rows = __esm({
|
|
27018
27474
|
"../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js"() {
|
|
27475
|
+
init_Arrow_dom();
|
|
27019
27476
|
init_arrow_data();
|
|
27020
27477
|
init_split_arrow_buffers();
|
|
27021
27478
|
}
|
|
@@ -27104,6 +27561,15 @@ return true;`);
|
|
|
27104
27561
|
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
27105
27562
|
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children2, dictionary, data.variadicBuffers);
|
|
27106
27563
|
}
|
|
27564
|
+
function dehydrateArrowRecordBatch(batch, options) {
|
|
27565
|
+
return dehydrateArrowTable(new Table(batch.schema, [batch]), options);
|
|
27566
|
+
}
|
|
27567
|
+
function hydrateArrowRecordBatch(payload) {
|
|
27568
|
+
if (payload.batches.length !== 1) {
|
|
27569
|
+
throw new Error("Arrow record batch transport requires exactly one batch.");
|
|
27570
|
+
}
|
|
27571
|
+
return hydrateArrowTable(payload).batches[0];
|
|
27572
|
+
}
|
|
27107
27573
|
var init_arrow_table_transport = __esm({
|
|
27108
27574
|
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
27109
27575
|
init_Arrow_dom();
|
|
@@ -27113,12 +27579,6 @@ return true;`);
|
|
|
27113
27579
|
}
|
|
27114
27580
|
});
|
|
27115
27581
|
|
|
27116
|
-
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
27117
|
-
var init_arrow_column_utils = __esm({
|
|
27118
|
-
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
27119
|
-
}
|
|
27120
|
-
});
|
|
27121
|
-
|
|
27122
27582
|
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
27123
27583
|
var init_arrow = __esm({
|
|
27124
27584
|
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
@@ -27142,63 +27602,425 @@ return true;`);
|
|
|
27142
27602
|
}
|
|
27143
27603
|
});
|
|
27144
27604
|
|
|
27605
|
+
// ../core/src/scan/arrow-execution/filter-arrow-table.ts
|
|
27606
|
+
function filterArrowTable(source, predicate, options = {}) {
|
|
27607
|
+
validateColumnarPredicate(predicate, new Set(source.schema.fields.map((field) => field.name)));
|
|
27608
|
+
const columnNames = getColumnarPredicateColumns(predicate);
|
|
27609
|
+
return filterArrowRows(
|
|
27610
|
+
source,
|
|
27611
|
+
(batch) => {
|
|
27612
|
+
const columns = getPredicateColumns(new Table(source.schema, [batch]), columnNames);
|
|
27613
|
+
return (rowIndex) => evaluatePredicate(predicate, columns, rowIndex) === true;
|
|
27614
|
+
},
|
|
27615
|
+
options
|
|
27616
|
+
);
|
|
27617
|
+
}
|
|
27618
|
+
function filterArrowRows(source, selectBatch, options = {}) {
|
|
27619
|
+
let remaining = options.limit ?? Infinity;
|
|
27620
|
+
if (remaining !== Infinity && (!Number.isSafeInteger(remaining) || remaining < 0)) {
|
|
27621
|
+
throw new Error("Arrow filter limit must be a non-negative safe integer.");
|
|
27622
|
+
}
|
|
27623
|
+
options.signal?.throwIfAborted();
|
|
27624
|
+
const batches = [];
|
|
27625
|
+
for (const batch of source.batches) {
|
|
27626
|
+
if (remaining === 0) break;
|
|
27627
|
+
options.signal?.throwIfAborted();
|
|
27628
|
+
const data = new Table(source.schema, [batch]);
|
|
27629
|
+
const selectRow = selectBatch(batch);
|
|
27630
|
+
const indices = [];
|
|
27631
|
+
for (let rowIndex = 0; rowIndex < batch.numRows && indices.length < remaining; rowIndex++) {
|
|
27632
|
+
options.signal?.throwIfAborted();
|
|
27633
|
+
if (selectRow(rowIndex)) indices.push(rowIndex);
|
|
27634
|
+
}
|
|
27635
|
+
remaining -= indices.length;
|
|
27636
|
+
if (indices.length === 0) continue;
|
|
27637
|
+
if (indices.length === batch.numRows) {
|
|
27638
|
+
batches.push(batch);
|
|
27639
|
+
continue;
|
|
27640
|
+
}
|
|
27641
|
+
if (indices[indices.length - 1] - indices[0] + 1 === indices.length) {
|
|
27642
|
+
batches.push(batch.slice(indices[0], indices[indices.length - 1] + 1));
|
|
27643
|
+
continue;
|
|
27644
|
+
}
|
|
27645
|
+
const gathered = takeArrowTableRows(data, Int32Array.from(indices));
|
|
27646
|
+
batches.push(
|
|
27647
|
+
...gathered.batches.map(
|
|
27648
|
+
(output2) => new RecordBatch3(source.schema, output2.data, batch.metadata)
|
|
27649
|
+
)
|
|
27650
|
+
);
|
|
27651
|
+
}
|
|
27652
|
+
return new Table(source.schema, batches);
|
|
27653
|
+
}
|
|
27654
|
+
function getPredicateColumns(sourceTable, columnNames) {
|
|
27655
|
+
const columns = {};
|
|
27656
|
+
for (const columnName of columnNames) {
|
|
27657
|
+
const column = sourceTable.getChild(columnName);
|
|
27658
|
+
if (!column) {
|
|
27659
|
+
throw new Error(`Arrow query column not found: ${columnName}`);
|
|
27660
|
+
}
|
|
27661
|
+
columns[columnName] = column;
|
|
27662
|
+
}
|
|
27663
|
+
return columns;
|
|
27664
|
+
}
|
|
27665
|
+
function evaluatePredicate(predicate, columns, rowIndex) {
|
|
27666
|
+
if (isLogicalPredicate(predicate)) {
|
|
27667
|
+
const values = predicate.args.map((child2) => evaluatePredicate(child2, columns, rowIndex));
|
|
27668
|
+
return predicate.op === "and" ? evaluateAnd(values) : evaluateOr(values);
|
|
27669
|
+
}
|
|
27670
|
+
if (isNotPredicate(predicate)) {
|
|
27671
|
+
const value3 = evaluatePredicate(predicate.args[0], columns, rowIndex);
|
|
27672
|
+
return value3 === null ? null : !value3;
|
|
27673
|
+
}
|
|
27674
|
+
const value2 = getColumnValue(columns, predicate.args[0].property, rowIndex);
|
|
27675
|
+
if (isNullPredicate(predicate)) {
|
|
27676
|
+
return value2 === null || value2 === void 0;
|
|
27677
|
+
}
|
|
27678
|
+
if (isInPredicate(predicate)) {
|
|
27679
|
+
return evaluateIn(value2, predicate.args[1]);
|
|
27680
|
+
}
|
|
27681
|
+
return evaluateComparison(value2, predicate);
|
|
27682
|
+
}
|
|
27683
|
+
function getColumnValue(columns, columnName, rowIndex) {
|
|
27684
|
+
const path = typeof columnName === "string" ? [columnName] : columnName;
|
|
27685
|
+
const column = columns[path[0]];
|
|
27686
|
+
if (!column) {
|
|
27687
|
+
throw new Error(`Arrow query could not read predicate column "${columnName}".`);
|
|
27688
|
+
}
|
|
27689
|
+
let value2 = column.get(rowIndex);
|
|
27690
|
+
for (const property of path.slice(1)) {
|
|
27691
|
+
if (value2 === null || value2 === void 0) return null;
|
|
27692
|
+
value2 = value2[property];
|
|
27693
|
+
}
|
|
27694
|
+
return value2;
|
|
27695
|
+
}
|
|
27696
|
+
function evaluateAnd(values) {
|
|
27697
|
+
if (values.includes(false)) {
|
|
27698
|
+
return false;
|
|
27699
|
+
}
|
|
27700
|
+
return values.includes(null) ? null : true;
|
|
27701
|
+
}
|
|
27702
|
+
function evaluateOr(values) {
|
|
27703
|
+
if (values.includes(true)) {
|
|
27704
|
+
return true;
|
|
27705
|
+
}
|
|
27706
|
+
return values.includes(null) ? null : false;
|
|
27707
|
+
}
|
|
27708
|
+
function evaluateIn(value2, candidates) {
|
|
27709
|
+
if (value2 === null || value2 === void 0) {
|
|
27710
|
+
return null;
|
|
27711
|
+
}
|
|
27712
|
+
for (const candidate of candidates) {
|
|
27713
|
+
if (compareValues(value2, candidate) === 0) {
|
|
27714
|
+
return true;
|
|
27715
|
+
}
|
|
27716
|
+
}
|
|
27717
|
+
return false;
|
|
27718
|
+
}
|
|
27719
|
+
function evaluateComparison(value2, predicate) {
|
|
27720
|
+
if (value2 === null || value2 === void 0) {
|
|
27721
|
+
return null;
|
|
27722
|
+
}
|
|
27723
|
+
const comparison = compareValues(value2, predicate.args[1]);
|
|
27724
|
+
switch (predicate.op) {
|
|
27725
|
+
case "=":
|
|
27726
|
+
return comparison === 0;
|
|
27727
|
+
case "<>":
|
|
27728
|
+
return comparison !== 0;
|
|
27729
|
+
case "<":
|
|
27730
|
+
return comparison < 0;
|
|
27731
|
+
case "<=":
|
|
27732
|
+
return comparison <= 0;
|
|
27733
|
+
case ">":
|
|
27734
|
+
return comparison > 0;
|
|
27735
|
+
case ">=":
|
|
27736
|
+
return comparison >= 0;
|
|
27737
|
+
}
|
|
27738
|
+
}
|
|
27739
|
+
function compareValues(left, right) {
|
|
27740
|
+
if (isColumnarPredicateParameter(right)) {
|
|
27741
|
+
throw new Error(
|
|
27742
|
+
`Arrow query parameter ":${right.parameter}" must be bound before query execution.`
|
|
27743
|
+
);
|
|
27744
|
+
}
|
|
27745
|
+
if (left instanceof Date && right instanceof Date) {
|
|
27746
|
+
return compareArrowQueryNumbers(left.getTime(), right.getTime());
|
|
27747
|
+
}
|
|
27748
|
+
if (typeof left === "number" && right instanceof Date) {
|
|
27749
|
+
return compareArrowQueryNumbers(left, right.getTime());
|
|
27750
|
+
}
|
|
27751
|
+
if (left instanceof Uint8Array && right instanceof Uint8Array) {
|
|
27752
|
+
return compareBinary(left, right);
|
|
27753
|
+
}
|
|
27754
|
+
if (typeof left === "bigint" && typeof right === "bigint") {
|
|
27755
|
+
return left === right ? 0 : left < right ? -1 : 1;
|
|
27756
|
+
}
|
|
27757
|
+
if (typeof left === "bigint" && typeof right === "number" || typeof left === "number" && typeof right === "bigint") {
|
|
27758
|
+
const numericValue = typeof left === "number" ? left : right;
|
|
27759
|
+
if (!Number.isFinite(numericValue))
|
|
27760
|
+
throw new Error("Arrow query cannot compare non-finite numbers.");
|
|
27761
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
27762
|
+
}
|
|
27763
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
27764
|
+
return compareArrowQueryNumbers(left, right);
|
|
27765
|
+
}
|
|
27766
|
+
if (typeof left === "string" && typeof right === "string") {
|
|
27767
|
+
return left === right ? 0 : left < right ? -1 : 1;
|
|
27768
|
+
}
|
|
27769
|
+
if (typeof left === "boolean" && typeof right === "boolean") {
|
|
27770
|
+
return Number(left) - Number(right);
|
|
27771
|
+
}
|
|
27772
|
+
throw new Error(
|
|
27773
|
+
`Arrow query cannot compare ${getArrowQueryValueType(left)} with ${getArrowQueryValueType(right)} values.`
|
|
27774
|
+
);
|
|
27775
|
+
}
|
|
27776
|
+
function compareArrowQueryNumbers(left, right) {
|
|
27777
|
+
if (!Number.isFinite(left) || !Number.isFinite(right)) {
|
|
27778
|
+
throw new Error("Arrow query cannot compare non-finite numbers.");
|
|
27779
|
+
}
|
|
27780
|
+
return left === right ? 0 : left < right ? -1 : 1;
|
|
27781
|
+
}
|
|
27782
|
+
function compareBinary(left, right) {
|
|
27783
|
+
const commonLength = Math.min(left.length, right.length);
|
|
27784
|
+
for (let index = 0; index < commonLength; index++) {
|
|
27785
|
+
if (left[index] !== right[index]) {
|
|
27786
|
+
return left[index] < right[index] ? -1 : 1;
|
|
27787
|
+
}
|
|
27788
|
+
}
|
|
27789
|
+
return left.length === right.length ? 0 : left.length < right.length ? -1 : 1;
|
|
27790
|
+
}
|
|
27791
|
+
function getArrowQueryValueType(value2) {
|
|
27792
|
+
if (value2 instanceof Date) {
|
|
27793
|
+
return "Date";
|
|
27794
|
+
}
|
|
27795
|
+
if (value2 instanceof Uint8Array) {
|
|
27796
|
+
return "Uint8Array";
|
|
27797
|
+
}
|
|
27798
|
+
return typeof value2;
|
|
27799
|
+
}
|
|
27800
|
+
function isLogicalPredicate(predicate) {
|
|
27801
|
+
return predicate.op === "and" || predicate.op === "or";
|
|
27802
|
+
}
|
|
27803
|
+
function isNotPredicate(predicate) {
|
|
27804
|
+
return predicate.op === "not";
|
|
27805
|
+
}
|
|
27806
|
+
function isNullPredicate(predicate) {
|
|
27807
|
+
return predicate.op === "isNull";
|
|
27808
|
+
}
|
|
27809
|
+
function isInPredicate(predicate) {
|
|
27810
|
+
return predicate.op === "in";
|
|
27811
|
+
}
|
|
27812
|
+
var init_filter_arrow_table = __esm({
|
|
27813
|
+
"../core/src/scan/arrow-execution/filter-arrow-table.ts"() {
|
|
27814
|
+
"use strict";
|
|
27815
|
+
init_Arrow_dom();
|
|
27816
|
+
init_dist2();
|
|
27817
|
+
init_loader_utils();
|
|
27818
|
+
}
|
|
27819
|
+
});
|
|
27820
|
+
|
|
27821
|
+
// ../core/src/scan/arrow-execution.ts
|
|
27822
|
+
var arrow_execution_exports = {};
|
|
27823
|
+
__export(arrow_execution_exports, {
|
|
27824
|
+
filterArrowTable: () => filterArrowTable,
|
|
27825
|
+
projectArrowTable: () => projectArrowTable
|
|
27826
|
+
});
|
|
27827
|
+
var init_arrow_execution = __esm({
|
|
27828
|
+
"../core/src/scan/arrow-execution.ts"() {
|
|
27829
|
+
"use strict";
|
|
27830
|
+
init_project_arrow_table();
|
|
27831
|
+
init_filter_arrow_table();
|
|
27832
|
+
}
|
|
27833
|
+
});
|
|
27834
|
+
|
|
27835
|
+
// ../pointclouds/src/las/las-source.ts
|
|
27836
|
+
var LAS_QUERY_CAPABILITIES, LASSource;
|
|
27837
|
+
var init_las_source = __esm({
|
|
27838
|
+
"../pointclouds/src/las/las-source.ts"() {
|
|
27839
|
+
"use strict";
|
|
27840
|
+
init_Arrow_dom();
|
|
27841
|
+
init_loader_utils();
|
|
27842
|
+
init_schema_utils();
|
|
27843
|
+
init_las_loader();
|
|
27844
|
+
LAS_QUERY_CAPABILITIES = Object.freeze({
|
|
27845
|
+
predicate: "residual",
|
|
27846
|
+
projection: "pushdown+residual",
|
|
27847
|
+
limit: "pushdown",
|
|
27848
|
+
offset: "pushdown",
|
|
27849
|
+
cast: "unsupported",
|
|
27850
|
+
streaming: true,
|
|
27851
|
+
cancellation: true
|
|
27852
|
+
});
|
|
27853
|
+
LASSource = class extends DataSource {
|
|
27854
|
+
/** Creates a source without fetching or decoding point data. */
|
|
27855
|
+
constructor(data, options = {}, coreApi2) {
|
|
27856
|
+
super(data, options, void 0, coreApi2);
|
|
27857
|
+
}
|
|
27858
|
+
/** Discovers fields from the header and variable-length records without decoding points. */
|
|
27859
|
+
async getQueryMetadata(options = {}) {
|
|
27860
|
+
const chunks = [];
|
|
27861
|
+
let length = 0;
|
|
27862
|
+
let required2 = 227;
|
|
27863
|
+
for await (const chunk of this.readBytes(options.signal)) {
|
|
27864
|
+
chunks.push(chunk);
|
|
27865
|
+
length += chunk.byteLength;
|
|
27866
|
+
if (length < required2) continue;
|
|
27867
|
+
const bytes = new Uint8Array(length);
|
|
27868
|
+
let offset = 0;
|
|
27869
|
+
for (const part of chunks) {
|
|
27870
|
+
bytes.set(part, offset);
|
|
27871
|
+
offset += part.byteLength;
|
|
27872
|
+
}
|
|
27873
|
+
const view = new DataView(bytes.buffer);
|
|
27874
|
+
if (view.getUint32(0, true) !== 1179861324) throw new Error("Invalid LAS header");
|
|
27875
|
+
required2 = Math.max(227, view.getUint16(94, true), view.getUint32(96, true));
|
|
27876
|
+
if (length < required2) continue;
|
|
27877
|
+
const table = parseLASMetadata(bytes.buffer.slice(0, required2), this.loadOptions);
|
|
27878
|
+
return createScanQueryMetadata({
|
|
27879
|
+
sourceType: "las",
|
|
27880
|
+
name: this.name,
|
|
27881
|
+
queryType: "table",
|
|
27882
|
+
execution: { status: "supported", method: "read" },
|
|
27883
|
+
schema: convertArrowToSchema(table.schema),
|
|
27884
|
+
capabilities: { table: LAS_QUERY_CAPABILITIES }
|
|
27885
|
+
});
|
|
27886
|
+
}
|
|
27887
|
+
throw new Error("Truncated LAS header");
|
|
27888
|
+
}
|
|
27889
|
+
/** Explains projection and row-window pushdown separately from residual filtering. */
|
|
27890
|
+
async explain(options = {}) {
|
|
27891
|
+
const metadata = await this.getQueryMetadata(options);
|
|
27892
|
+
return explainTableQuery(
|
|
27893
|
+
metadata.columns.map((column) => column.name),
|
|
27894
|
+
options,
|
|
27895
|
+
LAS_QUERY_CAPABILITIES
|
|
27896
|
+
);
|
|
27897
|
+
}
|
|
27898
|
+
/** Decodes selected columns and applies predicates before the global offset and limit. */
|
|
27899
|
+
async *read(options = {}) {
|
|
27900
|
+
const columns = options.columns === void 0 ? void 0 : [
|
|
27901
|
+
.../* @__PURE__ */ new Set([
|
|
27902
|
+
...options.columns,
|
|
27903
|
+
...options.predicate ? getColumnarPredicateColumns(options.predicate) : []
|
|
27904
|
+
])
|
|
27905
|
+
];
|
|
27906
|
+
for await (const table of executeTableScanBatches(
|
|
27907
|
+
(signal, onByteLength) => this.parseBatches(columns, signal, onByteLength),
|
|
27908
|
+
options,
|
|
27909
|
+
{
|
|
27910
|
+
async filter(batch, predicate, signal) {
|
|
27911
|
+
if (!predicate) return batch;
|
|
27912
|
+
const { filterArrowTable: filterArrowTable2 } = await Promise.resolve().then(() => (init_arrow_execution(), arrow_execution_exports));
|
|
27913
|
+
return filterArrowTable2(batch, predicate, { signal });
|
|
27914
|
+
}
|
|
27915
|
+
}
|
|
27916
|
+
)) {
|
|
27917
|
+
if (table.batches.length) yield* table.batches;
|
|
27918
|
+
else yield makeArrowMetadataBatch(table.schema);
|
|
27919
|
+
}
|
|
27920
|
+
}
|
|
27921
|
+
/** Pushes selected source fields into the decoder before allocating Arrow columns. */
|
|
27922
|
+
async *parseBatches(columns, signal, onByteLength) {
|
|
27923
|
+
const options = {
|
|
27924
|
+
...this.loadOptions,
|
|
27925
|
+
signal,
|
|
27926
|
+
las: {
|
|
27927
|
+
...this.options.las,
|
|
27928
|
+
shape: "arrow",
|
|
27929
|
+
...columns && {
|
|
27930
|
+
columns: [
|
|
27931
|
+
...new Set(
|
|
27932
|
+
columns.map(
|
|
27933
|
+
(column) => this.options.las?.extraBytes === "typed" && column.startsWith("EXTRA_BYTES_") ? "EXTRA_BYTES" : column
|
|
27934
|
+
)
|
|
27935
|
+
)
|
|
27936
|
+
]
|
|
27937
|
+
}
|
|
27938
|
+
}
|
|
27939
|
+
};
|
|
27940
|
+
const chunks = this.readBytes(signal, onByteLength);
|
|
27941
|
+
try {
|
|
27942
|
+
for await (const batch of LASLoaderWithParser.parseInBatches(chunks, options)) {
|
|
27943
|
+
if ("attributes" in batch) throw new Error("Expected Arrow LAS output");
|
|
27944
|
+
yield new Table(batch.schema, [batch]);
|
|
27945
|
+
}
|
|
27946
|
+
} finally {
|
|
27947
|
+
await chunks.return();
|
|
27948
|
+
}
|
|
27949
|
+
}
|
|
27950
|
+
/** Reads with cancellation and closes the stream when a limit stops decoding early. */
|
|
27951
|
+
async *readBytes(signal, onByteLength) {
|
|
27952
|
+
signal?.throwIfAborted();
|
|
27953
|
+
const input2 = this.data instanceof Blob ? this.data : await this.fetch(this.url, { signal });
|
|
27954
|
+
if (input2 instanceof Response && !input2.ok)
|
|
27955
|
+
throw new Error(`LAS request failed: ${input2.status}`);
|
|
27956
|
+
const stream = input2 instanceof Blob ? input2.stream() : input2.body;
|
|
27957
|
+
if (!stream) {
|
|
27958
|
+
const bytes = new Uint8Array(await input2.arrayBuffer());
|
|
27959
|
+
signal?.throwIfAborted();
|
|
27960
|
+
onByteLength?.(bytes.byteLength);
|
|
27961
|
+
yield bytes;
|
|
27962
|
+
return;
|
|
27963
|
+
}
|
|
27964
|
+
const reader = stream.getReader();
|
|
27965
|
+
const abort = () => {
|
|
27966
|
+
void reader.cancel().catch(() => {
|
|
27967
|
+
});
|
|
27968
|
+
};
|
|
27969
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
27970
|
+
try {
|
|
27971
|
+
while (true) {
|
|
27972
|
+
signal?.throwIfAborted();
|
|
27973
|
+
const { done, value: value2 } = await reader.read();
|
|
27974
|
+
signal?.throwIfAborted();
|
|
27975
|
+
if (done) return;
|
|
27976
|
+
onByteLength?.(value2.byteLength);
|
|
27977
|
+
yield value2;
|
|
27978
|
+
}
|
|
27979
|
+
} finally {
|
|
27980
|
+
signal?.removeEventListener("abort", abort);
|
|
27981
|
+
await reader.cancel();
|
|
27982
|
+
reader.releaseLock();
|
|
27983
|
+
}
|
|
27984
|
+
}
|
|
27985
|
+
};
|
|
27986
|
+
}
|
|
27987
|
+
});
|
|
27988
|
+
|
|
27145
27989
|
// ../core/src/arrow-worker-transport.ts
|
|
27146
|
-
function
|
|
27147
|
-
|
|
27990
|
+
function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
|
|
27991
|
+
const batch = result instanceof RecordBatch3;
|
|
27992
|
+
if (!batch && !(result instanceof Table)) {
|
|
27148
27993
|
throw new Error("Workers require Arrow table output");
|
|
27149
27994
|
}
|
|
27150
|
-
const { data, shape: _shape, ...metadata } = result;
|
|
27151
27995
|
return {
|
|
27152
|
-
transport: "arrow-
|
|
27153
|
-
|
|
27154
|
-
...serializeWorkerColumns(data, { copy: "all" })
|
|
27996
|
+
transport: batch ? "arrow-record-batch" : "arrow-table-columns",
|
|
27997
|
+
columns: batch ? { data: dehydrateArrowRecordBatch(result, options) } : serializeWorkerColumns(result, options)
|
|
27155
27998
|
};
|
|
27156
27999
|
}
|
|
27157
|
-
function
|
|
27158
|
-
|
|
27159
|
-
|
|
28000
|
+
function deserializeNativeArrowWorkerResult(result) {
|
|
28001
|
+
const payload = result;
|
|
28002
|
+
if (payload?.transport !== "arrow-table-columns" && payload?.transport !== "arrow-record-batch" || !hasArrowWorkerColumns(payload.columns)) {
|
|
28003
|
+
throw new Error("Workers require Arrow column transport");
|
|
27160
28004
|
}
|
|
27161
|
-
if (
|
|
27162
|
-
|
|
27163
|
-
return { ...metadata, data: hydrateWorkerTable(result) };
|
|
28005
|
+
if (payload.transport === "arrow-record-batch" && !payload.columns.arrowBatchMetadata) {
|
|
28006
|
+
return hydrateArrowRecordBatch(payload.columns.data);
|
|
27164
28007
|
}
|
|
27165
|
-
|
|
27166
|
-
|
|
27167
|
-
function isArrowTableWrapper(value2) {
|
|
27168
|
-
const table = value2;
|
|
27169
|
-
return Boolean(
|
|
27170
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
27171
|
-
);
|
|
28008
|
+
const data = hydrateWorkerTable(payload.columns);
|
|
28009
|
+
return payload.transport === "arrow-record-batch" ? data.batches[0] : data;
|
|
27172
28010
|
}
|
|
27173
28011
|
function hasArrowWorkerColumns(value2) {
|
|
27174
28012
|
const columns = value2;
|
|
27175
28013
|
return columns?.data?.transport === "arrow-js" && Array.isArray(columns.data.batches);
|
|
27176
28014
|
}
|
|
27177
|
-
function isArrowWorkerEnvelope(value2) {
|
|
27178
|
-
return value2?.transport === "arrow-column-envelope" && hasArrowWorkerColumns(value2);
|
|
27179
|
-
}
|
|
27180
|
-
function isLegacyArrowWorkerEnvelope(value2) {
|
|
27181
|
-
return value2?.shape === "arrow-table" && hasArrowWorkerColumns(value2);
|
|
27182
|
-
}
|
|
27183
28015
|
function serializeWorkerColumns(table, options) {
|
|
27184
28016
|
return {
|
|
27185
28017
|
arrowBatchMetadata: snapshotBatchMetadata(table),
|
|
27186
|
-
data:
|
|
28018
|
+
data: dehydrateArrowTable(table, options)
|
|
27187
28019
|
};
|
|
27188
28020
|
}
|
|
27189
|
-
function dehydrateWorkerTable(table, options) {
|
|
27190
|
-
const payload = dehydrateArrowTable(table, options);
|
|
27191
|
-
if (table.numCols === 0) {
|
|
27192
|
-
for (const [index, batch] of table.batches.entries()) {
|
|
27193
|
-
payload.batches[index].length = batch.numRows;
|
|
27194
|
-
}
|
|
27195
|
-
}
|
|
27196
|
-
return payload;
|
|
27197
|
-
}
|
|
27198
28021
|
function snapshotBatchMetadata(table) {
|
|
27199
28022
|
return table.batches.map((batch) => ({
|
|
27200
|
-
schema: tableToIPC(new Table(batch.schema, []))
|
|
27201
|
-
metadata: Array.from(batch.metadata)
|
|
28023
|
+
schema: tableToIPC(new Table(batch.schema, []))
|
|
27202
28024
|
}));
|
|
27203
28025
|
}
|
|
27204
28026
|
function hydrateWorkerTable(result) {
|
|
@@ -27206,18 +28028,11 @@ return true;`);
|
|
|
27206
28028
|
const table = hydrateArrowTable(data);
|
|
27207
28029
|
const batches = table.batches.map((batch, index) => {
|
|
27208
28030
|
const snapshot = arrowBatchMetadata?.[index];
|
|
27209
|
-
|
|
28031
|
+
return snapshot ? createRecordBatchWithMetadata(
|
|
27210
28032
|
tableFromIPC(snapshot.schema).schema,
|
|
27211
28033
|
batch.data,
|
|
27212
|
-
new Map(snapshot.metadata)
|
|
28034
|
+
snapshot.metadata ? new Map(snapshot.metadata) : getRecordBatchMetadata(batch)
|
|
27213
28035
|
) : batch;
|
|
27214
|
-
const rowCount = data.batches[index].length;
|
|
27215
|
-
if (restored.numCols === 0 && restored.numRows !== rowCount) {
|
|
27216
|
-
Object.defineProperty(restored, "data", {
|
|
27217
|
-
value: new Data(new Struct([]), 0, rowCount, 0, void 0, [])
|
|
27218
|
-
});
|
|
27219
|
-
}
|
|
27220
|
-
return restored;
|
|
27221
28036
|
});
|
|
27222
28037
|
return new Table(table.schema, batches);
|
|
27223
28038
|
}
|
|
@@ -27560,7 +28375,7 @@ return true;`);
|
|
|
27560
28375
|
lastTable = makeEmptyLASBatch(header, options);
|
|
27561
28376
|
} else {
|
|
27562
28377
|
for await (const table of parseLAZInBatches(pending, trackedIterator, header, options)) {
|
|
27563
|
-
lastTable =
|
|
28378
|
+
lastTable = updateLASArrowMetadata(
|
|
27564
28379
|
table,
|
|
27565
28380
|
makeMetadataFromLasHeader({
|
|
27566
28381
|
...header,
|
|
@@ -27605,7 +28420,7 @@ return true;`);
|
|
|
27605
28420
|
totalRead = batch.totalRead;
|
|
27606
28421
|
pending = batch.pending;
|
|
27607
28422
|
absoluteOffset = batch.absoluteOffset;
|
|
27608
|
-
lastTable =
|
|
28423
|
+
lastTable = updateLASArrowMetadata(
|
|
27609
28424
|
parseLASArrowTableBatch(batch.arrayBuffer, batch.header, options),
|
|
27610
28425
|
makeMetadataFromLasHeader({ ...header, totalRead })
|
|
27611
28426
|
);
|
|
@@ -27626,11 +28441,12 @@ return true;`);
|
|
|
27626
28441
|
if (update) yield update;
|
|
27627
28442
|
}
|
|
27628
28443
|
function makeEmptyLASBatch(header, options) {
|
|
27629
|
-
const table = parseLASArrowTableBatch(
|
|
27630
|
-
|
|
27631
|
-
{ ...
|
|
27632
|
-
|
|
28444
|
+
const table = parseLASArrowTableBatch(
|
|
28445
|
+
new ArrayBuffer(0),
|
|
28446
|
+
{ ...header, pointsCount: 0, pointsOffset: 0 },
|
|
28447
|
+
options
|
|
27633
28448
|
);
|
|
28449
|
+
return updateLASArrowMetadata({ ...table, loaderData: header }, makeMetadataFromLasHeader(header));
|
|
27634
28450
|
}
|
|
27635
28451
|
function makeLASMetadataUpdate(lastTable, header, pending, absoluteOffset, totalRead) {
|
|
27636
28452
|
const metadata = header.metadata;
|
|
@@ -27656,13 +28472,16 @@ return true;`);
|
|
|
27656
28472
|
const finalHeader = { ...header, totalRead, metadata: finalMetadata };
|
|
27657
28473
|
if (records.length > 0) {
|
|
27658
28474
|
const data = new Table([makeArrowMetadataBatch(lastTable.data.schema)]);
|
|
27659
|
-
return
|
|
28475
|
+
return updateLASArrowMetadata(
|
|
27660
28476
|
{ ...lastTable, data, loaderData: finalHeader },
|
|
27661
28477
|
makeMetadataFromLasHeader(finalHeader)
|
|
27662
28478
|
);
|
|
27663
28479
|
}
|
|
27664
28480
|
}
|
|
27665
28481
|
}
|
|
28482
|
+
function updateLASArrowMetadata(table, metadata) {
|
|
28483
|
+
return { ...table, data: updateNativeArrowTableMetadata(table.data, metadata) };
|
|
28484
|
+
}
|
|
27666
28485
|
async function* decodeLAZFileWithParsedVLRInBatches(initialPending, inputIterator, header, laszip, options) {
|
|
27667
28486
|
if (laszip.variableChunks) {
|
|
27668
28487
|
const bytes = await collectRemainingInputBytes(initialPending, inputIterator);
|
|
@@ -28089,7 +28908,7 @@ return true;`);
|
|
|
28089
28908
|
const batchSize = getBatchSize(options);
|
|
28090
28909
|
const outputHeader = {
|
|
28091
28910
|
...header,
|
|
28092
|
-
metadata:
|
|
28911
|
+
metadata: parseLASMetadata2(bytes, header),
|
|
28093
28912
|
totalToRead: header.pointsCount
|
|
28094
28913
|
};
|
|
28095
28914
|
const state = createRawPointBatchState(
|
|
@@ -28214,7 +29033,7 @@ return true;`);
|
|
|
28214
29033
|
userHeaderData: versionMinor === 5 && headerSize > 393 ? new Uint8Array(arrayBuffer, 393, headerSize - 393).slice() : void 0
|
|
28215
29034
|
};
|
|
28216
29035
|
if (hasCompleteLASMetadata(arrayBuffer, header)) {
|
|
28217
|
-
header.metadata =
|
|
29036
|
+
header.metadata = parseLASMetadata2(arrayBuffer, header);
|
|
28218
29037
|
}
|
|
28219
29038
|
return header;
|
|
28220
29039
|
}
|
|
@@ -28222,7 +29041,7 @@ return true;`);
|
|
|
28222
29041
|
const vlrEnd = header.headerSize + header.vlrCount * 54;
|
|
28223
29042
|
return arrayBuffer.byteLength >= Math.max(vlrEnd, header.pointsOffset);
|
|
28224
29043
|
}
|
|
28225
|
-
function
|
|
29044
|
+
function parseLASMetadata2(arrayBuffer, header) {
|
|
28226
29045
|
const dataView = makeDataView(arrayBuffer);
|
|
28227
29046
|
const bytes = new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength);
|
|
28228
29047
|
const version4 = header.versionAsString || "1.0";
|
|
@@ -28597,7 +29416,7 @@ return true;`);
|
|
|
28597
29416
|
if (extraBytes) {
|
|
28598
29417
|
attributes.EXTRA_BYTES = {
|
|
28599
29418
|
value: extraBytes,
|
|
28600
|
-
size:
|
|
29419
|
+
size: lasHeader.pointsStructSize - getLAZPointDataRecordBaseLength(lasHeader.pointsFormatId)
|
|
28601
29420
|
};
|
|
28602
29421
|
}
|
|
28603
29422
|
if (typedExtraBytes) {
|
|
@@ -28613,7 +29432,7 @@ return true;`);
|
|
|
28613
29432
|
}
|
|
28614
29433
|
const schema = getLASSchema(lasHeader, numericAttributes);
|
|
28615
29434
|
return {
|
|
28616
|
-
|
|
29435
|
+
data: makeMeshArrowTable(attributes, {
|
|
28617
29436
|
schema,
|
|
28618
29437
|
topology: "point-list",
|
|
28619
29438
|
mode: 0,
|
|
@@ -30157,8 +30976,8 @@ return true;`);
|
|
|
30157
30976
|
}
|
|
30158
30977
|
function convertLASMesh(table, options) {
|
|
30159
30978
|
const formattedTable = options?.las?.colorFormat === void 0 || options.las.colorFormat === "uint8norm" ? table : {
|
|
30160
|
-
|
|
30161
|
-
formatLASMeshColors(convertTableToMesh(table), options.las.colorFormat)
|
|
30979
|
+
data: convertMeshToArrowTable(
|
|
30980
|
+
formatLASMeshColors(convertTableToMesh(table.data), options.las.colorFormat)
|
|
30162
30981
|
),
|
|
30163
30982
|
loader: table.loader,
|
|
30164
30983
|
loaderData: table.loaderData,
|
|
@@ -30168,7 +30987,7 @@ return true;`);
|
|
|
30168
30987
|
return formattedTable;
|
|
30169
30988
|
}
|
|
30170
30989
|
return {
|
|
30171
|
-
...convertTableToMesh(formattedTable),
|
|
30990
|
+
...convertTableToMesh(formattedTable.data),
|
|
30172
30991
|
loader: formattedTable.loader,
|
|
30173
30992
|
loaderData: formattedTable.loaderData,
|
|
30174
30993
|
progress: formattedTable.progress
|
|
@@ -30183,11 +31002,25 @@ return true;`);
|
|
|
30183
31002
|
yield convertLASMesh(table, options);
|
|
30184
31003
|
}
|
|
30185
31004
|
}
|
|
31005
|
+
function serializeLASWorkerTable(result) {
|
|
31006
|
+
if ("attributes" in result) throw new Error("LAS workers require Arrow columns");
|
|
31007
|
+
return {
|
|
31008
|
+
columns: serializeNativeArrowWorkerResult(result.data),
|
|
31009
|
+
loaderData: structuredClone(result.loaderData),
|
|
31010
|
+
progress: result.progress
|
|
31011
|
+
};
|
|
31012
|
+
}
|
|
30186
31013
|
function deserializeLASWorkerTable(result, options) {
|
|
30187
|
-
|
|
31014
|
+
const payload = result;
|
|
31015
|
+
const table = deserializeNativeArrowWorkerResult(payload.columns);
|
|
31016
|
+
if (!isArrowTable2(table)) throw new Error("LAS workers require an Arrow table");
|
|
31017
|
+
return convertLASMesh(
|
|
31018
|
+
{ data: table, loader: "las", loaderData: payload.loaderData, progress: payload.progress },
|
|
31019
|
+
options
|
|
31020
|
+
);
|
|
30188
31021
|
}
|
|
30189
31022
|
function toPublicLASResult(result) {
|
|
30190
|
-
if (
|
|
31023
|
+
if ("attributes" in result) return result;
|
|
30191
31024
|
const header = JSON.stringify(
|
|
30192
31025
|
result.loaderData,
|
|
30193
31026
|
(_key, value2) => typeof value2 === "bigint" ? value2.toString() : ArrayBuffer.isView(value2) ? Array.from(value2) : value2
|
|
@@ -30199,16 +31032,22 @@ return true;`);
|
|
|
30199
31032
|
}
|
|
30200
31033
|
return result.data;
|
|
30201
31034
|
}
|
|
30202
|
-
function getLASRecordBatches(
|
|
30203
|
-
const table = toPublicLASResult(result);
|
|
31035
|
+
function getLASRecordBatches(table) {
|
|
30204
31036
|
return table.batches.length ? table.batches : [makeArrowMetadataBatch(table.schema)];
|
|
30205
31037
|
}
|
|
30206
|
-
|
|
31038
|
+
function parseLASMetadata(bytes, options) {
|
|
31039
|
+
const header = parseLASHeader(bytes);
|
|
31040
|
+
const empty = makeEmptyLASBatch(header, options);
|
|
31041
|
+
return toPublicLASResult(
|
|
31042
|
+
convertLASMesh(empty, { ...options, las: { ...options.las, shape: "arrow" } })
|
|
31043
|
+
);
|
|
31044
|
+
}
|
|
31045
|
+
var LASColumnLoader, _serializeLASWorkerResult, _serializeLASWorkerBatch, LASColumnLoaderForCaller, LASLoaderWithParser;
|
|
30207
31046
|
var init_las_loader = __esm({
|
|
30208
31047
|
"../pointclouds/src/las/las-loader.ts"() {
|
|
30209
31048
|
"use strict";
|
|
30210
31049
|
init_loader_utils();
|
|
30211
|
-
|
|
31050
|
+
init_las_source();
|
|
30212
31051
|
init_schema_utils();
|
|
30213
31052
|
init_las_loader_shared();
|
|
30214
31053
|
init_arrow_worker_transport();
|
|
@@ -30219,8 +31058,8 @@ return true;`);
|
|
|
30219
31058
|
batchType: null,
|
|
30220
31059
|
worker: true,
|
|
30221
31060
|
workerInBatches: true,
|
|
30222
|
-
serializeWorkerResult:
|
|
30223
|
-
serializeWorkerBatch:
|
|
31061
|
+
serializeWorkerResult: serializeLASWorkerTable,
|
|
31062
|
+
serializeWorkerBatch: serializeLASWorkerTable,
|
|
30224
31063
|
deserializeWorkerResult: deserializeLASWorkerTable,
|
|
30225
31064
|
deserializeWorkerBatch: deserializeLASWorkerTable,
|
|
30226
31065
|
parse: async (arrayBuffer, options) => convertLASMesh(parseLASTable(arrayBuffer, options), options),
|
|
@@ -30229,22 +31068,30 @@ return true;`);
|
|
|
30229
31068
|
yield* convertLASMeshBatches(parseLASInBatches(arrayBufferIterator, options), options);
|
|
30230
31069
|
}
|
|
30231
31070
|
};
|
|
31071
|
+
({
|
|
31072
|
+
serializeWorkerResult: _serializeLASWorkerResult,
|
|
31073
|
+
serializeWorkerBatch: _serializeLASWorkerBatch,
|
|
31074
|
+
...LASColumnLoaderForCaller
|
|
31075
|
+
} = LASColumnLoader);
|
|
30232
31076
|
LASLoaderWithParser = {
|
|
30233
|
-
...
|
|
31077
|
+
...LASColumnLoaderForCaller,
|
|
31078
|
+
...LAS_SOURCE_METADATA,
|
|
31079
|
+
/** Creates a sequential query source using the same LAS decoder. */
|
|
31080
|
+
createDataSourceSync: (data, options, coreApi2) => new LASSource(data, options, coreApi2),
|
|
30234
31081
|
dataType: LAS_LOADER_METADATA.dataType,
|
|
30235
31082
|
batchType: LAS_LOADER_METADATA.batchType,
|
|
30236
31083
|
parse: async (input2, options) => toPublicLASResult(await LASColumnLoader.parse(input2, options)),
|
|
30237
31084
|
parseSync: (input2, options) => toPublicLASResult(LASColumnLoader.parseSync(input2, options)),
|
|
30238
31085
|
async *parseInBatches(input2, options) {
|
|
30239
31086
|
for await (const result of LASColumnLoader.parseInBatches(input2, options)) {
|
|
30240
|
-
if ("
|
|
31087
|
+
if (!("attributes" in result)) yield* getLASRecordBatches(toPublicLASResult(result));
|
|
30241
31088
|
else yield result;
|
|
30242
31089
|
}
|
|
30243
31090
|
},
|
|
30244
31091
|
deserializeWorkerResult: (result, options) => toPublicLASResult(deserializeLASWorkerTable(result, options)),
|
|
30245
31092
|
deserializeWorkerBatch(result, options) {
|
|
30246
31093
|
const decoded = deserializeLASWorkerTable(result, options);
|
|
30247
|
-
return "
|
|
31094
|
+
return "attributes" in decoded ? decoded : getLASRecordBatches(toPublicLASResult(decoded))[0];
|
|
30248
31095
|
}
|
|
30249
31096
|
};
|
|
30250
31097
|
}
|
|
@@ -30256,6 +31103,7 @@ return true;`);
|
|
|
30256
31103
|
LASColumnLoader: () => LASColumnLoader,
|
|
30257
31104
|
LASLoaderWithParser: () => LASLoaderWithParser,
|
|
30258
31105
|
getLASRecordBatches: () => getLASRecordBatches,
|
|
31106
|
+
parseLASMetadata: () => parseLASMetadata,
|
|
30259
31107
|
toPublicLASResult: () => toPublicLASResult
|
|
30260
31108
|
});
|
|
30261
31109
|
var init_las_loader2 = __esm({
|
|
@@ -30279,7 +31127,12 @@ return true;`);
|
|
|
30279
31127
|
...LAS_LOADER_METADATA,
|
|
30280
31128
|
worker: true,
|
|
30281
31129
|
workerInBatches: true,
|
|
30282
|
-
preload
|
|
31130
|
+
preload,
|
|
31131
|
+
...LAS_SOURCE_METADATA,
|
|
31132
|
+
/** Creates a source after the parser implementation has been preloaded. */
|
|
31133
|
+
createDataSourceSync(_data, _options, _coreApi) {
|
|
31134
|
+
throw new Error("Call preload(LASLoader) before creating a source synchronously.");
|
|
31135
|
+
}
|
|
30283
31136
|
};
|
|
30284
31137
|
}
|
|
30285
31138
|
});
|
|
@@ -30623,9 +31476,9 @@ return true;`);
|
|
|
30623
31476
|
}
|
|
30624
31477
|
};
|
|
30625
31478
|
const formattedMesh = formatPotreeMeshColors(mesh, resolvedOptions.colorFormat);
|
|
30626
|
-
const table =
|
|
31479
|
+
const table = convertMeshToArrowTable(formattedMesh);
|
|
30627
31480
|
if (options?.potree?.shape === "arrow") {
|
|
30628
|
-
return table
|
|
31481
|
+
return table;
|
|
30629
31482
|
}
|
|
30630
31483
|
return {
|
|
30631
31484
|
...convertTableToMesh(table),
|
|
@@ -41352,9 +42205,12 @@ return true;`);
|
|
|
41352
42205
|
);
|
|
41353
42206
|
this.signal.throwIfAborted();
|
|
41354
42207
|
const header = this.createHeader(node2);
|
|
41355
|
-
mesh.header.boundingBox = header.boundingVolume.cartographicBounds;
|
|
41356
42208
|
return {
|
|
41357
|
-
data:
|
|
42209
|
+
data: makeMeshArrowTable(mesh.attributes, {
|
|
42210
|
+
schema: mesh.schema,
|
|
42211
|
+
topology: mesh.topology,
|
|
42212
|
+
boundingBox: header.boundingVolume.cartographicBounds
|
|
42213
|
+
}),
|
|
41358
42214
|
pointCount: node2.pointCount,
|
|
41359
42215
|
coordinateSystem: "cartesian",
|
|
41360
42216
|
cartographicOrigin: [0, 0, 0],
|
|
@@ -42435,18 +43291,7 @@ return true;`);
|
|
|
42435
43291
|
if (mesh.attributes.normals) {
|
|
42436
43292
|
attributes.NORMAL = mesh.attributes.normals;
|
|
42437
43293
|
}
|
|
42438
|
-
return
|
|
42439
|
-
topology: "point-list",
|
|
42440
|
-
mode: 0,
|
|
42441
|
-
header: {
|
|
42442
|
-
vertexCount: mesh.header?.vertexCount || mesh.attributes.positions.value.length / mesh.attributes.positions.size
|
|
42443
|
-
},
|
|
42444
|
-
schema: {
|
|
42445
|
-
fields: [],
|
|
42446
|
-
metadata: {}
|
|
42447
|
-
},
|
|
42448
|
-
attributes
|
|
42449
|
-
});
|
|
43294
|
+
return makeMeshArrowTable(attributes, { topology: "point-list" });
|
|
42450
43295
|
}
|
|
42451
43296
|
/**
|
|
42452
43297
|
* Detect whether a color buffer contains usable RGB information.
|
|
@@ -63007,6 +63852,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
63007
63852
|
_selectSource: () => import_core11._selectSource,
|
|
63008
63853
|
_unregisterLoaders: () => import_core11._unregisterLoaders,
|
|
63009
63854
|
assert: () => import_core11.assert,
|
|
63855
|
+
compareLoaderOptions: () => import_core11.compareLoaderOptions,
|
|
63010
63856
|
concatenateArrayBuffersAsync: () => import_core11.concatenateArrayBuffersAsync,
|
|
63011
63857
|
coreApi: () => import_core11.coreApi,
|
|
63012
63858
|
createDataSource: () => import_core11.createDataSource,
|
|
@@ -63103,7 +63949,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
63103
63949
|
];
|
|
63104
63950
|
function getMesh(input2) {
|
|
63105
63951
|
if (!("attributes" in input2)) {
|
|
63106
|
-
const table =
|
|
63952
|
+
const table = input2;
|
|
63107
63953
|
const checkNulls = (data) => {
|
|
63108
63954
|
if (data.nullCount) throw new Error("Potree writer cannot preserve null point attributes");
|
|
63109
63955
|
for (const child2 of data.children) checkNulls(child2);
|