@loaders.gl/arrow 4.3.2 → 4.4.0-alpha.2
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/arrow-loader.d.ts +1 -1
- package/dist/arrow-worker.js +638 -1292
- package/dist/arrow-writer.js +1 -1
- package/dist/dist.dev.js +2140 -3383
- package/dist/dist.min.js +5 -5
- package/dist/exports/arrow-format.d.ts +12 -0
- package/dist/exports/arrow-format.d.ts.map +1 -0
- package/dist/exports/arrow-format.js +18 -0
- package/dist/exports/arrow-loader.d.ts +1 -1
- package/dist/exports/arrow-loader.d.ts.map +1 -1
- package/dist/exports/arrow-loader.js +1 -1
- package/dist/exports/geoarrow-loader.d.ts +1 -1
- package/dist/exports/geoarrow-loader.d.ts.map +1 -1
- package/dist/geoarrow-loader.d.ts +1 -2
- package/dist/geoarrow-loader.d.ts.map +1 -1
- package/dist/geoarrow-writer.d.ts +3 -3
- package/dist/geoarrow-writer.d.ts.map +1 -1
- package/dist/geoarrow-writer.js +1 -1
- package/dist/index.cjs +39 -952
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -14
- package/dist/lib/parsers/parse-arrow.d.ts +1 -2
- package/dist/lib/parsers/parse-arrow.d.ts.map +1 -1
- package/dist/lib/parsers/parse-arrow.js +1 -1
- package/dist/lib/parsers/parse-geoarrow.d.ts +1 -2
- package/dist/lib/parsers/parse-geoarrow.d.ts.map +1 -1
- package/dist/lib/parsers/parse-geoarrow.js +2 -2
- package/dist/triangulate-on-worker.d.ts +2 -1
- package/dist/triangulate-on-worker.d.ts.map +1 -1
- package/dist/triangulate-on-worker.js +1 -1
- package/dist/triangulation-worker.js +212 -154
- package/dist/workers/triangulation-worker.js +2 -2
- package/package.json +10 -9
- package/src/exports/arrow-format.ts +21 -0
- package/src/exports/arrow-loader.ts +1 -1
- package/src/exports/geoarrow-loader.ts +1 -2
- package/src/geoarrow-loader.ts +6 -2
- package/src/geoarrow-writer.ts +1 -1
- package/src/index.ts +2 -42
- package/src/lib/parsers/parse-arrow.ts +2 -3
- package/src/lib/parsers/parse-geoarrow.ts +8 -4
- package/src/triangulate-on-worker.ts +2 -1
- package/src/workers/triangulation-worker.ts +3 -3
- package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.d.ts +0 -74
- package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.d.ts.map +0 -1
- package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.js +0 -377
- package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts +0 -13
- package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts.map +0 -1
- package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.js +0 -176
- package/dist/lib/geoarrow/get-arrow-bounds.d.ts +0 -11
- package/dist/lib/geoarrow/get-arrow-bounds.d.ts.map +0 -1
- package/dist/lib/geoarrow/get-arrow-bounds.js +0 -34
- package/dist/lib/tables/convert-arrow-schema.d.ts +0 -23
- package/dist/lib/tables/convert-arrow-schema.d.ts.map +0 -1
- package/dist/lib/tables/convert-arrow-schema.js +0 -280
- package/dist/lib/tables/convert-arrow-to-table.d.ts +0 -15
- package/dist/lib/tables/convert-arrow-to-table.d.ts.map +0 -1
- package/dist/lib/tables/convert-arrow-to-table.js +0 -104
- package/dist/lib/tables/convert-table-to-arrow.d.ts +0 -16
- package/dist/lib/tables/convert-table-to-arrow.d.ts.map +0 -1
- package/dist/lib/tables/convert-table-to-arrow.js +0 -56
- package/dist/schema/arrow-table-batch.d.ts +0 -10
- package/dist/schema/arrow-table-batch.d.ts.map +0 -1
- package/dist/schema/arrow-table-batch.js +0 -67
- package/dist/schema/arrow-table-type.d.ts +0 -25
- package/dist/schema/arrow-table-type.d.ts.map +0 -1
- package/dist/schema/arrow-table-type.js +0 -4
- package/src/lib/geoarrow/convert-geoarrow-to-binary-geometry.ts +0 -494
- package/src/lib/geoarrow/convert-geoarrow-to-geojson-geometry.ts +0 -207
- package/src/lib/geoarrow/get-arrow-bounds.ts +0 -41
- package/src/lib/tables/convert-arrow-schema.ts +0 -301
- package/src/lib/tables/convert-arrow-to-table.ts +0 -144
- package/src/lib/tables/convert-table-to-arrow.ts +0 -72
- package/src/schema/arrow-table-batch.ts +0 -82
- package/src/schema/arrow-table-type.ts +0 -30
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// ../../node_modules/tslib/tslib.es6.mjs
|
|
9
|
+
// ../../node_modules/apache-arrow/node_modules/tslib/tslib.es6.mjs
|
|
10
10
|
function __rest(s, e) {
|
|
11
11
|
var t = {};
|
|
12
12
|
for (var p in s)
|
|
@@ -1411,9 +1411,22 @@
|
|
|
1411
1411
|
this.addInt8(0);
|
|
1412
1412
|
this.startVector(1, utf8.length, 1);
|
|
1413
1413
|
this.bb.setPosition(this.space -= utf8.length);
|
|
1414
|
-
|
|
1415
|
-
|
|
1414
|
+
this.bb.bytes().set(utf8, this.space);
|
|
1415
|
+
return this.endVector();
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Create a byte vector.
|
|
1419
|
+
*
|
|
1420
|
+
* @param v The bytes to add
|
|
1421
|
+
* @returns The offset in the buffer where the byte vector starts
|
|
1422
|
+
*/
|
|
1423
|
+
createByteVector(v) {
|
|
1424
|
+
if (v === null || v === void 0) {
|
|
1425
|
+
return 0;
|
|
1416
1426
|
}
|
|
1427
|
+
this.startVector(1, v.length, 1);
|
|
1428
|
+
this.bb.setPosition(this.space -= v.length);
|
|
1429
|
+
this.bb.bytes().set(v, this.space);
|
|
1417
1430
|
return this.endVector();
|
|
1418
1431
|
}
|
|
1419
1432
|
/**
|
|
@@ -3016,9 +3029,9 @@
|
|
|
3016
3029
|
// ../../node_modules/apache-arrow/util/vector.mjs
|
|
3017
3030
|
var vector_exports = {};
|
|
3018
3031
|
__export(vector_exports, {
|
|
3019
|
-
clampIndex: () => clampIndex,
|
|
3020
3032
|
clampRange: () => clampRange,
|
|
3021
|
-
createElementComparator: () => createElementComparator
|
|
3033
|
+
createElementComparator: () => createElementComparator,
|
|
3034
|
+
wrapIndex: () => wrapIndex
|
|
3022
3035
|
});
|
|
3023
3036
|
|
|
3024
3037
|
// ../../node_modules/apache-arrow/util/pretty.mjs
|
|
@@ -3059,9 +3072,23 @@
|
|
|
3059
3072
|
__export(bn_exports, {
|
|
3060
3073
|
BN: () => BN,
|
|
3061
3074
|
bigNumToBigInt: () => bigNumToBigInt,
|
|
3075
|
+
bigNumToNumber: () => bigNumToNumber,
|
|
3062
3076
|
bigNumToString: () => bigNumToString,
|
|
3063
3077
|
isArrowBigNumSymbol: () => isArrowBigNumSymbol
|
|
3064
3078
|
});
|
|
3079
|
+
|
|
3080
|
+
// ../../node_modules/apache-arrow/util/bigint.mjs
|
|
3081
|
+
function bigIntToNumber(number) {
|
|
3082
|
+
if (typeof number === "bigint" && (number < Number.MIN_SAFE_INTEGER || number > Number.MAX_SAFE_INTEGER)) {
|
|
3083
|
+
throw new TypeError(`${number} is not safe to convert to a number.`);
|
|
3084
|
+
}
|
|
3085
|
+
return Number(number);
|
|
3086
|
+
}
|
|
3087
|
+
function divideBigInts(number, divisor) {
|
|
3088
|
+
return bigIntToNumber(number / divisor) + bigIntToNumber(number % divisor) / bigIntToNumber(divisor);
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
// ../../node_modules/apache-arrow/util/bn.mjs
|
|
3065
3092
|
var isArrowBigNumSymbol = Symbol.for("isArrowBigNum");
|
|
3066
3093
|
function BigNum(x, ...xs) {
|
|
3067
3094
|
if (xs.length === 0) {
|
|
@@ -3073,8 +3100,8 @@
|
|
|
3073
3100
|
BigNum.prototype.toJSON = function() {
|
|
3074
3101
|
return `"${bigNumToString(this)}"`;
|
|
3075
3102
|
};
|
|
3076
|
-
BigNum.prototype.valueOf = function() {
|
|
3077
|
-
return bigNumToNumber(this);
|
|
3103
|
+
BigNum.prototype.valueOf = function(scale) {
|
|
3104
|
+
return bigNumToNumber(this, scale);
|
|
3078
3105
|
};
|
|
3079
3106
|
BigNum.prototype.toString = function() {
|
|
3080
3107
|
return bigNumToString(this);
|
|
@@ -3105,25 +3132,34 @@
|
|
|
3105
3132
|
Object.assign(SignedBigNum.prototype, BigNum.prototype, { "constructor": SignedBigNum, "signed": true, "TypedArray": Int32Array, "BigIntArray": BigInt64Array });
|
|
3106
3133
|
Object.assign(UnsignedBigNum.prototype, BigNum.prototype, { "constructor": UnsignedBigNum, "signed": false, "TypedArray": Uint32Array, "BigIntArray": BigUint64Array });
|
|
3107
3134
|
Object.assign(DecimalBigNum.prototype, BigNum.prototype, { "constructor": DecimalBigNum, "signed": true, "TypedArray": Uint32Array, "BigIntArray": BigUint64Array });
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3135
|
+
var TWO_TO_THE_64 = BigInt(4294967296) * BigInt(4294967296);
|
|
3136
|
+
var TWO_TO_THE_64_MINUS_1 = TWO_TO_THE_64 - BigInt(1);
|
|
3137
|
+
function bigNumToNumber(bn, scale) {
|
|
3138
|
+
const { buffer, byteOffset, byteLength, "signed": signed } = bn;
|
|
3139
|
+
const words = new BigUint64Array(buffer, byteOffset, byteLength / 8);
|
|
3111
3140
|
const negative = signed && words.at(-1) & BigInt(1) << BigInt(63);
|
|
3112
|
-
let number =
|
|
3113
|
-
let i =
|
|
3114
|
-
if (
|
|
3141
|
+
let number = BigInt(0);
|
|
3142
|
+
let i = 0;
|
|
3143
|
+
if (negative) {
|
|
3115
3144
|
for (const word of words) {
|
|
3116
|
-
number
|
|
3145
|
+
number |= (word ^ TWO_TO_THE_64_MINUS_1) * (BigInt(1) << BigInt(64 * i++));
|
|
3117
3146
|
}
|
|
3147
|
+
number *= BigInt(-1);
|
|
3148
|
+
number -= BigInt(1);
|
|
3118
3149
|
} else {
|
|
3119
3150
|
for (const word of words) {
|
|
3120
|
-
number
|
|
3151
|
+
number |= word * (BigInt(1) << BigInt(64 * i++));
|
|
3121
3152
|
}
|
|
3122
|
-
number *= BigInt(-1);
|
|
3123
3153
|
}
|
|
3124
|
-
|
|
3154
|
+
if (typeof scale === "number") {
|
|
3155
|
+
const denominator = BigInt(Math.pow(10, scale));
|
|
3156
|
+
const quotient = number / denominator;
|
|
3157
|
+
const remainder = number % denominator;
|
|
3158
|
+
return bigIntToNumber(quotient) + bigIntToNumber(remainder) / bigIntToNumber(denominator);
|
|
3159
|
+
}
|
|
3160
|
+
return bigIntToNumber(number);
|
|
3125
3161
|
}
|
|
3126
|
-
|
|
3162
|
+
function bigNumToString(a) {
|
|
3127
3163
|
if (a.byteLength === 8) {
|
|
3128
3164
|
const bigIntArray = new a["BigIntArray"](a.buffer, a.byteOffset, 1);
|
|
3129
3165
|
return `${bigIntArray[0]}`;
|
|
@@ -3146,15 +3182,15 @@
|
|
|
3146
3182
|
}
|
|
3147
3183
|
const negated = unsignedBigNumToString(array);
|
|
3148
3184
|
return `-${negated}`;
|
|
3149
|
-
}
|
|
3150
|
-
|
|
3185
|
+
}
|
|
3186
|
+
function bigNumToBigInt(a) {
|
|
3151
3187
|
if (a.byteLength === 8) {
|
|
3152
3188
|
const bigIntArray = new a["BigIntArray"](a.buffer, a.byteOffset, 1);
|
|
3153
3189
|
return bigIntArray[0];
|
|
3154
3190
|
} else {
|
|
3155
3191
|
return bigNumToString(a);
|
|
3156
3192
|
}
|
|
3157
|
-
}
|
|
3193
|
+
}
|
|
3158
3194
|
function unsignedBigNumToString(a) {
|
|
3159
3195
|
let digits = "";
|
|
3160
3196
|
const base64 = new Uint32Array(2);
|
|
@@ -3211,14 +3247,6 @@
|
|
|
3211
3247
|
}
|
|
3212
3248
|
};
|
|
3213
3249
|
|
|
3214
|
-
// ../../node_modules/apache-arrow/util/bigint.mjs
|
|
3215
|
-
function bigIntToNumber(number) {
|
|
3216
|
-
if (typeof number === "bigint" && (number < Number.MIN_SAFE_INTEGER || number > Number.MAX_SAFE_INTEGER)) {
|
|
3217
|
-
throw new TypeError(`${number} is not safe to convert to a number.`);
|
|
3218
|
-
}
|
|
3219
|
-
return Number(number);
|
|
3220
|
-
}
|
|
3221
|
-
|
|
3222
3250
|
// ../../node_modules/apache-arrow/type.mjs
|
|
3223
3251
|
var _a;
|
|
3224
3252
|
var _b;
|
|
@@ -3593,11 +3621,13 @@
|
|
|
3593
3621
|
toString() {
|
|
3594
3622
|
return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
|
|
3595
3623
|
}
|
|
3624
|
+
get ArrayType() {
|
|
3625
|
+
return this.unit === DateUnit.DAY ? Int32Array : BigInt64Array;
|
|
3626
|
+
}
|
|
3596
3627
|
};
|
|
3597
3628
|
_l = Symbol.toStringTag;
|
|
3598
3629
|
Date_[_l] = ((proto) => {
|
|
3599
3630
|
proto.unit = null;
|
|
3600
|
-
proto.ArrayType = Int32Array;
|
|
3601
3631
|
return proto[Symbol.toStringTag] = "Date";
|
|
3602
3632
|
})(Date_.prototype);
|
|
3603
3633
|
var Time_ = class extends DataType {
|
|
@@ -3639,7 +3669,7 @@
|
|
|
3639
3669
|
Timestamp_[_o] = ((proto) => {
|
|
3640
3670
|
proto.unit = null;
|
|
3641
3671
|
proto.timezone = null;
|
|
3642
|
-
proto.ArrayType =
|
|
3672
|
+
proto.ArrayType = BigInt64Array;
|
|
3643
3673
|
return proto[Symbol.toStringTag] = "Timestamp";
|
|
3644
3674
|
})(Timestamp_.prototype);
|
|
3645
3675
|
var Interval_ = class extends DataType {
|
|
@@ -3844,10 +3874,6 @@
|
|
|
3844
3874
|
switch (type.typeId) {
|
|
3845
3875
|
case Type2.Decimal:
|
|
3846
3876
|
return type.bitWidth / 32;
|
|
3847
|
-
case Type2.Timestamp:
|
|
3848
|
-
return 2;
|
|
3849
|
-
case Type2.Date:
|
|
3850
|
-
return 1 + t.unit;
|
|
3851
3877
|
case Type2.Interval:
|
|
3852
3878
|
return 1 + t.unit;
|
|
3853
3879
|
case Type2.FixedSizeList:
|
|
@@ -4314,19 +4340,7 @@
|
|
|
4314
4340
|
};
|
|
4315
4341
|
}
|
|
4316
4342
|
var setEpochMsToDays = (data, index, epochMs) => {
|
|
4317
|
-
data[index] = Math.
|
|
4318
|
-
};
|
|
4319
|
-
var setEpochMsToMillisecondsLong = (data, index, epochMs) => {
|
|
4320
|
-
data[index] = Math.trunc(epochMs % 4294967296);
|
|
4321
|
-
data[index + 1] = Math.trunc(epochMs / 4294967296);
|
|
4322
|
-
};
|
|
4323
|
-
var setEpochMsToMicrosecondsLong = (data, index, epochMs) => {
|
|
4324
|
-
data[index] = Math.trunc(epochMs * 1e3 % 4294967296);
|
|
4325
|
-
data[index + 1] = Math.trunc(epochMs * 1e3 / 4294967296);
|
|
4326
|
-
};
|
|
4327
|
-
var setEpochMsToNanosecondsLong = (data, index, epochMs) => {
|
|
4328
|
-
data[index] = Math.trunc(epochMs * 1e6 % 4294967296);
|
|
4329
|
-
data[index + 1] = Math.trunc(epochMs * 1e6 / 4294967296);
|
|
4343
|
+
data[index] = Math.floor(epochMs / 864e5);
|
|
4330
4344
|
};
|
|
4331
4345
|
var setVariableWidthBytes = (values, valueOffsets, index, value) => {
|
|
4332
4346
|
if (index + 1 < valueOffsets.length) {
|
|
@@ -4361,7 +4375,7 @@
|
|
|
4361
4375
|
setEpochMsToDays(values, index, value.valueOf());
|
|
4362
4376
|
};
|
|
4363
4377
|
var setDateMillisecond = ({ values }, index, value) => {
|
|
4364
|
-
|
|
4378
|
+
values[index] = BigInt(value);
|
|
4365
4379
|
};
|
|
4366
4380
|
var setFixedSizeBinary = ({ stride, values }, index, value) => {
|
|
4367
4381
|
values.set(value.subarray(0, stride), stride * index);
|
|
@@ -4371,10 +4385,18 @@
|
|
|
4371
4385
|
var setDate = (data, index, value) => {
|
|
4372
4386
|
data.type.unit === DateUnit.DAY ? setDateDay(data, index, value) : setDateMillisecond(data, index, value);
|
|
4373
4387
|
};
|
|
4374
|
-
var setTimestampSecond = ({ values }, index, value) =>
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
var
|
|
4388
|
+
var setTimestampSecond = ({ values }, index, value) => {
|
|
4389
|
+
values[index] = BigInt(value / 1e3);
|
|
4390
|
+
};
|
|
4391
|
+
var setTimestampMillisecond = ({ values }, index, value) => {
|
|
4392
|
+
values[index] = BigInt(value);
|
|
4393
|
+
};
|
|
4394
|
+
var setTimestampMicrosecond = ({ values }, index, value) => {
|
|
4395
|
+
values[index] = BigInt(value * 1e3);
|
|
4396
|
+
};
|
|
4397
|
+
var setTimestampNanosecond = ({ values }, index, value) => {
|
|
4398
|
+
values[index] = BigInt(value * 1e6);
|
|
4399
|
+
};
|
|
4378
4400
|
var setTimestamp = (data, index, value) => {
|
|
4379
4401
|
switch (data.type.unit) {
|
|
4380
4402
|
case TimeUnit.SECOND:
|
|
@@ -4679,12 +4701,6 @@
|
|
|
4679
4701
|
return (data, _1) => data.getValid(_1) ? fn(data, _1) : null;
|
|
4680
4702
|
}
|
|
4681
4703
|
var epochDaysToMs = (data, index) => 864e5 * data[index];
|
|
4682
|
-
var epochMillisecondsLongToMs = (data, index) => 4294967296 * data[index + 1] + (data[index] >>> 0);
|
|
4683
|
-
var epochMicrosecondsLongToMs = (data, index) => 4294967296 * (data[index + 1] / 1e3) + (data[index] >>> 0) / 1e3;
|
|
4684
|
-
var epochNanosecondsLongToMs = (data, index) => 4294967296 * (data[index + 1] / 1e6) + (data[index] >>> 0) / 1e6;
|
|
4685
|
-
var epochMillisecondsToDate = (epochMs) => new Date(epochMs);
|
|
4686
|
-
var epochDaysToDate = (data, index) => epochMillisecondsToDate(epochDaysToMs(data, index));
|
|
4687
|
-
var epochMillisecondsLongToDate = (data, index) => epochMillisecondsToDate(epochMillisecondsLongToMs(data, index));
|
|
4688
4704
|
var getNull = (_data, _index) => null;
|
|
4689
4705
|
var getVariableWidthBytes = (values, valueOffsets, index) => {
|
|
4690
4706
|
if (index + 1 >= valueOffsets.length) {
|
|
@@ -4699,8 +4715,8 @@
|
|
|
4699
4715
|
const byte = values[idx >> 3];
|
|
4700
4716
|
return (byte & 1 << idx % 8) !== 0;
|
|
4701
4717
|
};
|
|
4702
|
-
var getDateDay = ({ values }, index) =>
|
|
4703
|
-
var getDateMillisecond = ({ values }, index) =>
|
|
4718
|
+
var getDateDay = ({ values }, index) => epochDaysToMs(values, index);
|
|
4719
|
+
var getDateMillisecond = ({ values }, index) => bigIntToNumber(values[index]);
|
|
4704
4720
|
var getNumeric = ({ stride, values }, index) => values[stride * index];
|
|
4705
4721
|
var getFloat16 = ({ stride, values }, index) => uint16ToFloat64(values[stride * index]);
|
|
4706
4722
|
var getBigInts = ({ values }, index) => values[index];
|
|
@@ -4713,10 +4729,10 @@
|
|
|
4713
4729
|
var getInt = ({ values }, index) => values[index];
|
|
4714
4730
|
var getFloat = ({ type, values }, index) => type.precision !== Precision.HALF ? values[index] : uint16ToFloat64(values[index]);
|
|
4715
4731
|
var getDate = (data, index) => data.type.unit === DateUnit.DAY ? getDateDay(data, index) : getDateMillisecond(data, index);
|
|
4716
|
-
var getTimestampSecond = ({ values }, index) => 1e3 *
|
|
4717
|
-
var getTimestampMillisecond = ({ values }, index) =>
|
|
4718
|
-
var getTimestampMicrosecond = ({ values }, index) =>
|
|
4719
|
-
var getTimestampNanosecond = ({ values }, index) =>
|
|
4732
|
+
var getTimestampSecond = ({ values }, index) => 1e3 * bigIntToNumber(values[index]);
|
|
4733
|
+
var getTimestampMillisecond = ({ values }, index) => bigIntToNumber(values[index]);
|
|
4734
|
+
var getTimestampMicrosecond = ({ values }, index) => divideBigInts(values[index], BigInt(1e3));
|
|
4735
|
+
var getTimestampNanosecond = ({ values }, index) => divideBigInts(values[index], BigInt(1e6));
|
|
4720
4736
|
var getTimestamp = (data, index) => {
|
|
4721
4737
|
switch (data.type.unit) {
|
|
4722
4738
|
case TimeUnit.SECOND:
|
|
@@ -4865,12 +4881,18 @@
|
|
|
4865
4881
|
// ../../node_modules/apache-arrow/row/map.mjs
|
|
4866
4882
|
var kKeys = Symbol.for("keys");
|
|
4867
4883
|
var kVals = Symbol.for("vals");
|
|
4884
|
+
var kKeysAsStrings = Symbol.for("kKeysAsStrings");
|
|
4885
|
+
var _kKeysAsStrings = Symbol.for("_kKeysAsStrings");
|
|
4868
4886
|
var MapRow = class {
|
|
4869
4887
|
constructor(slice) {
|
|
4870
4888
|
this[kKeys] = new Vector([slice.children[0]]).memoize();
|
|
4871
4889
|
this[kVals] = slice.children[1];
|
|
4872
4890
|
return new Proxy(this, new MapRowProxyHandler());
|
|
4873
4891
|
}
|
|
4892
|
+
/** @ignore */
|
|
4893
|
+
get [kKeysAsStrings]() {
|
|
4894
|
+
return this[_kKeysAsStrings] || (this[_kKeysAsStrings] = Array.from(this[kKeys].toArray(), String));
|
|
4895
|
+
}
|
|
4874
4896
|
[Symbol.iterator]() {
|
|
4875
4897
|
return new MapRowIterator(this[kKeys], this[kVals]);
|
|
4876
4898
|
}
|
|
@@ -4932,13 +4954,13 @@
|
|
|
4932
4954
|
return true;
|
|
4933
4955
|
}
|
|
4934
4956
|
ownKeys(row) {
|
|
4935
|
-
return row[
|
|
4957
|
+
return row[kKeysAsStrings];
|
|
4936
4958
|
}
|
|
4937
4959
|
has(row, key) {
|
|
4938
|
-
return row[
|
|
4960
|
+
return row[kKeysAsStrings].includes(key);
|
|
4939
4961
|
}
|
|
4940
4962
|
getOwnPropertyDescriptor(row, key) {
|
|
4941
|
-
const idx = row[
|
|
4963
|
+
const idx = row[kKeysAsStrings].indexOf(key);
|
|
4942
4964
|
if (idx !== -1) {
|
|
4943
4965
|
return { writable: true, enumerable: true, configurable: true };
|
|
4944
4966
|
}
|
|
@@ -4948,7 +4970,7 @@
|
|
|
4948
4970
|
if (Reflect.has(row, key)) {
|
|
4949
4971
|
return row[key];
|
|
4950
4972
|
}
|
|
4951
|
-
const idx = row[
|
|
4973
|
+
const idx = row[kKeysAsStrings].indexOf(key);
|
|
4952
4974
|
if (idx !== -1) {
|
|
4953
4975
|
const val = instance2.visit(Reflect.get(row, kVals), idx);
|
|
4954
4976
|
Reflect.set(row, key, val);
|
|
@@ -4956,7 +4978,7 @@
|
|
|
4956
4978
|
}
|
|
4957
4979
|
}
|
|
4958
4980
|
set(row, key, val) {
|
|
4959
|
-
const idx = row[
|
|
4981
|
+
const idx = row[kKeysAsStrings].indexOf(key);
|
|
4960
4982
|
if (idx !== -1) {
|
|
4961
4983
|
instance.visit(Reflect.get(row, kVals), idx, val);
|
|
4962
4984
|
return Reflect.set(row, key, val);
|
|
@@ -4969,15 +4991,11 @@
|
|
|
4969
4991
|
Object.defineProperties(MapRow.prototype, {
|
|
4970
4992
|
[Symbol.toStringTag]: { enumerable: false, configurable: false, value: "Row" },
|
|
4971
4993
|
[kKeys]: { writable: true, enumerable: false, configurable: false, value: null },
|
|
4972
|
-
[kVals]: { writable: true, enumerable: false, configurable: false, value: null }
|
|
4994
|
+
[kVals]: { writable: true, enumerable: false, configurable: false, value: null },
|
|
4995
|
+
[_kKeysAsStrings]: { writable: true, enumerable: false, configurable: false, value: null }
|
|
4973
4996
|
});
|
|
4974
4997
|
|
|
4975
4998
|
// ../../node_modules/apache-arrow/util/vector.mjs
|
|
4976
|
-
function clampIndex(source, index, then) {
|
|
4977
|
-
const length = source.length;
|
|
4978
|
-
const adjust = index > -1 ? index : length + index % length;
|
|
4979
|
-
return then ? then(source, adjust) : adjust;
|
|
4980
|
-
}
|
|
4981
4999
|
var tmp;
|
|
4982
5000
|
function clampRange(source, begin, end, then) {
|
|
4983
5001
|
const { length: len = 0 } = source;
|
|
@@ -4989,6 +5007,7 @@
|
|
|
4989
5007
|
rhs > len && (rhs = len);
|
|
4990
5008
|
return then ? then(source, lhs, rhs) : [lhs, rhs];
|
|
4991
5009
|
}
|
|
5010
|
+
var wrapIndex = (index, len) => index < 0 ? len + index : index;
|
|
4992
5011
|
var isNaNFast = (value) => value !== value;
|
|
4993
5012
|
function createElementComparator(search) {
|
|
4994
5013
|
const typeofSearch = typeof search;
|
|
@@ -5277,7 +5296,10 @@
|
|
|
5277
5296
|
let nullCount = this._nullCount;
|
|
5278
5297
|
let nullBitmap;
|
|
5279
5298
|
if (nullCount <= kUnknownNullCount && (nullBitmap = this.nullBitmap)) {
|
|
5280
|
-
this._nullCount = nullCount =
|
|
5299
|
+
this._nullCount = nullCount = nullBitmap.length === 0 ? (
|
|
5300
|
+
// no null bitmap, so all values are valid
|
|
5301
|
+
0
|
|
5302
|
+
) : this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);
|
|
5281
5303
|
}
|
|
5282
5304
|
return nullCount;
|
|
5283
5305
|
}
|
|
@@ -5339,12 +5361,14 @@
|
|
|
5339
5361
|
nullBitmap = new Uint8Array((offset + length + 63 & ~63) >> 3).fill(255);
|
|
5340
5362
|
if (this.nullCount > 0) {
|
|
5341
5363
|
nullBitmap.set(truncateBitmap(offset, length, this.nullBitmap), 0);
|
|
5364
|
+
Object.assign(this, { nullBitmap });
|
|
5365
|
+
} else {
|
|
5366
|
+
Object.assign(this, { nullBitmap, _nullCount: 0 });
|
|
5342
5367
|
}
|
|
5343
|
-
Object.assign(this, { nullBitmap, _nullCount: -1 });
|
|
5344
5368
|
}
|
|
5345
5369
|
const byte = nullBitmap[byteOffset];
|
|
5346
5370
|
prev = (byte & mask) !== 0;
|
|
5347
|
-
|
|
5371
|
+
nullBitmap[byteOffset] = value ? byte | mask : byte & ~mask;
|
|
5348
5372
|
}
|
|
5349
5373
|
if (prev !== !!value) {
|
|
5350
5374
|
this._nullCount = this.nullCount + (value ? -1 : 1);
|
|
@@ -5785,7 +5809,9 @@
|
|
|
5785
5809
|
};
|
|
5786
5810
|
function vectorIterator(vector) {
|
|
5787
5811
|
const { type } = vector;
|
|
5788
|
-
if (vector.nullCount === 0 && vector.stride === 1 &&
|
|
5812
|
+
if (vector.nullCount === 0 && vector.stride === 1 && // Don't defer to native iterator for timestamps since Numbers are expected
|
|
5813
|
+
// (DataType.isTimestamp(type)) && type.unit === TimeUnit.MILLISECOND ||
|
|
5814
|
+
(DataType.isInt(type) && type.bitWidth !== 64 || DataType.isTime(type) && type.bitWidth !== 64 || DataType.isFloat(type) && type.precision !== Precision.HALF)) {
|
|
5789
5815
|
return new ChunkedIterator(vector.data.length, (chunkIndex) => {
|
|
5790
5816
|
const data = vector.data[chunkIndex];
|
|
5791
5817
|
return data.values.subarray(0, data.length)[Symbol.iterator]();
|
|
@@ -5959,6 +5985,13 @@
|
|
|
5959
5985
|
get(index) {
|
|
5960
5986
|
return null;
|
|
5961
5987
|
}
|
|
5988
|
+
/**
|
|
5989
|
+
* Get an element value by position.
|
|
5990
|
+
* @param index The index of the element to read. A negative index will count back from the last element.
|
|
5991
|
+
*/
|
|
5992
|
+
at(index) {
|
|
5993
|
+
return this.get(wrapIndex(index, this.length));
|
|
5994
|
+
}
|
|
5962
5995
|
/**
|
|
5963
5996
|
* Set an element value by position.
|
|
5964
5997
|
* @param index The index of the element to write.
|
|
@@ -6190,7 +6223,7 @@
|
|
|
6190
6223
|
if (init instanceof DataView) {
|
|
6191
6224
|
init = new Uint8Array(init.buffer);
|
|
6192
6225
|
}
|
|
6193
|
-
const props = { offset: 0, length: init.length, nullCount:
|
|
6226
|
+
const props = { offset: 0, length: init.length, nullCount: -1, data: init };
|
|
6194
6227
|
if (init instanceof Int8Array) {
|
|
6195
6228
|
return new Vector([makeData(Object.assign(Object.assign({}, props), { type: new Int8() }))]);
|
|
6196
6229
|
}
|
|
@@ -6793,7 +6826,7 @@ return true;`);
|
|
|
6793
6826
|
this.fields = fields || [];
|
|
6794
6827
|
this.metadata = metadata || /* @__PURE__ */ new Map();
|
|
6795
6828
|
if (!dictionaries) {
|
|
6796
|
-
dictionaries = generateDictionaryMap(fields);
|
|
6829
|
+
dictionaries = generateDictionaryMap(this.fields);
|
|
6797
6830
|
}
|
|
6798
6831
|
this.dictionaries = dictionaries;
|
|
6799
6832
|
this.metadataVersion = metadataVersion;
|
|
@@ -7295,8 +7328,8 @@ return true;`);
|
|
|
7295
7328
|
return (yield this.next(size, "peek")).value;
|
|
7296
7329
|
});
|
|
7297
7330
|
}
|
|
7298
|
-
next(
|
|
7299
|
-
return __awaiter(this,
|
|
7331
|
+
next(size_1) {
|
|
7332
|
+
return __awaiter(this, arguments, void 0, function* (size, cmd = "read") {
|
|
7300
7333
|
return yield this.source.next({ cmd, size });
|
|
7301
7334
|
});
|
|
7302
7335
|
}
|
|
@@ -8873,6 +8906,14 @@ return true;`);
|
|
|
8873
8906
|
get(index) {
|
|
8874
8907
|
return null;
|
|
8875
8908
|
}
|
|
8909
|
+
/**
|
|
8910
|
+
* Get an element value by position.
|
|
8911
|
+
* @param index The index of the element to read. A negative index will count back from the last element.
|
|
8912
|
+
*/
|
|
8913
|
+
// @ts-ignore
|
|
8914
|
+
at(index) {
|
|
8915
|
+
return this.get(wrapIndex(index, this.numRows));
|
|
8916
|
+
}
|
|
8876
8917
|
/**
|
|
8877
8918
|
* Set an element value by position.
|
|
8878
8919
|
*
|
|
@@ -9110,7 +9151,7 @@ return true;`);
|
|
|
9110
9151
|
return this.data.nullCount;
|
|
9111
9152
|
}
|
|
9112
9153
|
/**
|
|
9113
|
-
* Check whether an
|
|
9154
|
+
* Check whether an row is null.
|
|
9114
9155
|
* @param index The index at which to read the validity bitmap.
|
|
9115
9156
|
*/
|
|
9116
9157
|
isValid(index) {
|
|
@@ -9118,14 +9159,21 @@ return true;`);
|
|
|
9118
9159
|
}
|
|
9119
9160
|
/**
|
|
9120
9161
|
* Get a row by position.
|
|
9121
|
-
* @param index The index of the
|
|
9162
|
+
* @param index The index of the row to read.
|
|
9122
9163
|
*/
|
|
9123
9164
|
get(index) {
|
|
9124
9165
|
return instance2.visit(this.data, index);
|
|
9125
9166
|
}
|
|
9167
|
+
/**
|
|
9168
|
+
* Get a row value by position.
|
|
9169
|
+
* @param index The index of the row to read. A negative index will count back from the last row.
|
|
9170
|
+
*/
|
|
9171
|
+
at(index) {
|
|
9172
|
+
return this.get(wrapIndex(index, this.numRows));
|
|
9173
|
+
}
|
|
9126
9174
|
/**
|
|
9127
9175
|
* Set a row by position.
|
|
9128
|
-
* @param index The index of the
|
|
9176
|
+
* @param index The index of the row to write.
|
|
9129
9177
|
* @param value The value to set.
|
|
9130
9178
|
*/
|
|
9131
9179
|
set(index, value) {
|
|
@@ -9162,7 +9210,7 @@ return true;`);
|
|
|
9162
9210
|
/**
|
|
9163
9211
|
* Return a zero-copy sub-section of this RecordBatch.
|
|
9164
9212
|
* @param start The beginning of the specified portion of the RecordBatch.
|
|
9165
|
-
* @param end The end of the specified portion of the RecordBatch. This is exclusive of the
|
|
9213
|
+
* @param end The end of the specified portion of the RecordBatch. This is exclusive of the row at the index 'end'.
|
|
9166
9214
|
*/
|
|
9167
9215
|
slice(begin, end) {
|
|
9168
9216
|
const [slice] = new Vector([this.data]).slice(begin, end).data;
|
|
@@ -10250,8 +10298,8 @@ return true;`);
|
|
|
10250
10298
|
);
|
|
10251
10299
|
});
|
|
10252
10300
|
}
|
|
10253
|
-
readSchema(
|
|
10254
|
-
return __awaiter(this,
|
|
10301
|
+
readSchema() {
|
|
10302
|
+
return __awaiter(this, arguments, void 0, function* (throwIfNull = false) {
|
|
10255
10303
|
const type = MessageHeader.Schema;
|
|
10256
10304
|
const message = yield this.readMessage(type);
|
|
10257
10305
|
const schema = message === null || message === void 0 ? void 0 : message.header();
|
|
@@ -10499,8 +10547,8 @@ return true;`);
|
|
|
10499
10547
|
this._impl = _impl;
|
|
10500
10548
|
}
|
|
10501
10549
|
readAll() {
|
|
10502
|
-
var _a5, e_1, _b2, _c2;
|
|
10503
10550
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10551
|
+
var _a5, e_1, _b2, _c2;
|
|
10504
10552
|
const batches = new Array();
|
|
10505
10553
|
try {
|
|
10506
10554
|
for (var _d2 = true, _e2 = __asyncValues(this), _f2; _f2 = yield _e2.next(), _a5 = _f2.done, !_a5; _d2 = true) {
|
|
@@ -10584,12 +10632,9 @@ return true;`);
|
|
|
10584
10632
|
const { id, isDelta } = header;
|
|
10585
10633
|
const { dictionaries, schema } = this;
|
|
10586
10634
|
const dictionary = dictionaries.get(id);
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
return (dictionary && isDelta ? dictionary.concat(new Vector(data)) : new Vector(data)).memoize();
|
|
10591
|
-
}
|
|
10592
|
-
return dictionary.memoize();
|
|
10635
|
+
const type = schema.dictionaries.get(id);
|
|
10636
|
+
const data = this._loadVectors(header.data, body, [type]);
|
|
10637
|
+
return (dictionary && isDelta ? dictionary.concat(new Vector(data)) : new Vector(data)).memoize();
|
|
10593
10638
|
}
|
|
10594
10639
|
_loadVectors(header, body, types) {
|
|
10595
10640
|
return new VectorLoader(body, header.nodes, header.buffers, this.dictionaries, this.schema.metadataVersion).visitMany(types);
|
|
@@ -10875,8 +10920,8 @@ return true;`);
|
|
|
10875
10920
|
});
|
|
10876
10921
|
}
|
|
10877
10922
|
readRecordBatch(index) {
|
|
10878
|
-
var _a5;
|
|
10879
10923
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10924
|
+
var _a5;
|
|
10880
10925
|
if (this.closed) {
|
|
10881
10926
|
return null;
|
|
10882
10927
|
}
|
|
@@ -10897,8 +10942,8 @@ return true;`);
|
|
|
10897
10942
|
});
|
|
10898
10943
|
}
|
|
10899
10944
|
_readDictionaryBatch(index) {
|
|
10900
|
-
var _a5;
|
|
10901
10945
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10946
|
+
var _a5;
|
|
10902
10947
|
const block = (_a5 = this._footer) === null || _a5 === void 0 ? void 0 : _a5.getDictionaryBatch(index);
|
|
10903
10948
|
if (block && (yield this._handle.seek(block.offset))) {
|
|
10904
10949
|
const message = yield this._reader.readMessage(MessageHeader.DictionaryBatch);
|
|
@@ -11173,6 +11218,7 @@ return true;`);
|
|
|
11173
11218
|
this._schema = null;
|
|
11174
11219
|
this._dictionaryBlocks = [];
|
|
11175
11220
|
this._recordBatchBlocks = [];
|
|
11221
|
+
this._seenDictionaries = /* @__PURE__ */ new Map();
|
|
11176
11222
|
this._dictionaryDeltaOffsets = /* @__PURE__ */ new Map();
|
|
11177
11223
|
isObject(options2) || (options2 = { autoDestroy: true, writeLegacyIpcFormat: false });
|
|
11178
11224
|
this._autoDestroy = typeof options2.autoDestroy === "boolean" ? options2.autoDestroy : true;
|
|
@@ -11231,6 +11277,7 @@ return true;`);
|
|
|
11231
11277
|
this._started = false;
|
|
11232
11278
|
this._dictionaryBlocks = [];
|
|
11233
11279
|
this._recordBatchBlocks = [];
|
|
11280
|
+
this._seenDictionaries = /* @__PURE__ */ new Map();
|
|
11234
11281
|
this._dictionaryDeltaOffsets = /* @__PURE__ */ new Map();
|
|
11235
11282
|
if (!schema || !compareSchemas(schema, this._schema)) {
|
|
11236
11283
|
if (schema == null) {
|
|
@@ -11322,7 +11369,6 @@ return true;`);
|
|
|
11322
11369
|
return this._writeDictionaries(batch)._writeMessage(message)._writeBodyBuffers(buffers);
|
|
11323
11370
|
}
|
|
11324
11371
|
_writeDictionaryBatch(dictionary, id, isDelta = false) {
|
|
11325
|
-
this._dictionaryDeltaOffsets.set(id, dictionary.length + (this._dictionaryDeltaOffsets.get(id) || 0));
|
|
11326
11372
|
const { byteLength, nodes, bufferRegions, buffers } = VectorAssembler.assemble(new Vector([dictionary]));
|
|
11327
11373
|
const recordBatch = new RecordBatch3(dictionary.length, nodes, bufferRegions);
|
|
11328
11374
|
const dictionaryBatch = new DictionaryBatch2(recordBatch, id, isDelta);
|
|
@@ -11343,14 +11389,20 @@ return true;`);
|
|
|
11343
11389
|
return this;
|
|
11344
11390
|
}
|
|
11345
11391
|
_writeDictionaries(batch) {
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11392
|
+
var _a5, _b2;
|
|
11393
|
+
for (const [id, dictionary] of batch.dictionaries) {
|
|
11394
|
+
const chunks = (_a5 = dictionary === null || dictionary === void 0 ? void 0 : dictionary.data) !== null && _a5 !== void 0 ? _a5 : [];
|
|
11395
|
+
const prevDictionary = this._seenDictionaries.get(id);
|
|
11396
|
+
const offset = (_b2 = this._dictionaryDeltaOffsets.get(id)) !== null && _b2 !== void 0 ? _b2 : 0;
|
|
11397
|
+
if (!prevDictionary || prevDictionary.data[0] !== chunks[0]) {
|
|
11398
|
+
for (const [index, chunk] of chunks.entries())
|
|
11399
|
+
this._writeDictionaryBatch(chunk, id, index > 0);
|
|
11400
|
+
} else if (offset < chunks.length) {
|
|
11401
|
+
for (const chunk of chunks.slice(offset))
|
|
11402
|
+
this._writeDictionaryBatch(chunk, id, true);
|
|
11403
|
+
}
|
|
11404
|
+
this._seenDictionaries.set(id, dictionary);
|
|
11405
|
+
this._dictionaryDeltaOffsets.set(id, chunks.length);
|
|
11354
11406
|
}
|
|
11355
11407
|
return this;
|
|
11356
11408
|
}
|
|
@@ -11386,6 +11438,12 @@ return true;`);
|
|
|
11386
11438
|
_writeSchema(schema) {
|
|
11387
11439
|
return this._writeMagic()._writePadding(2);
|
|
11388
11440
|
}
|
|
11441
|
+
_writeDictionaryBatch(dictionary, id, isDelta = false) {
|
|
11442
|
+
if (!isDelta && this._seenDictionaries.has(id)) {
|
|
11443
|
+
throw new Error("The Arrow File format does not support replacement dictionaries. ");
|
|
11444
|
+
}
|
|
11445
|
+
return super._writeDictionaryBatch(dictionary, id, isDelta);
|
|
11446
|
+
}
|
|
11389
11447
|
_writeFooter(schema) {
|
|
11390
11448
|
const buffer = Footer_.encode(new Footer_(schema, MetadataVersion.V5, this._recordBatchBlocks, this._dictionaryBlocks));
|
|
11391
11449
|
return super._writeFooter(schema)._write(buffer)._write(Int32Array.of(buffer.byteLength))._writeMagic();
|
|
@@ -11403,9 +11461,9 @@ return true;`);
|
|
|
11403
11461
|
return writer.finish();
|
|
11404
11462
|
}
|
|
11405
11463
|
function writeAllAsync(writer, batches) {
|
|
11406
|
-
var _a5, batches_1, batches_1_1;
|
|
11407
|
-
var _b2, e_1, _c2, _d2;
|
|
11408
11464
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11465
|
+
var _a5, batches_1, batches_1_1;
|
|
11466
|
+
var _b2, e_1, _c2, _d2;
|
|
11409
11467
|
try {
|
|
11410
11468
|
for (_a5 = true, batches_1 = __asyncValues(batches); batches_1_1 = yield batches_1.next(), _b2 = batches_1_1.done, !_b2; _a5 = true) {
|
|
11411
11469
|
_d2 = batches_1_1.value;
|
|
@@ -11948,6 +12006,30 @@ return true;`);
|
|
|
11948
12006
|
});
|
|
11949
12007
|
}
|
|
11950
12008
|
|
|
12009
|
+
// ../geoarrow/src/get-arrow-bounds.ts
|
|
12010
|
+
function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds, sampleSize = 100) {
|
|
12011
|
+
const numberOfFeatures = flatCoords.length / nDim;
|
|
12012
|
+
const sampleStep = Math.max(Math.floor(numberOfFeatures / sampleSize), 1);
|
|
12013
|
+
const newBounds = [...bounds];
|
|
12014
|
+
for (let i = 0; i < numberOfFeatures; i += sampleStep) {
|
|
12015
|
+
const lng = flatCoords[i * nDim];
|
|
12016
|
+
const lat = flatCoords[i * nDim + 1];
|
|
12017
|
+
if (lng < newBounds[0]) {
|
|
12018
|
+
newBounds[0] = lng;
|
|
12019
|
+
}
|
|
12020
|
+
if (lat < newBounds[1]) {
|
|
12021
|
+
newBounds[1] = lat;
|
|
12022
|
+
}
|
|
12023
|
+
if (lng > newBounds[2]) {
|
|
12024
|
+
newBounds[2] = lng;
|
|
12025
|
+
}
|
|
12026
|
+
if (lat > newBounds[3]) {
|
|
12027
|
+
newBounds[3] = lat;
|
|
12028
|
+
}
|
|
12029
|
+
}
|
|
12030
|
+
return newBounds;
|
|
12031
|
+
}
|
|
12032
|
+
|
|
11951
12033
|
// ../../node_modules/@math.gl/polygon/dist/polygon-utils.js
|
|
11952
12034
|
var DimIndex = {
|
|
11953
12035
|
x: 0,
|
|
@@ -12452,41 +12534,8 @@ return true;`);
|
|
|
12452
12534
|
}
|
|
12453
12535
|
};
|
|
12454
12536
|
|
|
12455
|
-
// src/lib/
|
|
12456
|
-
function
|
|
12457
|
-
const numberOfFeatures = flatCoords.length / nDim;
|
|
12458
|
-
const sampleStep = Math.max(Math.floor(numberOfFeatures / sampleSize), 1);
|
|
12459
|
-
const newBounds = [...bounds];
|
|
12460
|
-
for (let i = 0; i < numberOfFeatures; i += sampleStep) {
|
|
12461
|
-
const lng = flatCoords[i * nDim];
|
|
12462
|
-
const lat = flatCoords[i * nDim + 1];
|
|
12463
|
-
if (lng < newBounds[0]) {
|
|
12464
|
-
newBounds[0] = lng;
|
|
12465
|
-
}
|
|
12466
|
-
if (lat < newBounds[1]) {
|
|
12467
|
-
newBounds[1] = lat;
|
|
12468
|
-
}
|
|
12469
|
-
if (lng > newBounds[2]) {
|
|
12470
|
-
newBounds[2] = lng;
|
|
12471
|
-
}
|
|
12472
|
-
if (lat > newBounds[3]) {
|
|
12473
|
-
newBounds[3] = lat;
|
|
12474
|
-
}
|
|
12475
|
-
}
|
|
12476
|
-
return newBounds;
|
|
12477
|
-
}
|
|
12478
|
-
|
|
12479
|
-
// src/lib/geoarrow/convert-geoarrow-to-binary-geometry.ts
|
|
12480
|
-
function getBinaryGeometryTemplate() {
|
|
12481
|
-
return {
|
|
12482
|
-
globalFeatureIds: { value: new Uint32Array(0), size: 1 },
|
|
12483
|
-
positions: { value: new Float32Array(0), size: 2 },
|
|
12484
|
-
properties: [],
|
|
12485
|
-
numericProps: {},
|
|
12486
|
-
featureIds: { value: new Uint32Array(0), size: 1 }
|
|
12487
|
-
};
|
|
12488
|
-
}
|
|
12489
|
-
function getBinaryGeometriesFromArrow(geoColumn, geoEncoding, options2) {
|
|
12537
|
+
// ../gis/src/lib/feature-collection-converters/convert-geoarrow-to-binary-features.ts
|
|
12538
|
+
function convertGeoArrowToBinaryFeatureCollection(geoColumn, geoEncoding, options2) {
|
|
12490
12539
|
const featureTypes = {
|
|
12491
12540
|
polygon: geoEncoding === "geoarrow.multipolygon" || geoEncoding === "geoarrow.polygon",
|
|
12492
12541
|
point: geoEncoding === "geoarrow.multipoint" || geoEncoding === "geoarrow.point",
|
|
@@ -12553,6 +12602,15 @@ return true;`);
|
|
|
12553
12602
|
...options2?.calculateMeanCenters ? { meanCenters: getMeanCentersFromBinaryGeometries(binaryGeometries) } : {}
|
|
12554
12603
|
};
|
|
12555
12604
|
}
|
|
12605
|
+
function getBinaryGeometryTemplate() {
|
|
12606
|
+
return {
|
|
12607
|
+
globalFeatureIds: { value: new Uint32Array(0), size: 1 },
|
|
12608
|
+
positions: { value: new Float32Array(0), size: 2 },
|
|
12609
|
+
properties: [],
|
|
12610
|
+
numericProps: {},
|
|
12611
|
+
featureIds: { value: new Uint32Array(0), size: 1 }
|
|
12612
|
+
};
|
|
12613
|
+
}
|
|
12556
12614
|
function getMeanCentersFromBinaryGeometries(binaryGeometries) {
|
|
12557
12615
|
const globalMeanCenters = [];
|
|
12558
12616
|
binaryGeometries.forEach((binaryGeometry) => {
|
|
@@ -12674,9 +12732,9 @@ return true;`);
|
|
|
12674
12732
|
const nDim = pointData.stride;
|
|
12675
12733
|
const geomOffset = ringData.valueOffsets;
|
|
12676
12734
|
const flatCoordinateArray = coordData.values;
|
|
12677
|
-
const
|
|
12735
|
+
const geometryIndexes = new Uint16Array(polygonOffset.length);
|
|
12678
12736
|
for (let i = 0; i < polygonOffset.length; i++) {
|
|
12679
|
-
|
|
12737
|
+
geometryIndexes[i] = geomOffset[polygonOffset[i]];
|
|
12680
12738
|
}
|
|
12681
12739
|
const numOfVertices = flatCoordinateArray.length / nDim;
|
|
12682
12740
|
const featureIds = new Uint32Array(numOfVertices);
|
|
@@ -12687,13 +12745,13 @@ return true;`);
|
|
|
12687
12745
|
featureIds[j] = i;
|
|
12688
12746
|
}
|
|
12689
12747
|
}
|
|
12690
|
-
const triangles = options2?.triangulate ? getTriangleIndices(
|
|
12748
|
+
const triangles = options2?.triangulate ? getTriangleIndices(geometryIndexes, geomOffset, flatCoordinateArray, nDim) : null;
|
|
12691
12749
|
return {
|
|
12692
12750
|
featureIds,
|
|
12693
12751
|
nDim,
|
|
12694
12752
|
flatCoordinateArray,
|
|
12695
12753
|
geomOffset,
|
|
12696
|
-
|
|
12754
|
+
geometryIndexes,
|
|
12697
12755
|
...options2?.triangulate && triangles ? { triangles } : {}
|
|
12698
12756
|
};
|
|
12699
12757
|
}
|
|
@@ -12705,7 +12763,7 @@ return true;`);
|
|
|
12705
12763
|
const nDim = pointData.stride;
|
|
12706
12764
|
const geomOffset = lineData.valueOffsets;
|
|
12707
12765
|
const flatCoordinateArray = coordData.values;
|
|
12708
|
-
const
|
|
12766
|
+
const geometryIndexes = new Uint16Array(0);
|
|
12709
12767
|
const numOfVertices = flatCoordinateArray.length / nDim;
|
|
12710
12768
|
const featureIds = new Uint32Array(numOfVertices);
|
|
12711
12769
|
if (isMultiLineString) {
|
|
@@ -12731,7 +12789,7 @@ return true;`);
|
|
|
12731
12789
|
flatCoordinateArray,
|
|
12732
12790
|
nDim,
|
|
12733
12791
|
geomOffset,
|
|
12734
|
-
|
|
12792
|
+
geometryIndexes
|
|
12735
12793
|
};
|
|
12736
12794
|
}
|
|
12737
12795
|
function getBinaryPointsFromChunk(chunk, geoEncoding) {
|
|
@@ -12740,7 +12798,7 @@ return true;`);
|
|
|
12740
12798
|
const coordData = pointData.children[0];
|
|
12741
12799
|
const nDim = pointData.stride;
|
|
12742
12800
|
const flatCoordinateArray = coordData.values;
|
|
12743
|
-
const
|
|
12801
|
+
const geometryIndexes = new Uint16Array(0);
|
|
12744
12802
|
const geomOffset = new Int32Array(0);
|
|
12745
12803
|
const numOfVertices = flatCoordinateArray.length / nDim;
|
|
12746
12804
|
const featureIds = new Uint32Array(numOfVertices);
|
|
@@ -12763,7 +12821,7 @@ return true;`);
|
|
|
12763
12821
|
flatCoordinateArray,
|
|
12764
12822
|
nDim,
|
|
12765
12823
|
geomOffset,
|
|
12766
|
-
|
|
12824
|
+
geometryIndexes
|
|
12767
12825
|
};
|
|
12768
12826
|
}
|
|
12769
12827
|
|
|
@@ -12808,7 +12866,7 @@ return true;`);
|
|
|
12808
12866
|
const geometryColumn = makeVector(arrowData);
|
|
12809
12867
|
if (geometryColumn) {
|
|
12810
12868
|
const options2 = { calculateMeanCenters, triangle, chunkIndex: 0, chunkOffset };
|
|
12811
|
-
binaryDataFromGeoArrow =
|
|
12869
|
+
binaryDataFromGeoArrow = convertGeoArrowToBinaryFeatureCollection(
|
|
12812
12870
|
geometryColumn,
|
|
12813
12871
|
geometryEncoding,
|
|
12814
12872
|
options2
|