@loaders.gl/arrow 4.3.0-alpha.8 → 4.3.0-beta.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 +6 -38
- package/dist/arrow-loader.d.ts.map +1 -1
- package/dist/arrow-loader.js +2 -29
- package/dist/arrow-worker.js +2654 -1710
- package/dist/arrow-writer.d.ts +1 -1
- package/dist/arrow-writer.d.ts.map +1 -1
- package/dist/arrow-writer.js +2 -2
- package/dist/dist.dev.js +1863 -1768
- package/dist/dist.min.js +5 -5
- package/dist/exports/arrow-loader.d.ts +34 -0
- package/dist/exports/arrow-loader.d.ts.map +1 -0
- package/dist/exports/arrow-loader.js +30 -0
- package/dist/exports/geoarrow-loader.d.ts +27 -0
- package/dist/exports/geoarrow-loader.d.ts.map +1 -0
- package/dist/exports/geoarrow-loader.js +13 -0
- package/dist/geoarrow-loader.d.ts +3 -27
- package/dist/geoarrow-loader.d.ts.map +1 -1
- package/dist/geoarrow-loader.js +2 -12
- package/dist/geoarrow-writer.d.ts +2 -2
- package/dist/geoarrow-writer.d.ts.map +1 -1
- package/dist/geoarrow-writer.js +2 -2
- package/dist/index.cjs +426 -387
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +14 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -12
- package/dist/lib/encoders/encode-arrow.d.ts.map +1 -0
- package/dist/lib/encoders/encode-geoarrow.d.ts.map +1 -0
- package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.d.ts.map +1 -0
- package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts.map +1 -0
- package/dist/lib/geoarrow/get-arrow-bounds.d.ts.map +1 -0
- package/dist/lib/parsers/parse-arrow.d.ts +9 -0
- package/dist/lib/parsers/parse-arrow.d.ts.map +1 -0
- package/dist/{parsers/parse-arrow-in-batches.js → lib/parsers/parse-arrow.js} +7 -3
- package/dist/lib/parsers/parse-geoarrow.d.ts +9 -0
- package/dist/lib/parsers/parse-geoarrow.d.ts.map +1 -0
- package/dist/{parsers/parse-geoarrow-sync.js → lib/parsers/parse-geoarrow.js} +9 -3
- package/dist/{schema → lib/tables}/convert-arrow-schema.d.ts +4 -0
- package/dist/lib/tables/convert-arrow-schema.d.ts.map +1 -0
- package/dist/{schema → lib/tables}/convert-arrow-schema.js +8 -0
- package/dist/lib/tables/convert-arrow-to-table.d.ts +15 -0
- package/dist/lib/tables/convert-arrow-to-table.d.ts.map +1 -0
- package/dist/lib/tables/convert-arrow-to-table.js +104 -0
- package/dist/lib/tables/convert-table-to-arrow.d.ts +16 -0
- package/dist/lib/tables/convert-table-to-arrow.d.ts.map +1 -0
- package/dist/lib/tables/convert-table-to-arrow.js +56 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/{lib → schema}/arrow-table-batch.d.ts +2 -1
- package/dist/schema/arrow-table-batch.d.ts.map +1 -0
- package/dist/{lib → schema}/arrow-table-batch.js +1 -0
- package/dist/{lib/arrow-table.d.ts → schema/arrow-table-type.d.ts} +3 -1
- package/dist/schema/arrow-table-type.d.ts.map +1 -0
- package/dist/triangulate-on-worker.js +1 -1
- package/dist/triangulation-worker.js +13 -5
- package/dist/workers/triangulation-worker.js +1 -1
- package/package.json +11 -7
- package/src/arrow-loader.ts +6 -57
- package/src/arrow-writer.ts +1 -2
- package/src/exports/arrow-loader.ts +49 -0
- package/src/exports/geoarrow-loader.ts +24 -0
- package/src/geoarrow-loader.ts +6 -22
- package/src/geoarrow-writer.ts +1 -1
- package/src/index.ts +23 -23
- package/src/{parsers/parse-arrow-in-batches.ts → lib/parsers/parse-arrow.ts} +11 -5
- package/src/lib/parsers/parse-geoarrow.ts +32 -0
- package/src/{schema → lib/tables}/convert-arrow-schema.ts +10 -0
- package/src/lib/tables/convert-arrow-to-table.ts +144 -0
- package/src/lib/tables/convert-table-to-arrow.ts +72 -0
- package/src/{lib → schema}/arrow-table-batch.ts +2 -1
- package/src/{lib/arrow-table.ts → schema/arrow-table-type.ts} +2 -0
- package/src/workers/triangulation-worker.ts +1 -1
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.d.ts.map +0 -1
- package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts.map +0 -1
- package/dist/geoarrow/get-arrow-bounds.d.ts.map +0 -1
- package/dist/lib/arrow-table-batch.d.ts.map +0 -1
- package/dist/lib/arrow-table.d.ts.map +0 -1
- package/dist/lib/encode-arrow.d.ts.map +0 -1
- package/dist/lib/encode-geoarrow.d.ts.map +0 -1
- package/dist/parsers/parse-arrow-in-batches.d.ts +0 -6
- package/dist/parsers/parse-arrow-in-batches.d.ts.map +0 -1
- package/dist/parsers/parse-arrow-sync.d.ts +0 -6
- package/dist/parsers/parse-arrow-sync.d.ts.map +0 -1
- package/dist/parsers/parse-arrow-sync.js +0 -32
- package/dist/parsers/parse-geoarrow-in-batches.d.ts +0 -6
- package/dist/parsers/parse-geoarrow-in-batches.d.ts.map +0 -1
- package/dist/parsers/parse-geoarrow-in-batches.js +0 -10
- package/dist/parsers/parse-geoarrow-sync.d.ts +0 -6
- package/dist/parsers/parse-geoarrow-sync.d.ts.map +0 -1
- package/dist/schema/arrow-type-utils.d.ts +0 -5
- package/dist/schema/arrow-type-utils.d.ts.map +0 -1
- package/dist/schema/arrow-type-utils.js +0 -51
- package/dist/schema/convert-arrow-schema.d.ts.map +0 -1
- package/dist/tables/convert-arrow-to-columnar-table.d.ts +0 -8
- package/dist/tables/convert-arrow-to-columnar-table.d.ts.map +0 -1
- package/dist/tables/convert-arrow-to-columnar-table.js +0 -24
- package/dist/tables/convert-arrow-to-geojson-table.d.ts +0 -16
- package/dist/tables/convert-arrow-to-geojson-table.d.ts.map +0 -1
- package/dist/tables/convert-arrow-to-geojson-table.js +0 -54
- package/dist/tables/convert-columnar-to-row-table.d.ts +0 -7
- package/dist/tables/convert-columnar-to-row-table.d.ts.map +0 -1
- package/dist/tables/convert-columnar-to-row-table.js +0 -25
- package/dist/tables/convert-table-to-arrow.d.ts +0 -42
- package/dist/tables/convert-table-to-arrow.d.ts.map +0 -1
- package/dist/tables/convert-table-to-arrow.js +0 -59
- package/dist/types.d.ts.map +0 -1
- package/src/parsers/parse-arrow-sync.ts +0 -44
- package/src/parsers/parse-geoarrow-in-batches.ts +0 -16
- package/src/parsers/parse-geoarrow-sync.ts +0 -23
- package/src/schema/arrow-type-utils.ts +0 -55
- package/src/tables/convert-arrow-to-columnar-table.ts +0 -31
- package/src/tables/convert-arrow-to-geojson-table.ts +0 -66
- package/src/tables/convert-columnar-to-row-table.ts +0 -31
- package/src/tables/convert-table-to-arrow.ts +0 -61
- /package/dist/lib/{encode-arrow.d.ts → encoders/encode-arrow.d.ts} +0 -0
- /package/dist/lib/{encode-arrow.js → encoders/encode-arrow.js} +0 -0
- /package/dist/lib/{encode-geoarrow.d.ts → encoders/encode-geoarrow.d.ts} +0 -0
- /package/dist/lib/{encode-geoarrow.js → encoders/encode-geoarrow.js} +0 -0
- /package/dist/{geoarrow → lib/geoarrow}/convert-geoarrow-to-binary-geometry.d.ts +0 -0
- /package/dist/{geoarrow → lib/geoarrow}/convert-geoarrow-to-binary-geometry.js +0 -0
- /package/dist/{geoarrow → lib/geoarrow}/convert-geoarrow-to-geojson-geometry.d.ts +0 -0
- /package/dist/{geoarrow → lib/geoarrow}/convert-geoarrow-to-geojson-geometry.js +0 -0
- /package/dist/{geoarrow → lib/geoarrow}/get-arrow-bounds.d.ts +0 -0
- /package/dist/{geoarrow → lib/geoarrow}/get-arrow-bounds.js +0 -0
- /package/dist/{types.d.ts → lib/types.d.ts} +0 -0
- /package/dist/{types.js → lib/types.js} +0 -0
- /package/dist/{lib/arrow-table.js → schema/arrow-table-type.js} +0 -0
- /package/src/lib/{encode-arrow.ts → encoders/encode-arrow.ts} +0 -0
- /package/src/lib/{encode-geoarrow.ts → encoders/encode-geoarrow.ts} +0 -0
- /package/src/{geoarrow → lib/geoarrow}/convert-geoarrow-to-binary-geometry.ts +0 -0
- /package/src/{geoarrow → lib/geoarrow}/convert-geoarrow-to-geojson-geometry.ts +0 -0
- /package/src/{geoarrow → lib/geoarrow}/get-arrow-bounds.ts +0 -0
- /package/src/{types.ts → lib/types.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -37,19 +37,21 @@ __export(dist_exports, {
|
|
|
37
37
|
GeoArrowWorkerLoader: () => GeoArrowWorkerLoader,
|
|
38
38
|
TriangulationWorker: () => TriangulationWorker,
|
|
39
39
|
VECTOR_TYPES: () => VECTOR_TYPES,
|
|
40
|
-
|
|
40
|
+
convertArrowToSchema: () => convertArrowToSchema,
|
|
41
|
+
convertArrowToTable: () => convertArrowToTable,
|
|
42
|
+
convertSchemaToArrow: () => convertSchemaToArrow,
|
|
43
|
+
convertTableToArrow: () => convertTableToArrow,
|
|
41
44
|
deserializeArrowField: () => deserializeArrowField,
|
|
42
45
|
deserializeArrowMetadata: () => deserializeArrowMetadata,
|
|
43
46
|
deserializeArrowSchema: () => deserializeArrowSchema,
|
|
44
47
|
deserializeArrowType: () => deserializeArrowType,
|
|
45
|
-
getArrowType: () => getArrowType,
|
|
46
48
|
getBinaryGeometriesFromArrow: () => getBinaryGeometriesFromArrow,
|
|
47
49
|
getBinaryGeometryTemplate: () => getBinaryGeometryTemplate,
|
|
48
50
|
getMeanCentersFromBinaryGeometries: () => getMeanCentersFromBinaryGeometries,
|
|
49
51
|
getTriangleIndices: () => getTriangleIndices,
|
|
50
52
|
hardClone: () => hardClone,
|
|
51
53
|
parseGeoArrowOnWorker: () => parseGeoArrowOnWorker,
|
|
52
|
-
parseGeometryFromArrow: () =>
|
|
54
|
+
parseGeometryFromArrow: () => parseGeometryFromArrow,
|
|
53
55
|
serializeArrowField: () => serializeArrowField,
|
|
54
56
|
serializeArrowMetadata: () => serializeArrowMetadata,
|
|
55
57
|
serializeArrowSchema: () => serializeArrowSchema,
|
|
@@ -58,9 +60,15 @@ __export(dist_exports, {
|
|
|
58
60
|
updateBoundsFromGeoArrowSamples: () => updateBoundsFromGeoArrowSamples
|
|
59
61
|
});
|
|
60
62
|
module.exports = __toCommonJS(dist_exports);
|
|
61
|
-
var import_schema3 = require("@loaders.gl/schema");
|
|
62
63
|
|
|
63
|
-
// dist/lib/
|
|
64
|
+
// dist/lib/types.js
|
|
65
|
+
var VECTOR_TYPES;
|
|
66
|
+
(function(VECTOR_TYPES2) {
|
|
67
|
+
VECTOR_TYPES2[VECTOR_TYPES2["FLOAT"] = 0] = "FLOAT";
|
|
68
|
+
VECTOR_TYPES2[VECTOR_TYPES2["DATE"] = 1] = "DATE";
|
|
69
|
+
})(VECTOR_TYPES || (VECTOR_TYPES = {}));
|
|
70
|
+
|
|
71
|
+
// dist/schema/arrow-table-batch.js
|
|
64
72
|
var import_schema = require("@loaders.gl/schema");
|
|
65
73
|
var arrow = __toESM(require("apache-arrow"), 1);
|
|
66
74
|
var ArrowTableBatchAggregator = class extends import_schema.ColumnarTableBatchAggregator {
|
|
@@ -118,60 +126,50 @@ function getArrowVectors(arrowSchema, data) {
|
|
|
118
126
|
return arrowVectors;
|
|
119
127
|
}
|
|
120
128
|
|
|
121
|
-
// dist/
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
129
|
+
// dist/index.js
|
|
130
|
+
var import_schema4 = require("@loaders.gl/schema");
|
|
131
|
+
|
|
132
|
+
// dist/exports/arrow-loader.js
|
|
133
|
+
var VERSION = true ? "4.3.0-beta.1" : "latest";
|
|
134
|
+
var ArrowWorkerLoader = {
|
|
135
|
+
dataType: null,
|
|
136
|
+
batchType: null,
|
|
137
|
+
name: "Apache Arrow",
|
|
138
|
+
id: "arrow",
|
|
139
|
+
module: "arrow",
|
|
140
|
+
version: VERSION,
|
|
141
|
+
// worker: true,
|
|
142
|
+
category: "table",
|
|
143
|
+
extensions: ["arrow", "feather"],
|
|
144
|
+
mimeTypes: [
|
|
145
|
+
"application/vnd.apache.arrow.file",
|
|
146
|
+
"application/vnd.apache.arrow.stream",
|
|
147
|
+
"application/octet-stream"
|
|
148
|
+
],
|
|
149
|
+
binary: true,
|
|
150
|
+
tests: ["ARROW"],
|
|
151
|
+
options: {
|
|
152
|
+
arrow: {
|
|
153
|
+
shape: "columnar-table"
|
|
154
|
+
}
|
|
143
155
|
}
|
|
144
|
-
}
|
|
156
|
+
};
|
|
145
157
|
|
|
146
|
-
// dist/
|
|
147
|
-
var
|
|
148
|
-
(function(VECTOR_TYPES2) {
|
|
149
|
-
VECTOR_TYPES2[VECTOR_TYPES2["FLOAT"] = 0] = "FLOAT";
|
|
150
|
-
VECTOR_TYPES2[VECTOR_TYPES2["DATE"] = 1] = "DATE";
|
|
151
|
-
})(VECTOR_TYPES || (VECTOR_TYPES = {}));
|
|
158
|
+
// dist/lib/parsers/parse-arrow.js
|
|
159
|
+
var arrow3 = __toESM(require("apache-arrow"), 1);
|
|
152
160
|
|
|
153
|
-
// dist/
|
|
161
|
+
// dist/lib/tables/convert-arrow-to-table.js
|
|
154
162
|
var import_schema2 = require("@loaders.gl/schema");
|
|
155
|
-
var
|
|
163
|
+
var import_gis2 = require("@loaders.gl/gis");
|
|
156
164
|
|
|
157
|
-
// dist/tables/convert-arrow-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
columnarTable[field.name] = values;
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
shape: "columnar-table",
|
|
168
|
-
schema: table.schema,
|
|
169
|
-
data: columnarTable
|
|
170
|
-
};
|
|
165
|
+
// dist/lib/tables/convert-arrow-schema.js
|
|
166
|
+
var arrow2 = __toESM(require("apache-arrow"), 1);
|
|
167
|
+
function convertArrowToSchema(arrowSchema) {
|
|
168
|
+
return serializeArrowSchema(arrowSchema);
|
|
169
|
+
}
|
|
170
|
+
function convertSchemaToArrow(schema) {
|
|
171
|
+
return deserializeArrowSchema(schema);
|
|
171
172
|
}
|
|
172
|
-
|
|
173
|
-
// dist/schema/convert-arrow-schema.js
|
|
174
|
-
var arrow3 = __toESM(require("apache-arrow"), 1);
|
|
175
173
|
function serializeArrowSchema(arrowSchema) {
|
|
176
174
|
return {
|
|
177
175
|
fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
|
|
@@ -179,7 +177,7 @@ function serializeArrowSchema(arrowSchema) {
|
|
|
179
177
|
};
|
|
180
178
|
}
|
|
181
179
|
function deserializeArrowSchema(schema) {
|
|
182
|
-
return new
|
|
180
|
+
return new arrow2.Schema(schema.fields.map((field) => deserializeArrowField(field)), deserializeArrowMetadata(schema.metadata));
|
|
183
181
|
}
|
|
184
182
|
function serializeArrowMetadata(arrowMetadata) {
|
|
185
183
|
return Object.fromEntries(arrowMetadata);
|
|
@@ -196,56 +194,56 @@ function serializeArrowField(field) {
|
|
|
196
194
|
};
|
|
197
195
|
}
|
|
198
196
|
function deserializeArrowField(field) {
|
|
199
|
-
return new
|
|
197
|
+
return new arrow2.Field(field.name, deserializeArrowType(field.type), field.nullable, deserializeArrowMetadata(field.metadata));
|
|
200
198
|
}
|
|
201
199
|
function serializeArrowType(arrowType) {
|
|
202
200
|
switch (arrowType.constructor) {
|
|
203
|
-
case
|
|
201
|
+
case arrow2.Null:
|
|
204
202
|
return "null";
|
|
205
|
-
case
|
|
203
|
+
case arrow2.Binary:
|
|
206
204
|
return "binary";
|
|
207
|
-
case
|
|
205
|
+
case arrow2.Bool:
|
|
208
206
|
return "bool";
|
|
209
|
-
case
|
|
207
|
+
case arrow2.Int:
|
|
210
208
|
const intType = arrowType;
|
|
211
209
|
return `${intType.isSigned ? "u" : ""}int${intType.bitWidth}`;
|
|
212
|
-
case
|
|
210
|
+
case arrow2.Int8:
|
|
213
211
|
return "int8";
|
|
214
|
-
case
|
|
212
|
+
case arrow2.Int16:
|
|
215
213
|
return "int16";
|
|
216
|
-
case
|
|
214
|
+
case arrow2.Int32:
|
|
217
215
|
return "int32";
|
|
218
|
-
case
|
|
216
|
+
case arrow2.Int64:
|
|
219
217
|
return "int64";
|
|
220
|
-
case
|
|
218
|
+
case arrow2.Uint8:
|
|
221
219
|
return "uint8";
|
|
222
|
-
case
|
|
220
|
+
case arrow2.Uint16:
|
|
223
221
|
return "uint16";
|
|
224
|
-
case
|
|
222
|
+
case arrow2.Uint32:
|
|
225
223
|
return "uint32";
|
|
226
|
-
case
|
|
224
|
+
case arrow2.Uint64:
|
|
227
225
|
return "uint64";
|
|
228
|
-
case
|
|
226
|
+
case arrow2.Float:
|
|
229
227
|
const precision = arrowType.precision;
|
|
230
228
|
switch (precision) {
|
|
231
|
-
case
|
|
229
|
+
case arrow2.Precision.HALF:
|
|
232
230
|
return "float16";
|
|
233
|
-
case
|
|
231
|
+
case arrow2.Precision.SINGLE:
|
|
234
232
|
return "float32";
|
|
235
|
-
case
|
|
233
|
+
case arrow2.Precision.DOUBLE:
|
|
236
234
|
return "float64";
|
|
237
235
|
default:
|
|
238
236
|
return "float16";
|
|
239
237
|
}
|
|
240
|
-
case
|
|
238
|
+
case arrow2.Float16:
|
|
241
239
|
return "float16";
|
|
242
|
-
case
|
|
240
|
+
case arrow2.Float32:
|
|
243
241
|
return "float32";
|
|
244
|
-
case
|
|
242
|
+
case arrow2.Float64:
|
|
245
243
|
return "float64";
|
|
246
|
-
case
|
|
244
|
+
case arrow2.Utf8:
|
|
247
245
|
return "utf8";
|
|
248
|
-
case
|
|
246
|
+
case arrow2.Decimal:
|
|
249
247
|
const decimal = arrowType;
|
|
250
248
|
return {
|
|
251
249
|
type: "decimal",
|
|
@@ -253,93 +251,93 @@ function serializeArrowType(arrowType) {
|
|
|
253
251
|
precision: decimal.precision,
|
|
254
252
|
scale: decimal.scale
|
|
255
253
|
};
|
|
256
|
-
case
|
|
254
|
+
case arrow2.Date_:
|
|
257
255
|
const dateUnit = arrowType.unit;
|
|
258
|
-
return dateUnit ===
|
|
259
|
-
case
|
|
256
|
+
return dateUnit === arrow2.DateUnit.DAY ? "date-day" : "date-millisecond";
|
|
257
|
+
case arrow2.DateDay:
|
|
260
258
|
return "date-day";
|
|
261
|
-
case
|
|
259
|
+
case arrow2.DateMillisecond:
|
|
262
260
|
return "date-millisecond";
|
|
263
|
-
case
|
|
261
|
+
case arrow2.Time:
|
|
264
262
|
const timeUnit = arrowType.unit;
|
|
265
263
|
switch (timeUnit) {
|
|
266
|
-
case
|
|
264
|
+
case arrow2.TimeUnit.SECOND:
|
|
267
265
|
return "time-second";
|
|
268
|
-
case
|
|
266
|
+
case arrow2.TimeUnit.MILLISECOND:
|
|
269
267
|
return "time-millisecond";
|
|
270
|
-
case
|
|
268
|
+
case arrow2.TimeUnit.MICROSECOND:
|
|
271
269
|
return "time-microsecond";
|
|
272
|
-
case
|
|
270
|
+
case arrow2.TimeUnit.NANOSECOND:
|
|
273
271
|
return "time-nanosecond";
|
|
274
272
|
default:
|
|
275
273
|
return "time-second";
|
|
276
274
|
}
|
|
277
|
-
case
|
|
275
|
+
case arrow2.TimeMillisecond:
|
|
278
276
|
return "time-millisecond";
|
|
279
|
-
case
|
|
277
|
+
case arrow2.TimeSecond:
|
|
280
278
|
return "time-second";
|
|
281
|
-
case
|
|
279
|
+
case arrow2.TimeMicrosecond:
|
|
282
280
|
return "time-microsecond";
|
|
283
|
-
case
|
|
281
|
+
case arrow2.TimeNanosecond:
|
|
284
282
|
return "time-nanosecond";
|
|
285
|
-
case
|
|
283
|
+
case arrow2.Timestamp:
|
|
286
284
|
const timeStampUnit = arrowType.unit;
|
|
287
285
|
switch (timeStampUnit) {
|
|
288
|
-
case
|
|
286
|
+
case arrow2.TimeUnit.SECOND:
|
|
289
287
|
return "timestamp-second";
|
|
290
|
-
case
|
|
288
|
+
case arrow2.TimeUnit.MILLISECOND:
|
|
291
289
|
return "timestamp-millisecond";
|
|
292
|
-
case
|
|
290
|
+
case arrow2.TimeUnit.MICROSECOND:
|
|
293
291
|
return "timestamp-microsecond";
|
|
294
|
-
case
|
|
292
|
+
case arrow2.TimeUnit.NANOSECOND:
|
|
295
293
|
return "timestamp-nanosecond";
|
|
296
294
|
default:
|
|
297
295
|
return "timestamp-second";
|
|
298
296
|
}
|
|
299
|
-
case
|
|
297
|
+
case arrow2.TimestampSecond:
|
|
300
298
|
return "timestamp-second";
|
|
301
|
-
case
|
|
299
|
+
case arrow2.TimestampMillisecond:
|
|
302
300
|
return "timestamp-millisecond";
|
|
303
|
-
case
|
|
301
|
+
case arrow2.TimestampMicrosecond:
|
|
304
302
|
return "timestamp-microsecond";
|
|
305
|
-
case
|
|
303
|
+
case arrow2.TimestampNanosecond:
|
|
306
304
|
return "timestamp-nanosecond";
|
|
307
|
-
case
|
|
305
|
+
case arrow2.Interval:
|
|
308
306
|
const intervalUnit = arrowType.unit;
|
|
309
307
|
switch (intervalUnit) {
|
|
310
|
-
case
|
|
308
|
+
case arrow2.IntervalUnit.DAY_TIME:
|
|
311
309
|
return "interval-daytime";
|
|
312
|
-
case
|
|
310
|
+
case arrow2.IntervalUnit.YEAR_MONTH:
|
|
313
311
|
return "interval-yearmonth";
|
|
314
312
|
default:
|
|
315
313
|
return "interval-daytime";
|
|
316
314
|
}
|
|
317
|
-
case
|
|
315
|
+
case arrow2.IntervalDayTime:
|
|
318
316
|
return "interval-daytime";
|
|
319
|
-
case
|
|
317
|
+
case arrow2.IntervalYearMonth:
|
|
320
318
|
return "interval-yearmonth";
|
|
321
|
-
case
|
|
319
|
+
case arrow2.Map_:
|
|
322
320
|
const mapType = arrowType;
|
|
323
321
|
return {
|
|
324
322
|
type: "map",
|
|
325
323
|
keysSorted: mapType.keysSorted,
|
|
326
324
|
children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
327
325
|
};
|
|
328
|
-
case
|
|
326
|
+
case arrow2.List:
|
|
329
327
|
const listType = arrowType;
|
|
330
328
|
const listField = listType.valueField;
|
|
331
329
|
return {
|
|
332
330
|
type: "list",
|
|
333
331
|
children: [serializeArrowField(listField)]
|
|
334
332
|
};
|
|
335
|
-
case
|
|
333
|
+
case arrow2.FixedSizeList:
|
|
336
334
|
const fixedSizeList = arrowType;
|
|
337
335
|
return {
|
|
338
336
|
type: "fixed-size-list",
|
|
339
337
|
listSize: fixedSizeList.listSize,
|
|
340
338
|
children: [serializeArrowField(fixedSizeList.children[0])]
|
|
341
339
|
};
|
|
342
|
-
case
|
|
340
|
+
case arrow2.Struct:
|
|
343
341
|
const structType = arrowType;
|
|
344
342
|
return {
|
|
345
343
|
type: "struct",
|
|
@@ -353,114 +351,312 @@ function deserializeArrowType(dataType) {
|
|
|
353
351
|
if (typeof dataType === "object") {
|
|
354
352
|
switch (dataType.type) {
|
|
355
353
|
case "decimal":
|
|
356
|
-
return new
|
|
354
|
+
return new arrow2.Decimal(dataType.precision, dataType.scale, dataType.bitWidth);
|
|
357
355
|
case "map":
|
|
358
356
|
let children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
|
|
359
|
-
return new
|
|
357
|
+
return new arrow2.Map_(children, dataType.keysSorted);
|
|
360
358
|
case "list":
|
|
361
359
|
const field = deserializeArrowField(dataType.children[0]);
|
|
362
|
-
return new
|
|
360
|
+
return new arrow2.List(field);
|
|
363
361
|
case "fixed-size-list":
|
|
364
362
|
const child = deserializeArrowField(dataType.children[0]);
|
|
365
|
-
return new
|
|
363
|
+
return new arrow2.FixedSizeList(dataType.listSize, child);
|
|
366
364
|
case "struct":
|
|
367
365
|
children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
|
|
368
|
-
return new
|
|
366
|
+
return new arrow2.Struct(children);
|
|
369
367
|
default:
|
|
370
368
|
throw new Error("array type not supported");
|
|
371
369
|
}
|
|
372
370
|
}
|
|
373
371
|
switch (dataType) {
|
|
374
372
|
case "null":
|
|
375
|
-
return new
|
|
373
|
+
return new arrow2.Null();
|
|
376
374
|
case "binary":
|
|
377
|
-
return new
|
|
375
|
+
return new arrow2.Binary();
|
|
378
376
|
case "bool":
|
|
379
|
-
return new
|
|
377
|
+
return new arrow2.Bool();
|
|
380
378
|
case "int8":
|
|
381
|
-
return new
|
|
379
|
+
return new arrow2.Int8();
|
|
382
380
|
case "int16":
|
|
383
|
-
return new
|
|
381
|
+
return new arrow2.Int16();
|
|
384
382
|
case "int32":
|
|
385
|
-
return new
|
|
383
|
+
return new arrow2.Int32();
|
|
386
384
|
case "int64":
|
|
387
|
-
return new
|
|
385
|
+
return new arrow2.Int64();
|
|
388
386
|
case "uint8":
|
|
389
|
-
return new
|
|
387
|
+
return new arrow2.Uint8();
|
|
390
388
|
case "uint16":
|
|
391
|
-
return new
|
|
389
|
+
return new arrow2.Uint16();
|
|
392
390
|
case "uint32":
|
|
393
|
-
return new
|
|
391
|
+
return new arrow2.Uint32();
|
|
394
392
|
case "uint64":
|
|
395
|
-
return new
|
|
393
|
+
return new arrow2.Uint64();
|
|
396
394
|
case "float16":
|
|
397
|
-
return new
|
|
395
|
+
return new arrow2.Float16();
|
|
398
396
|
case "float32":
|
|
399
|
-
return new
|
|
397
|
+
return new arrow2.Float32();
|
|
400
398
|
case "float64":
|
|
401
|
-
return new
|
|
399
|
+
return new arrow2.Float64();
|
|
402
400
|
case "utf8":
|
|
403
|
-
return new
|
|
401
|
+
return new arrow2.Utf8();
|
|
404
402
|
case "date-day":
|
|
405
|
-
return new
|
|
403
|
+
return new arrow2.DateDay();
|
|
406
404
|
case "date-millisecond":
|
|
407
|
-
return new
|
|
405
|
+
return new arrow2.DateMillisecond();
|
|
408
406
|
case "time-second":
|
|
409
|
-
return new
|
|
407
|
+
return new arrow2.TimeSecond();
|
|
410
408
|
case "time-millisecond":
|
|
411
|
-
return new
|
|
409
|
+
return new arrow2.TimeMillisecond();
|
|
412
410
|
case "time-microsecond":
|
|
413
|
-
return new
|
|
411
|
+
return new arrow2.TimeMicrosecond();
|
|
414
412
|
case "time-nanosecond":
|
|
415
|
-
return new
|
|
413
|
+
return new arrow2.TimeNanosecond();
|
|
416
414
|
case "timestamp-second":
|
|
417
|
-
return new
|
|
415
|
+
return new arrow2.TimestampSecond();
|
|
418
416
|
case "timestamp-millisecond":
|
|
419
|
-
return new
|
|
417
|
+
return new arrow2.TimestampMillisecond();
|
|
420
418
|
case "timestamp-microsecond":
|
|
421
|
-
return new
|
|
419
|
+
return new arrow2.TimestampMicrosecond();
|
|
422
420
|
case "timestamp-nanosecond":
|
|
423
|
-
return new
|
|
421
|
+
return new arrow2.TimestampNanosecond();
|
|
424
422
|
case "interval-daytime":
|
|
425
|
-
return new
|
|
423
|
+
return new arrow2.IntervalDayTime();
|
|
426
424
|
case "interval-yearmonth":
|
|
427
|
-
return new
|
|
425
|
+
return new arrow2.IntervalYearMonth();
|
|
428
426
|
default:
|
|
429
427
|
throw new Error("array type not supported");
|
|
430
428
|
}
|
|
431
429
|
}
|
|
432
430
|
|
|
433
|
-
// dist/
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
431
|
+
// dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.js
|
|
432
|
+
var import_gis = require("@loaders.gl/gis");
|
|
433
|
+
var import_wkt = require("@loaders.gl/wkt");
|
|
434
|
+
function parseGeometryFromArrow(arrowCellValue, encoding) {
|
|
435
|
+
encoding = encoding == null ? void 0 : encoding.toLowerCase();
|
|
436
|
+
if (!encoding || !arrowCellValue) {
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
let geometry;
|
|
440
|
+
switch (encoding) {
|
|
441
|
+
case "geoarrow.multipolygon":
|
|
442
|
+
geometry = arrowMultiPolygonToFeature(arrowCellValue);
|
|
443
|
+
break;
|
|
444
|
+
case "geoarrow.polygon":
|
|
445
|
+
geometry = arrowPolygonToFeature(arrowCellValue);
|
|
446
|
+
break;
|
|
447
|
+
case "geoarrow.multipoint":
|
|
448
|
+
geometry = arrowMultiPointToFeature(arrowCellValue);
|
|
449
|
+
break;
|
|
450
|
+
case "geoarrow.point":
|
|
451
|
+
geometry = arrowPointToFeature(arrowCellValue);
|
|
452
|
+
break;
|
|
453
|
+
case "geoarrow.multilinestring":
|
|
454
|
+
geometry = arrowMultiLineStringToFeature(arrowCellValue);
|
|
455
|
+
break;
|
|
456
|
+
case "geoarrow.linestring":
|
|
457
|
+
geometry = arrowLineStringToFeature(arrowCellValue);
|
|
458
|
+
break;
|
|
459
|
+
case "geoarrow.wkb":
|
|
460
|
+
geometry = arrowWKBToFeature(arrowCellValue);
|
|
461
|
+
break;
|
|
462
|
+
case "geoarrow.wkt":
|
|
463
|
+
geometry = arrowWKTToFeature(arrowCellValue);
|
|
464
|
+
break;
|
|
465
|
+
default: {
|
|
466
|
+
throw Error(`GeoArrow encoding not supported ${encoding}`);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return geometry;
|
|
470
|
+
}
|
|
471
|
+
function arrowWKBToFeature(arrowCellValue) {
|
|
472
|
+
var _a, _b;
|
|
473
|
+
const arrayBuffer = arrowCellValue.buffer.slice(arrowCellValue.byteOffset, arrowCellValue.byteOffset + arrowCellValue.byteLength);
|
|
474
|
+
const binaryGeometry = (_b = (_a = import_wkt.WKBLoader).parseSync) == null ? void 0 : _b.call(_a, arrayBuffer);
|
|
475
|
+
const geometry = (0, import_gis.binaryToGeometry)(binaryGeometry);
|
|
476
|
+
return geometry;
|
|
477
|
+
}
|
|
478
|
+
function arrowWKTToFeature(arrowCellValue) {
|
|
479
|
+
var _a, _b;
|
|
480
|
+
const string = arrowCellValue;
|
|
481
|
+
return (_b = (_a = import_wkt.WKTLoader).parseTextSync) == null ? void 0 : _b.call(_a, string);
|
|
482
|
+
}
|
|
483
|
+
function arrowMultiPolygonToFeature(arrowMultiPolygon) {
|
|
484
|
+
const multiPolygon = [];
|
|
485
|
+
for (let m = 0; m < arrowMultiPolygon.length; m++) {
|
|
486
|
+
const arrowPolygon = arrowMultiPolygon.get(m);
|
|
487
|
+
const polygon = [];
|
|
488
|
+
for (let i = 0; arrowPolygon && i < (arrowPolygon == null ? void 0 : arrowPolygon.length); i++) {
|
|
489
|
+
const arrowRing = arrowPolygon == null ? void 0 : arrowPolygon.get(i);
|
|
490
|
+
const ring = [];
|
|
491
|
+
for (let j = 0; arrowRing && j < arrowRing.length; j++) {
|
|
492
|
+
const arrowCoord = arrowRing.get(j);
|
|
493
|
+
const coord = Array.from(arrowCoord);
|
|
494
|
+
ring.push(coord);
|
|
495
|
+
}
|
|
496
|
+
polygon.push(ring);
|
|
497
|
+
}
|
|
498
|
+
multiPolygon.push(polygon);
|
|
499
|
+
}
|
|
500
|
+
const geometry = {
|
|
501
|
+
type: "MultiPolygon",
|
|
502
|
+
coordinates: multiPolygon
|
|
440
503
|
};
|
|
441
|
-
|
|
504
|
+
return geometry;
|
|
505
|
+
}
|
|
506
|
+
function arrowPolygonToFeature(arrowPolygon) {
|
|
507
|
+
const polygon = [];
|
|
508
|
+
for (let i = 0; arrowPolygon && i < arrowPolygon.length; i++) {
|
|
509
|
+
const arrowRing = arrowPolygon.get(i);
|
|
510
|
+
const ring = [];
|
|
511
|
+
for (let j = 0; arrowRing && j < arrowRing.length; j++) {
|
|
512
|
+
const arrowCoord = arrowRing.get(j);
|
|
513
|
+
const coords = Array.from(arrowCoord);
|
|
514
|
+
ring.push(coords);
|
|
515
|
+
}
|
|
516
|
+
polygon.push(ring);
|
|
517
|
+
}
|
|
518
|
+
const geometry = {
|
|
519
|
+
type: "Polygon",
|
|
520
|
+
coordinates: polygon
|
|
521
|
+
};
|
|
522
|
+
return geometry;
|
|
523
|
+
}
|
|
524
|
+
function arrowMultiPointToFeature(arrowMultiPoint) {
|
|
525
|
+
const multiPoint = [];
|
|
526
|
+
for (let i = 0; arrowMultiPoint && i < arrowMultiPoint.length; i++) {
|
|
527
|
+
const arrowPoint = arrowMultiPoint.get(i);
|
|
528
|
+
if (arrowPoint) {
|
|
529
|
+
const coord = Array.from(arrowPoint);
|
|
530
|
+
multiPoint.push(coord);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
type: "MultiPoint",
|
|
535
|
+
coordinates: multiPoint
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function arrowPointToFeature(arrowPoint) {
|
|
539
|
+
const point = Array.from(arrowPoint);
|
|
540
|
+
return {
|
|
541
|
+
type: "Point",
|
|
542
|
+
coordinates: point
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
function arrowMultiLineStringToFeature(arrowMultiLineString) {
|
|
546
|
+
const multiLineString = [];
|
|
547
|
+
for (let i = 0; arrowMultiLineString && i < arrowMultiLineString.length; i++) {
|
|
548
|
+
const arrowLineString = arrowMultiLineString.get(i);
|
|
549
|
+
const lineString = [];
|
|
550
|
+
for (let j = 0; arrowLineString && j < arrowLineString.length; j++) {
|
|
551
|
+
const arrowCoord = arrowLineString.get(j);
|
|
552
|
+
if (arrowCoord) {
|
|
553
|
+
const coords = Array.from(arrowCoord);
|
|
554
|
+
lineString.push(coords);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
multiLineString.push(lineString);
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
type: "MultiLineString",
|
|
561
|
+
coordinates: multiLineString
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
function arrowLineStringToFeature(arrowLineString) {
|
|
565
|
+
const lineString = [];
|
|
566
|
+
for (let i = 0; arrowLineString && i < arrowLineString.length; i++) {
|
|
567
|
+
const arrowCoord = arrowLineString.get(i);
|
|
568
|
+
if (arrowCoord) {
|
|
569
|
+
const coords = Array.from(arrowCoord);
|
|
570
|
+
lineString.push(coords);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
type: "LineString",
|
|
575
|
+
coordinates: lineString
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// dist/lib/tables/convert-arrow-to-table.js
|
|
580
|
+
function convertArrowToTable(arrowTable, shape) {
|
|
442
581
|
switch (shape) {
|
|
443
582
|
case "arrow-table":
|
|
444
|
-
return arrowTable;
|
|
583
|
+
return convertArrowToArrowTable(arrowTable);
|
|
584
|
+
case "array-row-table":
|
|
585
|
+
return convertArrowToArrayRowTable(arrowTable);
|
|
586
|
+
case "object-row-table":
|
|
587
|
+
return convertArrowToObjectRowTable(arrowTable);
|
|
445
588
|
case "columnar-table":
|
|
446
589
|
return convertArrowToColumnarTable(arrowTable);
|
|
447
|
-
case "
|
|
448
|
-
|
|
449
|
-
return (0, import_schema2.convertTable)(columnarTable, "object-row-table");
|
|
450
|
-
case "array-row-table":
|
|
451
|
-
columnarTable = convertArrowToColumnarTable(arrowTable);
|
|
452
|
-
return (0, import_schema2.convertTable)(columnarTable, "array-row-table");
|
|
590
|
+
case "geojson-table":
|
|
591
|
+
return convertArrowToGeoJSONTable(arrowTable);
|
|
453
592
|
default:
|
|
454
593
|
throw new Error(shape);
|
|
455
594
|
}
|
|
456
595
|
}
|
|
596
|
+
function convertArrowToArrowTable(arrowTable) {
|
|
597
|
+
return {
|
|
598
|
+
shape: "arrow-table",
|
|
599
|
+
schema: convertArrowToSchema(arrowTable.schema),
|
|
600
|
+
data: arrowTable
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
function convertArrowToArrayRowTable(arrowTable) {
|
|
604
|
+
const columnarTable = convertArrowToColumnarTable(arrowTable);
|
|
605
|
+
return (0, import_schema2.convertTable)(columnarTable, "array-row-table");
|
|
606
|
+
}
|
|
607
|
+
function convertArrowToObjectRowTable(arrowTable) {
|
|
608
|
+
const columnarTable = convertArrowToColumnarTable(arrowTable);
|
|
609
|
+
return (0, import_schema2.convertTable)(columnarTable, "object-row-table");
|
|
610
|
+
}
|
|
611
|
+
function convertArrowToColumnarTable(arrowTable) {
|
|
612
|
+
const columns = {};
|
|
613
|
+
for (const field of arrowTable.schema.fields) {
|
|
614
|
+
const arrowColumn = arrowTable.getChild(field.name);
|
|
615
|
+
const values = arrowColumn == null ? void 0 : arrowColumn.toArray();
|
|
616
|
+
columns[field.name] = values;
|
|
617
|
+
}
|
|
618
|
+
const schema = convertArrowToSchema(arrowTable.schema);
|
|
619
|
+
return {
|
|
620
|
+
shape: "columnar-table",
|
|
621
|
+
schema,
|
|
622
|
+
data: columns
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function convertArrowToGeoJSONTable(arrowTable) {
|
|
626
|
+
var _a;
|
|
627
|
+
const schema = convertArrowToSchema(arrowTable.schema);
|
|
628
|
+
const geometryColumns = (0, import_gis2.getGeometryColumnsFromSchema)(schema);
|
|
629
|
+
const encoding = geometryColumns.geometry.encoding;
|
|
630
|
+
const features = [];
|
|
631
|
+
const propertyColumnNames = arrowTable.schema.fields.map((field) => field.name).filter((name) => !(name in geometryColumns));
|
|
632
|
+
const propertiesTable = arrowTable.select(propertyColumnNames);
|
|
633
|
+
const arrowGeometryColumn = arrowTable.getChild("geometry");
|
|
634
|
+
for (let row = 0; row < arrowTable.numRows; row++) {
|
|
635
|
+
const arrowGeometry = arrowGeometryColumn == null ? void 0 : arrowGeometryColumn.get(row);
|
|
636
|
+
const feature = parseGeometryFromArrow(arrowGeometry, encoding);
|
|
637
|
+
if (feature) {
|
|
638
|
+
const properties = ((_a = propertiesTable.get(row)) == null ? void 0 : _a.toJSON()) || {};
|
|
639
|
+
features.push({ type: "Feature", geometry: feature, properties });
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return {
|
|
643
|
+
shape: "geojson-table",
|
|
644
|
+
type: "FeatureCollection",
|
|
645
|
+
schema,
|
|
646
|
+
features
|
|
647
|
+
};
|
|
648
|
+
}
|
|
457
649
|
|
|
458
|
-
// dist/parsers/parse-arrow
|
|
459
|
-
|
|
650
|
+
// dist/lib/parsers/parse-arrow.js
|
|
651
|
+
function parseArrowSync(arrayBuffer, options) {
|
|
652
|
+
const shape = (options == null ? void 0 : options.shape) || "arrow-table";
|
|
653
|
+
const arrowTable = arrow3.tableFromIPC([new Uint8Array(arrayBuffer)]);
|
|
654
|
+
return convertArrowToTable(arrowTable, shape);
|
|
655
|
+
}
|
|
460
656
|
function parseArrowInBatches(asyncIterator, options) {
|
|
461
657
|
async function* makeArrowAsyncIterator() {
|
|
462
658
|
var _a, _b;
|
|
463
|
-
const readers =
|
|
659
|
+
const readers = arrow3.RecordBatchReader.readAll(asyncIterator);
|
|
464
660
|
for await (const reader of readers) {
|
|
465
661
|
for await (const recordBatch of reader) {
|
|
466
662
|
if (((_a = options == null ? void 0 : options.arrow) == null ? void 0 : _a.batchDebounceMs) !== void 0 && ((_b = options == null ? void 0 : options.arrow) == null ? void 0 : _b.batchDebounceMs) > 0) {
|
|
@@ -472,7 +668,7 @@ function parseArrowInBatches(asyncIterator, options) {
|
|
|
472
668
|
const arrowTabledBatch = {
|
|
473
669
|
shape: "arrow-table",
|
|
474
670
|
batchType: "data",
|
|
475
|
-
data: new
|
|
671
|
+
data: new arrow3.Table([recordBatch]),
|
|
476
672
|
length: recordBatch.data.length
|
|
477
673
|
};
|
|
478
674
|
yield arrowTabledBatch;
|
|
@@ -484,30 +680,6 @@ function parseArrowInBatches(asyncIterator, options) {
|
|
|
484
680
|
}
|
|
485
681
|
|
|
486
682
|
// dist/arrow-loader.js
|
|
487
|
-
var VERSION = true ? "4.3.0-alpha.7" : "latest";
|
|
488
|
-
var ArrowWorkerLoader = {
|
|
489
|
-
dataType: null,
|
|
490
|
-
batchType: null,
|
|
491
|
-
name: "Apache Arrow",
|
|
492
|
-
id: "arrow",
|
|
493
|
-
module: "arrow",
|
|
494
|
-
version: VERSION,
|
|
495
|
-
// worker: true,
|
|
496
|
-
category: "table",
|
|
497
|
-
extensions: ["arrow", "feather"],
|
|
498
|
-
mimeTypes: [
|
|
499
|
-
"application/vnd.apache.arrow.file",
|
|
500
|
-
"application/vnd.apache.arrow.stream",
|
|
501
|
-
"application/octet-stream"
|
|
502
|
-
],
|
|
503
|
-
binary: true,
|
|
504
|
-
tests: ["ARROW"],
|
|
505
|
-
options: {
|
|
506
|
-
arrow: {
|
|
507
|
-
shape: "columnar-table"
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
683
|
var ArrowLoader = {
|
|
512
684
|
...ArrowWorkerLoader,
|
|
513
685
|
parse: async (arraybuffer, options) => parseArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
|
|
@@ -515,30 +687,30 @@ var ArrowLoader = {
|
|
|
515
687
|
parseInBatches: parseArrowInBatches
|
|
516
688
|
};
|
|
517
689
|
|
|
518
|
-
// dist/lib/encode-arrow.js
|
|
519
|
-
var
|
|
690
|
+
// dist/lib/encoders/encode-arrow.js
|
|
691
|
+
var arrow4 = __toESM(require("apache-arrow"), 1);
|
|
520
692
|
function encodeArrowSync(data) {
|
|
521
693
|
const vectors = {};
|
|
522
694
|
for (const arrayData of data) {
|
|
523
695
|
const arrayVector = createVector(arrayData.array, arrayData.type);
|
|
524
696
|
vectors[arrayData.name] = arrayVector;
|
|
525
697
|
}
|
|
526
|
-
const table = new
|
|
527
|
-
const arrowBuffer =
|
|
698
|
+
const table = new arrow4.Table(vectors);
|
|
699
|
+
const arrowBuffer = arrow4.tableToIPC(table);
|
|
528
700
|
return arrowBuffer;
|
|
529
701
|
}
|
|
530
702
|
function createVector(array, type) {
|
|
531
703
|
switch (type) {
|
|
532
704
|
case VECTOR_TYPES.DATE:
|
|
533
|
-
return
|
|
705
|
+
return arrow4.vectorFromArray(array);
|
|
534
706
|
case VECTOR_TYPES.FLOAT:
|
|
535
707
|
default:
|
|
536
|
-
return
|
|
708
|
+
return arrow4.vectorFromArray(array);
|
|
537
709
|
}
|
|
538
710
|
}
|
|
539
711
|
|
|
540
712
|
// dist/arrow-writer.js
|
|
541
|
-
var VERSION2 = true ? "4.3.0-
|
|
713
|
+
var VERSION2 = true ? "4.3.0-beta.1" : "latest";
|
|
542
714
|
var ArrowWriter = {
|
|
543
715
|
name: "Apache Arrow",
|
|
544
716
|
id: "arrow",
|
|
@@ -560,60 +732,31 @@ var ArrowWriter = {
|
|
|
560
732
|
}
|
|
561
733
|
};
|
|
562
734
|
|
|
563
|
-
// dist/
|
|
564
|
-
var
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
const schema = (0, import_arrow.serializeArrowSchema)(arrowTable.schema);
|
|
570
|
-
const geometryColumns = (0, import_gis.getGeometryColumnsFromSchema)(schema);
|
|
571
|
-
const encoding = geometryColumns.geometry.encoding;
|
|
572
|
-
const features = [];
|
|
573
|
-
const propertyColumnNames = arrowTable.schema.fields.map((field) => field.name).filter((name) => !(name in geometryColumns));
|
|
574
|
-
const propertiesTable = arrowTable.select(propertyColumnNames);
|
|
575
|
-
const arrowGeometryColumn = arrowTable.getChild("geometry");
|
|
576
|
-
for (let row = 0; row < arrowTable.numRows; row++) {
|
|
577
|
-
const arrowGeometry = arrowGeometryColumn == null ? void 0 : arrowGeometryColumn.get(row);
|
|
578
|
-
const feature = (0, import_arrow.parseGeometryFromArrow)(arrowGeometry, encoding);
|
|
579
|
-
if (feature) {
|
|
580
|
-
const properties = ((_a = propertiesTable.get(row)) == null ? void 0 : _a.toJSON()) || {};
|
|
581
|
-
features.push({ type: "Feature", geometry: feature, properties });
|
|
735
|
+
// dist/exports/geoarrow-loader.js
|
|
736
|
+
var GeoArrowWorkerLoader = {
|
|
737
|
+
...ArrowWorkerLoader,
|
|
738
|
+
options: {
|
|
739
|
+
arrow: {
|
|
740
|
+
shape: "arrow-table"
|
|
582
741
|
}
|
|
583
742
|
}
|
|
584
|
-
|
|
585
|
-
shape: "geojson-table",
|
|
586
|
-
type: "FeatureCollection",
|
|
587
|
-
schema: table.schema,
|
|
588
|
-
features
|
|
589
|
-
};
|
|
590
|
-
}
|
|
743
|
+
};
|
|
591
744
|
|
|
592
|
-
// dist/parsers/parse-geoarrow
|
|
745
|
+
// dist/lib/parsers/parse-geoarrow.js
|
|
593
746
|
function parseGeoArrowSync(arrayBuffer, options) {
|
|
594
747
|
const table = parseArrowSync(arrayBuffer, { shape: "arrow-table" });
|
|
595
748
|
switch (options == null ? void 0 : options.shape) {
|
|
596
749
|
case "geojson-table":
|
|
597
|
-
return
|
|
750
|
+
return convertArrowToTable(table.data, "geojson-table");
|
|
598
751
|
default:
|
|
599
752
|
return table;
|
|
600
753
|
}
|
|
601
754
|
}
|
|
602
|
-
|
|
603
|
-
// dist/parsers/parse-geoarrow-in-batches.js
|
|
604
755
|
function parseGeoArrowInBatches(asyncIterator) {
|
|
605
756
|
return parseArrowInBatches(asyncIterator);
|
|
606
757
|
}
|
|
607
758
|
|
|
608
759
|
// dist/geoarrow-loader.js
|
|
609
|
-
var GeoArrowWorkerLoader = {
|
|
610
|
-
...ArrowWorkerLoader,
|
|
611
|
-
options: {
|
|
612
|
-
arrow: {
|
|
613
|
-
shape: "arrow-table"
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
760
|
var GeoArrowLoader = {
|
|
618
761
|
...GeoArrowWorkerLoader,
|
|
619
762
|
parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
|
|
@@ -621,10 +764,54 @@ var GeoArrowLoader = {
|
|
|
621
764
|
parseInBatches: parseGeoArrowInBatches
|
|
622
765
|
};
|
|
623
766
|
|
|
624
|
-
// dist/
|
|
767
|
+
// dist/lib/tables/convert-table-to-arrow.js
|
|
768
|
+
var arrow5 = __toESM(require("apache-arrow"), 1);
|
|
769
|
+
var import_schema3 = require("@loaders.gl/schema");
|
|
770
|
+
function convertTableToArrow(table, options) {
|
|
771
|
+
switch (table.shape) {
|
|
772
|
+
case "arrow-table":
|
|
773
|
+
return table.data;
|
|
774
|
+
case "columnar-table":
|
|
775
|
+
default:
|
|
776
|
+
const arrowBatchIterator = makeTableToArrowBatchesIterator(table, options);
|
|
777
|
+
return new arrow5.Table(arrowBatchIterator);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function* makeTableToArrowBatchesIterator(table, options) {
|
|
781
|
+
const arrowSchema = deserializeArrowSchema(table.schema);
|
|
782
|
+
const length = (0, import_schema3.getTableLength)(table);
|
|
783
|
+
const numColumns = (0, import_schema3.getTableNumCols)(table);
|
|
784
|
+
const batchSize = (options == null ? void 0 : options.batchSize) || length;
|
|
785
|
+
const builders = arrowSchema == null ? void 0 : arrowSchema.fields.map((arrowField) => arrow5.makeBuilder(arrowField));
|
|
786
|
+
const structField = new arrow5.Struct(arrowSchema.fields);
|
|
787
|
+
let batchLength = 0;
|
|
788
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
789
|
+
for (let columnIndex = 0; columnIndex < numColumns; ++columnIndex) {
|
|
790
|
+
const value = (0, import_schema3.getTableCellAt)(table, rowIndex, columnIndex);
|
|
791
|
+
const builder = builders[columnIndex];
|
|
792
|
+
builder.append(value);
|
|
793
|
+
batchLength++;
|
|
794
|
+
if (batchLength >= batchSize) {
|
|
795
|
+
const datas = builders.map((builder2) => builder2.flush());
|
|
796
|
+
const structData = new arrow5.Data(structField, 0, batchLength, 0, void 0, datas);
|
|
797
|
+
yield new arrow5.RecordBatch(arrowSchema, structData);
|
|
798
|
+
batchLength = 0;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (batchLength > 0) {
|
|
803
|
+
const datas = builders.map((builder) => builder.flush());
|
|
804
|
+
const structData = new arrow5.Data(structField, 0, batchLength, 0, void 0, datas);
|
|
805
|
+
yield new arrow5.RecordBatch(arrowSchema, structData);
|
|
806
|
+
batchLength = 0;
|
|
807
|
+
}
|
|
808
|
+
builders.map((builder) => builder.finish());
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.js
|
|
625
812
|
var import_polygon = require("@math.gl/polygon");
|
|
626
813
|
|
|
627
|
-
// dist/geoarrow/get-arrow-bounds.js
|
|
814
|
+
// dist/lib/geoarrow/get-arrow-bounds.js
|
|
628
815
|
function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds, sampleSize = 100) {
|
|
629
816
|
const numberOfFeatures = flatCoords.length / nDim;
|
|
630
817
|
const sampleStep = Math.max(Math.floor(numberOfFeatures / sampleSize), 1);
|
|
@@ -648,7 +835,7 @@ function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds, sampleSize =
|
|
|
648
835
|
return newBounds;
|
|
649
836
|
}
|
|
650
837
|
|
|
651
|
-
// dist/geoarrow/convert-geoarrow-to-binary-geometry.js
|
|
838
|
+
// dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.js
|
|
652
839
|
var BinaryGeometryType;
|
|
653
840
|
(function(BinaryGeometryType2) {
|
|
654
841
|
BinaryGeometryType2["points"] = "points";
|
|
@@ -936,159 +1123,11 @@ function getBinaryPointsFromChunk(chunk, geoEncoding) {
|
|
|
936
1123
|
};
|
|
937
1124
|
}
|
|
938
1125
|
|
|
939
|
-
// dist/geoarrow/convert-geoarrow-to-geojson-geometry.js
|
|
940
|
-
var import_gis2 = require("@loaders.gl/gis");
|
|
941
|
-
var import_wkt = require("@loaders.gl/wkt");
|
|
942
|
-
function parseGeometryFromArrow2(arrowCellValue, encoding) {
|
|
943
|
-
encoding = encoding == null ? void 0 : encoding.toLowerCase();
|
|
944
|
-
if (!encoding || !arrowCellValue) {
|
|
945
|
-
return null;
|
|
946
|
-
}
|
|
947
|
-
let geometry;
|
|
948
|
-
switch (encoding) {
|
|
949
|
-
case "geoarrow.multipolygon":
|
|
950
|
-
geometry = arrowMultiPolygonToFeature(arrowCellValue);
|
|
951
|
-
break;
|
|
952
|
-
case "geoarrow.polygon":
|
|
953
|
-
geometry = arrowPolygonToFeature(arrowCellValue);
|
|
954
|
-
break;
|
|
955
|
-
case "geoarrow.multipoint":
|
|
956
|
-
geometry = arrowMultiPointToFeature(arrowCellValue);
|
|
957
|
-
break;
|
|
958
|
-
case "geoarrow.point":
|
|
959
|
-
geometry = arrowPointToFeature(arrowCellValue);
|
|
960
|
-
break;
|
|
961
|
-
case "geoarrow.multilinestring":
|
|
962
|
-
geometry = arrowMultiLineStringToFeature(arrowCellValue);
|
|
963
|
-
break;
|
|
964
|
-
case "geoarrow.linestring":
|
|
965
|
-
geometry = arrowLineStringToFeature(arrowCellValue);
|
|
966
|
-
break;
|
|
967
|
-
case "geoarrow.wkb":
|
|
968
|
-
geometry = arrowWKBToFeature(arrowCellValue);
|
|
969
|
-
break;
|
|
970
|
-
case "geoarrow.wkt":
|
|
971
|
-
geometry = arrowWKTToFeature(arrowCellValue);
|
|
972
|
-
break;
|
|
973
|
-
default: {
|
|
974
|
-
throw Error(`GeoArrow encoding not supported ${encoding}`);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
return geometry;
|
|
978
|
-
}
|
|
979
|
-
function arrowWKBToFeature(arrowCellValue) {
|
|
980
|
-
var _a, _b;
|
|
981
|
-
const arrayBuffer = arrowCellValue.buffer.slice(arrowCellValue.byteOffset, arrowCellValue.byteOffset + arrowCellValue.byteLength);
|
|
982
|
-
const binaryGeometry = (_b = (_a = import_wkt.WKBLoader).parseSync) == null ? void 0 : _b.call(_a, arrayBuffer);
|
|
983
|
-
const geometry = (0, import_gis2.binaryToGeometry)(binaryGeometry);
|
|
984
|
-
return geometry;
|
|
985
|
-
}
|
|
986
|
-
function arrowWKTToFeature(arrowCellValue) {
|
|
987
|
-
var _a, _b;
|
|
988
|
-
const string = arrowCellValue;
|
|
989
|
-
return (_b = (_a = import_wkt.WKTLoader).parseTextSync) == null ? void 0 : _b.call(_a, string);
|
|
990
|
-
}
|
|
991
|
-
function arrowMultiPolygonToFeature(arrowMultiPolygon) {
|
|
992
|
-
const multiPolygon = [];
|
|
993
|
-
for (let m = 0; m < arrowMultiPolygon.length; m++) {
|
|
994
|
-
const arrowPolygon = arrowMultiPolygon.get(m);
|
|
995
|
-
const polygon = [];
|
|
996
|
-
for (let i = 0; arrowPolygon && i < (arrowPolygon == null ? void 0 : arrowPolygon.length); i++) {
|
|
997
|
-
const arrowRing = arrowPolygon == null ? void 0 : arrowPolygon.get(i);
|
|
998
|
-
const ring = [];
|
|
999
|
-
for (let j = 0; arrowRing && j < arrowRing.length; j++) {
|
|
1000
|
-
const arrowCoord = arrowRing.get(j);
|
|
1001
|
-
const coord = Array.from(arrowCoord);
|
|
1002
|
-
ring.push(coord);
|
|
1003
|
-
}
|
|
1004
|
-
polygon.push(ring);
|
|
1005
|
-
}
|
|
1006
|
-
multiPolygon.push(polygon);
|
|
1007
|
-
}
|
|
1008
|
-
const geometry = {
|
|
1009
|
-
type: "MultiPolygon",
|
|
1010
|
-
coordinates: multiPolygon
|
|
1011
|
-
};
|
|
1012
|
-
return geometry;
|
|
1013
|
-
}
|
|
1014
|
-
function arrowPolygonToFeature(arrowPolygon) {
|
|
1015
|
-
const polygon = [];
|
|
1016
|
-
for (let i = 0; arrowPolygon && i < arrowPolygon.length; i++) {
|
|
1017
|
-
const arrowRing = arrowPolygon.get(i);
|
|
1018
|
-
const ring = [];
|
|
1019
|
-
for (let j = 0; arrowRing && j < arrowRing.length; j++) {
|
|
1020
|
-
const arrowCoord = arrowRing.get(j);
|
|
1021
|
-
const coords = Array.from(arrowCoord);
|
|
1022
|
-
ring.push(coords);
|
|
1023
|
-
}
|
|
1024
|
-
polygon.push(ring);
|
|
1025
|
-
}
|
|
1026
|
-
const geometry = {
|
|
1027
|
-
type: "Polygon",
|
|
1028
|
-
coordinates: polygon
|
|
1029
|
-
};
|
|
1030
|
-
return geometry;
|
|
1031
|
-
}
|
|
1032
|
-
function arrowMultiPointToFeature(arrowMultiPoint) {
|
|
1033
|
-
const multiPoint = [];
|
|
1034
|
-
for (let i = 0; arrowMultiPoint && i < arrowMultiPoint.length; i++) {
|
|
1035
|
-
const arrowPoint = arrowMultiPoint.get(i);
|
|
1036
|
-
if (arrowPoint) {
|
|
1037
|
-
const coord = Array.from(arrowPoint);
|
|
1038
|
-
multiPoint.push(coord);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
return {
|
|
1042
|
-
type: "MultiPoint",
|
|
1043
|
-
coordinates: multiPoint
|
|
1044
|
-
};
|
|
1045
|
-
}
|
|
1046
|
-
function arrowPointToFeature(arrowPoint) {
|
|
1047
|
-
const point = Array.from(arrowPoint);
|
|
1048
|
-
return {
|
|
1049
|
-
type: "Point",
|
|
1050
|
-
coordinates: point
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
function arrowMultiLineStringToFeature(arrowMultiLineString) {
|
|
1054
|
-
const multiLineString = [];
|
|
1055
|
-
for (let i = 0; arrowMultiLineString && i < arrowMultiLineString.length; i++) {
|
|
1056
|
-
const arrowLineString = arrowMultiLineString.get(i);
|
|
1057
|
-
const lineString = [];
|
|
1058
|
-
for (let j = 0; arrowLineString && j < arrowLineString.length; j++) {
|
|
1059
|
-
const arrowCoord = arrowLineString.get(j);
|
|
1060
|
-
if (arrowCoord) {
|
|
1061
|
-
const coords = Array.from(arrowCoord);
|
|
1062
|
-
lineString.push(coords);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
multiLineString.push(lineString);
|
|
1066
|
-
}
|
|
1067
|
-
return {
|
|
1068
|
-
type: "MultiLineString",
|
|
1069
|
-
coordinates: multiLineString
|
|
1070
|
-
};
|
|
1071
|
-
}
|
|
1072
|
-
function arrowLineStringToFeature(arrowLineString) {
|
|
1073
|
-
const lineString = [];
|
|
1074
|
-
for (let i = 0; arrowLineString && i < arrowLineString.length; i++) {
|
|
1075
|
-
const arrowCoord = arrowLineString.get(i);
|
|
1076
|
-
if (arrowCoord) {
|
|
1077
|
-
const coords = Array.from(arrowCoord);
|
|
1078
|
-
lineString.push(coords);
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
return {
|
|
1082
|
-
type: "LineString",
|
|
1083
|
-
coordinates: lineString
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
1126
|
// dist/workers/hard-clone.js
|
|
1088
|
-
var
|
|
1127
|
+
var arrow6 = __toESM(require("apache-arrow"), 1);
|
|
1089
1128
|
function hardClone(data, force = false) {
|
|
1090
1129
|
if ("data" in data) {
|
|
1091
|
-
return new
|
|
1130
|
+
return new arrow6.Vector(data.data.map((data2) => hardClone(data2, force)));
|
|
1092
1131
|
}
|
|
1093
1132
|
const clonedChildren = [];
|
|
1094
1133
|
for (const childData of data.children) {
|
|
@@ -1099,12 +1138,12 @@ function hardClone(data, force = false) {
|
|
|
1099
1138
|
clonedDictionary = hardClone(data.dictionary, force);
|
|
1100
1139
|
}
|
|
1101
1140
|
const clonedBuffers = {
|
|
1102
|
-
[
|
|
1103
|
-
[
|
|
1104
|
-
[
|
|
1105
|
-
[
|
|
1141
|
+
[arrow6.BufferType.OFFSET]: cloneBuffer(data.buffers[arrow6.BufferType.OFFSET], force),
|
|
1142
|
+
[arrow6.BufferType.DATA]: cloneBuffer(data.buffers[arrow6.BufferType.DATA], force),
|
|
1143
|
+
[arrow6.BufferType.VALIDITY]: cloneBuffer(data.buffers[arrow6.BufferType.VALIDITY], force),
|
|
1144
|
+
[arrow6.BufferType.TYPE]: cloneBuffer(data.buffers[arrow6.BufferType.TYPE], force)
|
|
1106
1145
|
};
|
|
1107
|
-
return new
|
|
1146
|
+
return new arrow6.Data(
|
|
1108
1147
|
data.type,
|
|
1109
1148
|
data.offset,
|
|
1110
1149
|
data.length,
|
|
@@ -1131,7 +1170,7 @@ function cloneBuffer(arr, force) {
|
|
|
1131
1170
|
|
|
1132
1171
|
// dist/triangulate-on-worker.js
|
|
1133
1172
|
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
1134
|
-
var VERSION3 = true ? "4.3.0-
|
|
1173
|
+
var VERSION3 = true ? "4.3.0-beta.1" : "latest";
|
|
1135
1174
|
var TriangulationWorker = {
|
|
1136
1175
|
id: "triangulation",
|
|
1137
1176
|
name: "Triangulate",
|
|
@@ -1147,5 +1186,5 @@ function parseGeoArrowOnWorker(data, options = {}) {
|
|
|
1147
1186
|
}
|
|
1148
1187
|
|
|
1149
1188
|
// dist/index.js
|
|
1150
|
-
|
|
1189
|
+
import_schema4.TableBatchBuilder.ArrowBatch = ArrowTableBatchAggregator;
|
|
1151
1190
|
//# sourceMappingURL=index.cjs.map
|