@loaders.gl/arrow 4.2.0-alpha.4 → 4.2.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrow-loader.d.ts +1 -1
- package/dist/arrow-loader.d.ts.map +1 -1
- package/dist/arrow-loader.js +30 -19
- package/dist/arrow-worker.js +4 -2
- package/dist/arrow-writer.d.ts +1 -1
- package/dist/arrow-writer.d.ts.map +1 -1
- package/dist/arrow-writer.js +23 -16
- package/dist/dist.dev.js +361 -333
- package/dist/dist.min.js +23 -0
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js +345 -288
- package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.js +151 -124
- package/dist/geoarrow/get-arrow-bounds.js +32 -22
- package/dist/geoarrow-loader.d.ts +1 -1
- package/dist/geoarrow-loader.d.ts.map +1 -1
- package/dist/geoarrow-loader.js +22 -15
- package/dist/geoarrow-writer.js +25 -16
- package/dist/index.cjs +55 -71
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/lib/arrow-table-batch.d.ts +1 -1
- package/dist/lib/arrow-table-batch.d.ts.map +1 -1
- package/dist/lib/arrow-table-batch.js +55 -51
- package/dist/lib/arrow-table.js +3 -1
- package/dist/lib/encode-arrow.d.ts +1 -1
- package/dist/lib/encode-arrow.d.ts.map +1 -1
- package/dist/lib/encode-arrow.js +31 -16
- package/dist/lib/encode-geoarrow.d.ts +1 -1
- package/dist/lib/encode-geoarrow.d.ts.map +1 -1
- package/dist/lib/encode-geoarrow.js +31 -16
- package/dist/parsers/parse-arrow-in-batches.d.ts +2 -2
- package/dist/parsers/parse-arrow-in-batches.d.ts.map +1 -1
- package/dist/parsers/parse-arrow-in-batches.js +49 -21
- package/dist/parsers/parse-arrow-sync.d.ts +1 -1
- package/dist/parsers/parse-arrow-sync.d.ts.map +1 -1
- package/dist/parsers/parse-arrow-sync.js +26 -22
- package/dist/parsers/parse-geoarrow-in-batches.d.ts +1 -1
- package/dist/parsers/parse-geoarrow-in-batches.d.ts.map +1 -1
- package/dist/parsers/parse-geoarrow-in-batches.js +7 -2
- package/dist/parsers/parse-geoarrow-sync.d.ts +1 -1
- package/dist/parsers/parse-geoarrow-sync.d.ts.map +1 -1
- package/dist/parsers/parse-geoarrow-sync.js +12 -10
- package/dist/schema/arrow-type-utils.js +36 -9
- package/dist/schema/convert-arrow-schema.js +253 -240
- package/dist/tables/convert-arrow-to-columnar-table.d.ts +1 -1
- package/dist/tables/convert-arrow-to-columnar-table.d.ts.map +1 -1
- package/dist/tables/convert-arrow-to-columnar-table.js +22 -13
- package/dist/tables/convert-arrow-to-geojson-table.d.ts +1 -1
- package/dist/tables/convert-arrow-to-geojson-table.d.ts.map +1 -1
- package/dist/tables/convert-arrow-to-geojson-table.js +47 -32
- package/dist/tables/convert-columnar-to-row-table.js +22 -16
- package/dist/tables/convert-table-to-arrow.js +58 -1
- package/dist/triangulate-on-worker.js +24 -19
- package/dist/triangulation-worker.js +6 -1
- package/dist/types.js +8 -6
- package/dist/workers/arrow-worker.js +3 -1
- package/dist/workers/hard-clone.js +93 -49
- package/dist/workers/triangulation-worker-node.d.ts +1 -1
- package/dist/workers/triangulation-worker-node.d.ts.map +1 -1
- package/dist/workers/triangulation-worker-node.js +3 -1
- package/dist/workers/triangulation-worker.js +48 -48
- package/package.json +13 -8
- package/dist/arrow-loader.js.map +0 -1
- package/dist/arrow-writer.js.map +0 -1
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js.map +0 -1
- package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.js.map +0 -1
- package/dist/geoarrow/get-arrow-bounds.js.map +0 -1
- package/dist/geoarrow-loader.js.map +0 -1
- package/dist/geoarrow-writer.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/arrow-table-batch.js.map +0 -1
- package/dist/lib/arrow-table.js.map +0 -1
- package/dist/lib/encode-arrow.js.map +0 -1
- package/dist/lib/encode-geoarrow.js.map +0 -1
- package/dist/parsers/parse-arrow-in-batches.js.map +0 -1
- package/dist/parsers/parse-arrow-sync.js.map +0 -1
- package/dist/parsers/parse-geoarrow-in-batches.js.map +0 -1
- package/dist/parsers/parse-geoarrow-sync.js.map +0 -1
- package/dist/schema/arrow-type-utils.js.map +0 -1
- package/dist/schema/convert-arrow-schema.js.map +0 -1
- package/dist/tables/convert-arrow-to-columnar-table.js.map +0 -1
- package/dist/tables/convert-arrow-to-geojson-table.js.map +0 -1
- package/dist/tables/convert-columnar-to-row-table.js.map +0 -1
- package/dist/tables/convert-table-to-arrow.js.map +0 -1
- package/dist/triangulate-on-worker.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/arrow-worker.js.map +0 -1
- package/dist/workers/hard-clone.js.map +0 -1
- package/dist/workers/triangulation-worker-node.js.map +0 -1
- package/dist/workers/triangulation-worker.js.map +0 -1
|
@@ -1,149 +1,176 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { binaryToGeometry } from '@loaders.gl/gis';
|
|
2
5
|
import { WKBLoader, WKTLoader } from '@loaders.gl/wkt';
|
|
6
|
+
/**
|
|
7
|
+
* parse geometry from arrow data that is returned from processArrowData()
|
|
8
|
+
* NOTE: this function could be deduplicated with the binaryToFeature() in deck.gl,
|
|
9
|
+
* it is currently used for deck.gl picking because currently deck.gl returns only the index of the feature
|
|
10
|
+
*
|
|
11
|
+
* @param data data extraced from arrow vector representing a geometry
|
|
12
|
+
* @param encoding the geoarrow encoding of the geometry column
|
|
13
|
+
* @returns Feature or null
|
|
14
|
+
*/
|
|
3
15
|
export function parseGeometryFromArrow(arrowCellValue, encoding) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return geometry;
|
|
16
|
+
// sanity
|
|
17
|
+
encoding = encoding?.toLowerCase();
|
|
18
|
+
if (!encoding || !arrowCellValue) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
let geometry;
|
|
22
|
+
switch (encoding) {
|
|
23
|
+
case 'geoarrow.multipolygon':
|
|
24
|
+
geometry = arrowMultiPolygonToFeature(arrowCellValue);
|
|
25
|
+
break;
|
|
26
|
+
case 'geoarrow.polygon':
|
|
27
|
+
geometry = arrowPolygonToFeature(arrowCellValue);
|
|
28
|
+
break;
|
|
29
|
+
case 'geoarrow.multipoint':
|
|
30
|
+
geometry = arrowMultiPointToFeature(arrowCellValue);
|
|
31
|
+
break;
|
|
32
|
+
case 'geoarrow.point':
|
|
33
|
+
geometry = arrowPointToFeature(arrowCellValue);
|
|
34
|
+
break;
|
|
35
|
+
case 'geoarrow.multilinestring':
|
|
36
|
+
geometry = arrowMultiLineStringToFeature(arrowCellValue);
|
|
37
|
+
break;
|
|
38
|
+
case 'geoarrow.linestring':
|
|
39
|
+
geometry = arrowLineStringToFeature(arrowCellValue);
|
|
40
|
+
break;
|
|
41
|
+
case 'geoarrow.wkb':
|
|
42
|
+
geometry = arrowWKBToFeature(arrowCellValue);
|
|
43
|
+
break;
|
|
44
|
+
case 'geoarrow.wkt':
|
|
45
|
+
geometry = arrowWKTToFeature(arrowCellValue);
|
|
46
|
+
break;
|
|
47
|
+
default: {
|
|
48
|
+
throw Error(`GeoArrow encoding not supported ${encoding}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return geometry;
|
|
41
52
|
}
|
|
42
53
|
function arrowWKBToFeature(arrowCellValue) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
// The actual WKB array buffer starts from byteOffset and ends at byteOffset + byteLength
|
|
55
|
+
const arrayBuffer = arrowCellValue.buffer.slice(arrowCellValue.byteOffset, arrowCellValue.byteOffset + arrowCellValue.byteLength);
|
|
56
|
+
const binaryGeometry = WKBLoader.parseSync?.(arrayBuffer);
|
|
57
|
+
const geometry = binaryToGeometry(binaryGeometry);
|
|
58
|
+
return geometry;
|
|
48
59
|
}
|
|
49
60
|
function arrowWKTToFeature(arrowCellValue) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return (_WKTLoader$parseTextS = WKTLoader.parseTextSync) === null || _WKTLoader$parseTextS === void 0 ? void 0 : _WKTLoader$parseTextS.call(WKTLoader, string);
|
|
61
|
+
const string = arrowCellValue;
|
|
62
|
+
return WKTLoader.parseTextSync?.(string);
|
|
53
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* convert Arrow MultiPolygon to geojson Feature
|
|
66
|
+
*/
|
|
54
67
|
function arrowMultiPolygonToFeature(arrowMultiPolygon) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
const multiPolygon = [];
|
|
69
|
+
for (let m = 0; m < arrowMultiPolygon.length; m++) {
|
|
70
|
+
const arrowPolygon = arrowMultiPolygon.get(m);
|
|
71
|
+
const polygon = [];
|
|
72
|
+
for (let i = 0; arrowPolygon && i < arrowPolygon?.length; i++) {
|
|
73
|
+
const arrowRing = arrowPolygon?.get(i);
|
|
74
|
+
const ring = [];
|
|
75
|
+
for (let j = 0; arrowRing && j < arrowRing.length; j++) {
|
|
76
|
+
const arrowCoord = arrowRing.get(j);
|
|
77
|
+
const coord = Array.from(arrowCoord);
|
|
78
|
+
ring.push(coord);
|
|
79
|
+
}
|
|
80
|
+
polygon.push(ring);
|
|
81
|
+
}
|
|
82
|
+
multiPolygon.push(polygon);
|
|
68
83
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
75
|
-
return geometry;
|
|
84
|
+
const geometry = {
|
|
85
|
+
type: 'MultiPolygon',
|
|
86
|
+
coordinates: multiPolygon
|
|
87
|
+
};
|
|
88
|
+
return geometry;
|
|
76
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* convert Arrow Polygon to geojson Feature
|
|
92
|
+
*/
|
|
77
93
|
function arrowPolygonToFeature(arrowPolygon) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
const polygon = [];
|
|
95
|
+
for (let i = 0; arrowPolygon && i < arrowPolygon.length; i++) {
|
|
96
|
+
const arrowRing = arrowPolygon.get(i);
|
|
97
|
+
const ring = [];
|
|
98
|
+
for (let j = 0; arrowRing && j < arrowRing.length; j++) {
|
|
99
|
+
const arrowCoord = arrowRing.get(j);
|
|
100
|
+
const coords = Array.from(arrowCoord);
|
|
101
|
+
ring.push(coords);
|
|
102
|
+
}
|
|
103
|
+
polygon.push(ring);
|
|
86
104
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
93
|
-
return geometry;
|
|
105
|
+
const geometry = {
|
|
106
|
+
type: 'Polygon',
|
|
107
|
+
coordinates: polygon
|
|
108
|
+
};
|
|
109
|
+
return geometry;
|
|
94
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* convert Arrow MultiPoint to geojson MultiPoint
|
|
113
|
+
*/
|
|
95
114
|
function arrowMultiPointToFeature(arrowMultiPoint) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
115
|
+
const multiPoint = [];
|
|
116
|
+
for (let i = 0; arrowMultiPoint && i < arrowMultiPoint.length; i++) {
|
|
117
|
+
const arrowPoint = arrowMultiPoint.get(i);
|
|
118
|
+
if (arrowPoint) {
|
|
119
|
+
const coord = Array.from(arrowPoint);
|
|
120
|
+
multiPoint.push(coord);
|
|
121
|
+
}
|
|
102
122
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
};
|
|
123
|
+
return {
|
|
124
|
+
type: 'MultiPoint',
|
|
125
|
+
coordinates: multiPoint
|
|
126
|
+
};
|
|
108
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* convert Arrow Point to geojson Point
|
|
130
|
+
*/
|
|
109
131
|
function arrowPointToFeature(arrowPoint) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
const point = Array.from(arrowPoint);
|
|
133
|
+
return {
|
|
134
|
+
type: 'Point',
|
|
135
|
+
coordinates: point
|
|
136
|
+
};
|
|
115
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* convert Arrow MultiLineString to geojson MultiLineString
|
|
140
|
+
*/
|
|
116
141
|
function arrowMultiLineStringToFeature(arrowMultiLineString) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
142
|
+
const multiLineString = [];
|
|
143
|
+
for (let i = 0; arrowMultiLineString && i < arrowMultiLineString.length; i++) {
|
|
144
|
+
const arrowLineString = arrowMultiLineString.get(i);
|
|
145
|
+
const lineString = [];
|
|
146
|
+
for (let j = 0; arrowLineString && j < arrowLineString.length; j++) {
|
|
147
|
+
const arrowCoord = arrowLineString.get(j);
|
|
148
|
+
if (arrowCoord) {
|
|
149
|
+
const coords = Array.from(arrowCoord);
|
|
150
|
+
lineString.push(coords);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
multiLineString.push(lineString);
|
|
127
154
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
coordinates: multiLineString
|
|
133
|
-
};
|
|
155
|
+
return {
|
|
156
|
+
type: 'MultiLineString',
|
|
157
|
+
coordinates: multiLineString
|
|
158
|
+
};
|
|
134
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* convert Arrow LineString to geojson LineString
|
|
162
|
+
*/
|
|
135
163
|
function arrowLineStringToFeature(arrowLineString) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
164
|
+
const lineString = [];
|
|
165
|
+
for (let i = 0; arrowLineString && i < arrowLineString.length; i++) {
|
|
166
|
+
const arrowCoord = arrowLineString.get(i);
|
|
167
|
+
if (arrowCoord) {
|
|
168
|
+
const coords = Array.from(arrowCoord);
|
|
169
|
+
lineString.push(coords);
|
|
170
|
+
}
|
|
142
171
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
};
|
|
172
|
+
return {
|
|
173
|
+
type: 'LineString',
|
|
174
|
+
coordinates: lineString
|
|
175
|
+
};
|
|
148
176
|
}
|
|
149
|
-
//# sourceMappingURL=convert-geoarrow-to-geojson-geometry.js.map
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Update bounds from geoarrow sample data
|
|
6
|
+
*
|
|
7
|
+
* @param flatCoords the flattend coordinates array from one chunk of geoarrow column
|
|
8
|
+
* @param nDim the number of dimensions of the coordinates
|
|
9
|
+
* @param bounds the bounds to be updated
|
|
10
|
+
* @param sampleSize how many samples to be used to update the bounds, default is 1000 per chunk
|
|
11
|
+
* @returns the updated bounds
|
|
12
|
+
*/
|
|
13
|
+
export function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds, sampleSize = 100) {
|
|
14
|
+
const numberOfFeatures = flatCoords.length / nDim;
|
|
15
|
+
const sampleStep = Math.max(Math.floor(numberOfFeatures / sampleSize), 1);
|
|
16
|
+
const newBounds = [...bounds];
|
|
17
|
+
for (let i = 0; i < numberOfFeatures; i += sampleStep) {
|
|
18
|
+
const lng = flatCoords[i * nDim];
|
|
19
|
+
const lat = flatCoords[i * nDim + 1];
|
|
20
|
+
if (lng < newBounds[0]) {
|
|
21
|
+
newBounds[0] = lng;
|
|
22
|
+
}
|
|
23
|
+
if (lat < newBounds[1]) {
|
|
24
|
+
newBounds[1] = lat;
|
|
25
|
+
}
|
|
26
|
+
if (lng > newBounds[2]) {
|
|
27
|
+
newBounds[2] = lng;
|
|
28
|
+
}
|
|
29
|
+
if (lat > newBounds[3]) {
|
|
30
|
+
newBounds[3] = lat;
|
|
31
|
+
}
|
|
11
32
|
}
|
|
12
|
-
|
|
13
|
-
newBounds[1] = lat;
|
|
14
|
-
}
|
|
15
|
-
if (lng > newBounds[2]) {
|
|
16
|
-
newBounds[2] = lng;
|
|
17
|
-
}
|
|
18
|
-
if (lat > newBounds[3]) {
|
|
19
|
-
newBounds[3] = lat;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return newBounds;
|
|
33
|
+
return newBounds;
|
|
23
34
|
}
|
|
24
|
-
//# sourceMappingURL=get-arrow-bounds.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Loader, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { GeoJSONTable, GeoJSONTableBatch, BinaryGeometry } from '@loaders.gl/schema';
|
|
3
|
-
import type { ArrowTable, ArrowTableBatch } from
|
|
3
|
+
import type { ArrowTable, ArrowTableBatch } from "./lib/arrow-table.js";
|
|
4
4
|
export type GeoArrowLoaderOptions = LoaderOptions & {
|
|
5
5
|
arrow?: {
|
|
6
6
|
shape: 'arrow-table' | 'binary-geometry';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geoarrow-loader.d.ts","sourceRoot":"","sources":["../src/geoarrow-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EAAC,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAC,UAAU,EAAE,eAAe,EAAC,
|
|
1
|
+
{"version":3,"file":"geoarrow-loader.d.ts","sourceRoot":"","sources":["../src/geoarrow-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EAAC,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAC,UAAU,EAAE,eAAe,EAAC,6BAA0B;AAInE,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,iBAAiB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,UAAU,GAAG,cAAc,EAC3B,KAAK,EACL,qBAAqB,CAQtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAC3C,UAAU,GAAG,YAAY,EAAE,oBAAoB;AAC/C,AAD2B,oBAAoB;AAC/C,eAAe,GAAG,iBAAiB,EAAE,oBAAoB;AACzD,qBAAqB,CAatB,CAAC"}
|
package/dist/geoarrow-loader.js
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { ArrowWorkerLoader } from "./arrow-loader.js";
|
|
2
5
|
import { parseGeoArrowSync } from "./parsers/parse-geoarrow-sync.js";
|
|
3
6
|
import { parseGeoArrowInBatches } from "./parsers/parse-geoarrow-in-batches.js";
|
|
7
|
+
/** ArrowJS table loader */
|
|
4
8
|
export const GeoArrowWorkerLoader = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
...ArrowWorkerLoader,
|
|
10
|
+
options: {
|
|
11
|
+
arrow: {
|
|
12
|
+
shape: 'arrow-table'
|
|
13
|
+
}
|
|
9
14
|
}
|
|
10
|
-
}
|
|
11
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* GeoArrowLoader loads an Apache Arrow table, parses GeoArrow type extension data
|
|
18
|
+
* to convert it to a GeoJSON table or a BinaryGeometry
|
|
19
|
+
*/
|
|
12
20
|
export const GeoArrowLoader = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
...ArrowWorkerLoader,
|
|
22
|
+
options: {
|
|
23
|
+
arrow: {
|
|
24
|
+
shape: 'arrow-table'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
|
|
28
|
+
parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
|
|
29
|
+
parseInBatches: parseGeoArrowInBatches
|
|
22
30
|
};
|
|
23
|
-
//# sourceMappingURL=geoarrow-loader.js.map
|
package/dist/geoarrow-writer.js
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
+
// import type {} from '@loaders.gl/loader-utils';
|
|
1
2
|
import { encodeGeoArrowSync } from "./lib/encode-geoarrow.js";
|
|
2
|
-
|
|
3
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
5
|
+
const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
|
|
6
|
+
/** Apache Arrow writer */
|
|
3
7
|
export const GeoArrowWriter = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
name: 'Apache Arrow',
|
|
9
|
+
id: 'arrow',
|
|
10
|
+
module: 'arrow',
|
|
11
|
+
version: VERSION,
|
|
12
|
+
extensions: ['arrow', 'feather'],
|
|
13
|
+
mimeTypes: [
|
|
14
|
+
'application/vnd.apache.arrow.file',
|
|
15
|
+
'application/vnd.apache.arrow.stream',
|
|
16
|
+
'application/octet-stream'
|
|
17
|
+
],
|
|
18
|
+
binary: true,
|
|
19
|
+
options: {},
|
|
20
|
+
encode: async function encodeArrow(data, options) {
|
|
21
|
+
// @ts-expect-error
|
|
22
|
+
return encodeGeoArrowSync(data);
|
|
23
|
+
},
|
|
24
|
+
encodeSync(data, options) {
|
|
25
|
+
// @ts-expect-error
|
|
26
|
+
return encodeGeoArrowSync(data);
|
|
27
|
+
}
|
|
18
28
|
};
|
|
19
|
-
//# sourceMappingURL=geoarrow-writer.js.map
|