@loaders.gl/arrow 4.2.0-alpha.6 → 4.2.0-beta.1
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 +48 -4
- package/dist/arrow-loader.d.ts.map +1 -1
- package/dist/arrow-loader.js +3 -1
- package/dist/arrow-worker.js +3 -1
- package/dist/arrow-writer.d.ts +13 -2
- package/dist/arrow-writer.d.ts.map +1 -1
- package/dist/arrow-writer.js +1 -1
- package/dist/dist.dev.js +12 -11
- package/dist/dist.min.js +4 -4
- package/dist/geoarrow-loader.d.ts +44 -9
- package/dist/geoarrow-loader.d.ts.map +1 -1
- package/dist/geoarrow-loader.js +1 -6
- package/dist/geoarrow-writer.d.ts +13 -2
- package/dist/geoarrow-writer.d.ts.map +1 -1
- package/dist/geoarrow-writer.js +1 -1
- package/dist/index.cjs +6 -9
- package/dist/index.cjs.map +2 -2
- package/dist/triangulate-on-worker.js +1 -1
- package/package.json +7 -7
- package/src/arrow-loader.ts +17 -8
- package/src/arrow-writer.ts +2 -2
- package/src/geoarrow/convert-geoarrow-to-geojson-geometry.ts +2 -2
- package/src/geoarrow-loader.ts +11 -19
- package/src/geoarrow-writer.ts +2 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/arrow",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.1",
|
|
4
4
|
"description": "Simple columnar table loader for the Apache Arrow format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"build-worker2": "esbuild src/workers/arrow-worker.ts --bundle --outfile=dist/arrow-worker.js --platform=browser --external:{stream}"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@loaders.gl/gis": "4.2.0-
|
|
57
|
-
"@loaders.gl/loader-utils": "4.2.0-
|
|
58
|
-
"@loaders.gl/schema": "4.2.0-
|
|
59
|
-
"@loaders.gl/wkt": "4.2.0-
|
|
60
|
-
"@loaders.gl/worker-utils": "4.2.0-
|
|
56
|
+
"@loaders.gl/gis": "4.2.0-beta.1",
|
|
57
|
+
"@loaders.gl/loader-utils": "4.2.0-beta.1",
|
|
58
|
+
"@loaders.gl/schema": "4.2.0-beta.1",
|
|
59
|
+
"@loaders.gl/wkt": "4.2.0-beta.1",
|
|
60
|
+
"@loaders.gl/worker-utils": "4.2.0-beta.1",
|
|
61
61
|
"@math.gl/polygon": "4.0.0",
|
|
62
62
|
"apache-arrow": ">= 15.0.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@loaders.gl/core": "^4.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "c386a9196516fe3ff24847b40e6c77be039cf905"
|
|
68
68
|
}
|
package/src/arrow-loader.ts
CHANGED
|
@@ -17,15 +17,24 @@ import {parseArrowInBatches} from './parsers/parse-arrow-in-batches';
|
|
|
17
17
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
18
18
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
19
19
|
|
|
20
|
+
/** ArrowLoader options */
|
|
20
21
|
export type ArrowLoaderOptions = LoaderOptions & {
|
|
22
|
+
/** ArrowLoader options */
|
|
21
23
|
arrow?: {
|
|
24
|
+
/** Shape of returned data */
|
|
22
25
|
shape: 'arrow-table' | 'columnar-table' | 'array-row-table' | 'object-row-table';
|
|
26
|
+
/** Debounce time between batches (prevent excessive numbers of small batches) */
|
|
23
27
|
batchDebounceMs?: number;
|
|
28
|
+
/** Override the URL to the worker bundle (by default loads from unpkg.com) */
|
|
29
|
+
workerUrl?: string;
|
|
24
30
|
};
|
|
25
31
|
};
|
|
26
32
|
|
|
27
33
|
/** ArrowJS table loader */
|
|
28
|
-
export const ArrowWorkerLoader
|
|
34
|
+
export const ArrowWorkerLoader = {
|
|
35
|
+
dataType: null as unknown as ArrowTable,
|
|
36
|
+
batchType: null as never,
|
|
37
|
+
|
|
29
38
|
name: 'Apache Arrow',
|
|
30
39
|
id: 'arrow',
|
|
31
40
|
module: 'arrow',
|
|
@@ -45,18 +54,18 @@ export const ArrowWorkerLoader: Loader<ArrowTable, never, ArrowLoaderOptions> =
|
|
|
45
54
|
shape: 'columnar-table'
|
|
46
55
|
}
|
|
47
56
|
}
|
|
48
|
-
}
|
|
57
|
+
} as const satisfies Loader<ArrowTable, never, ArrowLoaderOptions>;
|
|
49
58
|
|
|
50
59
|
/** ArrowJS table loader */
|
|
51
|
-
export const ArrowLoader
|
|
52
|
-
ArrowTable | ColumnarTable | ObjectRowTable | ArrayRowTable,
|
|
53
|
-
ArrowTableBatch,
|
|
54
|
-
ArrowLoaderOptions
|
|
55
|
-
> = {
|
|
60
|
+
export const ArrowLoader = {
|
|
56
61
|
...ArrowWorkerLoader,
|
|
57
62
|
parse: async (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>
|
|
58
63
|
parseArrowSync(arraybuffer, options?.arrow),
|
|
59
64
|
parseSync: (arraybuffer: ArrayBuffer, options?: ArrowLoaderOptions) =>
|
|
60
65
|
parseArrowSync(arraybuffer, options?.arrow),
|
|
61
66
|
parseInBatches: parseArrowInBatches
|
|
62
|
-
}
|
|
67
|
+
} as const satisfies LoaderWithParser<
|
|
68
|
+
ArrowTable | ColumnarTable | ObjectRowTable | ArrayRowTable,
|
|
69
|
+
ArrowTableBatch,
|
|
70
|
+
ArrowLoaderOptions
|
|
71
|
+
>;
|
package/src/arrow-writer.ts
CHANGED
|
@@ -13,7 +13,7 @@ type ArrowWriterOptions = WriterOptions & {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
/** Apache Arrow writer */
|
|
16
|
-
export const ArrowWriter
|
|
16
|
+
export const ArrowWriter = {
|
|
17
17
|
name: 'Apache Arrow',
|
|
18
18
|
id: 'arrow',
|
|
19
19
|
module: 'arrow',
|
|
@@ -32,4 +32,4 @@ export const ArrowWriter: WriterWithEncoder<ColumnarTable, never, ArrowWriterOpt
|
|
|
32
32
|
encodeSync(data, options?) {
|
|
33
33
|
return encodeArrowSync(data);
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
} as const satisfies WriterWithEncoder<ColumnarTable, never, ArrowWriterOptions>;
|
|
@@ -77,14 +77,14 @@ function arrowWKBToFeature(arrowCellValue: any) {
|
|
|
77
77
|
arrowCellValue.byteOffset,
|
|
78
78
|
arrowCellValue.byteOffset + arrowCellValue.byteLength
|
|
79
79
|
);
|
|
80
|
-
const binaryGeometry = WKBLoader.parseSync?.(arrayBuffer)
|
|
80
|
+
const binaryGeometry = WKBLoader.parseSync?.(arrayBuffer) as BinaryGeometry;
|
|
81
81
|
const geometry = binaryToGeometry(binaryGeometry);
|
|
82
82
|
return geometry;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function arrowWKTToFeature(arrowCellValue: any) {
|
|
86
86
|
const string: string = arrowCellValue;
|
|
87
|
-
return WKTLoader.parseTextSync?.(string)
|
|
87
|
+
return WKTLoader.parseTextSync?.(string);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
package/src/geoarrow-loader.ts
CHANGED
|
@@ -11,42 +11,34 @@ import {parseGeoArrowInBatches} from './parsers/parse-geoarrow-in-batches';
|
|
|
11
11
|
|
|
12
12
|
export type GeoArrowLoaderOptions = LoaderOptions & {
|
|
13
13
|
arrow?: {
|
|
14
|
-
shape
|
|
14
|
+
shape?: 'arrow-table' | 'binary-geometry';
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/** ArrowJS table loader */
|
|
19
|
-
export const GeoArrowWorkerLoader
|
|
20
|
-
ArrowTable | BinaryGeometry,
|
|
21
|
-
never,
|
|
22
|
-
GeoArrowLoaderOptions
|
|
23
|
-
> = {
|
|
19
|
+
export const GeoArrowWorkerLoader = {
|
|
24
20
|
...ArrowWorkerLoader,
|
|
25
21
|
options: {
|
|
26
22
|
arrow: {
|
|
27
23
|
shape: 'arrow-table'
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
}
|
|
26
|
+
} as const satisfies Loader<ArrowTable | BinaryGeometry, never, GeoArrowLoaderOptions>;
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* GeoArrowLoader loads an Apache Arrow table, parses GeoArrow type extension data
|
|
34
30
|
* to convert it to a GeoJSON table or a BinaryGeometry
|
|
35
31
|
*/
|
|
36
|
-
export const GeoArrowLoader
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
GeoArrowLoaderOptions
|
|
40
|
-
> = {
|
|
41
|
-
...ArrowWorkerLoader,
|
|
42
|
-
options: {
|
|
43
|
-
arrow: {
|
|
44
|
-
shape: 'arrow-table'
|
|
45
|
-
}
|
|
46
|
-
},
|
|
32
|
+
export const GeoArrowLoader = {
|
|
33
|
+
...GeoArrowWorkerLoader,
|
|
34
|
+
|
|
47
35
|
parse: async (arraybuffer: ArrayBuffer, options?: GeoArrowLoaderOptions) =>
|
|
48
36
|
parseGeoArrowSync(arraybuffer, options?.arrow),
|
|
49
37
|
parseSync: (arraybuffer: ArrayBuffer, options?: GeoArrowLoaderOptions) =>
|
|
50
38
|
parseGeoArrowSync(arraybuffer, options?.arrow),
|
|
51
39
|
parseInBatches: parseGeoArrowInBatches
|
|
52
|
-
}
|
|
40
|
+
} as const satisfies LoaderWithParser<
|
|
41
|
+
ArrowTable | GeoJSONTable, // | BinaryGeometry,
|
|
42
|
+
ArrowTableBatch | GeoJSONTableBatch, // | BinaryGeometry,
|
|
43
|
+
GeoArrowLoaderOptions
|
|
44
|
+
>;
|
package/src/geoarrow-writer.ts
CHANGED
|
@@ -13,11 +13,7 @@ type ArrowWriterOptions = WriterOptions & {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
/** Apache Arrow writer */
|
|
16
|
-
export const GeoArrowWriter
|
|
17
|
-
GeoJSONTable | BinaryGeometry,
|
|
18
|
-
never,
|
|
19
|
-
ArrowWriterOptions
|
|
20
|
-
> = {
|
|
16
|
+
export const GeoArrowWriter = {
|
|
21
17
|
name: 'Apache Arrow',
|
|
22
18
|
id: 'arrow',
|
|
23
19
|
module: 'arrow',
|
|
@@ -38,4 +34,4 @@ export const GeoArrowWriter: WriterWithEncoder<
|
|
|
38
34
|
// @ts-expect-error
|
|
39
35
|
return encodeGeoArrowSync(data);
|
|
40
36
|
}
|
|
41
|
-
}
|
|
37
|
+
} as const satisfies WriterWithEncoder<GeoJSONTable | BinaryGeometry, never, ArrowWriterOptions>;
|