@loaders.gl/schema 3.1.7 → 3.2.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/category/common.d.ts +1 -2
- package/dist/category/common.d.ts.map +1 -1
- package/dist/category/gis.d.ts +1 -1
- package/dist/category/gis.d.ts.map +1 -1
- package/dist/category/image/image.d.ts +18 -0
- package/dist/category/image/image.d.ts.map +1 -0
- package/dist/category/image/image.js +2 -0
- package/dist/category/mesh/convert-mesh.js +6 -5
- package/dist/category/mesh/mesh-to-arrow-table.d.ts +10 -0
- package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -1
- package/dist/category/mesh/mesh-to-arrow-table.js +26 -36
- package/dist/category/table/table-types.d.ts +22 -5
- package/dist/category/table/table-types.d.ts.map +1 -1
- package/dist/category/texture/texture.d.ts +18 -0
- package/dist/category/texture/texture.d.ts.map +1 -0
- package/dist/category/texture/texture.js +2 -0
- package/dist/dist.min.js +15078 -208
- package/dist/es5/category/image/image.js +2 -0
- package/dist/es5/category/image/image.js.map +1 -0
- package/dist/es5/category/mesh/convert-mesh.js +8 -0
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js +38 -0
- package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/es5/category/texture/texture.js +2 -0
- package/dist/es5/category/texture/texture.js.map +1 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/arrow/arrow-type-utils.js +70 -0
- package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/esm/category/image/image.js +2 -0
- package/dist/esm/category/image/image.js.map +1 -0
- package/dist/esm/category/mesh/convert-mesh.js +7 -0
- package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
- package/dist/esm/category/mesh/mesh-to-arrow-table.js +29 -0
- package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/esm/category/texture/texture.js +2 -0
- package/dist/esm/category/texture/texture.js.map +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/arrow/arrow-type-utils.js +60 -0
- package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/arrow/arrow-type-utils.d.ts +5 -0
- package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -1
- package/dist/lib/arrow/arrow-type-utils.js +47 -67
- package/package.json +4 -3
- package/src/category/common.ts +1 -2
- package/src/category/gis.ts +8 -1
- package/src/category/image/image.ts +19 -0
- package/src/category/mesh/convert-mesh.ts +6 -6
- package/src/category/mesh/mesh-to-arrow-table.ts +2 -4
- package/src/category/table/table-types.ts +28 -6
- package/src/category/texture/texture.ts +28 -0
- package/src/index.ts +16 -3
- package/src/lib/arrow/arrow-type-utils.ts +0 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data images
|
|
3
|
+
*/
|
|
4
|
+
export type ImageDataType = {
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
compressed?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Supported Image Types
|
|
13
|
+
*/
|
|
14
|
+
export type ImageType = ImageBitmap | typeof Image | ImageDataType;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Image type string used to control or determine the type of images returned from ImageLoader
|
|
18
|
+
*/
|
|
19
|
+
export type ImageTypeEnum = 'imagebitmap' | 'image' | 'data';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {Mesh} from './mesh-types';
|
|
2
2
|
import type {ColumnarTable, ArrowTable} from '../table/table-types';
|
|
3
|
-
|
|
3
|
+
import {convertMeshToArrowTable} from './mesh-to-arrow-table';
|
|
4
4
|
|
|
5
5
|
type TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';
|
|
6
6
|
|
|
@@ -17,11 +17,11 @@ export function convertMesh(
|
|
|
17
17
|
return mesh;
|
|
18
18
|
case 'columnar-table':
|
|
19
19
|
return convertMeshToColumnarTable(mesh);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
case 'arrow-table':
|
|
21
|
+
return {
|
|
22
|
+
shape: 'arrow-table',
|
|
23
|
+
data: convertMeshToArrowTable(mesh)
|
|
24
|
+
};
|
|
25
25
|
default:
|
|
26
26
|
throw new Error(`Unsupported shape ${options?.shape}`);
|
|
27
27
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
1
|
import {
|
|
3
2
|
Table,
|
|
4
3
|
Schema,
|
|
@@ -7,7 +6,7 @@ import {
|
|
|
7
6
|
Field,
|
|
8
7
|
Data,
|
|
9
8
|
FixedSizeListVector
|
|
10
|
-
} from 'apache-arrow';
|
|
9
|
+
} from 'apache-arrow/Arrow.dom';
|
|
11
10
|
import {AbstractVector} from 'apache-arrow/vector';
|
|
12
11
|
import {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';
|
|
13
12
|
import type {Mesh} from './mesh-types';
|
|
@@ -19,7 +18,7 @@ import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
|
19
18
|
* @param metadata
|
|
20
19
|
* @param batchSize
|
|
21
20
|
* @returns
|
|
22
|
-
|
|
21
|
+
*/
|
|
23
22
|
export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
24
23
|
const vectors: AbstractVector[] = [];
|
|
25
24
|
const fields: Field[] = [];
|
|
@@ -40,4 +39,3 @@ export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
|
40
39
|
const table = new Table(schema, recordBatch);
|
|
41
40
|
return table;
|
|
42
41
|
}
|
|
43
|
-
*/
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import type {Schema} from '../../lib/schema/schema';
|
|
2
|
+
import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
|
|
2
3
|
import type {AnyArray} from '../../types';
|
|
3
4
|
import type {Batch} from '../common';
|
|
4
|
-
|
|
5
|
-
// import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
|
|
6
|
-
type ApacheArrowTable = any;
|
|
7
|
-
type RecordBatch = any;
|
|
5
|
+
import type {Feature} from '../gis';
|
|
8
6
|
|
|
9
7
|
/** A general table */
|
|
10
8
|
export interface Table {
|
|
11
|
-
shape:
|
|
9
|
+
shape:
|
|
10
|
+
| 'row-table'
|
|
11
|
+
| 'array-row-table'
|
|
12
|
+
| 'object-row-table'
|
|
13
|
+
| 'geojson-row-table'
|
|
14
|
+
| 'columnar-table'
|
|
15
|
+
| 'arrow-table';
|
|
12
16
|
schema?: Schema;
|
|
13
17
|
schemaType?: 'explicit' | 'deduced';
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
/** A table organized as an array of rows */
|
|
17
21
|
export interface RowTable extends Table {
|
|
18
|
-
shape: 'row-table' | 'array-row-table' | 'object-row-table';
|
|
22
|
+
shape: 'row-table' | 'array-row-table' | 'object-row-table' | 'geojson-row-table';
|
|
19
23
|
data: any[];
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -31,6 +35,12 @@ export interface ObjectRowTable extends RowTable {
|
|
|
31
35
|
data: {[columnName: string]: any}[];
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
/** A table organized as an array of rows, each row is a GeoJSON Feature */
|
|
39
|
+
export interface GeoJSONRowTable extends RowTable {
|
|
40
|
+
shape: 'geojson-row-table';
|
|
41
|
+
data: Feature[];
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
/** A table organized as a map of columns, each column is an array of value */
|
|
35
45
|
export interface ColumnarTable extends Table {
|
|
36
46
|
shape: 'columnar-table';
|
|
@@ -43,6 +53,12 @@ export interface ArrowTable extends Table {
|
|
|
43
53
|
data: ApacheArrowTable;
|
|
44
54
|
}
|
|
45
55
|
|
|
56
|
+
/** A collection of tables */
|
|
57
|
+
export type Tables<TableType extends Table = Table> = {
|
|
58
|
+
shape: 'tables';
|
|
59
|
+
tables: {name: string; table: TableType}[];
|
|
60
|
+
};
|
|
61
|
+
|
|
46
62
|
// Batches
|
|
47
63
|
|
|
48
64
|
/** Batch for a general table */
|
|
@@ -71,6 +87,12 @@ export type RowObjectTableBatch = RowTableBatch & {
|
|
|
71
87
|
data: {[columnName: string]: any}[];
|
|
72
88
|
};
|
|
73
89
|
|
|
90
|
+
/** Batch for a table organized as an array of rows, each row is an array of values */
|
|
91
|
+
export type GeoJSONRowTableBatch = RowTableBatch & {
|
|
92
|
+
shape: 'geojson-row-table';
|
|
93
|
+
data: Feature[];
|
|
94
|
+
};
|
|
95
|
+
|
|
74
96
|
/** Batch for a table organized as a map of columns, each column is an array of value */
|
|
75
97
|
export type ColumnarTableBatch = TableBatch & {
|
|
76
98
|
shape: 'columnar-table';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type {ImageType} from '../image/image';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* These represent the main compressed texture formats
|
|
5
|
+
* Each format typically has a number of more specific subformats
|
|
6
|
+
*/
|
|
7
|
+
export type GPUTextureFormat =
|
|
8
|
+
| 'dxt'
|
|
9
|
+
| 'dxt-srgb'
|
|
10
|
+
| 'etc1'
|
|
11
|
+
| 'etc2'
|
|
12
|
+
| 'pvrtc'
|
|
13
|
+
| 'atc'
|
|
14
|
+
| 'astc'
|
|
15
|
+
| 'rgtc';
|
|
16
|
+
|
|
17
|
+
/** One mip level */
|
|
18
|
+
export type TextureLevel = {
|
|
19
|
+
compressed: boolean;
|
|
20
|
+
format?: number;
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
levelSize?: number;
|
|
25
|
+
hasAlpha?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type TextureOrImage = ImageType | (TextureLevel | ImageType);
|
package/src/index.ts
CHANGED
|
@@ -4,18 +4,20 @@ export type {TypedArray, NumberArray, AnyArray} from './types';
|
|
|
4
4
|
export type {Batch} from './category/common';
|
|
5
5
|
|
|
6
6
|
// TABLE CATEGORY TYPES
|
|
7
|
-
|
|
8
7
|
export type {
|
|
9
8
|
Table,
|
|
10
9
|
ArrayRowTable,
|
|
11
10
|
ObjectRowTable,
|
|
11
|
+
GeoJSONRowTable,
|
|
12
12
|
ColumnarTable,
|
|
13
|
-
ArrowTable
|
|
13
|
+
ArrowTable,
|
|
14
|
+
Tables
|
|
14
15
|
} from './category/table/table-types';
|
|
15
16
|
export type {
|
|
16
17
|
TableBatch,
|
|
17
18
|
RowArrayTableBatch,
|
|
18
19
|
RowObjectTableBatch,
|
|
20
|
+
GeoJSONRowTableBatch,
|
|
19
21
|
ColumnarTableBatch,
|
|
20
22
|
ArrowTableBatch
|
|
21
23
|
} from './category/table/table-types';
|
|
@@ -46,10 +48,21 @@ export {
|
|
|
46
48
|
makeMeshAttributeMetadata
|
|
47
49
|
} from './category/mesh/deduce-mesh-schema';
|
|
48
50
|
|
|
51
|
+
// TEXTURES
|
|
52
|
+
export type {TextureLevel, GPUTextureFormat} from './category/texture/texture';
|
|
53
|
+
|
|
54
|
+
// IMAGES
|
|
55
|
+
export type {ImageDataType, ImageType, ImageTypeEnum} from './category/image/image';
|
|
56
|
+
|
|
49
57
|
// TYPES
|
|
50
58
|
// GIS CATEGORY - GEOJSON
|
|
51
|
-
export type {GeoJSON, Feature, Geometry, Position, GeoJsonProperties} from './category/gis';
|
|
52
59
|
export type {
|
|
60
|
+
GeoJSON,
|
|
61
|
+
Feature,
|
|
62
|
+
FeatureCollection,
|
|
63
|
+
Geometry,
|
|
64
|
+
Position,
|
|
65
|
+
GeoJsonProperties,
|
|
53
66
|
Point,
|
|
54
67
|
MultiPoint,
|
|
55
68
|
LineString,
|