@loaders.gl/parquet 5.0.0-alpha.4 → 5.0.0-alpha.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/dist/delta-source-loader-types.js +1 -1
- package/dist/delta-source.js +1 -1
- package/dist/geoparquet-loader.js +1 -1
- package/dist/index.cjs +817 -794
- package/dist/index.cjs.map +3 -3
- package/dist/lib/constants.js +1 -1
- package/dist/lib/encoders/encode-table-to-parquet-js.d.ts +1 -1
- package/dist/lib/encoders/encode-table-to-parquet-js.d.ts.map +1 -1
- package/dist/lib/encoders/encode-table-to-parquet-js.js +1 -1
- package/dist/lib/encoders/encode-table-to-parquet-js.js.map +1 -1
- package/dist/lib/geo/geoparquet-covering.js +1 -1
- package/dist/lib/geo/geoparquet-covering.js.map +1 -1
- package/dist/lib/geo/geospatial-metadata.d.ts +1 -1
- package/dist/lib/geo/geospatial-metadata.d.ts.map +1 -1
- package/dist/lib/geo/geospatial-metadata.js +53 -5
- package/dist/lib/geo/geospatial-metadata.js.map +1 -1
- package/dist/lib/parsers/get-parquet-schema.js +1 -1
- package/dist/lib/parsers/get-parquet-schema.js.map +1 -1
- package/dist/parquet-dataset-source.cjs +296 -107
- package/dist/parquet-dataset-source.cjs.map +3 -3
- package/dist/parquet-js-loader-types.js +1 -1
- package/dist/parquet-js-writer.js +1 -1
- package/dist/parquet-loader-base.js +1 -1
- package/dist/parquet-source-loader-types.js +1 -1
- package/dist/parquet-source-loader.cjs +296 -107
- package/dist/parquet-source-loader.cjs.map +3 -3
- package/dist/parquet-source-worker-url.js +1 -1
- package/dist/parquet-source-worker-url.js.map +1 -1
- package/dist/parquet-source-worker.js +56 -4
- package/dist/parquet-source-worker.js.map +3 -3
- package/dist/parquet-worker-node.cjs +39501 -30799
- package/dist/parquet-worker-node.cjs.map +4 -4
- package/dist/parquet-worker.js +115 -59
- package/dist/parquet-worker.js.map +4 -4
- package/package.json +12 -12
- package/src/lib/encoders/encode-table-to-parquet-js.ts +7 -3
- package/src/lib/geo/geoparquet-covering.ts +1 -1
- package/src/lib/geo/geospatial-metadata.ts +70 -7
- package/src/lib/parsers/get-parquet-schema.ts +1 -1
- package/src/parquet-source-worker-url.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -73,7 +73,7 @@ var init_parquet_loader_base = __esm({
|
|
|
73
73
|
"use strict";
|
|
74
74
|
init_parquet_format();
|
|
75
75
|
init_parquet_loader_options();
|
|
76
|
-
VERSION = true ? "5.0.0-alpha.
|
|
76
|
+
VERSION = true ? "5.0.0-alpha.6" : "latest";
|
|
77
77
|
PARQUET_LOADER_BASE = {
|
|
78
78
|
...ParquetFormat,
|
|
79
79
|
dataType: null,
|
|
@@ -497,6 +497,10 @@ var init_worker_thread = __esm({
|
|
|
497
497
|
name;
|
|
498
498
|
source;
|
|
499
499
|
url;
|
|
500
|
+
/** Lazily resolves the classic worker URL used as a fallback. */
|
|
501
|
+
getUrl;
|
|
502
|
+
/** Creates a browser Worker directly. */
|
|
503
|
+
loadWorker;
|
|
500
504
|
terminated = false;
|
|
501
505
|
worker;
|
|
502
506
|
onMessage;
|
|
@@ -507,11 +511,13 @@ var init_worker_thread = __esm({
|
|
|
507
511
|
return typeof Worker !== "undefined" && isBrowser2 || typeof NodeWorker !== "undefined" && !isBrowser2;
|
|
508
512
|
}
|
|
509
513
|
constructor(props) {
|
|
510
|
-
const { name, source, url } = props;
|
|
511
|
-
assert(source || url);
|
|
514
|
+
const { name, source, url, getUrl, loadWorker } = props;
|
|
515
|
+
assert(source || url || getUrl || loadWorker);
|
|
512
516
|
this.name = name;
|
|
513
517
|
this.source = source;
|
|
514
518
|
this.url = url;
|
|
519
|
+
this.getUrl = getUrl;
|
|
520
|
+
this.loadWorker = loadWorker;
|
|
515
521
|
this.onMessage = NOOP;
|
|
516
522
|
this.onError = (error) => console.log(error);
|
|
517
523
|
this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
|
|
@@ -557,7 +563,7 @@ var init_worker_thread = __esm({
|
|
|
557
563
|
*/
|
|
558
564
|
_getErrorFromErrorEvent(event) {
|
|
559
565
|
let message = "Failed to load ";
|
|
560
|
-
message += `worker ${this.name} from ${this.url}. `;
|
|
566
|
+
message += `worker ${this.name} from ${this.url || "built-in worker factory"}. `;
|
|
561
567
|
if (event.message) {
|
|
562
568
|
message += `${event.message} in `;
|
|
563
569
|
}
|
|
@@ -570,8 +576,26 @@ var init_worker_thread = __esm({
|
|
|
570
576
|
* Creates a worker thread on the browser
|
|
571
577
|
*/
|
|
572
578
|
_createBrowserWorker() {
|
|
573
|
-
|
|
579
|
+
var _a;
|
|
580
|
+
if (this.loadWorker) {
|
|
581
|
+
try {
|
|
582
|
+
const worker2 = this.loadWorker();
|
|
583
|
+
if (worker2) {
|
|
584
|
+
return this._initializeBrowserWorker(worker2);
|
|
585
|
+
}
|
|
586
|
+
} catch (error) {
|
|
587
|
+
if (!this.source && !this.url && !this.getUrl) {
|
|
588
|
+
throw error;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const url = this.url || ((_a = this.getUrl) == null ? void 0 : _a.call(this));
|
|
593
|
+
this._loadableURL = getLoadableWorkerURL({ source: this.source, url });
|
|
574
594
|
const worker = new Worker(this._loadableURL, { name: this.name });
|
|
595
|
+
return this._initializeBrowserWorker(worker);
|
|
596
|
+
}
|
|
597
|
+
/** Attaches protocol handlers to a browser worker. */
|
|
598
|
+
_initializeBrowserWorker(worker) {
|
|
575
599
|
worker.onmessage = (event) => {
|
|
576
600
|
if (!event.data) {
|
|
577
601
|
this.onError(new Error("No data received"));
|
|
@@ -630,6 +654,10 @@ var init_worker_pool = __esm({
|
|
|
630
654
|
source;
|
|
631
655
|
// | Function;
|
|
632
656
|
url;
|
|
657
|
+
/** Lazily resolves a classic worker fallback URL. */
|
|
658
|
+
getUrl;
|
|
659
|
+
/** Creates a browser Worker directly. */
|
|
660
|
+
loadWorker;
|
|
633
661
|
maxConcurrency = 1;
|
|
634
662
|
maxMobileConcurrency = 1;
|
|
635
663
|
onDebug = () => {
|
|
@@ -651,6 +679,8 @@ var init_worker_pool = __esm({
|
|
|
651
679
|
constructor(props) {
|
|
652
680
|
this.source = props.source;
|
|
653
681
|
this.url = props.url;
|
|
682
|
+
this.getUrl = props.getUrl;
|
|
683
|
+
this.loadWorker = props.loadWorker;
|
|
654
684
|
this.setProps(props);
|
|
655
685
|
}
|
|
656
686
|
/**
|
|
@@ -760,7 +790,13 @@ var init_worker_pool = __esm({
|
|
|
760
790
|
if (this.count < this._getMaxConcurrency()) {
|
|
761
791
|
this.count++;
|
|
762
792
|
const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
|
|
763
|
-
return new WorkerThread({
|
|
793
|
+
return new WorkerThread({
|
|
794
|
+
name,
|
|
795
|
+
source: this.source,
|
|
796
|
+
url: this.url,
|
|
797
|
+
getUrl: this.getUrl,
|
|
798
|
+
loadWorker: this.loadWorker
|
|
799
|
+
});
|
|
764
800
|
}
|
|
765
801
|
return null;
|
|
766
802
|
}
|
|
@@ -772,7 +808,22 @@ var init_worker_pool = __esm({
|
|
|
772
808
|
});
|
|
773
809
|
|
|
774
810
|
// ../worker-utils/src/lib/worker-farm/worker-farm.ts
|
|
775
|
-
|
|
811
|
+
function getWorkerPoolKey(options) {
|
|
812
|
+
const { name, source, url, urlKey, loadWorker } = options;
|
|
813
|
+
const sourceKey = source ? `source:${source}` : "";
|
|
814
|
+
const urlKeyPart = url || urlKey ? `url:${url || urlKey}` : "";
|
|
815
|
+
const loadWorkerKey = loadWorker ? `loadWorker:${getLoadWorkerId(loadWorker)}` : "";
|
|
816
|
+
return [name, sourceKey, urlKeyPart, loadWorkerKey].filter(Boolean).join("|");
|
|
817
|
+
}
|
|
818
|
+
function getLoadWorkerId(loadWorker) {
|
|
819
|
+
let loadWorkerId = loadWorkerIds.get(loadWorker);
|
|
820
|
+
if (!loadWorkerId) {
|
|
821
|
+
loadWorkerId = nextLoadWorkerId++;
|
|
822
|
+
loadWorkerIds.set(loadWorker, loadWorkerId);
|
|
823
|
+
}
|
|
824
|
+
return loadWorkerId;
|
|
825
|
+
}
|
|
826
|
+
var DEFAULT_PROPS, loadWorkerIds, nextLoadWorkerId, WorkerFarm;
|
|
776
827
|
var init_worker_farm = __esm({
|
|
777
828
|
"../worker-utils/src/lib/worker-farm/worker-farm.ts"() {
|
|
778
829
|
"use strict";
|
|
@@ -785,6 +836,8 @@ var init_worker_farm = __esm({
|
|
|
785
836
|
onDebug: () => {
|
|
786
837
|
}
|
|
787
838
|
};
|
|
839
|
+
loadWorkerIds = /* @__PURE__ */ new WeakMap();
|
|
840
|
+
nextLoadWorkerId = 1;
|
|
788
841
|
WorkerFarm = class _WorkerFarm {
|
|
789
842
|
props;
|
|
790
843
|
workerPools = /* @__PURE__ */ new Map();
|
|
@@ -828,24 +881,28 @@ var init_worker_farm = __esm({
|
|
|
828
881
|
}
|
|
829
882
|
/**
|
|
830
883
|
* Returns a worker pool for the specified worker
|
|
831
|
-
* @param options
|
|
832
|
-
* @param options.name
|
|
833
|
-
* @param options.url
|
|
834
|
-
* @param options.source
|
|
884
|
+
* @param options Worker target used to identify and initialize the pool.
|
|
885
|
+
* @param options.name Worker name used as the base pool identity.
|
|
886
|
+
* @param options.url Worker script URL.
|
|
887
|
+
* @param options.source Inline worker source.
|
|
888
|
+
* @param options.loadWorker Built-in browser worker factory.
|
|
835
889
|
* @example
|
|
836
890
|
* const job = WorkerFarm.getWorkerFarm().getWorkerPool({name, url}).startJob(...);
|
|
837
891
|
*/
|
|
838
892
|
getWorkerPool(options) {
|
|
839
|
-
const { name, source, url } = options;
|
|
840
|
-
|
|
893
|
+
const { name, source, url, getUrl, loadWorker } = options;
|
|
894
|
+
const workerPoolKey = getWorkerPoolKey(options);
|
|
895
|
+
let workerPool = this.workerPools.get(workerPoolKey);
|
|
841
896
|
if (!workerPool) {
|
|
842
897
|
workerPool = new WorkerPool({
|
|
843
898
|
name,
|
|
844
899
|
source,
|
|
845
|
-
url
|
|
900
|
+
url,
|
|
901
|
+
getUrl,
|
|
902
|
+
loadWorker
|
|
846
903
|
});
|
|
847
904
|
workerPool.setProps(this._getWorkerPoolProps());
|
|
848
|
-
this.workerPools.set(
|
|
905
|
+
this.workerPools.set(workerPoolKey, workerPool);
|
|
849
906
|
}
|
|
850
907
|
return workerPool;
|
|
851
908
|
}
|
|
@@ -866,35 +923,42 @@ function getWorkerName(worker) {
|
|
|
866
923
|
const warning = worker.version !== VERSION3 ? ` (worker-utils@${VERSION3})` : "";
|
|
867
924
|
return `${worker.name}@${worker.version}${warning}`;
|
|
868
925
|
}
|
|
869
|
-
function
|
|
926
|
+
function getCustomWorkerURL(worker, options = {}) {
|
|
870
927
|
var _a;
|
|
871
928
|
const workerOptions = options[worker.id] || {};
|
|
872
|
-
const workerFile = isBrowser2 ? `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
929
|
+
const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
873
930
|
let url = workerOptions.workerUrl;
|
|
874
|
-
if (!url && typeof worker.worker === "string") {
|
|
875
|
-
url = worker.worker;
|
|
876
|
-
}
|
|
877
931
|
if (!url && worker.id === "compression") {
|
|
878
932
|
url = options.workerUrl;
|
|
879
933
|
}
|
|
880
934
|
const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
|
|
881
|
-
if (workerType === "test") {
|
|
935
|
+
if (!url && workerType === "test") {
|
|
882
936
|
if (isBrowser2) {
|
|
883
937
|
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
884
938
|
} else {
|
|
885
939
|
url = `modules/${worker.module}/src/workers/${worker.id}-worker-node.ts`;
|
|
886
940
|
}
|
|
887
941
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
942
|
+
return url || null;
|
|
943
|
+
}
|
|
944
|
+
function getWorkerURL(worker, options = {}) {
|
|
945
|
+
const customWorkerUrl = getCustomWorkerURL(worker, options);
|
|
946
|
+
const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
|
|
947
|
+
const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
|
|
948
|
+
assert(url);
|
|
949
|
+
return url;
|
|
950
|
+
}
|
|
951
|
+
function getDefaultWorkerURL(worker, warn = false) {
|
|
952
|
+
const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
953
|
+
let version2 = worker.version;
|
|
954
|
+
if (version2 === "latest") {
|
|
955
|
+
version2 = NPM_TAG;
|
|
956
|
+
}
|
|
957
|
+
const versionTag = version2 ? `@${version2}` : "";
|
|
958
|
+
const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
|
|
959
|
+
if (warn) {
|
|
895
960
|
warnIfUsingNpmTagFallback(worker, url);
|
|
896
961
|
}
|
|
897
|
-
assert(url);
|
|
898
962
|
return url;
|
|
899
963
|
}
|
|
900
964
|
function warnIfUsingNpmTagFallback(worker, url) {
|
|
@@ -928,19 +992,16 @@ function canProcessOnWorker(worker, options) {
|
|
|
928
992
|
return false;
|
|
929
993
|
}
|
|
930
994
|
const workerOptions = options == null ? void 0 : options[worker.id];
|
|
931
|
-
return Boolean(
|
|
995
|
+
return Boolean(
|
|
996
|
+
(worker.worker || worker.loadWorker || (workerOptions == null ? void 0 : workerOptions.workerUrl)) && (options == null ? void 0 : options.worker)
|
|
997
|
+
);
|
|
932
998
|
}
|
|
933
999
|
async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
|
|
934
1000
|
var _a, _b, _c;
|
|
935
1001
|
throwIfAborted(options.signal);
|
|
936
1002
|
const name = getWorkerName(worker);
|
|
937
1003
|
const workerFarm = WorkerFarm.getWorkerFarm(options);
|
|
938
|
-
const
|
|
939
|
-
const workerPoolProps = { name, source };
|
|
940
|
-
if (!source) {
|
|
941
|
-
workerPoolProps.url = getWorkerURL(worker, options);
|
|
942
|
-
}
|
|
943
|
-
const workerPool = workerFarm.getWorkerPool(workerPoolProps);
|
|
1004
|
+
const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
|
|
944
1005
|
const jobName = options.jobName || worker.name;
|
|
945
1006
|
const job = await workerPool.startJob(
|
|
946
1007
|
jobName,
|
|
@@ -983,6 +1044,24 @@ function createAbortError2(message) {
|
|
|
983
1044
|
error.name = "AbortError";
|
|
984
1045
|
return error;
|
|
985
1046
|
}
|
|
1047
|
+
function getWorkerPoolTarget(worker, options, name) {
|
|
1048
|
+
if (options.source) {
|
|
1049
|
+
return { name, source: options.source };
|
|
1050
|
+
}
|
|
1051
|
+
const customWorkerUrl = getCustomWorkerURL(worker, options);
|
|
1052
|
+
if (customWorkerUrl) {
|
|
1053
|
+
return { name, url: customWorkerUrl };
|
|
1054
|
+
}
|
|
1055
|
+
if (isBrowser2 && worker.loadWorker) {
|
|
1056
|
+
return {
|
|
1057
|
+
name,
|
|
1058
|
+
loadWorker: worker.loadWorker,
|
|
1059
|
+
getUrl: () => getWorkerURL(worker, options),
|
|
1060
|
+
urlKey: getDefaultWorkerURL(worker)
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
return { name, url: getWorkerURL(worker, options) };
|
|
1064
|
+
}
|
|
986
1065
|
async function onMessage(context, job, type, payload) {
|
|
987
1066
|
switch (type) {
|
|
988
1067
|
case "done":
|
|
@@ -1015,6 +1094,7 @@ var init_process_on_worker = __esm({
|
|
|
1015
1094
|
init_worker_farm();
|
|
1016
1095
|
init_get_worker_url();
|
|
1017
1096
|
init_get_transfer_list();
|
|
1097
|
+
init_globals2();
|
|
1018
1098
|
}
|
|
1019
1099
|
});
|
|
1020
1100
|
|
|
@@ -1048,7 +1128,7 @@ async function parseWithWorker(loader, data, options, context, parseOnMainThread
|
|
|
1048
1128
|
const result = await processOnWorker(
|
|
1049
1129
|
loader,
|
|
1050
1130
|
data,
|
|
1051
|
-
{ ...getWorkerOptions(options), signal: workerSignal },
|
|
1131
|
+
{ ...getWorkerOptions(options, loader), signal: workerSignal },
|
|
1052
1132
|
{
|
|
1053
1133
|
process: async (input, processOptions, _workerContext, parseContext) => {
|
|
1054
1134
|
if (!parseOnMainThread) {
|
|
@@ -1081,12 +1161,19 @@ function callParseOnMainThread(parseOnMainThread, input, options, context) {
|
|
|
1081
1161
|
}
|
|
1082
1162
|
return parseOnMainThread(input, void 0, options, context);
|
|
1083
1163
|
}
|
|
1084
|
-
function getWorkerOptions(options = {}) {
|
|
1164
|
+
function getWorkerOptions(options = {}, loader) {
|
|
1085
1165
|
const serializedOptions = JSON.parse(JSON.stringify(options));
|
|
1086
|
-
|
|
1166
|
+
const workerOptions = {
|
|
1087
1167
|
...serializedOptions.core,
|
|
1088
1168
|
...serializedOptions
|
|
1089
1169
|
};
|
|
1170
|
+
if (workerOptions.worker === "auto") {
|
|
1171
|
+
workerOptions.worker = true;
|
|
1172
|
+
}
|
|
1173
|
+
if (loader) {
|
|
1174
|
+
workerOptions._workerLoaderId = loader.id;
|
|
1175
|
+
}
|
|
1176
|
+
return workerOptions;
|
|
1090
1177
|
}
|
|
1091
1178
|
function getSerializableLoaderContext(context) {
|
|
1092
1179
|
if (!context) {
|
|
@@ -3089,6 +3176,12 @@ function serializeArrowType(arrowType) {
|
|
|
3089
3176
|
type: "list",
|
|
3090
3177
|
children: [serializeArrowField(listField)]
|
|
3091
3178
|
};
|
|
3179
|
+
case arrow.LargeList:
|
|
3180
|
+
const largeListType = arrowType;
|
|
3181
|
+
return {
|
|
3182
|
+
type: "large-list",
|
|
3183
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
3184
|
+
};
|
|
3092
3185
|
case arrow.FixedSizeList:
|
|
3093
3186
|
const fixedSizeList = arrowType;
|
|
3094
3187
|
return {
|
|
@@ -3102,6 +3195,15 @@ function serializeArrowType(arrowType) {
|
|
|
3102
3195
|
type: "struct",
|
|
3103
3196
|
children: structType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
3104
3197
|
};
|
|
3198
|
+
case arrow.SparseUnion:
|
|
3199
|
+
case arrow.DenseUnion:
|
|
3200
|
+
const unionType = arrowType;
|
|
3201
|
+
return {
|
|
3202
|
+
type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
|
|
3203
|
+
typeIds: unionType.typeIds,
|
|
3204
|
+
children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
|
|
3205
|
+
typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
|
|
3206
|
+
};
|
|
3105
3207
|
case arrow.Dictionary:
|
|
3106
3208
|
const dictionaryType = arrowType;
|
|
3107
3209
|
return {
|
|
@@ -3130,6 +3232,10 @@ function deserializeArrowType(dataType, options) {
|
|
|
3130
3232
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
3131
3233
|
return new arrow.List(field);
|
|
3132
3234
|
}
|
|
3235
|
+
case "large-list": {
|
|
3236
|
+
const field = deserializeArrowField(dataType.children[0], options);
|
|
3237
|
+
return new arrow.LargeList(field);
|
|
3238
|
+
}
|
|
3133
3239
|
case "fixed-size-list": {
|
|
3134
3240
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
3135
3241
|
return new arrow.FixedSizeList(dataType.listSize, child);
|
|
@@ -3142,6 +3248,13 @@ function deserializeArrowType(dataType, options) {
|
|
|
3142
3248
|
);
|
|
3143
3249
|
return new arrow.Struct(children);
|
|
3144
3250
|
}
|
|
3251
|
+
case "sparse-union":
|
|
3252
|
+
case "dense-union": {
|
|
3253
|
+
const children = dataType.children.map(
|
|
3254
|
+
(arrowField) => deserializeArrowField(arrowField, options)
|
|
3255
|
+
);
|
|
3256
|
+
return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
|
|
3257
|
+
}
|
|
3145
3258
|
case "dictionary": {
|
|
3146
3259
|
return new arrow.Dictionary(
|
|
3147
3260
|
deserializeArrowType(dataType.dictionary, options),
|
|
@@ -3845,625 +3958,7 @@ var init_deprecated = __esm({
|
|
|
3845
3958
|
}
|
|
3846
3959
|
});
|
|
3847
3960
|
|
|
3848
|
-
// ../schema
|
|
3849
|
-
var init_src3 = __esm({
|
|
3850
|
-
"../schema-utils/src/index.ts"() {
|
|
3851
|
-
"use strict";
|
|
3852
|
-
init_convert_arrow_schema();
|
|
3853
|
-
init_deduce_table_schema();
|
|
3854
|
-
init_deprecated();
|
|
3855
|
-
init_table_accessors();
|
|
3856
|
-
}
|
|
3857
|
-
});
|
|
3858
|
-
|
|
3859
|
-
// src/lib/parsers/convert-parquet-tables.ts
|
|
3860
|
-
function convertArrowTableToObjectRows(arrowTable) {
|
|
3861
|
-
return convertArrowToTable2(arrowTable.data, "object-row-table");
|
|
3862
|
-
}
|
|
3863
|
-
function convertArrowBatchToObjectRows(batch) {
|
|
3864
|
-
const objectRowTable = convertArrowToTable2(batch.data, "object-row-table");
|
|
3865
|
-
return {
|
|
3866
|
-
batchType: batch.batchType,
|
|
3867
|
-
shape: objectRowTable.shape,
|
|
3868
|
-
schema: objectRowTable.schema,
|
|
3869
|
-
data: objectRowTable.data,
|
|
3870
|
-
length: batch.length
|
|
3871
|
-
};
|
|
3872
|
-
}
|
|
3873
|
-
var init_convert_parquet_tables = __esm({
|
|
3874
|
-
"src/lib/parsers/convert-parquet-tables.ts"() {
|
|
3875
|
-
"use strict";
|
|
3876
|
-
init_src3();
|
|
3877
|
-
}
|
|
3878
|
-
});
|
|
3879
|
-
|
|
3880
|
-
// ../gis/src/lib/geometry-converters/wkb/helpers/wkb-types.ts
|
|
3881
|
-
var EWKB_FLAG_Z, EWKB_FLAG_M, EWKB_FLAG_SRID, WKT_MAGIC_STRINGS, textEncoder, WKT_MAGIC_BYTES;
|
|
3882
|
-
var init_wkb_types = __esm({
|
|
3883
|
-
"../gis/src/lib/geometry-converters/wkb/helpers/wkb-types.ts"() {
|
|
3884
|
-
"use strict";
|
|
3885
|
-
EWKB_FLAG_Z = 2147483648;
|
|
3886
|
-
EWKB_FLAG_M = 1073741824;
|
|
3887
|
-
EWKB_FLAG_SRID = 536870912;
|
|
3888
|
-
WKT_MAGIC_STRINGS = [
|
|
3889
|
-
"POINT(",
|
|
3890
|
-
"LINESTRING(",
|
|
3891
|
-
"POLYGON(",
|
|
3892
|
-
"MULTIPOINT(",
|
|
3893
|
-
"MULTILINESTRING(",
|
|
3894
|
-
"MULTIPOLYGON(",
|
|
3895
|
-
"GEOMETRYCOLLECTION("
|
|
3896
|
-
];
|
|
3897
|
-
textEncoder = new TextEncoder();
|
|
3898
|
-
WKT_MAGIC_BYTES = WKT_MAGIC_STRINGS.map((string) => textEncoder.encode(string));
|
|
3899
|
-
}
|
|
3900
|
-
});
|
|
3901
|
-
|
|
3902
|
-
// ../gis/src/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts
|
|
3903
|
-
function isWKT(input) {
|
|
3904
|
-
return getWKTGeometryType(input) !== null;
|
|
3905
|
-
}
|
|
3906
|
-
function getWKTGeometryType(input) {
|
|
3907
|
-
if (typeof input === "string") {
|
|
3908
|
-
const index2 = WKT_MAGIC_STRINGS.findIndex((magicString) => input.startsWith(magicString));
|
|
3909
|
-
return index2 >= 0 ? index2 + 1 : null;
|
|
3910
|
-
}
|
|
3911
|
-
const inputArray = new Uint8Array(input);
|
|
3912
|
-
const index = WKT_MAGIC_BYTES.findIndex(
|
|
3913
|
-
(magicBytes) => magicBytes.every((value, index2) => value === inputArray[index2])
|
|
3914
|
-
);
|
|
3915
|
-
return index >= 0 ? index + 1 : null;
|
|
3916
|
-
}
|
|
3917
|
-
function parseWKBHeader(dataView, target) {
|
|
3918
|
-
const wkbHeader = Object.assign(target || {}, {
|
|
3919
|
-
type: "wkb",
|
|
3920
|
-
variant: "wkb",
|
|
3921
|
-
geometryType: 1,
|
|
3922
|
-
dimensions: 2,
|
|
3923
|
-
coordinates: "xy",
|
|
3924
|
-
littleEndian: true
|
|
3925
|
-
});
|
|
3926
|
-
wkbHeader.byteOffset = (target == null ? void 0 : target.byteOffset) ?? 0;
|
|
3927
|
-
if (isWKT(dataView.buffer)) {
|
|
3928
|
-
throw new Error("WKB: Cannot parse WKT data");
|
|
3929
|
-
}
|
|
3930
|
-
wkbHeader.littleEndian = dataView.getUint8(wkbHeader.byteOffset) === 1;
|
|
3931
|
-
wkbHeader.byteOffset++;
|
|
3932
|
-
const geometryCode = dataView.getUint32(wkbHeader.byteOffset, wkbHeader.littleEndian);
|
|
3933
|
-
wkbHeader.byteOffset += 4;
|
|
3934
|
-
wkbHeader.geometryType = geometryCode & 7;
|
|
3935
|
-
const ewkbZ = geometryCode & EWKB_FLAG_Z;
|
|
3936
|
-
const ewkbM = geometryCode & EWKB_FLAG_M;
|
|
3937
|
-
const ewkbSRID = geometryCode & EWKB_FLAG_SRID;
|
|
3938
|
-
if (!ewkbZ && !ewkbM && !ewkbSRID) {
|
|
3939
|
-
const isoType = (geometryCode - wkbHeader.geometryType) / 1e3;
|
|
3940
|
-
switch (isoType) {
|
|
3941
|
-
case 0:
|
|
3942
|
-
break;
|
|
3943
|
-
case 1:
|
|
3944
|
-
wkbHeader.variant = "iso-wkb";
|
|
3945
|
-
wkbHeader.dimensions = 3;
|
|
3946
|
-
wkbHeader.coordinates = "xyz";
|
|
3947
|
-
break;
|
|
3948
|
-
case 2:
|
|
3949
|
-
wkbHeader.variant = "iso-wkb";
|
|
3950
|
-
wkbHeader.dimensions = 3;
|
|
3951
|
-
wkbHeader.coordinates = "xym";
|
|
3952
|
-
break;
|
|
3953
|
-
case 3:
|
|
3954
|
-
wkbHeader.variant = "iso-wkb";
|
|
3955
|
-
wkbHeader.dimensions = 4;
|
|
3956
|
-
wkbHeader.coordinates = "xyzm";
|
|
3957
|
-
break;
|
|
3958
|
-
default:
|
|
3959
|
-
throw new Error(`WKB: Unsupported iso-wkb type: ${isoType}`);
|
|
3960
|
-
}
|
|
3961
|
-
}
|
|
3962
|
-
if (ewkbZ && ewkbM) {
|
|
3963
|
-
wkbHeader.variant = "ewkb";
|
|
3964
|
-
wkbHeader.dimensions = 4;
|
|
3965
|
-
wkbHeader.coordinates = "xyzm";
|
|
3966
|
-
} else if (ewkbZ) {
|
|
3967
|
-
wkbHeader.variant = "ewkb";
|
|
3968
|
-
wkbHeader.dimensions = 3;
|
|
3969
|
-
wkbHeader.coordinates = "xyz";
|
|
3970
|
-
} else if (ewkbM) {
|
|
3971
|
-
wkbHeader.variant = "ewkb";
|
|
3972
|
-
wkbHeader.dimensions = 3;
|
|
3973
|
-
wkbHeader.coordinates = "xym";
|
|
3974
|
-
}
|
|
3975
|
-
if (ewkbSRID) {
|
|
3976
|
-
wkbHeader.variant = "ewkb";
|
|
3977
|
-
wkbHeader.srid = dataView.getUint32(wkbHeader.byteOffset, wkbHeader.littleEndian);
|
|
3978
|
-
wkbHeader.byteOffset += 4;
|
|
3979
|
-
}
|
|
3980
|
-
return wkbHeader;
|
|
3981
|
-
}
|
|
3982
|
-
var init_parse_wkb_header = __esm({
|
|
3983
|
-
"../gis/src/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts"() {
|
|
3984
|
-
"use strict";
|
|
3985
|
-
init_wkb_types();
|
|
3986
|
-
}
|
|
3987
|
-
});
|
|
3988
|
-
|
|
3989
|
-
// ../gis/src/lib/geometry-converters/wkb/convert-wkb-to-geometry.ts
|
|
3990
|
-
function convertWKBToGeometry(arrayBuffer) {
|
|
3991
|
-
const dataView = new DataView(arrayBuffer);
|
|
3992
|
-
return parseWKBGeometry(dataView, 0).geometry;
|
|
3993
|
-
}
|
|
3994
|
-
function parseWKBGeometry(dataView, byteOffset) {
|
|
3995
|
-
const wkbHeader = parseWKBHeader(dataView, { byteOffset });
|
|
3996
|
-
return parseWKBGeometryBody(dataView, wkbHeader.byteOffset, wkbHeader);
|
|
3997
|
-
}
|
|
3998
|
-
function parseWKBGeometryBody(dataView, byteOffset, wkbHeader) {
|
|
3999
|
-
const { geometryType, dimensions, littleEndian } = wkbHeader;
|
|
4000
|
-
switch (geometryType) {
|
|
4001
|
-
case 1 /* Point */:
|
|
4002
|
-
return parsePointGeometry(dataView, byteOffset, dimensions, littleEndian);
|
|
4003
|
-
case 2 /* LineString */:
|
|
4004
|
-
return parseLineStringGeometry(dataView, byteOffset, dimensions, littleEndian);
|
|
4005
|
-
case 3 /* Polygon */:
|
|
4006
|
-
return parsePolygonGeometry(dataView, byteOffset, dimensions, littleEndian);
|
|
4007
|
-
case 4 /* MultiPoint */:
|
|
4008
|
-
return parseMultiPointGeometry(dataView, byteOffset, littleEndian);
|
|
4009
|
-
case 5 /* MultiLineString */:
|
|
4010
|
-
return parseMultiLineStringGeometry(dataView, byteOffset, littleEndian);
|
|
4011
|
-
case 6 /* MultiPolygon */:
|
|
4012
|
-
return parseMultiPolygonGeometry(dataView, byteOffset, littleEndian);
|
|
4013
|
-
case 7 /* GeometryCollection */:
|
|
4014
|
-
return parseGeometryCollectionGeometry(dataView, byteOffset, littleEndian);
|
|
4015
|
-
default:
|
|
4016
|
-
throw new Error(`WKB: Unsupported geometry type: ${geometryType}`);
|
|
4017
|
-
}
|
|
4018
|
-
}
|
|
4019
|
-
function parsePosition(dataView, byteOffset, dimensions, littleEndian) {
|
|
4020
|
-
const position = [];
|
|
4021
|
-
for (let coordinateIndex = 0; coordinateIndex < dimensions; coordinateIndex++) {
|
|
4022
|
-
position.push(dataView.getFloat64(byteOffset, littleEndian));
|
|
4023
|
-
byteOffset += 8;
|
|
4024
|
-
}
|
|
4025
|
-
return { position, byteOffset };
|
|
4026
|
-
}
|
|
4027
|
-
function parseCoordinateSequence(dataView, byteOffset, dimensions, littleEndian) {
|
|
4028
|
-
const pointCount = dataView.getUint32(byteOffset, littleEndian);
|
|
4029
|
-
byteOffset += 4;
|
|
4030
|
-
const coordinates = [];
|
|
4031
|
-
for (let pointIndex = 0; pointIndex < pointCount; pointIndex++) {
|
|
4032
|
-
const parsedPosition = parsePosition(dataView, byteOffset, dimensions, littleEndian);
|
|
4033
|
-
coordinates.push(parsedPosition.position);
|
|
4034
|
-
byteOffset = parsedPosition.byteOffset;
|
|
4035
|
-
}
|
|
4036
|
-
return { coordinates, byteOffset };
|
|
4037
|
-
}
|
|
4038
|
-
function parsePointGeometry(dataView, byteOffset, dimensions, littleEndian) {
|
|
4039
|
-
const parsedPosition = parsePosition(dataView, byteOffset, dimensions, littleEndian);
|
|
4040
|
-
return {
|
|
4041
|
-
geometry: { type: "Point", coordinates: parsedPosition.position },
|
|
4042
|
-
byteOffset: parsedPosition.byteOffset
|
|
4043
|
-
};
|
|
4044
|
-
}
|
|
4045
|
-
function parseLineStringGeometry(dataView, byteOffset, dimensions, littleEndian) {
|
|
4046
|
-
const parsedCoordinates = parseCoordinateSequence(dataView, byteOffset, dimensions, littleEndian);
|
|
4047
|
-
return {
|
|
4048
|
-
geometry: { type: "LineString", coordinates: parsedCoordinates.coordinates },
|
|
4049
|
-
byteOffset: parsedCoordinates.byteOffset
|
|
4050
|
-
};
|
|
4051
|
-
}
|
|
4052
|
-
function parsePolygonGeometry(dataView, byteOffset, dimensions, littleEndian) {
|
|
4053
|
-
const ringCount = dataView.getUint32(byteOffset, littleEndian);
|
|
4054
|
-
byteOffset += 4;
|
|
4055
|
-
const coordinates = [];
|
|
4056
|
-
for (let ringIndex = 0; ringIndex < ringCount; ringIndex++) {
|
|
4057
|
-
const parsedRing = parseCoordinateSequence(dataView, byteOffset, dimensions, littleEndian);
|
|
4058
|
-
coordinates.push(parsedRing.coordinates);
|
|
4059
|
-
byteOffset = parsedRing.byteOffset;
|
|
4060
|
-
}
|
|
4061
|
-
return {
|
|
4062
|
-
geometry: { type: "Polygon", coordinates },
|
|
4063
|
-
byteOffset
|
|
4064
|
-
};
|
|
4065
|
-
}
|
|
4066
|
-
function parseMultiPointGeometry(dataView, byteOffset, littleEndian) {
|
|
4067
|
-
const geometryCount = dataView.getUint32(byteOffset, littleEndian);
|
|
4068
|
-
byteOffset += 4;
|
|
4069
|
-
const coordinates = [];
|
|
4070
|
-
for (let geometryIndex = 0; geometryIndex < geometryCount; geometryIndex++) {
|
|
4071
|
-
const parsedGeometry = parseWKBGeometry(dataView, byteOffset);
|
|
4072
|
-
if (parsedGeometry.geometry.type !== "Point") {
|
|
4073
|
-
throw new Error("WKB: Inner geometries of MultiPoint not of type Point");
|
|
4074
|
-
}
|
|
4075
|
-
coordinates.push(parsedGeometry.geometry.coordinates);
|
|
4076
|
-
byteOffset = parsedGeometry.byteOffset;
|
|
4077
|
-
}
|
|
4078
|
-
return {
|
|
4079
|
-
geometry: { type: "MultiPoint", coordinates },
|
|
4080
|
-
byteOffset
|
|
4081
|
-
};
|
|
4082
|
-
}
|
|
4083
|
-
function parseMultiLineStringGeometry(dataView, byteOffset, littleEndian) {
|
|
4084
|
-
const geometryCount = dataView.getUint32(byteOffset, littleEndian);
|
|
4085
|
-
byteOffset += 4;
|
|
4086
|
-
const coordinates = [];
|
|
4087
|
-
for (let geometryIndex = 0; geometryIndex < geometryCount; geometryIndex++) {
|
|
4088
|
-
const parsedGeometry = parseWKBGeometry(dataView, byteOffset);
|
|
4089
|
-
if (parsedGeometry.geometry.type !== "LineString") {
|
|
4090
|
-
throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");
|
|
4091
|
-
}
|
|
4092
|
-
coordinates.push(parsedGeometry.geometry.coordinates);
|
|
4093
|
-
byteOffset = parsedGeometry.byteOffset;
|
|
4094
|
-
}
|
|
4095
|
-
return {
|
|
4096
|
-
geometry: { type: "MultiLineString", coordinates },
|
|
4097
|
-
byteOffset
|
|
4098
|
-
};
|
|
4099
|
-
}
|
|
4100
|
-
function parseMultiPolygonGeometry(dataView, byteOffset, littleEndian) {
|
|
4101
|
-
const geometryCount = dataView.getUint32(byteOffset, littleEndian);
|
|
4102
|
-
byteOffset += 4;
|
|
4103
|
-
const coordinates = [];
|
|
4104
|
-
for (let geometryIndex = 0; geometryIndex < geometryCount; geometryIndex++) {
|
|
4105
|
-
const parsedGeometry = parseWKBGeometry(dataView, byteOffset);
|
|
4106
|
-
if (parsedGeometry.geometry.type !== "Polygon") {
|
|
4107
|
-
throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");
|
|
4108
|
-
}
|
|
4109
|
-
coordinates.push(parsedGeometry.geometry.coordinates);
|
|
4110
|
-
byteOffset = parsedGeometry.byteOffset;
|
|
4111
|
-
}
|
|
4112
|
-
return {
|
|
4113
|
-
geometry: { type: "MultiPolygon", coordinates },
|
|
4114
|
-
byteOffset
|
|
4115
|
-
};
|
|
4116
|
-
}
|
|
4117
|
-
function parseGeometryCollectionGeometry(dataView, byteOffset, littleEndian) {
|
|
4118
|
-
const geometryCount = dataView.getUint32(byteOffset, littleEndian);
|
|
4119
|
-
byteOffset += 4;
|
|
4120
|
-
const geometries = [];
|
|
4121
|
-
for (let geometryIndex = 0; geometryIndex < geometryCount; geometryIndex++) {
|
|
4122
|
-
const parsedGeometry = parseWKBGeometry(dataView, byteOffset);
|
|
4123
|
-
geometries.push(parsedGeometry.geometry);
|
|
4124
|
-
byteOffset = parsedGeometry.byteOffset;
|
|
4125
|
-
}
|
|
4126
|
-
return {
|
|
4127
|
-
geometry: { type: "GeometryCollection", geometries },
|
|
4128
|
-
byteOffset
|
|
4129
|
-
};
|
|
4130
|
-
}
|
|
4131
|
-
var init_convert_wkb_to_geometry = __esm({
|
|
4132
|
-
"../gis/src/lib/geometry-converters/wkb/convert-wkb-to-geometry.ts"() {
|
|
4133
|
-
"use strict";
|
|
4134
|
-
init_parse_wkb_header();
|
|
4135
|
-
}
|
|
4136
|
-
});
|
|
4137
|
-
|
|
4138
|
-
// ../gis/src/lib/geometry-converters/wkb/convert-wkt-to-geometry.ts
|
|
4139
|
-
function convertWKTToGeometry(input, options) {
|
|
4140
|
-
var _a;
|
|
4141
|
-
const parts = input.split(";");
|
|
4142
|
-
let _ = parts.pop();
|
|
4143
|
-
const srid = (parts.shift() || "").split("=").pop();
|
|
4144
|
-
const state = { parts, _, i: 0 };
|
|
4145
|
-
const geometry = parseGeometry(state);
|
|
4146
|
-
return ((_a = options == null ? void 0 : options.wkt) == null ? void 0 : _a.crs) ? addCRS(geometry, srid) : geometry;
|
|
4147
|
-
}
|
|
4148
|
-
function parseGeometry(state) {
|
|
4149
|
-
return parsePoint(state) || parseLineString(state) || parsePolygon(state) || parseMultiPoint(state) || parseMultiLineString(state) || parseMultiPolygon(state) || parseGeometryCollection(state);
|
|
4150
|
-
}
|
|
4151
|
-
function addCRS(obj, srid) {
|
|
4152
|
-
if (obj && (srid == null ? void 0 : srid.match(/\d+/))) {
|
|
4153
|
-
const crs = {
|
|
4154
|
-
type: "name",
|
|
4155
|
-
properties: {
|
|
4156
|
-
name: "urn:ogc:def:crs:EPSG::" + srid
|
|
4157
|
-
}
|
|
4158
|
-
};
|
|
4159
|
-
obj.crs = crs;
|
|
4160
|
-
}
|
|
4161
|
-
return obj;
|
|
4162
|
-
}
|
|
4163
|
-
function parsePoint(state) {
|
|
4164
|
-
if (!$(/^(POINT(\sz)?)/i, state)) {
|
|
4165
|
-
return null;
|
|
4166
|
-
}
|
|
4167
|
-
white(state);
|
|
4168
|
-
if (!$(/^(\()/, state)) {
|
|
4169
|
-
return null;
|
|
4170
|
-
}
|
|
4171
|
-
const c = coords(state);
|
|
4172
|
-
if (!c) {
|
|
4173
|
-
return null;
|
|
4174
|
-
}
|
|
4175
|
-
white(state);
|
|
4176
|
-
if (!$(/^(\))/, state)) {
|
|
4177
|
-
return null;
|
|
4178
|
-
}
|
|
4179
|
-
return {
|
|
4180
|
-
type: "Point",
|
|
4181
|
-
coordinates: c[0]
|
|
4182
|
-
};
|
|
4183
|
-
}
|
|
4184
|
-
function parseMultiPoint(state) {
|
|
4185
|
-
var _a, _b;
|
|
4186
|
-
if (!$(/^(MULTIPOINT)/i, state)) {
|
|
4187
|
-
return null;
|
|
4188
|
-
}
|
|
4189
|
-
white(state);
|
|
4190
|
-
const newCoordsFormat = (_b = state._) == null ? void 0 : _b.substring(((_a = state._) == null ? void 0 : _a.indexOf("(")) + 1, state._.length - 1).replace(/\(/g, "").replace(/\)/g, "");
|
|
4191
|
-
state._ = "MULTIPOINT (" + newCoordsFormat + ")";
|
|
4192
|
-
const c = multicoords(state);
|
|
4193
|
-
if (!c) {
|
|
4194
|
-
return null;
|
|
4195
|
-
}
|
|
4196
|
-
white(state);
|
|
4197
|
-
return {
|
|
4198
|
-
type: "MultiPoint",
|
|
4199
|
-
coordinates: c
|
|
4200
|
-
};
|
|
4201
|
-
}
|
|
4202
|
-
function parseLineString(state) {
|
|
4203
|
-
if (!$(/^(LINESTRING(\sz)?)/i, state)) {
|
|
4204
|
-
return null;
|
|
4205
|
-
}
|
|
4206
|
-
white(state);
|
|
4207
|
-
if (!$(/^(\()/, state)) {
|
|
4208
|
-
return null;
|
|
4209
|
-
}
|
|
4210
|
-
const c = coords(state);
|
|
4211
|
-
if (!c) {
|
|
4212
|
-
return null;
|
|
4213
|
-
}
|
|
4214
|
-
if (!$(/^(\))/, state)) {
|
|
4215
|
-
return null;
|
|
4216
|
-
}
|
|
4217
|
-
return {
|
|
4218
|
-
type: "LineString",
|
|
4219
|
-
coordinates: c
|
|
4220
|
-
};
|
|
4221
|
-
}
|
|
4222
|
-
function parseMultiLineString(state) {
|
|
4223
|
-
if (!$(/^(MULTILINESTRING)/i, state)) return null;
|
|
4224
|
-
white(state);
|
|
4225
|
-
const c = multicoords(state);
|
|
4226
|
-
if (!c) {
|
|
4227
|
-
return null;
|
|
4228
|
-
}
|
|
4229
|
-
white(state);
|
|
4230
|
-
return {
|
|
4231
|
-
// @ts-ignore
|
|
4232
|
-
type: "MultiLineString",
|
|
4233
|
-
// @ts-expect-error
|
|
4234
|
-
coordinates: c
|
|
4235
|
-
};
|
|
4236
|
-
}
|
|
4237
|
-
function parsePolygon(state) {
|
|
4238
|
-
if (!$(/^(POLYGON(\sz)?)/i, state)) {
|
|
4239
|
-
return null;
|
|
4240
|
-
}
|
|
4241
|
-
white(state);
|
|
4242
|
-
const c = multicoords(state);
|
|
4243
|
-
if (!c) {
|
|
4244
|
-
return null;
|
|
4245
|
-
}
|
|
4246
|
-
return {
|
|
4247
|
-
// @ts-ignore
|
|
4248
|
-
type: "Polygon",
|
|
4249
|
-
// @ts-expect-error
|
|
4250
|
-
coordinates: c
|
|
4251
|
-
};
|
|
4252
|
-
}
|
|
4253
|
-
function parseMultiPolygon(state) {
|
|
4254
|
-
if (!$(/^(MULTIPOLYGON)/i, state)) {
|
|
4255
|
-
return null;
|
|
4256
|
-
}
|
|
4257
|
-
white(state);
|
|
4258
|
-
const c = multicoords(state);
|
|
4259
|
-
if (!c) {
|
|
4260
|
-
return null;
|
|
4261
|
-
}
|
|
4262
|
-
return {
|
|
4263
|
-
type: "MultiPolygon",
|
|
4264
|
-
// @ts-expect-error
|
|
4265
|
-
coordinates: c
|
|
4266
|
-
};
|
|
4267
|
-
}
|
|
4268
|
-
function parseGeometryCollection(state) {
|
|
4269
|
-
const geometries = [];
|
|
4270
|
-
let geometry;
|
|
4271
|
-
if (!$(/^(GEOMETRYCOLLECTION)/i, state)) {
|
|
4272
|
-
return null;
|
|
4273
|
-
}
|
|
4274
|
-
white(state);
|
|
4275
|
-
if (!$(/^(\()/, state)) {
|
|
4276
|
-
return null;
|
|
4277
|
-
}
|
|
4278
|
-
geometry = parseGeometry(state);
|
|
4279
|
-
while (geometry) {
|
|
4280
|
-
geometries.push(geometry);
|
|
4281
|
-
white(state);
|
|
4282
|
-
$(/^(,)/, state);
|
|
4283
|
-
white(state);
|
|
4284
|
-
geometry = parseGeometry(state);
|
|
4285
|
-
}
|
|
4286
|
-
if (!$(/^(\))/, state)) {
|
|
4287
|
-
return null;
|
|
4288
|
-
}
|
|
4289
|
-
return {
|
|
4290
|
-
type: "GeometryCollection",
|
|
4291
|
-
geometries
|
|
4292
|
-
};
|
|
4293
|
-
}
|
|
4294
|
-
function multicoords(state) {
|
|
4295
|
-
white(state);
|
|
4296
|
-
let depth = 0;
|
|
4297
|
-
const rings = [];
|
|
4298
|
-
const stack = [rings];
|
|
4299
|
-
let pointer = rings;
|
|
4300
|
-
let elem;
|
|
4301
|
-
elem = $(/^(\()/, state) || $(/^(\))/, state) || $(/^(,)/, state) || $(tuples, state);
|
|
4302
|
-
while (elem) {
|
|
4303
|
-
if (elem === "(") {
|
|
4304
|
-
stack.push(pointer);
|
|
4305
|
-
pointer = [];
|
|
4306
|
-
stack[stack.length - 1].push(pointer);
|
|
4307
|
-
depth++;
|
|
4308
|
-
} else if (elem === ")") {
|
|
4309
|
-
if (pointer.length === 0) return null;
|
|
4310
|
-
pointer = stack.pop();
|
|
4311
|
-
if (!pointer) return null;
|
|
4312
|
-
depth--;
|
|
4313
|
-
if (depth === 0) break;
|
|
4314
|
-
} else if (elem === ",") {
|
|
4315
|
-
pointer = [];
|
|
4316
|
-
stack[stack.length - 1].push(pointer);
|
|
4317
|
-
} else if (!elem.split(/\s/g).some(Number.isNaN)) {
|
|
4318
|
-
Array.prototype.push.apply(pointer, elem.split(/\s/g).map(parseFloat));
|
|
4319
|
-
} else {
|
|
4320
|
-
return null;
|
|
4321
|
-
}
|
|
4322
|
-
white(state);
|
|
4323
|
-
elem = $(/^(\()/, state) || $(/^(\))/, state) || $(/^(,)/, state) || $(tuples, state);
|
|
4324
|
-
}
|
|
4325
|
-
if (depth !== 0) return null;
|
|
4326
|
-
return rings;
|
|
4327
|
-
}
|
|
4328
|
-
function coords(state) {
|
|
4329
|
-
const list = [];
|
|
4330
|
-
let item;
|
|
4331
|
-
let pt;
|
|
4332
|
-
pt = $(tuples, state) || $(/^(,)/, state);
|
|
4333
|
-
while (pt) {
|
|
4334
|
-
if (pt === ",") {
|
|
4335
|
-
list.push(item);
|
|
4336
|
-
item = [];
|
|
4337
|
-
} else if (!pt.split(/\s/g).some(Number.isNaN)) {
|
|
4338
|
-
if (!item) item = [];
|
|
4339
|
-
Array.prototype.push.apply(item, pt.split(/\s/g).map(parseFloat));
|
|
4340
|
-
}
|
|
4341
|
-
white(state);
|
|
4342
|
-
pt = $(tuples, state) || $(/^(,)/, state);
|
|
4343
|
-
}
|
|
4344
|
-
if (item) list.push(item);
|
|
4345
|
-
else return null;
|
|
4346
|
-
return list.length ? list : null;
|
|
4347
|
-
}
|
|
4348
|
-
function $(regexp, state) {
|
|
4349
|
-
var _a;
|
|
4350
|
-
const match = (_a = state._) == null ? void 0 : _a.substring(state.i).match(regexp);
|
|
4351
|
-
if (!match) return null;
|
|
4352
|
-
else {
|
|
4353
|
-
state.i += match[0].length;
|
|
4354
|
-
return match[0];
|
|
4355
|
-
}
|
|
4356
|
-
}
|
|
4357
|
-
function white(state) {
|
|
4358
|
-
$(/^\s*/, state);
|
|
4359
|
-
}
|
|
4360
|
-
var numberRegexp, tuples;
|
|
4361
|
-
var init_convert_wkt_to_geometry = __esm({
|
|
4362
|
-
"../gis/src/lib/geometry-converters/wkb/convert-wkt-to-geometry.ts"() {
|
|
4363
|
-
"use strict";
|
|
4364
|
-
numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
|
|
4365
|
-
tuples = new RegExp("^" + numberRegexp.source + "(\\s" + numberRegexp.source + "){1,}");
|
|
4366
|
-
}
|
|
4367
|
-
});
|
|
4368
|
-
|
|
4369
|
-
// ../gis/src/lib/geometry-converters/wkb/get-wkb-geometry-statistics.ts
|
|
4370
|
-
function getWKBGeometryStatistics(input) {
|
|
4371
|
-
const dataView = getDataView(input);
|
|
4372
|
-
const bounds = {};
|
|
4373
|
-
const parsedGeometry = scanGeometry(dataView, 0, bounds);
|
|
4374
|
-
if (parsedGeometry.byteOffset !== dataView.byteLength) {
|
|
4375
|
-
throw new Error("WKB: Unexpected trailing bytes after geometry");
|
|
4376
|
-
}
|
|
4377
|
-
return {
|
|
4378
|
-
geometryType: getISOTypeCode(parsedGeometry.header),
|
|
4379
|
-
bbox: createBoundingBox(bounds)
|
|
4380
|
-
};
|
|
4381
|
-
}
|
|
4382
|
-
function scanGeometry(dataView, byteOffset, bounds) {
|
|
4383
|
-
const header = parseWKBHeader(dataView, { byteOffset });
|
|
4384
|
-
byteOffset = header.byteOffset;
|
|
4385
|
-
switch (header.geometryType) {
|
|
4386
|
-
case 1 /* Point */:
|
|
4387
|
-
byteOffset = scanPosition(dataView, byteOffset, header, bounds);
|
|
4388
|
-
break;
|
|
4389
|
-
case 2 /* LineString */:
|
|
4390
|
-
byteOffset = scanCoordinateSequence(dataView, byteOffset, header, bounds);
|
|
4391
|
-
break;
|
|
4392
|
-
case 3 /* Polygon */: {
|
|
4393
|
-
const ringCount = dataView.getUint32(byteOffset, header.littleEndian);
|
|
4394
|
-
byteOffset += 4;
|
|
4395
|
-
for (let ringIndex = 0; ringIndex < ringCount; ringIndex++) {
|
|
4396
|
-
byteOffset = scanCoordinateSequence(dataView, byteOffset, header, bounds);
|
|
4397
|
-
}
|
|
4398
|
-
break;
|
|
4399
|
-
}
|
|
4400
|
-
case 4 /* MultiPoint */:
|
|
4401
|
-
case 5 /* MultiLineString */:
|
|
4402
|
-
case 6 /* MultiPolygon */:
|
|
4403
|
-
case 7 /* GeometryCollection */: {
|
|
4404
|
-
const geometryCount = dataView.getUint32(byteOffset, header.littleEndian);
|
|
4405
|
-
byteOffset += 4;
|
|
4406
|
-
for (let geometryIndex = 0; geometryIndex < geometryCount; geometryIndex++) {
|
|
4407
|
-
byteOffset = scanGeometry(dataView, byteOffset, bounds).byteOffset;
|
|
4408
|
-
}
|
|
4409
|
-
break;
|
|
4410
|
-
}
|
|
4411
|
-
default:
|
|
4412
|
-
throw new Error(`WKB: Unsupported geometry type: ${header.geometryType}`);
|
|
4413
|
-
}
|
|
4414
|
-
return { byteOffset, header };
|
|
4415
|
-
}
|
|
4416
|
-
function scanCoordinateSequence(dataView, byteOffset, header, bounds) {
|
|
4417
|
-
const pointCount = dataView.getUint32(byteOffset, header.littleEndian);
|
|
4418
|
-
byteOffset += 4;
|
|
4419
|
-
for (let pointIndex = 0; pointIndex < pointCount; pointIndex++) {
|
|
4420
|
-
byteOffset = scanPosition(dataView, byteOffset, header, bounds);
|
|
4421
|
-
}
|
|
4422
|
-
return byteOffset;
|
|
4423
|
-
}
|
|
4424
|
-
function scanPosition(dataView, byteOffset, header, bounds) {
|
|
4425
|
-
const coordinates = new Array(header.dimensions);
|
|
4426
|
-
for (let coordinateIndex = 0; coordinateIndex < header.dimensions; coordinateIndex++) {
|
|
4427
|
-
coordinates[coordinateIndex] = dataView.getFloat64(byteOffset, header.littleEndian);
|
|
4428
|
-
byteOffset += 8;
|
|
4429
|
-
}
|
|
4430
|
-
updateBounds(bounds, "x", coordinates[0]);
|
|
4431
|
-
updateBounds(bounds, "y", coordinates[1]);
|
|
4432
|
-
if (header.coordinates === "xyz" || header.coordinates === "xyzm") {
|
|
4433
|
-
updateBounds(bounds, "z", coordinates[2]);
|
|
4434
|
-
}
|
|
4435
|
-
if (header.coordinates === "xym") updateBounds(bounds, "m", coordinates[2]);
|
|
4436
|
-
if (header.coordinates === "xyzm") updateBounds(bounds, "m", coordinates[3]);
|
|
4437
|
-
return byteOffset;
|
|
4438
|
-
}
|
|
4439
|
-
function updateBounds(bounds, dimension, value) {
|
|
4440
|
-
if (!Number.isFinite(value)) return;
|
|
4441
|
-
const minimumKey = `${dimension}min`;
|
|
4442
|
-
const maximumKey = `${dimension}max`;
|
|
4443
|
-
bounds[minimumKey] = bounds[minimumKey] === void 0 ? value : Math.min(bounds[minimumKey], value);
|
|
4444
|
-
bounds[maximumKey] = bounds[maximumKey] === void 0 ? value : Math.max(bounds[maximumKey], value);
|
|
4445
|
-
}
|
|
4446
|
-
function createBoundingBox(bounds) {
|
|
4447
|
-
if (bounds.xmin === void 0 || bounds.xmax === void 0 || bounds.ymin === void 0 || bounds.ymax === void 0) {
|
|
4448
|
-
return void 0;
|
|
4449
|
-
}
|
|
4450
|
-
return bounds;
|
|
4451
|
-
}
|
|
4452
|
-
function getISOTypeCode(header) {
|
|
4453
|
-
const dimensionOffset = header.coordinates === "xyz" ? 1e3 : header.coordinates === "xym" ? 2e3 : header.coordinates === "xyzm" ? 3e3 : 0;
|
|
4454
|
-
return header.geometryType + dimensionOffset;
|
|
4455
|
-
}
|
|
4456
|
-
function getDataView(input) {
|
|
4457
|
-
return ArrayBuffer.isView(input) ? new DataView(input.buffer, input.byteOffset, input.byteLength) : new DataView(input);
|
|
4458
|
-
}
|
|
4459
|
-
var init_get_wkb_geometry_statistics = __esm({
|
|
4460
|
-
"../gis/src/lib/geometry-converters/wkb/get-wkb-geometry-statistics.ts"() {
|
|
4461
|
-
"use strict";
|
|
4462
|
-
init_parse_wkb_header();
|
|
4463
|
-
}
|
|
4464
|
-
});
|
|
4465
|
-
|
|
4466
|
-
// ../gis/src/lib/geoarrow/metadata-utils.ts
|
|
3961
|
+
// ../schema/src/metadata.ts
|
|
4467
3962
|
function getMetadataValue(metadata, key) {
|
|
4468
3963
|
return metadata instanceof Map ? metadata.get(key) || null : metadata[key] || null;
|
|
4469
3964
|
}
|
|
@@ -4474,13 +3969,6 @@ function setMetadataValue(metadata, key, value) {
|
|
|
4474
3969
|
metadata[key] = value;
|
|
4475
3970
|
}
|
|
4476
3971
|
}
|
|
4477
|
-
var init_metadata_utils = __esm({
|
|
4478
|
-
"../gis/src/lib/geoarrow/metadata-utils.ts"() {
|
|
4479
|
-
"use strict";
|
|
4480
|
-
}
|
|
4481
|
-
});
|
|
4482
|
-
|
|
4483
|
-
// ../gis/src/lib/geoarrow/geoparquet-metadata.ts
|
|
4484
3972
|
function getGeoMetadata(metadata) {
|
|
4485
3973
|
if (!metadata) {
|
|
4486
3974
|
return null;
|
|
@@ -4491,7 +3979,7 @@ function getGeoMetadata(metadata) {
|
|
|
4491
3979
|
return null;
|
|
4492
3980
|
}
|
|
4493
3981
|
for (const column of Object.values(geoMetadata.columns || {})) {
|
|
4494
|
-
if (column.encoding) {
|
|
3982
|
+
if (column && typeof column === "object" && typeof column.encoding === "string") {
|
|
4495
3983
|
column.encoding = column.encoding.toLowerCase();
|
|
4496
3984
|
}
|
|
4497
3985
|
}
|
|
@@ -4505,12 +3993,12 @@ function unpackGeoMetadata(metadata) {
|
|
|
4505
3993
|
if (!geoMetadata) {
|
|
4506
3994
|
return;
|
|
4507
3995
|
}
|
|
4508
|
-
const { version: version2, primary_column, columns } = geoMetadata;
|
|
3996
|
+
const { version: version2, primary_column: primaryColumn, columns } = geoMetadata;
|
|
4509
3997
|
if (version2) {
|
|
4510
3998
|
setMetadataValue(metadata, "geo.version", version2);
|
|
4511
3999
|
}
|
|
4512
|
-
if (
|
|
4513
|
-
setMetadataValue(metadata, "geo.primary_column",
|
|
4000
|
+
if (primaryColumn) {
|
|
4001
|
+
setMetadataValue(metadata, "geo.primary_column", primaryColumn);
|
|
4514
4002
|
}
|
|
4515
4003
|
setMetadataValue(metadata, "geo.columns", Object.keys(columns || {}).join(","));
|
|
4516
4004
|
}
|
|
@@ -4531,85 +4019,54 @@ function parseJSONStringMetadata(stringifiedMetadata) {
|
|
|
4531
4019
|
}
|
|
4532
4020
|
try {
|
|
4533
4021
|
const metadata = JSON.parse(stringifiedMetadata);
|
|
4534
|
-
|
|
4535
|
-
return null;
|
|
4536
|
-
}
|
|
4537
|
-
return metadata;
|
|
4022
|
+
return metadata && typeof metadata === "object" ? metadata : null;
|
|
4538
4023
|
} catch {
|
|
4539
4024
|
return null;
|
|
4540
4025
|
}
|
|
4541
4026
|
}
|
|
4542
|
-
var
|
|
4543
|
-
"../
|
|
4027
|
+
var init_metadata = __esm({
|
|
4028
|
+
"../schema/src/metadata.ts"() {
|
|
4544
4029
|
"use strict";
|
|
4545
|
-
init_metadata_utils();
|
|
4546
4030
|
}
|
|
4547
4031
|
});
|
|
4548
4032
|
|
|
4549
|
-
// ../
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
const geoMetadata = getGeoMetadata(schema.metadata);
|
|
4553
|
-
const primaryColumn = geoMetadata == null ? void 0 : geoMetadata.primary_column;
|
|
4554
|
-
if (!primaryColumn) {
|
|
4555
|
-
throw new Error("no geometry column");
|
|
4556
|
-
}
|
|
4557
|
-
const columnMetadata = (_a = geoMetadata.columns) == null ? void 0 : _a[primaryColumn];
|
|
4558
|
-
if (!columnMetadata) {
|
|
4559
|
-
throw new Error(`missing metadata for geometry column "${primaryColumn}"`);
|
|
4560
|
-
}
|
|
4561
|
-
const features = [];
|
|
4562
|
-
const length = getTableLength(table);
|
|
4563
|
-
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
4564
|
-
const row = getTableRowAsObject(table, rowIndex);
|
|
4565
|
-
const geometry = parseGeometry2(row[primaryColumn], columnMetadata);
|
|
4566
|
-
delete row[primaryColumn];
|
|
4567
|
-
features.push({ type: "Feature", geometry, properties: row });
|
|
4568
|
-
}
|
|
4569
|
-
return { shape: "geojson-table", schema, type: "FeatureCollection", features };
|
|
4570
|
-
}
|
|
4571
|
-
function parseGeometry2(geometry, columnMetadata) {
|
|
4572
|
-
var _a;
|
|
4573
|
-
switch ((_a = columnMetadata.encoding) == null ? void 0 : _a.toLowerCase()) {
|
|
4574
|
-
case "wkt":
|
|
4575
|
-
return convertWKTToGeometry(geometry) || null;
|
|
4576
|
-
case "wkb":
|
|
4577
|
-
default: {
|
|
4578
|
-
const arrayBuffer = ArrayBuffer.isView(geometry) ? geometry.buffer.slice(geometry.byteOffset, geometry.byteOffset + geometry.byteLength) : geometry;
|
|
4579
|
-
return convertWKBToGeometry(arrayBuffer);
|
|
4580
|
-
}
|
|
4581
|
-
}
|
|
4582
|
-
}
|
|
4583
|
-
var init_convert_wkb_table_to_geojson = __esm({
|
|
4584
|
-
"../gis/src/lib/table-converters/convert-wkb-table-to-geojson.ts"() {
|
|
4033
|
+
// ../schema/src/index.ts
|
|
4034
|
+
var init_src3 = __esm({
|
|
4035
|
+
"../schema/src/index.ts"() {
|
|
4585
4036
|
"use strict";
|
|
4586
|
-
|
|
4587
|
-
init_geoparquet_metadata();
|
|
4588
|
-
init_convert_wkb_to_geometry();
|
|
4589
|
-
init_convert_wkt_to_geometry();
|
|
4037
|
+
init_metadata();
|
|
4590
4038
|
}
|
|
4591
4039
|
});
|
|
4592
4040
|
|
|
4593
|
-
// ../
|
|
4594
|
-
var
|
|
4595
|
-
|
|
4596
|
-
"../gis/src/deprecated.ts"() {
|
|
4041
|
+
// ../schema-utils/src/index.ts
|
|
4042
|
+
var init_src4 = __esm({
|
|
4043
|
+
"../schema-utils/src/index.ts"() {
|
|
4597
4044
|
"use strict";
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
)
|
|
4045
|
+
init_convert_arrow_schema();
|
|
4046
|
+
init_deduce_table_schema();
|
|
4047
|
+
init_deprecated();
|
|
4048
|
+
init_table_accessors();
|
|
4602
4049
|
}
|
|
4603
4050
|
});
|
|
4604
4051
|
|
|
4605
|
-
//
|
|
4606
|
-
|
|
4607
|
-
|
|
4052
|
+
// src/lib/parsers/convert-parquet-tables.ts
|
|
4053
|
+
function convertArrowTableToObjectRows(arrowTable) {
|
|
4054
|
+
return convertArrowToTable2(arrowTable.data, "object-row-table");
|
|
4055
|
+
}
|
|
4056
|
+
function convertArrowBatchToObjectRows(batch) {
|
|
4057
|
+
const objectRowTable = convertArrowToTable2(batch.data, "object-row-table");
|
|
4058
|
+
return {
|
|
4059
|
+
batchType: batch.batchType,
|
|
4060
|
+
shape: objectRowTable.shape,
|
|
4061
|
+
schema: objectRowTable.schema,
|
|
4062
|
+
data: objectRowTable.data,
|
|
4063
|
+
length: batch.length
|
|
4064
|
+
};
|
|
4065
|
+
}
|
|
4066
|
+
var init_convert_parquet_tables = __esm({
|
|
4067
|
+
"src/lib/parsers/convert-parquet-tables.ts"() {
|
|
4608
4068
|
"use strict";
|
|
4609
|
-
|
|
4610
|
-
init_metadata_utils();
|
|
4611
|
-
init_geoparquet_metadata();
|
|
4612
|
-
init_deprecated2();
|
|
4069
|
+
init_src4();
|
|
4613
4070
|
}
|
|
4614
4071
|
});
|
|
4615
4072
|
|
|
@@ -4657,6 +4114,10 @@ var init_geospatial_metadata_zod_schema = __esm({
|
|
|
4657
4114
|
encoding: import_zod.z.enum([
|
|
4658
4115
|
"WKB",
|
|
4659
4116
|
"wkb",
|
|
4117
|
+
"GEOMETRY",
|
|
4118
|
+
"geometry",
|
|
4119
|
+
"GEOGRAPHY",
|
|
4120
|
+
"geography",
|
|
4660
4121
|
"point",
|
|
4661
4122
|
"linestring",
|
|
4662
4123
|
"polygon",
|
|
@@ -4694,10 +4155,11 @@ var init_geospatial_metadata_zod_schema = __esm({
|
|
|
4694
4155
|
}).superRefine((metadata, context) => {
|
|
4695
4156
|
if (!metadata.version.startsWith("2.")) return;
|
|
4696
4157
|
for (const [columnName, column] of Object.entries(metadata.columns)) {
|
|
4697
|
-
|
|
4158
|
+
const encoding = column.encoding.toUpperCase();
|
|
4159
|
+
if (encoding !== "WKB" && encoding !== "GEOMETRY" && encoding !== "GEOGRAPHY") {
|
|
4698
4160
|
context.addIssue({
|
|
4699
4161
|
code: "custom",
|
|
4700
|
-
message: "GeoParquet 2.x geometry columns must use WKB encoding",
|
|
4162
|
+
message: "GeoParquet 2.x geometry columns must use WKB, GEOMETRY, or GEOGRAPHY encoding",
|
|
4701
4163
|
path: ["columns", columnName, "encoding"]
|
|
4702
4164
|
});
|
|
4703
4165
|
}
|
|
@@ -4812,10 +4274,11 @@ function getGeoArrowMetadataFromGeoParquetField(field, columnMetadata) {
|
|
|
4812
4274
|
if (!extensionName) {
|
|
4813
4275
|
return null;
|
|
4814
4276
|
}
|
|
4815
|
-
|
|
4277
|
+
const isBinaryGeospatialEncoding = normalizedEncoding === "wkb" || normalizedEncoding === "geometry" || normalizedEncoding === "geography";
|
|
4278
|
+
if (isBinaryGeospatialEncoding && !isBinaryFieldType(field.type)) {
|
|
4816
4279
|
return null;
|
|
4817
4280
|
}
|
|
4818
|
-
if (
|
|
4281
|
+
if (!isBinaryGeospatialEncoding && (isBinaryFieldType(field.type) || isStringFieldType(field.type))) {
|
|
4819
4282
|
return null;
|
|
4820
4283
|
}
|
|
4821
4284
|
const extensionMetadata = {};
|
|
@@ -4829,8 +4292,22 @@ function getGeoArrowMetadataFromGeoParquetField(field, columnMetadata) {
|
|
|
4829
4292
|
if (columnMetadata.edges && columnMetadata.edges !== "planar") {
|
|
4830
4293
|
extensionMetadata.edges = columnMetadata.edges;
|
|
4831
4294
|
}
|
|
4295
|
+
if (normalizedEncoding === "geography" && !extensionMetadata.edges) {
|
|
4296
|
+
extensionMetadata.edges = "spherical";
|
|
4297
|
+
}
|
|
4298
|
+
for (const [metadataKey, metadataValue] of Object.entries(columnMetadata)) {
|
|
4299
|
+
if (metadataValue !== void 0 && metadataValue !== null && !["encoding", "geometry_types", "crs", "edges"].includes(metadataKey)) {
|
|
4300
|
+
extensionMetadata[metadataKey] = metadataValue;
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4832
4303
|
return Object.keys(extensionMetadata).length > 0 ? { extensionName, extensionMetadata } : { extensionName };
|
|
4833
4304
|
}
|
|
4305
|
+
function isBinaryFieldType(fieldType) {
|
|
4306
|
+
return typeof fieldType === "string" && (fieldType === "binary" || fieldType === "binary-view");
|
|
4307
|
+
}
|
|
4308
|
+
function isStringFieldType(fieldType) {
|
|
4309
|
+
return typeof fieldType === "string" && (fieldType === "utf8" || fieldType === "utf8-view");
|
|
4310
|
+
}
|
|
4834
4311
|
function getMetadataEntries(metadata) {
|
|
4835
4312
|
if (metadata instanceof Map) {
|
|
4836
4313
|
return [...metadata.entries()];
|
|
@@ -4856,12 +4333,14 @@ var init_geospatial_metadata = __esm({
|
|
|
4856
4333
|
"src/lib/geo/geospatial-metadata.ts"() {
|
|
4857
4334
|
"use strict";
|
|
4858
4335
|
arrow4 = __toESM(require("apache-arrow"), 1);
|
|
4859
|
-
init_src4();
|
|
4860
4336
|
init_src3();
|
|
4337
|
+
init_src4();
|
|
4861
4338
|
GEOARROW_EXTENSION_NAME_KEY = "ARROW:extension:name";
|
|
4862
4339
|
GEOARROW_EXTENSION_METADATA_KEY = "ARROW:extension:metadata";
|
|
4863
4340
|
GEOPARQUET_TO_GEOARROW_ENCODINGS = {
|
|
4864
4341
|
wkb: "geoarrow.wkb",
|
|
4342
|
+
geometry: "geoarrow.wkb",
|
|
4343
|
+
geography: "geoarrow.wkb",
|
|
4865
4344
|
point: "geoarrow.point",
|
|
4866
4345
|
linestring: "geoarrow.linestring",
|
|
4867
4346
|
polygon: "geoarrow.polygon",
|
|
@@ -6206,13 +5685,518 @@ var init_arrow_table_transport = __esm({
|
|
|
6206
5685
|
"../arrow/src/lib/utils/arrow-table-transport.ts"() {
|
|
6207
5686
|
"use strict";
|
|
6208
5687
|
arrow8 = __toESM(require("apache-arrow"), 1);
|
|
6209
|
-
|
|
5688
|
+
init_src4();
|
|
6210
5689
|
init_split_arrow_buffers();
|
|
6211
5690
|
}
|
|
6212
5691
|
});
|
|
6213
5692
|
|
|
6214
|
-
// ../
|
|
5693
|
+
// ../gis/src/lib/geometry-converters/wkb/convert-wkb-to-geometry.ts
|
|
5694
|
+
function convertWKBToGeometry(arrayBuffer) {
|
|
5695
|
+
const geometry = (0, import_wkb.parseWKB)(new Uint8Array(arrayBuffer)).geometry;
|
|
5696
|
+
return normalizeEmptyPoints(geometry);
|
|
5697
|
+
}
|
|
5698
|
+
function normalizeEmptyPoints(geometry) {
|
|
5699
|
+
if (geometry.type === "Point") {
|
|
5700
|
+
return geometry.coordinates.length > 0 && geometry.coordinates.every(Number.isNaN) ? { ...geometry, coordinates: [] } : geometry;
|
|
5701
|
+
}
|
|
5702
|
+
if (geometry.type === "MultiPoint") {
|
|
5703
|
+
const coordinates = geometry.coordinates.map(
|
|
5704
|
+
(coordinate) => coordinate.length > 0 && coordinate.every(Number.isNaN) ? [] : coordinate
|
|
5705
|
+
);
|
|
5706
|
+
return coordinates.some((coordinate, index) => coordinate !== geometry.coordinates[index]) ? { ...geometry, coordinates } : geometry;
|
|
5707
|
+
}
|
|
5708
|
+
if (geometry.type === "GeometryCollection") {
|
|
5709
|
+
const geometries = geometry.geometries.map(normalizeEmptyPoints);
|
|
5710
|
+
return geometries.some((child, index) => child !== geometry.geometries[index]) ? { ...geometry, geometries } : geometry;
|
|
5711
|
+
}
|
|
5712
|
+
return geometry;
|
|
5713
|
+
}
|
|
5714
|
+
var import_wkb;
|
|
5715
|
+
var init_convert_wkb_to_geometry = __esm({
|
|
5716
|
+
"../gis/src/lib/geometry-converters/wkb/convert-wkb-to-geometry.ts"() {
|
|
5717
|
+
"use strict";
|
|
5718
|
+
import_wkb = require("@math.gl/wkb");
|
|
5719
|
+
}
|
|
5720
|
+
});
|
|
5721
|
+
|
|
5722
|
+
// ../gis/src/lib/geometry-converters/wkb/convert-wkt-to-geometry.ts
|
|
5723
|
+
function getWKTDimension(input) {
|
|
5724
|
+
var _a;
|
|
5725
|
+
const match = input.trim().match(
|
|
5726
|
+
/^(?:POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)(?:\s+(ZM|Z|M))?(?:\s|\()/i
|
|
5727
|
+
);
|
|
5728
|
+
if (!match) return null;
|
|
5729
|
+
const dimensionToken = (_a = match[1]) == null ? void 0 : _a.toUpperCase();
|
|
5730
|
+
return dimensionToken === "Z" ? "xyz" : dimensionToken === "M" ? "xym" : dimensionToken === "ZM" ? "xyzm" : "xy";
|
|
5731
|
+
}
|
|
5732
|
+
function convertWKTToGeometry(input, options) {
|
|
5733
|
+
var _a, _b;
|
|
5734
|
+
const parts = input.split(";");
|
|
5735
|
+
let _ = parts.pop();
|
|
5736
|
+
const srid = (parts.shift() || "").split("=").pop();
|
|
5737
|
+
const state = { parts, _, i: 0 };
|
|
5738
|
+
const geometry = parseGeometry(state);
|
|
5739
|
+
white(state);
|
|
5740
|
+
if (!geometry || state.i !== ((_a = state._) == null ? void 0 : _a.length)) {
|
|
5741
|
+
return null;
|
|
5742
|
+
}
|
|
5743
|
+
return ((_b = options == null ? void 0 : options.wkt) == null ? void 0 : _b.crs) ? addCRS(geometry, srid) : geometry;
|
|
5744
|
+
}
|
|
5745
|
+
function parseGeometry(state) {
|
|
5746
|
+
var _a;
|
|
5747
|
+
const startIndex = state.i;
|
|
5748
|
+
const geometry = parsePoint(state) || parseLineString(state) || parsePolygon(state) || parseMultiPoint(state) || parseMultiLineString(state) || parseMultiPolygon(state) || parseGeometryCollection(state);
|
|
5749
|
+
if (geometry) {
|
|
5750
|
+
const geometryText = ((_a = state._) == null ? void 0 : _a.substring(startIndex, state.i)) || "";
|
|
5751
|
+
const dimension = getWKTDimension(geometryText);
|
|
5752
|
+
const hasExplicitDimension = /\s+(?:ZM|Z|M)\s*(?:\(|EMPTY\b)/i.test(geometryText);
|
|
5753
|
+
if (!hasValidCoordinateArity(geometry, hasExplicitDimension ? dimension : null)) {
|
|
5754
|
+
return null;
|
|
5755
|
+
}
|
|
5756
|
+
if (hasExplicitDimension && dimension && dimension !== "xy") {
|
|
5757
|
+
Object.defineProperty(geometry, "__geoarrowDimension", {
|
|
5758
|
+
configurable: true,
|
|
5759
|
+
enumerable: false,
|
|
5760
|
+
value: dimension
|
|
5761
|
+
});
|
|
5762
|
+
}
|
|
5763
|
+
}
|
|
5764
|
+
return geometry;
|
|
5765
|
+
}
|
|
5766
|
+
function hasValidCoordinateArity(geometry, dimension) {
|
|
5767
|
+
const coordinateSize = dimension === null ? null : dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
|
|
5768
|
+
let inferredCoordinateSize = null;
|
|
5769
|
+
const isValidCoordinate = (coordinate) => {
|
|
5770
|
+
if (!Array.isArray(coordinate)) return false;
|
|
5771
|
+
if (coordinate.length === 0) return true;
|
|
5772
|
+
if (!coordinate.every((value) => typeof value === "number" && Number.isFinite(value))) {
|
|
5773
|
+
return false;
|
|
5774
|
+
}
|
|
5775
|
+
if (coordinateSize !== null) return coordinate.length === coordinateSize;
|
|
5776
|
+
if (coordinate.length < 2 || coordinate.length > 4) return false;
|
|
5777
|
+
if (inferredCoordinateSize === null) inferredCoordinateSize = coordinate.length;
|
|
5778
|
+
return coordinate.length === inferredCoordinateSize;
|
|
5779
|
+
};
|
|
5780
|
+
const isValidCoordinateList = (coordinates) => Array.isArray(coordinates) && coordinates.every(isValidCoordinate);
|
|
5781
|
+
const isValidRingList = (rings) => Array.isArray(rings) && rings.every(isValidCoordinateList);
|
|
5782
|
+
switch (geometry.type) {
|
|
5783
|
+
case "Point":
|
|
5784
|
+
return isValidCoordinate(geometry.coordinates);
|
|
5785
|
+
case "LineString":
|
|
5786
|
+
return isValidCoordinateList(geometry.coordinates);
|
|
5787
|
+
case "Polygon":
|
|
5788
|
+
return isValidRingList(geometry.coordinates);
|
|
5789
|
+
case "MultiPoint":
|
|
5790
|
+
return isValidCoordinateList(geometry.coordinates);
|
|
5791
|
+
case "MultiLineString":
|
|
5792
|
+
return isValidRingList(geometry.coordinates);
|
|
5793
|
+
case "MultiPolygon":
|
|
5794
|
+
return Array.isArray(geometry.coordinates) && geometry.coordinates.every(isValidRingList);
|
|
5795
|
+
case "GeometryCollection":
|
|
5796
|
+
return true;
|
|
5797
|
+
default:
|
|
5798
|
+
return false;
|
|
5799
|
+
}
|
|
5800
|
+
}
|
|
5801
|
+
function addCRS(obj, srid) {
|
|
5802
|
+
if (obj && (srid == null ? void 0 : srid.match(/\d+/))) {
|
|
5803
|
+
const crs = {
|
|
5804
|
+
type: "name",
|
|
5805
|
+
properties: {
|
|
5806
|
+
name: "urn:ogc:def:crs:EPSG::" + srid
|
|
5807
|
+
}
|
|
5808
|
+
};
|
|
5809
|
+
obj.crs = crs;
|
|
5810
|
+
}
|
|
5811
|
+
return obj;
|
|
5812
|
+
}
|
|
5813
|
+
function parsePoint(state) {
|
|
5814
|
+
if (!$(/^(POINT(?:\s+(?:ZM|Z|M))?)/i, state)) {
|
|
5815
|
+
return null;
|
|
5816
|
+
}
|
|
5817
|
+
white(state);
|
|
5818
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5819
|
+
return { type: "Point", coordinates: [] };
|
|
5820
|
+
}
|
|
5821
|
+
if (!$(/^(\()/, state)) {
|
|
5822
|
+
return null;
|
|
5823
|
+
}
|
|
5824
|
+
const c = coords(state);
|
|
5825
|
+
if (!c) {
|
|
5826
|
+
return null;
|
|
5827
|
+
}
|
|
5828
|
+
white(state);
|
|
5829
|
+
if (!$(/^(\))/, state)) {
|
|
5830
|
+
return null;
|
|
5831
|
+
}
|
|
5832
|
+
return {
|
|
5833
|
+
type: "Point",
|
|
5834
|
+
coordinates: c[0]
|
|
5835
|
+
};
|
|
5836
|
+
}
|
|
5837
|
+
function parseMultiPoint(state) {
|
|
5838
|
+
var _a;
|
|
5839
|
+
if (!$(/^(MULTIPOINT(?:\s+(?:ZM|Z|M))?)/i, state)) {
|
|
5840
|
+
return null;
|
|
5841
|
+
}
|
|
5842
|
+
white(state);
|
|
5843
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5844
|
+
return { type: "MultiPoint", coordinates: [] };
|
|
5845
|
+
}
|
|
5846
|
+
if (!$(/^(\()/, state)) {
|
|
5847
|
+
return null;
|
|
5848
|
+
}
|
|
5849
|
+
const coordinates = [];
|
|
5850
|
+
white(state);
|
|
5851
|
+
const isParenthesized = (_a = state._) == null ? void 0 : _a.substring(state.i).startsWith("(");
|
|
5852
|
+
if (isParenthesized) {
|
|
5853
|
+
while (true) {
|
|
5854
|
+
if (!$(/^(\()/, state)) return null;
|
|
5855
|
+
const coordinate = coords(state);
|
|
5856
|
+
if (!coordinate || coordinate.length !== 1 || !$(/^(\))/, state)) return null;
|
|
5857
|
+
coordinates.push(coordinate[0]);
|
|
5858
|
+
white(state);
|
|
5859
|
+
if (!$(/^(,)/, state)) break;
|
|
5860
|
+
white(state);
|
|
5861
|
+
}
|
|
5862
|
+
} else {
|
|
5863
|
+
const coordinateList = coords(state);
|
|
5864
|
+
if (!coordinateList) return null;
|
|
5865
|
+
coordinates.push(...coordinateList);
|
|
5866
|
+
}
|
|
5867
|
+
white(state);
|
|
5868
|
+
if (!$(/^(\))/, state)) return null;
|
|
5869
|
+
return {
|
|
5870
|
+
type: "MultiPoint",
|
|
5871
|
+
coordinates
|
|
5872
|
+
};
|
|
5873
|
+
}
|
|
5874
|
+
function parseLineString(state) {
|
|
5875
|
+
if (!$(/^(LINESTRING(?:\s+(?:ZM|Z|M))?)/i, state)) {
|
|
5876
|
+
return null;
|
|
5877
|
+
}
|
|
5878
|
+
white(state);
|
|
5879
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5880
|
+
return { type: "LineString", coordinates: [] };
|
|
5881
|
+
}
|
|
5882
|
+
if (!$(/^(\()/, state)) {
|
|
5883
|
+
return null;
|
|
5884
|
+
}
|
|
5885
|
+
const c = coords(state);
|
|
5886
|
+
if (!c) {
|
|
5887
|
+
return null;
|
|
5888
|
+
}
|
|
5889
|
+
if (!$(/^(\))/, state)) {
|
|
5890
|
+
return null;
|
|
5891
|
+
}
|
|
5892
|
+
return {
|
|
5893
|
+
type: "LineString",
|
|
5894
|
+
coordinates: c
|
|
5895
|
+
};
|
|
5896
|
+
}
|
|
5897
|
+
function parseMultiLineString(state) {
|
|
5898
|
+
if (!$(/^(MULTILINESTRING(?:\s+(?:ZM|Z|M))?)/i, state)) return null;
|
|
5899
|
+
white(state);
|
|
5900
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5901
|
+
return { type: "MultiLineString", coordinates: [] };
|
|
5902
|
+
}
|
|
5903
|
+
const c = multicoords(state);
|
|
5904
|
+
if (!c) {
|
|
5905
|
+
return null;
|
|
5906
|
+
}
|
|
5907
|
+
white(state);
|
|
5908
|
+
return {
|
|
5909
|
+
// @ts-ignore
|
|
5910
|
+
type: "MultiLineString",
|
|
5911
|
+
// @ts-expect-error
|
|
5912
|
+
coordinates: c
|
|
5913
|
+
};
|
|
5914
|
+
}
|
|
5915
|
+
function parsePolygon(state) {
|
|
5916
|
+
if (!$(/^(POLYGON(?:\s+(?:ZM|Z|M))?)/i, state)) {
|
|
5917
|
+
return null;
|
|
5918
|
+
}
|
|
5919
|
+
white(state);
|
|
5920
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5921
|
+
return { type: "Polygon", coordinates: [] };
|
|
5922
|
+
}
|
|
5923
|
+
const c = multicoords(state);
|
|
5924
|
+
if (!c) {
|
|
5925
|
+
return null;
|
|
5926
|
+
}
|
|
5927
|
+
return {
|
|
5928
|
+
// @ts-ignore
|
|
5929
|
+
type: "Polygon",
|
|
5930
|
+
// @ts-expect-error
|
|
5931
|
+
coordinates: c
|
|
5932
|
+
};
|
|
5933
|
+
}
|
|
5934
|
+
function parseMultiPolygon(state) {
|
|
5935
|
+
if (!$(/^(MULTIPOLYGON(?:\s+(?:ZM|Z|M))?)/i, state)) {
|
|
5936
|
+
return null;
|
|
5937
|
+
}
|
|
5938
|
+
white(state);
|
|
5939
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5940
|
+
return { type: "MultiPolygon", coordinates: [] };
|
|
5941
|
+
}
|
|
5942
|
+
const c = multicoords(state);
|
|
5943
|
+
if (!c) {
|
|
5944
|
+
return null;
|
|
5945
|
+
}
|
|
5946
|
+
return {
|
|
5947
|
+
type: "MultiPolygon",
|
|
5948
|
+
// @ts-expect-error
|
|
5949
|
+
coordinates: c
|
|
5950
|
+
};
|
|
5951
|
+
}
|
|
5952
|
+
function parseGeometryCollection(state) {
|
|
5953
|
+
const geometries = [];
|
|
5954
|
+
let geometry;
|
|
5955
|
+
if (!$(/^(GEOMETRYCOLLECTION(?:\s+(?:ZM|Z|M))?)/i, state)) {
|
|
5956
|
+
return null;
|
|
5957
|
+
}
|
|
5958
|
+
white(state);
|
|
5959
|
+
if ($(/^(EMPTY)\b/i, state)) {
|
|
5960
|
+
return { type: "GeometryCollection", geometries: [] };
|
|
5961
|
+
}
|
|
5962
|
+
if (!$(/^(\()/, state)) {
|
|
5963
|
+
return null;
|
|
5964
|
+
}
|
|
5965
|
+
geometry = parseGeometry(state);
|
|
5966
|
+
while (geometry) {
|
|
5967
|
+
geometries.push(geometry);
|
|
5968
|
+
white(state);
|
|
5969
|
+
$(/^(,)/, state);
|
|
5970
|
+
white(state);
|
|
5971
|
+
geometry = parseGeometry(state);
|
|
5972
|
+
}
|
|
5973
|
+
if (!$(/^(\))/, state)) {
|
|
5974
|
+
return null;
|
|
5975
|
+
}
|
|
5976
|
+
return {
|
|
5977
|
+
type: "GeometryCollection",
|
|
5978
|
+
geometries
|
|
5979
|
+
};
|
|
5980
|
+
}
|
|
5981
|
+
function multicoords(state) {
|
|
5982
|
+
white(state);
|
|
5983
|
+
let depth = 0;
|
|
5984
|
+
const rings = [];
|
|
5985
|
+
const stack = [rings];
|
|
5986
|
+
let pointer = rings;
|
|
5987
|
+
let elem;
|
|
5988
|
+
elem = $(/^(\()/, state) || $(/^(\))/, state) || $(/^(,)/, state) || $(tuples, state);
|
|
5989
|
+
while (elem) {
|
|
5990
|
+
if (elem === "(") {
|
|
5991
|
+
stack.push(pointer);
|
|
5992
|
+
pointer = [];
|
|
5993
|
+
stack[stack.length - 1].push(pointer);
|
|
5994
|
+
depth++;
|
|
5995
|
+
} else if (elem === ")") {
|
|
5996
|
+
if (pointer.length === 0) return null;
|
|
5997
|
+
pointer = stack.pop();
|
|
5998
|
+
if (!pointer) return null;
|
|
5999
|
+
depth--;
|
|
6000
|
+
if (depth === 0) break;
|
|
6001
|
+
} else if (elem === ",") {
|
|
6002
|
+
pointer = [];
|
|
6003
|
+
stack[stack.length - 1].push(pointer);
|
|
6004
|
+
} else if (!elem.split(/\s/g).some(Number.isNaN)) {
|
|
6005
|
+
Array.prototype.push.apply(pointer, elem.split(/\s/g).map(parseFloat));
|
|
6006
|
+
} else {
|
|
6007
|
+
return null;
|
|
6008
|
+
}
|
|
6009
|
+
white(state);
|
|
6010
|
+
elem = $(/^(\()/, state) || $(/^(\))/, state) || $(/^(,)/, state) || $(tuples, state);
|
|
6011
|
+
}
|
|
6012
|
+
if (depth !== 0) return null;
|
|
6013
|
+
return rings;
|
|
6014
|
+
}
|
|
6015
|
+
function coords(state) {
|
|
6016
|
+
const list = [];
|
|
6017
|
+
let item;
|
|
6018
|
+
let pt;
|
|
6019
|
+
pt = $(tuples, state) || $(/^(,)/, state);
|
|
6020
|
+
while (pt) {
|
|
6021
|
+
if (pt === ",") {
|
|
6022
|
+
list.push(item);
|
|
6023
|
+
item = [];
|
|
6024
|
+
} else if (!pt.split(/\s/g).some(Number.isNaN)) {
|
|
6025
|
+
if (!item) item = [];
|
|
6026
|
+
Array.prototype.push.apply(item, pt.split(/\s/g).map(parseFloat));
|
|
6027
|
+
}
|
|
6028
|
+
white(state);
|
|
6029
|
+
pt = $(tuples, state) || $(/^(,)/, state);
|
|
6030
|
+
}
|
|
6031
|
+
if (item) list.push(item);
|
|
6032
|
+
else return null;
|
|
6033
|
+
return list.length ? list : null;
|
|
6034
|
+
}
|
|
6035
|
+
function $(regexp, state) {
|
|
6036
|
+
var _a;
|
|
6037
|
+
const match = (_a = state._) == null ? void 0 : _a.substring(state.i).match(regexp);
|
|
6038
|
+
if (!match) return null;
|
|
6039
|
+
else {
|
|
6040
|
+
state.i += match[0].length;
|
|
6041
|
+
return match[0];
|
|
6042
|
+
}
|
|
6043
|
+
}
|
|
6044
|
+
function white(state) {
|
|
6045
|
+
$(/^\s*/, state);
|
|
6046
|
+
}
|
|
6047
|
+
var numberRegexp, tuples;
|
|
6048
|
+
var init_convert_wkt_to_geometry = __esm({
|
|
6049
|
+
"../gis/src/lib/geometry-converters/wkb/convert-wkt-to-geometry.ts"() {
|
|
6050
|
+
"use strict";
|
|
6051
|
+
numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
|
|
6052
|
+
tuples = new RegExp("^" + numberRegexp.source + "(\\s" + numberRegexp.source + "){1,}");
|
|
6053
|
+
}
|
|
6054
|
+
});
|
|
6055
|
+
|
|
6056
|
+
// ../gis/src/lib/geometry-converters/wkb/get-wkb-geometry-statistics.ts
|
|
6057
|
+
function getWKBGeometryStatistics(input) {
|
|
6058
|
+
const statistics = (0, import_wkb2.scanWKB)(input);
|
|
6059
|
+
return {
|
|
6060
|
+
geometryType: getGeometryTypeCode(statistics.header.geometryType) + getDimensionOffset(statistics.header.dimension),
|
|
6061
|
+
...statistics.bounds ? { bbox: { ...statistics.bounds } } : {}
|
|
6062
|
+
};
|
|
6063
|
+
}
|
|
6064
|
+
function getGeometryTypeCode(geometryType) {
|
|
6065
|
+
return [
|
|
6066
|
+
"Point",
|
|
6067
|
+
"LineString",
|
|
6068
|
+
"Polygon",
|
|
6069
|
+
"MultiPoint",
|
|
6070
|
+
"MultiLineString",
|
|
6071
|
+
"MultiPolygon",
|
|
6072
|
+
"GeometryCollection"
|
|
6073
|
+
].indexOf(geometryType) + 1;
|
|
6074
|
+
}
|
|
6075
|
+
function getDimensionOffset(dimension) {
|
|
6076
|
+
return dimension === "xyz" ? 1e3 : dimension === "xym" ? 2e3 : dimension === "xyzm" ? 3e3 : 0;
|
|
6077
|
+
}
|
|
6078
|
+
var import_wkb2;
|
|
6079
|
+
var init_get_wkb_geometry_statistics = __esm({
|
|
6080
|
+
"../gis/src/lib/geometry-converters/wkb/get-wkb-geometry-statistics.ts"() {
|
|
6081
|
+
"use strict";
|
|
6082
|
+
import_wkb2 = require("@math.gl/wkb");
|
|
6083
|
+
}
|
|
6084
|
+
});
|
|
6085
|
+
|
|
6086
|
+
// ../gis/src/lib/geoarrow/metadata-utils.ts
|
|
6087
|
+
var init_metadata_utils = __esm({
|
|
6088
|
+
"../gis/src/lib/geoarrow/metadata-utils.ts"() {
|
|
6089
|
+
"use strict";
|
|
6090
|
+
init_src3();
|
|
6091
|
+
}
|
|
6092
|
+
});
|
|
6093
|
+
|
|
6094
|
+
// ../gis/src/lib/geoarrow/geoparquet-metadata.ts
|
|
6095
|
+
function getGeoMetadata2(metadata) {
|
|
6096
|
+
if (!metadata) {
|
|
6097
|
+
return null;
|
|
6098
|
+
}
|
|
6099
|
+
const stringifiedGeoMetadata = getMetadataValue(metadata, "geo");
|
|
6100
|
+
const geoMetadata = stringifiedGeoMetadata && parseJSONStringMetadata2(stringifiedGeoMetadata);
|
|
6101
|
+
if (!geoMetadata) {
|
|
6102
|
+
return null;
|
|
6103
|
+
}
|
|
6104
|
+
for (const column of Object.values(geoMetadata.columns || {})) {
|
|
6105
|
+
if (column.encoding) {
|
|
6106
|
+
column.encoding = column.encoding.toLowerCase();
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
return geoMetadata;
|
|
6110
|
+
}
|
|
6111
|
+
function parseJSONStringMetadata2(stringifiedMetadata) {
|
|
6112
|
+
if (!stringifiedMetadata) {
|
|
6113
|
+
return null;
|
|
6114
|
+
}
|
|
6115
|
+
try {
|
|
6116
|
+
const metadata = JSON.parse(stringifiedMetadata);
|
|
6117
|
+
if (!metadata || typeof metadata !== "object") {
|
|
6118
|
+
return null;
|
|
6119
|
+
}
|
|
6120
|
+
return metadata;
|
|
6121
|
+
} catch {
|
|
6122
|
+
return null;
|
|
6123
|
+
}
|
|
6124
|
+
}
|
|
6125
|
+
var init_geoparquet_metadata = __esm({
|
|
6126
|
+
"../gis/src/lib/geoarrow/geoparquet-metadata.ts"() {
|
|
6127
|
+
"use strict";
|
|
6128
|
+
init_metadata_utils();
|
|
6129
|
+
}
|
|
6130
|
+
});
|
|
6131
|
+
|
|
6132
|
+
// ../gis/src/lib/table-converters/convert-wkb-table-to-geojson.ts
|
|
6133
|
+
function convertWKBTableToGeoJSON(table, schema) {
|
|
6134
|
+
var _a;
|
|
6135
|
+
const geoMetadata = getGeoMetadata2(schema.metadata);
|
|
6136
|
+
const primaryColumn = geoMetadata == null ? void 0 : geoMetadata.primary_column;
|
|
6137
|
+
if (!primaryColumn) {
|
|
6138
|
+
throw new Error("no geometry column");
|
|
6139
|
+
}
|
|
6140
|
+
const columnMetadata = (_a = geoMetadata.columns) == null ? void 0 : _a[primaryColumn];
|
|
6141
|
+
if (!columnMetadata) {
|
|
6142
|
+
throw new Error(`missing metadata for geometry column "${primaryColumn}"`);
|
|
6143
|
+
}
|
|
6144
|
+
const features = [];
|
|
6145
|
+
const length = getTableLength(table);
|
|
6146
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
6147
|
+
const row = getTableRowAsObject(table, rowIndex);
|
|
6148
|
+
const geometry = parseGeometry2(row[primaryColumn], columnMetadata);
|
|
6149
|
+
delete row[primaryColumn];
|
|
6150
|
+
features.push({ type: "Feature", geometry, properties: row });
|
|
6151
|
+
}
|
|
6152
|
+
return { shape: "geojson-table", schema, type: "FeatureCollection", features };
|
|
6153
|
+
}
|
|
6154
|
+
function parseGeometry2(geometry, columnMetadata) {
|
|
6155
|
+
var _a;
|
|
6156
|
+
switch ((_a = columnMetadata.encoding) == null ? void 0 : _a.toLowerCase()) {
|
|
6157
|
+
case "wkt":
|
|
6158
|
+
return convertWKTToGeometry(geometry) || null;
|
|
6159
|
+
case "wkb":
|
|
6160
|
+
default: {
|
|
6161
|
+
const arrayBuffer = ArrayBuffer.isView(geometry) ? geometry.buffer.slice(geometry.byteOffset, geometry.byteOffset + geometry.byteLength) : geometry;
|
|
6162
|
+
return convertWKBToGeometry(arrayBuffer);
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
}
|
|
6166
|
+
var init_convert_wkb_table_to_geojson = __esm({
|
|
6167
|
+
"../gis/src/lib/table-converters/convert-wkb-table-to-geojson.ts"() {
|
|
6168
|
+
"use strict";
|
|
6169
|
+
init_src4();
|
|
6170
|
+
init_geoparquet_metadata();
|
|
6171
|
+
init_convert_wkb_to_geometry();
|
|
6172
|
+
init_convert_wkt_to_geometry();
|
|
6173
|
+
}
|
|
6174
|
+
});
|
|
6175
|
+
|
|
6176
|
+
// ../gis/src/deprecated.ts
|
|
6177
|
+
var convertWKBTableToGeoJSON2;
|
|
6178
|
+
var init_deprecated2 = __esm({
|
|
6179
|
+
"../gis/src/deprecated.ts"() {
|
|
6180
|
+
"use strict";
|
|
6181
|
+
init_convert_wkb_table_to_geojson();
|
|
6182
|
+
convertWKBTableToGeoJSON2 = ((...args) => convertWKBTableToGeoJSON(
|
|
6183
|
+
...args
|
|
6184
|
+
));
|
|
6185
|
+
}
|
|
6186
|
+
});
|
|
6187
|
+
|
|
6188
|
+
// ../gis/src/index.ts
|
|
6215
6189
|
var init_src5 = __esm({
|
|
6190
|
+
"../gis/src/index.ts"() {
|
|
6191
|
+
"use strict";
|
|
6192
|
+
init_get_wkb_geometry_statistics();
|
|
6193
|
+
init_geoparquet_metadata();
|
|
6194
|
+
init_deprecated2();
|
|
6195
|
+
}
|
|
6196
|
+
});
|
|
6197
|
+
|
|
6198
|
+
// ../arrow/src/index.ts
|
|
6199
|
+
var init_src6 = __esm({
|
|
6216
6200
|
"../arrow/src/index.ts"() {
|
|
6217
6201
|
"use strict";
|
|
6218
6202
|
init_indexed_arrow_table();
|
|
@@ -6251,7 +6235,7 @@ function isSerializedArrowTable(value) {
|
|
|
6251
6235
|
var init_parquet_worker_transport = __esm({
|
|
6252
6236
|
"src/lib/parquet-worker-transport.ts"() {
|
|
6253
6237
|
"use strict";
|
|
6254
|
-
|
|
6238
|
+
init_src6();
|
|
6255
6239
|
}
|
|
6256
6240
|
});
|
|
6257
6241
|
|
|
@@ -6596,10 +6580,11 @@ function getGeoArrowMetadataFromGeoParquetField2(field, columnMetadata) {
|
|
|
6596
6580
|
if (!extensionName) {
|
|
6597
6581
|
return null;
|
|
6598
6582
|
}
|
|
6599
|
-
|
|
6583
|
+
const isBinaryGeospatialEncoding = normalizedEncoding === "wkb" || normalizedEncoding === "geometry" || normalizedEncoding === "geography";
|
|
6584
|
+
if (isBinaryGeospatialEncoding && !isBinaryFieldType2(field.type)) {
|
|
6600
6585
|
return null;
|
|
6601
6586
|
}
|
|
6602
|
-
if (
|
|
6587
|
+
if (!isBinaryGeospatialEncoding && (isBinaryFieldType2(field.type) || isStringFieldType2(field.type))) {
|
|
6603
6588
|
return null;
|
|
6604
6589
|
}
|
|
6605
6590
|
const extensionMetadata = {};
|
|
@@ -6613,6 +6598,14 @@ function getGeoArrowMetadataFromGeoParquetField2(field, columnMetadata) {
|
|
|
6613
6598
|
if (columnMetadata.edges && columnMetadata.edges !== "planar") {
|
|
6614
6599
|
extensionMetadata.edges = columnMetadata.edges;
|
|
6615
6600
|
}
|
|
6601
|
+
if (normalizedEncoding === "geography" && !extensionMetadata.edges) {
|
|
6602
|
+
extensionMetadata.edges = "spherical";
|
|
6603
|
+
}
|
|
6604
|
+
for (const [metadataKey, metadataValue] of Object.entries(columnMetadata)) {
|
|
6605
|
+
if (metadataValue !== void 0 && metadataValue !== null && !["encoding", "geometry_types", "crs", "edges"].includes(metadataKey)) {
|
|
6606
|
+
extensionMetadata[metadataKey] = metadataValue;
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6616
6609
|
return Object.keys(extensionMetadata).length > 0 ? { extensionName, extensionMetadata } : { extensionName };
|
|
6617
6610
|
}
|
|
6618
6611
|
function isValidGeoParquetMetadata(geoMetadata) {
|
|
@@ -6628,6 +6621,7 @@ function synthesizeGeoParquetColumnMetadata(geometryMetadata) {
|
|
|
6628
6621
|
encoding,
|
|
6629
6622
|
geometry_types: geometryTypes
|
|
6630
6623
|
};
|
|
6624
|
+
const preservedMetadata = preserveUnknownGeoParquetColumnMetadata(geometryMetadata);
|
|
6631
6625
|
if (geometryMetadata.crs === void 0) {
|
|
6632
6626
|
columnMetadata.crs = null;
|
|
6633
6627
|
} else if (typeof geometryMetadata.crs === "object") {
|
|
@@ -6638,7 +6632,7 @@ function synthesizeGeoParquetColumnMetadata(geometryMetadata) {
|
|
|
6638
6632
|
if (geometryMetadata.edges) {
|
|
6639
6633
|
columnMetadata.edges = geometryMetadata.edges;
|
|
6640
6634
|
}
|
|
6641
|
-
return columnMetadata;
|
|
6635
|
+
return { ...preservedMetadata, ...columnMetadata };
|
|
6642
6636
|
}
|
|
6643
6637
|
function isDefaultCRS84Identifier(crs) {
|
|
6644
6638
|
const normalizedCRS = crs.toUpperCase();
|
|
@@ -6652,7 +6646,7 @@ function pickValidOptionalGeoParquetColumnMetadata(columnMetadata) {
|
|
|
6652
6646
|
if (!columnMetadata) {
|
|
6653
6647
|
return {};
|
|
6654
6648
|
}
|
|
6655
|
-
const nextColumnMetadata =
|
|
6649
|
+
const nextColumnMetadata = preserveUnknownGeoParquetColumnMetadata(columnMetadata);
|
|
6656
6650
|
if (columnMetadata.orientation === "counterclockwise") {
|
|
6657
6651
|
nextColumnMetadata.orientation = columnMetadata.orientation;
|
|
6658
6652
|
}
|
|
@@ -6667,6 +6661,33 @@ function pickValidOptionalGeoParquetColumnMetadata(columnMetadata) {
|
|
|
6667
6661
|
}
|
|
6668
6662
|
return nextColumnMetadata;
|
|
6669
6663
|
}
|
|
6664
|
+
function preserveUnknownGeoParquetColumnMetadata(columnMetadata) {
|
|
6665
|
+
if (!columnMetadata) {
|
|
6666
|
+
return {};
|
|
6667
|
+
}
|
|
6668
|
+
const preservedMetadata = {};
|
|
6669
|
+
for (const [metadataKey, metadataValue] of Object.entries(columnMetadata)) {
|
|
6670
|
+
if (metadataValue !== void 0 && ![
|
|
6671
|
+
"encoding",
|
|
6672
|
+
"geometry_types",
|
|
6673
|
+
"crs",
|
|
6674
|
+
"edges",
|
|
6675
|
+
"orientation",
|
|
6676
|
+
"bbox",
|
|
6677
|
+
"epoch",
|
|
6678
|
+
"covering"
|
|
6679
|
+
].includes(metadataKey)) {
|
|
6680
|
+
preservedMetadata[metadataKey] = metadataValue;
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6683
|
+
return preservedMetadata;
|
|
6684
|
+
}
|
|
6685
|
+
function isBinaryFieldType2(fieldType) {
|
|
6686
|
+
return typeof fieldType === "string" && (fieldType === "binary" || fieldType === "binary-view");
|
|
6687
|
+
}
|
|
6688
|
+
function isStringFieldType2(fieldType) {
|
|
6689
|
+
return typeof fieldType === "string" && (fieldType === "utf8" || fieldType === "utf8-view");
|
|
6690
|
+
}
|
|
6670
6691
|
function isValidBBox(bbox) {
|
|
6671
6692
|
if (!Array.isArray(bbox) || ![4, 6, 8].includes(bbox.length)) {
|
|
6672
6693
|
return false;
|
|
@@ -6696,9 +6717,9 @@ var init_geospatial_metadata2 = __esm({
|
|
|
6696
6717
|
"dist/lib/geo/geospatial-metadata.js"() {
|
|
6697
6718
|
"use strict";
|
|
6698
6719
|
arrow9 = __toESM(require("apache-arrow"), 1);
|
|
6699
|
-
init_src4();
|
|
6700
|
-
init_geospatial_metadata_zod_schema();
|
|
6701
6720
|
init_src3();
|
|
6721
|
+
init_geospatial_metadata_zod_schema();
|
|
6722
|
+
init_src4();
|
|
6702
6723
|
GEOARROW_EXTENSION_NAME_KEY2 = "ARROW:extension:name";
|
|
6703
6724
|
GEOARROW_EXTENSION_METADATA_KEY2 = "ARROW:extension:metadata";
|
|
6704
6725
|
GEOPARQUET_VERSION = "1.1.0";
|
|
@@ -6717,6 +6738,8 @@ var init_geospatial_metadata2 = __esm({
|
|
|
6717
6738
|
];
|
|
6718
6739
|
GEOPARQUET_TO_GEOARROW_ENCODINGS2 = {
|
|
6719
6740
|
wkb: "geoarrow.wkb",
|
|
6741
|
+
geometry: "geoarrow.wkb",
|
|
6742
|
+
geography: "geoarrow.wkb",
|
|
6720
6743
|
point: "geoarrow.point",
|
|
6721
6744
|
linestring: "geoarrow.linestring",
|
|
6722
6745
|
polygon: "geoarrow.polygon",
|
|
@@ -7030,7 +7053,7 @@ function convertArrowBatchToObjectRows2(batch) {
|
|
|
7030
7053
|
var init_convert_parquet_tables2 = __esm({
|
|
7031
7054
|
"dist/lib/parsers/convert-parquet-tables.js"() {
|
|
7032
7055
|
"use strict";
|
|
7033
|
-
|
|
7056
|
+
init_src4();
|
|
7034
7057
|
}
|
|
7035
7058
|
});
|
|
7036
7059
|
|
|
@@ -7075,8 +7098,8 @@ function convertGeoParquetArrowBatch(batch) {
|
|
|
7075
7098
|
var init_parse_geoparquet_to_geojson = __esm({
|
|
7076
7099
|
"dist/lib/parsers/parse-geoparquet-to-geojson.js"() {
|
|
7077
7100
|
"use strict";
|
|
7101
|
+
init_src5();
|
|
7078
7102
|
init_src4();
|
|
7079
|
-
init_src3();
|
|
7080
7103
|
init_parse_parquet_tables();
|
|
7081
7104
|
}
|
|
7082
7105
|
});
|
|
@@ -7135,7 +7158,7 @@ function isSerializedArrowTable2(value) {
|
|
|
7135
7158
|
var init_parquet_worker_transport2 = __esm({
|
|
7136
7159
|
"dist/lib/parquet-worker-transport.js"() {
|
|
7137
7160
|
"use strict";
|
|
7138
|
-
|
|
7161
|
+
init_src6();
|
|
7139
7162
|
}
|
|
7140
7163
|
});
|
|
7141
7164
|
|
|
@@ -7255,7 +7278,7 @@ var init_geoparquet_loader = __esm({
|
|
|
7255
7278
|
"use strict";
|
|
7256
7279
|
init_parquet_format();
|
|
7257
7280
|
init_parquet_loader_options();
|
|
7258
|
-
VERSION5 = true ? "5.0.0-alpha.
|
|
7281
|
+
VERSION5 = true ? "5.0.0-alpha.6" : "latest";
|
|
7259
7282
|
GeoParquetLoader = {
|
|
7260
7283
|
...ParquetFormat,
|
|
7261
7284
|
dataType: null,
|
|
@@ -7321,26 +7344,26 @@ function encodeUtf8(text) {
|
|
|
7321
7344
|
function decodeString(binary, start = 0, end = binary.length) {
|
|
7322
7345
|
return decodeUtf8(binary.subarray(start, end));
|
|
7323
7346
|
}
|
|
7324
|
-
function
|
|
7347
|
+
function getDataView(binary) {
|
|
7325
7348
|
return new DataView(binary.buffer, binary.byteOffset, binary.byteLength);
|
|
7326
7349
|
}
|
|
7327
7350
|
function readInt32LE(binary, offset) {
|
|
7328
|
-
return
|
|
7351
|
+
return getDataView(binary).getInt32(offset, true);
|
|
7329
7352
|
}
|
|
7330
7353
|
function readUInt32LE(binary, offset) {
|
|
7331
|
-
return
|
|
7354
|
+
return getDataView(binary).getUint32(offset, true);
|
|
7332
7355
|
}
|
|
7333
7356
|
function readInt64LE(binary, offset) {
|
|
7334
|
-
return
|
|
7357
|
+
return getDataView(binary).getBigInt64(offset, true);
|
|
7335
7358
|
}
|
|
7336
7359
|
function readUInt64LE(binary, offset) {
|
|
7337
|
-
return
|
|
7360
|
+
return getDataView(binary).getBigUint64(offset, true);
|
|
7338
7361
|
}
|
|
7339
7362
|
function readFloatLE(binary, offset) {
|
|
7340
|
-
return
|
|
7363
|
+
return getDataView(binary).getFloat32(offset, true);
|
|
7341
7364
|
}
|
|
7342
7365
|
function readDoubleLE(binary, offset) {
|
|
7343
|
-
return
|
|
7366
|
+
return getDataView(binary).getFloat64(offset, true);
|
|
7344
7367
|
}
|
|
7345
7368
|
function concatUint8Arrays(chunks) {
|
|
7346
7369
|
let byteLength = 0;
|
|
@@ -7356,19 +7379,19 @@ function concatUint8Arrays(chunks) {
|
|
|
7356
7379
|
return result;
|
|
7357
7380
|
}
|
|
7358
7381
|
function writeInt32LE(binary, value, offset) {
|
|
7359
|
-
|
|
7382
|
+
getDataView(binary).setInt32(offset, value, true);
|
|
7360
7383
|
}
|
|
7361
7384
|
function writeUInt32LE(binary, value, offset) {
|
|
7362
|
-
|
|
7385
|
+
getDataView(binary).setUint32(offset, value, true);
|
|
7363
7386
|
}
|
|
7364
7387
|
function writeInt64LE(binary, value, offset) {
|
|
7365
|
-
|
|
7388
|
+
getDataView(binary).setBigInt64(offset, BigInt(value), true);
|
|
7366
7389
|
}
|
|
7367
7390
|
function writeFloatLE(binary, value, offset) {
|
|
7368
|
-
|
|
7391
|
+
getDataView(binary).setFloat32(offset, value, true);
|
|
7369
7392
|
}
|
|
7370
7393
|
function writeDoubleLE(binary, value, offset) {
|
|
7371
|
-
|
|
7394
|
+
getDataView(binary).setFloat64(offset, value, true);
|
|
7372
7395
|
}
|
|
7373
7396
|
var TEXT_DECODER, TEXT_ENCODER;
|
|
7374
7397
|
var init_binary_utils = __esm({
|
|
@@ -12874,7 +12897,7 @@ var init_default_codecs = __esm({
|
|
|
12874
12897
|
});
|
|
12875
12898
|
|
|
12876
12899
|
// ../compression/src/index.ts
|
|
12877
|
-
var
|
|
12900
|
+
var init_src7 = __esm({
|
|
12878
12901
|
"../compression/src/index.ts"() {
|
|
12879
12902
|
"use strict";
|
|
12880
12903
|
init_compression();
|
|
@@ -12987,7 +13010,7 @@ var PARQUET_COMPRESSION_METHODS, ParquetSnappyDecompressor;
|
|
|
12987
13010
|
var init_compression2 = __esm({
|
|
12988
13011
|
"src/parquetjs/compression.ts"() {
|
|
12989
13012
|
"use strict";
|
|
12990
|
-
|
|
13013
|
+
init_src7();
|
|
12991
13014
|
init_snappy_decompressor_hysnappy();
|
|
12992
13015
|
init_src2();
|
|
12993
13016
|
init_binary_utils();
|
|
@@ -13151,7 +13174,7 @@ var init_parse_bson = __esm({
|
|
|
13151
13174
|
});
|
|
13152
13175
|
|
|
13153
13176
|
// ../bson/src/index.ts
|
|
13154
|
-
var
|
|
13177
|
+
var init_src8 = __esm({
|
|
13155
13178
|
"../bson/src/index.ts"() {
|
|
13156
13179
|
"use strict";
|
|
13157
13180
|
init_bson_writer();
|
|
@@ -13560,7 +13583,7 @@ var PARQUET_LOGICAL_TYPES, kMillisPerDay;
|
|
|
13560
13583
|
var init_types = __esm({
|
|
13561
13584
|
"src/parquetjs/schema/types.ts"() {
|
|
13562
13585
|
"use strict";
|
|
13563
|
-
|
|
13586
|
+
init_src8();
|
|
13564
13587
|
init_binary_utils();
|
|
13565
13588
|
PARQUET_LOGICAL_TYPES = {
|
|
13566
13589
|
BOOLEAN: {
|
|
@@ -23288,7 +23311,7 @@ async function getSchemaFromParquetReader(reader) {
|
|
|
23288
23311
|
var init_get_parquet_schema = __esm({
|
|
23289
23312
|
"src/lib/parsers/get-parquet-schema.ts"() {
|
|
23290
23313
|
"use strict";
|
|
23291
|
-
|
|
23314
|
+
init_src3();
|
|
23292
23315
|
init_convert_schema_from_parquet();
|
|
23293
23316
|
init_geospatial_metadata();
|
|
23294
23317
|
}
|
|
@@ -24699,7 +24722,7 @@ var init_parse_parquet_to_arrow_js = __esm({
|
|
|
24699
24722
|
"src/lib/parsers/parse-parquet-to-arrow-js.ts"() {
|
|
24700
24723
|
"use strict";
|
|
24701
24724
|
arrow12 = __toESM(require("apache-arrow"), 1);
|
|
24702
|
-
|
|
24725
|
+
init_src4();
|
|
24703
24726
|
init_compression2();
|
|
24704
24727
|
init_parquet_reader();
|
|
24705
24728
|
init_shred();
|
|
@@ -24950,7 +24973,7 @@ function doLongitudeIntervalsIntersect(firstWest, firstEast, secondWest, secondE
|
|
|
24950
24973
|
var init_geoparquet_covering = __esm({
|
|
24951
24974
|
"src/lib/geo/geoparquet-covering.ts"() {
|
|
24952
24975
|
"use strict";
|
|
24953
|
-
|
|
24976
|
+
init_src3();
|
|
24954
24977
|
}
|
|
24955
24978
|
});
|
|
24956
24979
|
|
|
@@ -25963,7 +25986,7 @@ function resolveParquetSourceWorkerUrl() {
|
|
|
25963
25986
|
}
|
|
25964
25987
|
}
|
|
25965
25988
|
function getParquetSourceWorkerFile() {
|
|
25966
|
-
return "
|
|
25989
|
+
return "../dist/parquet-source-worker.js";
|
|
25967
25990
|
}
|
|
25968
25991
|
var import_meta5, PARQUET_SOURCE_WORKER_URL;
|
|
25969
25992
|
var init_parquet_source_worker_url = __esm({
|
|
@@ -27029,10 +27052,10 @@ var _preloadParquetSourceLoader, _createMetadataDataSource, ParquetSourceLoaderB
|
|
|
27029
27052
|
var init_parquet_source_loader = __esm({
|
|
27030
27053
|
"src/parquet-source-loader.ts"() {
|
|
27031
27054
|
"use strict";
|
|
27032
|
-
|
|
27055
|
+
init_src6();
|
|
27033
27056
|
init_src2();
|
|
27034
|
-
init_src3();
|
|
27035
27057
|
init_src4();
|
|
27058
|
+
init_src5();
|
|
27036
27059
|
init_get_parquet_schema();
|
|
27037
27060
|
init_geoparquet_covering();
|
|
27038
27061
|
init_parquet_bloom_filter();
|
|
@@ -27215,7 +27238,7 @@ var init_parquet_source_loader = __esm({
|
|
|
27215
27238
|
);
|
|
27216
27239
|
const projectedColumns = normalizeColumns(readOptions.columns, initialization.schema);
|
|
27217
27240
|
const predicateColumns = physicalPlan.predicate ? getParquetPredicateColumns(physicalPlan.predicate) : [];
|
|
27218
|
-
const geoMetadata = readOptions.bbox ?
|
|
27241
|
+
const geoMetadata = readOptions.bbox ? getGeoMetadata2(initialization.schema.metadata) : void 0;
|
|
27219
27242
|
const geometryColumn = readOptions.bbox ? readOptions.geometryColumn || (geoMetadata == null ? void 0 : geoMetadata.primary_column) : void 0;
|
|
27220
27243
|
const filterColumns = [
|
|
27221
27244
|
.../* @__PURE__ */ new Set([...predicateColumns, ...geometryColumn ? [geometryColumn] : []])
|
|
@@ -28077,7 +28100,7 @@ init_geoparquet_loader();
|
|
|
28077
28100
|
|
|
28078
28101
|
// dist/parquet-js-loader-types.js
|
|
28079
28102
|
init_parquet_format();
|
|
28080
|
-
var VERSION8 = true ? "5.0.0-alpha.
|
|
28103
|
+
var VERSION8 = true ? "5.0.0-alpha.6" : "latest";
|
|
28081
28104
|
var DEFAULT_PARQUET_JS_OPTIONS3 = {
|
|
28082
28105
|
columns: void 0,
|
|
28083
28106
|
preserveBinary: false,
|
|
@@ -28104,7 +28127,7 @@ var ParquetJSLoader2 = {
|
|
|
28104
28127
|
|
|
28105
28128
|
// dist/parquet-source-loader-types.js
|
|
28106
28129
|
init_parquet_format();
|
|
28107
|
-
var VERSION10 = true ? "5.0.0-alpha.
|
|
28130
|
+
var VERSION10 = true ? "5.0.0-alpha.6" : "latest";
|
|
28108
28131
|
async function preloadParquetSourceLoader2() {
|
|
28109
28132
|
const { ParquetSourceLoaderWithParser: ParquetSourceLoaderWithParser2 } = await Promise.resolve().then(() => (init_parquet_source_loader(), parquet_source_loader_exports));
|
|
28110
28133
|
return ParquetSourceLoaderWithParser2;
|
|
@@ -28204,7 +28227,7 @@ var PARQUET_SOURCE_CAPABILITIES2 = Object.freeze({
|
|
|
28204
28227
|
});
|
|
28205
28228
|
|
|
28206
28229
|
// dist/parquet-writer.js
|
|
28207
|
-
|
|
28230
|
+
init_src4();
|
|
28208
28231
|
|
|
28209
28232
|
// dist/lib/encoders/encode-arrow-to-parquet.js
|
|
28210
28233
|
var arrow13 = __toESM(require("apache-arrow"), 1);
|
|
@@ -28228,7 +28251,7 @@ init_normalize_parquet_options2();
|
|
|
28228
28251
|
init_parquet_format();
|
|
28229
28252
|
|
|
28230
28253
|
// dist/lib/constants.js
|
|
28231
|
-
var VERSION11 = true ? "5.0.0-alpha.
|
|
28254
|
+
var VERSION11 = true ? "5.0.0-alpha.6" : "latest";
|
|
28232
28255
|
var PARQUET_MAGIC2 = "PAR1";
|
|
28233
28256
|
var PARQUET_MAGIC_ENCRYPTED2 = "PARE";
|
|
28234
28257
|
var PARQUET_RDLVL_TYPE2 = "INT32";
|
|
@@ -28251,11 +28274,11 @@ var ParquetWriter = {
|
|
|
28251
28274
|
};
|
|
28252
28275
|
|
|
28253
28276
|
// dist/parquet-js-writer.js
|
|
28254
|
-
|
|
28277
|
+
init_src4();
|
|
28255
28278
|
init_normalize_parquet_options2();
|
|
28256
28279
|
|
|
28257
28280
|
// dist/lib/encoders/encode-table-to-parquet-js.js
|
|
28258
|
-
|
|
28281
|
+
init_src3();
|
|
28259
28282
|
|
|
28260
28283
|
// dist/parquetjs/utils/binary-utils.js
|
|
28261
28284
|
var TEXT_DECODER2 = new TextDecoder();
|
|
@@ -28285,26 +28308,26 @@ function encodeUtf82(text) {
|
|
|
28285
28308
|
function decodeString2(binary, start = 0, end = binary.length) {
|
|
28286
28309
|
return decodeUtf82(binary.subarray(start, end));
|
|
28287
28310
|
}
|
|
28288
|
-
function
|
|
28311
|
+
function getDataView2(binary) {
|
|
28289
28312
|
return new DataView(binary.buffer, binary.byteOffset, binary.byteLength);
|
|
28290
28313
|
}
|
|
28291
28314
|
function readInt32LE2(binary, offset) {
|
|
28292
|
-
return
|
|
28315
|
+
return getDataView2(binary).getInt32(offset, true);
|
|
28293
28316
|
}
|
|
28294
28317
|
function readUInt32LE2(binary, offset) {
|
|
28295
|
-
return
|
|
28318
|
+
return getDataView2(binary).getUint32(offset, true);
|
|
28296
28319
|
}
|
|
28297
28320
|
function readInt64LE2(binary, offset) {
|
|
28298
|
-
return
|
|
28321
|
+
return getDataView2(binary).getBigInt64(offset, true);
|
|
28299
28322
|
}
|
|
28300
28323
|
function readUInt64LE2(binary, offset) {
|
|
28301
|
-
return
|
|
28324
|
+
return getDataView2(binary).getBigUint64(offset, true);
|
|
28302
28325
|
}
|
|
28303
28326
|
function readFloatLE2(binary, offset) {
|
|
28304
|
-
return
|
|
28327
|
+
return getDataView2(binary).getFloat32(offset, true);
|
|
28305
28328
|
}
|
|
28306
28329
|
function readDoubleLE2(binary, offset) {
|
|
28307
|
-
return
|
|
28330
|
+
return getDataView2(binary).getFloat64(offset, true);
|
|
28308
28331
|
}
|
|
28309
28332
|
function concatUint8Arrays2(chunks) {
|
|
28310
28333
|
let byteLength = 0;
|
|
@@ -28320,23 +28343,23 @@ function concatUint8Arrays2(chunks) {
|
|
|
28320
28343
|
return result;
|
|
28321
28344
|
}
|
|
28322
28345
|
function writeInt32LE2(binary, value, offset) {
|
|
28323
|
-
|
|
28346
|
+
getDataView2(binary).setInt32(offset, value, true);
|
|
28324
28347
|
}
|
|
28325
28348
|
function writeUInt32LE2(binary, value, offset) {
|
|
28326
|
-
|
|
28349
|
+
getDataView2(binary).setUint32(offset, value, true);
|
|
28327
28350
|
}
|
|
28328
28351
|
function writeInt64LE2(binary, value, offset) {
|
|
28329
|
-
|
|
28352
|
+
getDataView2(binary).setBigInt64(offset, BigInt(value), true);
|
|
28330
28353
|
}
|
|
28331
28354
|
function writeFloatLE2(binary, value, offset) {
|
|
28332
|
-
|
|
28355
|
+
getDataView2(binary).setFloat32(offset, value, true);
|
|
28333
28356
|
}
|
|
28334
28357
|
function writeDoubleLE2(binary, value, offset) {
|
|
28335
|
-
|
|
28358
|
+
getDataView2(binary).setFloat64(offset, value, true);
|
|
28336
28359
|
}
|
|
28337
28360
|
|
|
28338
28361
|
// dist/parquetjs/encoder/parquet-encoder.js
|
|
28339
|
-
|
|
28362
|
+
init_src5();
|
|
28340
28363
|
|
|
28341
28364
|
// dist/parquetjs/codecs/declare.js
|
|
28342
28365
|
function reserveParquetByteArrayOutput2(output, additionalByteLength) {
|
|
@@ -30230,7 +30253,7 @@ var PARQUET_CODECS2 = {
|
|
|
30230
30253
|
};
|
|
30231
30254
|
|
|
30232
30255
|
// dist/parquetjs/compression.js
|
|
30233
|
-
|
|
30256
|
+
init_src7();
|
|
30234
30257
|
init_snappy_decompressor_hysnappy();
|
|
30235
30258
|
init_src2();
|
|
30236
30259
|
var PARQUET_COMPRESSION_METHODS2 = {
|
|
@@ -30350,7 +30373,7 @@ function createParquetDecompressor2(method) {
|
|
|
30350
30373
|
}
|
|
30351
30374
|
|
|
30352
30375
|
// dist/parquetjs/schema/types.js
|
|
30353
|
-
|
|
30376
|
+
init_src8();
|
|
30354
30377
|
var PARQUET_LOGICAL_TYPES2 = {
|
|
30355
30378
|
BOOLEAN: {
|
|
30356
30379
|
primitiveType: "BOOLEAN",
|
|
@@ -39091,7 +39114,7 @@ function formatDataType(dataType) {
|
|
|
39091
39114
|
|
|
39092
39115
|
// dist/parquet-js-writer.js
|
|
39093
39116
|
init_parquet_format();
|
|
39094
|
-
var VERSION12 = true ? "5.0.0-alpha.
|
|
39117
|
+
var VERSION12 = true ? "5.0.0-alpha.6" : "latest";
|
|
39095
39118
|
var DEFAULT_PARQUET_JS_OPTIONS4 = {};
|
|
39096
39119
|
var ParquetJSWriter = {
|
|
39097
39120
|
...ParquetFormat,
|