@loaders.gl/schema 4.3.2 → 4.4.0-alpha.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/categories/category-gis.d.ts +6 -0
- package/dist/categories/category-gis.d.ts.map +1 -0
- package/dist/categories/category-image.d.ts.map +1 -0
- package/dist/{types → categories}/category-mesh.d.ts +2 -2
- package/dist/categories/category-mesh.d.ts.map +1 -0
- package/dist/{types → categories}/category-table.d.ts +14 -14
- package/dist/categories/category-table.d.ts.map +1 -0
- package/dist/categories/category-texture.d.ts.map +1 -0
- package/dist/{lib/mesh → deprecated}/mesh-utils.d.ts +4 -2
- package/dist/deprecated/mesh-utils.d.ts.map +1 -0
- package/dist/{lib/mesh → deprecated}/mesh-utils.js +2 -0
- package/dist/dist.dev.js +0 -1836
- package/dist/dist.min.js +1 -1
- package/dist/geometry/binary-features.d.ts +30 -0
- package/dist/geometry/binary-features.d.ts.map +1 -0
- package/dist/geometry/binary-geometries.d.ts +33 -0
- package/dist/geometry/binary-geometries.d.ts.map +1 -0
- package/dist/geometry/flat-geometries.d.ts +61 -0
- package/dist/geometry/flat-geometries.d.ts.map +1 -0
- package/dist/index.cjs +2 -1792
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +10 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -23
- package/dist/types/batch.d.ts +3 -1
- package/dist/types/batch.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/{types → categories}/category-gis.ts +7 -18
- package/src/{types → categories}/category-mesh.ts +2 -2
- package/src/{types → categories}/category-table.ts +14 -17
- package/src/{lib/mesh → deprecated}/mesh-utils.ts +4 -2
- package/src/geometry/binary-features.ts +43 -0
- package/src/geometry/binary-geometries.ts +45 -0
- package/src/{types → geometry}/flat-geometries.ts +44 -14
- package/src/index.ts +15 -101
- package/src/types/batch.ts +3 -1
- package/dist/lib/mesh/convert-mesh.d.ts +0 -15
- package/dist/lib/mesh/convert-mesh.d.ts.map +0 -1
- package/dist/lib/mesh/convert-mesh.js +0 -37
- package/dist/lib/mesh/deduce-mesh-schema.d.ts +0 -24
- package/dist/lib/mesh/deduce-mesh-schema.d.ts.map +0 -1
- package/dist/lib/mesh/deduce-mesh-schema.js +0 -62
- package/dist/lib/mesh/mesh-to-arrow-table.d.ts +0 -1
- package/dist/lib/mesh/mesh-to-arrow-table.d.ts.map +0 -1
- package/dist/lib/mesh/mesh-to-arrow-table.js +0 -47
- package/dist/lib/mesh/mesh-utils.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts +0 -19
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-field.js +0 -36
- package/dist/lib/table/arrow-api/arrow-like-interface.d.ts +0 -43
- package/dist/lib/table/arrow-api/arrow-like-interface.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts +0 -12
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-schema.js +0 -81
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts +0 -24
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-table.js +0 -63
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts +0 -177
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-type.js +0 -442
- package/dist/lib/table/arrow-api/enum.d.ts +0 -92
- package/dist/lib/table/arrow-api/enum.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/enum.js +0 -97
- package/dist/lib/table/arrow-api/get-type-info.d.ts +0 -13
- package/dist/lib/table/arrow-api/get-type-info.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/get-type-info.js +0 -27
- package/dist/lib/table/arrow-api/index.d.ts +0 -5
- package/dist/lib/table/arrow-api/index.d.ts.map +0 -1
- package/dist/lib/table/arrow-api/index.js +0 -7
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts +0 -20
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/table/batches/base-table-batch-aggregator.js +0 -63
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts +0 -23
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js +0 -91
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts +0 -22
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/table/batches/row-table-batch-aggregator.js +0 -85
- package/dist/lib/table/batches/table-batch-aggregator.d.ts +0 -25
- package/dist/lib/table/batches/table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/table/batches/table-batch-aggregator.js +0 -4
- package/dist/lib/table/batches/table-batch-builder.d.ts +0 -53
- package/dist/lib/table/batches/table-batch-builder.d.ts.map +0 -1
- package/dist/lib/table/batches/table-batch-builder.js +0 -151
- package/dist/lib/table/simple-table/convert-table.d.ts +0 -43
- package/dist/lib/table/simple-table/convert-table.d.ts.map +0 -1
- package/dist/lib/table/simple-table/convert-table.js +0 -118
- package/dist/lib/table/simple-table/data-type.d.ts +0 -17
- package/dist/lib/table/simple-table/data-type.d.ts.map +0 -1
- package/dist/lib/table/simple-table/data-type.js +0 -88
- package/dist/lib/table/simple-table/make-table-from-batches.d.ts +0 -22
- package/dist/lib/table/simple-table/make-table-from-batches.d.ts.map +0 -1
- package/dist/lib/table/simple-table/make-table-from-batches.js +0 -79
- package/dist/lib/table/simple-table/make-table.d.ts +0 -65
- package/dist/lib/table/simple-table/make-table.d.ts.map +0 -1
- package/dist/lib/table/simple-table/make-table.js +0 -94
- package/dist/lib/table/simple-table/row-utils.d.ts +0 -15
- package/dist/lib/table/simple-table/row-utils.d.ts.map +0 -1
- package/dist/lib/table/simple-table/row-utils.js +0 -49
- package/dist/lib/table/simple-table/table-accessors.d.ts +0 -68
- package/dist/lib/table/simple-table/table-accessors.d.ts.map +0 -1
- package/dist/lib/table/simple-table/table-accessors.js +0 -350
- package/dist/lib/table/simple-table/table-column.d.ts +0 -7
- package/dist/lib/table/simple-table/table-column.d.ts.map +0 -1
- package/dist/lib/table/simple-table/table-column.js +0 -39
- package/dist/lib/table/simple-table/table-schema.d.ts +0 -15
- package/dist/lib/table/simple-table/table-schema.d.ts.map +0 -1
- package/dist/lib/table/simple-table/table-schema.js +0 -100
- package/dist/lib/utils/assert.d.ts +0 -2
- package/dist/lib/utils/assert.d.ts.map +0 -1
- package/dist/lib/utils/assert.js +0 -8
- package/dist/lib/utils/async-queue.d.ts +0 -18
- package/dist/lib/utils/async-queue.d.ts.map +0 -1
- package/dist/lib/utils/async-queue.js +0 -90
- package/dist/types/binary-geometries.d.ts +0 -57
- package/dist/types/binary-geometries.d.ts.map +0 -1
- package/dist/types/category-gis.d.ts +0 -18
- package/dist/types/category-gis.d.ts.map +0 -1
- package/dist/types/category-image.d.ts.map +0 -1
- package/dist/types/category-mesh.d.ts.map +0 -1
- package/dist/types/category-table.d.ts.map +0 -1
- package/dist/types/category-texture.d.ts.map +0 -1
- package/dist/types/flat-geometries.d.ts +0 -30
- package/dist/types/flat-geometries.d.ts.map +0 -1
- package/src/lib/mesh/convert-mesh.ts +0 -51
- package/src/lib/mesh/deduce-mesh-schema.ts +0 -76
- package/src/lib/mesh/mesh-to-arrow-table.ts +0 -47
- package/src/lib/table/arrow-api/arrow-like-field.ts +0 -53
- package/src/lib/table/arrow-api/arrow-like-interface.ts +0 -84
- package/src/lib/table/arrow-api/arrow-like-schema.ts +0 -101
- package/src/lib/table/arrow-api/arrow-like-table.ts +0 -86
- package/src/lib/table/arrow-api/arrow-like-type.ts +0 -502
- package/src/lib/table/arrow-api/enum.ts +0 -99
- package/src/lib/table/arrow-api/get-type-info.ts +0 -38
- package/src/lib/table/arrow-api/index.ts +0 -8
- package/src/lib/table/batches/base-table-batch-aggregator.ts +0 -83
- package/src/lib/table/batches/columnar-table-batch-aggregator.ts +0 -112
- package/src/lib/table/batches/row-table-batch-aggregator.ts +0 -109
- package/src/lib/table/batches/table-batch-aggregator.ts +0 -29
- package/src/lib/table/batches/table-batch-builder.ts +0 -190
- package/src/lib/table/simple-table/convert-table.ts +0 -149
- package/src/lib/table/simple-table/data-type.ts +0 -104
- package/src/lib/table/simple-table/make-table-from-batches.ts +0 -98
- package/src/lib/table/simple-table/make-table.ts +0 -111
- package/src/lib/table/simple-table/row-utils.ts +0 -59
- package/src/lib/table/simple-table/table-accessors.ts +0 -417
- package/src/lib/table/simple-table/table-column.ts +0 -49
- package/src/lib/table/simple-table/table-schema.ts +0 -121
- package/src/lib/utils/assert.ts +0 -8
- package/src/lib/utils/async-queue.ts +0 -104
- package/src/types/binary-geometries.ts +0 -67
- /package/dist/{types → categories}/category-gis.js +0 -0
- /package/dist/{types → categories}/category-image.d.ts +0 -0
- /package/dist/{types → categories}/category-image.js +0 -0
- /package/dist/{types → categories}/category-mesh.js +0 -0
- /package/dist/{types → categories}/category-table.js +0 -0
- /package/dist/{types → categories}/category-texture.d.ts +0 -0
- /package/dist/{types → categories}/category-texture.js +0 -0
- /package/dist/{lib/table/arrow-api/arrow-like-interface.js → geometry/binary-features.js} +0 -0
- /package/dist/{types → geometry}/binary-geometries.js +0 -0
- /package/dist/{types → geometry}/flat-geometries.js +0 -0
- /package/src/{types → categories}/category-image.ts +0 -0
- /package/src/{types → categories}/category-texture.ts +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { TypedArray } from "./types.js";
|
|
2
|
-
export type BinaryAttribute = {
|
|
3
|
-
value: TypedArray;
|
|
4
|
-
size: number;
|
|
5
|
-
};
|
|
6
|
-
export type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';
|
|
7
|
-
type NumericProps = {
|
|
8
|
-
[key: string]: BinaryAttribute;
|
|
9
|
-
};
|
|
10
|
-
type Properties = object[];
|
|
11
|
-
/**
|
|
12
|
-
* Represent a single Geometry, similar to a GeoJSON Geometry
|
|
13
|
-
*/
|
|
14
|
-
export type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;
|
|
15
|
-
/** Binary point geometry: an array of positions */
|
|
16
|
-
export type BinaryPointGeometry = {
|
|
17
|
-
type: 'Point';
|
|
18
|
-
positions: BinaryAttribute;
|
|
19
|
-
};
|
|
20
|
-
/** Binary line geometry, array of positions and indices to the start of each line */
|
|
21
|
-
export type BinaryLineGeometry = {
|
|
22
|
-
type: 'LineString';
|
|
23
|
-
positions: BinaryAttribute;
|
|
24
|
-
pathIndices: BinaryAttribute;
|
|
25
|
-
};
|
|
26
|
-
/** Binary polygon geometry, an array of positions to each primitite polygon and polygon */
|
|
27
|
-
export type BinaryPolygonGeometry = {
|
|
28
|
-
type: 'Polygon';
|
|
29
|
-
positions: BinaryAttribute;
|
|
30
|
-
polygonIndices: BinaryAttribute;
|
|
31
|
-
primitivePolygonIndices: BinaryAttribute;
|
|
32
|
-
triangles?: BinaryAttribute;
|
|
33
|
-
};
|
|
34
|
-
/** Common properties for binary geometries */
|
|
35
|
-
export type BinaryProperties = {
|
|
36
|
-
featureIds: BinaryAttribute;
|
|
37
|
-
globalFeatureIds: BinaryAttribute;
|
|
38
|
-
numericProps: NumericProps;
|
|
39
|
-
properties: Properties;
|
|
40
|
-
fields?: Properties;
|
|
41
|
-
};
|
|
42
|
-
/** Binary feature + binary attributes */
|
|
43
|
-
export type BinaryFeature = BinaryPointFeature | BinaryLineFeature | BinaryPolygonFeature;
|
|
44
|
-
export type BinaryPointFeature = BinaryPointGeometry & BinaryProperties;
|
|
45
|
-
export type BinaryLineFeature = BinaryLineGeometry & BinaryProperties;
|
|
46
|
-
export type BinaryPolygonFeature = BinaryPolygonGeometry & BinaryProperties;
|
|
47
|
-
/**
|
|
48
|
-
* Represent a collection of Features, similar to a GeoJSON FeatureCollection
|
|
49
|
-
*/
|
|
50
|
-
export type BinaryFeatureCollection = {
|
|
51
|
-
shape: 'binary-feature-collection';
|
|
52
|
-
points?: BinaryPointFeature;
|
|
53
|
-
lines?: BinaryLineFeature;
|
|
54
|
-
polygons?: BinaryPolygonFeature;
|
|
55
|
-
};
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=binary-geometries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binary-geometries.d.ts","sourceRoot":"","sources":["../../src/types/binary-geometries.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAC,mBAAgB;AAIxC,MAAM,MAAM,eAAe,GAAG;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;AAEpE,KAAK,YAAY,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAA;CAAC,CAAC;AACrD,KAAK,UAAU,GAAG,MAAM,EAAE,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAE9F,mDAAmD;AACnD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,eAAe,CAAC;IAC3B,cAAc,EAAE,eAAe,CAAC;IAChC,uBAAuB,EAAE,eAAe,CAAC;IACzC,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,8CAA8C;AAC9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,eAAe,CAAC;IAC5B,gBAAgB,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAE1F,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,2BAA2B,CAAC;IACnC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type { GeoJSON, Feature, FeatureCollection, Geometry, Position, GeoJsonProperties } from 'geojson';
|
|
2
|
-
export type { Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection } from 'geojson';
|
|
3
|
-
export type { FlatGeometryType, FlatIndexedGeometry, FlatPoint, FlatLineString, FlatPolygon, FlatGeometry, FlatFeature } from "./flat-geometries.js";
|
|
4
|
-
export type { BinaryAttribute, BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryProperties, BinaryFeatureCollection, BinaryFeature, BinaryPointFeature, BinaryLineFeature, BinaryPolygonFeature } from "./binary-geometries.js";
|
|
5
|
-
/** Aggregate information for converting GeoJSON into other formats */
|
|
6
|
-
export type GeojsonGeometryInfo = {
|
|
7
|
-
coordLength: number;
|
|
8
|
-
pointPositionsCount: number;
|
|
9
|
-
pointFeaturesCount: number;
|
|
10
|
-
linePositionsCount: number;
|
|
11
|
-
linePathsCount: number;
|
|
12
|
-
lineFeaturesCount: number;
|
|
13
|
-
polygonPositionsCount: number;
|
|
14
|
-
polygonObjectsCount: number;
|
|
15
|
-
polygonRingsCount: number;
|
|
16
|
-
polygonFeaturesCount: number;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=category-gis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"category-gis.d.ts","sourceRoot":"","sources":["../../src/types/category-gis.ts"],"names":[],"mappings":"AAOA,YAAY,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,KAAK,EACL,UAAU,EACV,UAAU,EACV,eAAe,EACf,OAAO,EACP,YAAY,EACZ,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACZ,6BAA0B;AAG3B,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACrB,+BAA4B;AAE7B,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"category-image.d.ts","sourceRoot":"","sources":["../../src/types/category-image.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"category-mesh.d.ts","sourceRoot":"","sources":["../../src/types/category-mesh.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,UAAU,EAAC,mBAAgB;AACxC,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,4BAAyB;AAEhE,6BAA6B;AAC7B,MAAM,WAAW,SAAU,SAAQ,aAAa;IAE9C,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,0BAA0B;AAC1B,MAAM,WAAW,cAAe,SAAQ,UAAU;IAEhD,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE;QAAC,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAA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AU,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;KAAC,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"category-texture.d.ts","sourceRoot":"","sources":["../../src/types/category-texture.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,SAAS,EAAC,4BAAyB;AAEhD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,UAAU,GACV,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,CAAC;AAEX,oBAAoB;AACpB,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Feature, Geometry, Point, LineString, Polygon } from 'geojson';
|
|
2
|
-
/** Flat geometry type */
|
|
3
|
-
export type FlatGeometryType = 'Point' | 'LineString' | 'Polygon';
|
|
4
|
-
type RemoveCoordinatesField<Type> = {
|
|
5
|
-
[Property in keyof Type as Exclude<Property, 'coordinates'>]: Type[Property];
|
|
6
|
-
};
|
|
7
|
-
/** Generic flat geometry data storage type */
|
|
8
|
-
export type FlatIndexedGeometry = {
|
|
9
|
-
data: number[];
|
|
10
|
-
indices: number[];
|
|
11
|
-
};
|
|
12
|
-
/** GeoJSON (Multi)Point geometry with coordinate data flattened into `data` array and indexed by `indices` */
|
|
13
|
-
export type FlatPoint = RemoveCoordinatesField<Point> & FlatIndexedGeometry;
|
|
14
|
-
/** GeoJSON (Multi)LineString geometry with coordinate data flattened into `data` array and indexed by `indices` */
|
|
15
|
-
export type FlatLineString = RemoveCoordinatesField<LineString> & FlatIndexedGeometry;
|
|
16
|
-
/** GeoJSON (Multi)Polygon geometry with coordinate data flattened into `data` array and indexed by 2D `indices` */
|
|
17
|
-
export type FlatPolygon = RemoveCoordinatesField<Polygon> & {
|
|
18
|
-
data: number[];
|
|
19
|
-
indices: number[][];
|
|
20
|
-
areas: number[][];
|
|
21
|
-
};
|
|
22
|
-
/** GeoJSON geometry with coordinate data flattened into `data` array and indexed by 2D `indices` */
|
|
23
|
-
export type FlatGeometry = FlatPoint | FlatLineString | FlatPolygon;
|
|
24
|
-
type FlattenGeometry<Type> = {
|
|
25
|
-
[Property in keyof Type]: Type[Property] extends Geometry ? FlatGeometry : Type[Property];
|
|
26
|
-
};
|
|
27
|
-
/** GeoJSON Feature with Geometry replaced by FlatGeometry */
|
|
28
|
-
export type FlatFeature = FlattenGeometry<Feature>;
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=flat-geometries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flat-geometries.d.ts","sourceRoot":"","sources":["../../src/types/flat-geometries.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAE3E,yBAAyB;AACzB,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;AAElE,KAAK,sBAAsB,CAAC,IAAI,IAAI;KACjC,QAAQ,IAAI,MAAM,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CAC7E,CAAC;AAEF,8CAA8C;AAC9C,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,8GAA8G;AAC9G,MAAM,MAAM,SAAS,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC;AAE5E,mHAAmH;AACnH,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC,UAAU,CAAC,GAAG,mBAAmB,CAAC;AAEtF,mHAAmH;AACnH,MAAM,MAAM,WAAW,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG;IAC1D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;CACnB,CAAC;AAEF,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,CAAC;AAEpE,KAAK,eAAe,CAAC,IAAI,IAAI;KAC1B,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,QAAQ,GAAG,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;CAC1F,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import type {Mesh} from '../../types/category-mesh';
|
|
6
|
-
import type {ColumnarTable, ArrowTable} from '../../types/category-table';
|
|
7
|
-
// import {convertMeshToArrowTable} from './mesh-to-arrow-table';
|
|
8
|
-
|
|
9
|
-
type TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Convert a mesh to a specific shape
|
|
13
|
-
*/
|
|
14
|
-
export function convertMesh(
|
|
15
|
-
mesh: Mesh,
|
|
16
|
-
shape: TargetShape,
|
|
17
|
-
options?: any
|
|
18
|
-
): Mesh | ColumnarTable | ArrowTable {
|
|
19
|
-
switch (shape || 'mesh') {
|
|
20
|
-
case 'mesh':
|
|
21
|
-
return mesh;
|
|
22
|
-
case 'columnar-table':
|
|
23
|
-
return convertMeshToColumnarTable(mesh);
|
|
24
|
-
// case 'arrow-table':
|
|
25
|
-
// return {
|
|
26
|
-
// shape: 'arrow-table',
|
|
27
|
-
// data: convertMeshToArrowTable(mesh)
|
|
28
|
-
// };
|
|
29
|
-
default:
|
|
30
|
-
throw new Error(`Unsupported shape ${options?.shape}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Convert a loaders.gl Mesh to a Columnar Table
|
|
36
|
-
* @param mesh
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
export function convertMeshToColumnarTable(mesh: Mesh): ColumnarTable {
|
|
40
|
-
const columns = {};
|
|
41
|
-
|
|
42
|
-
for (const [columnName, attribute] of Object.entries(mesh.attributes)) {
|
|
43
|
-
columns[columnName] = attribute.value;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
shape: 'columnar-table',
|
|
48
|
-
schema: mesh.schema,
|
|
49
|
-
data: columns
|
|
50
|
-
};
|
|
51
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {MeshAttribute, MeshAttributes} from '../../types/category-mesh';
|
|
6
|
-
import {Schema, Field} from '../../types/schema';
|
|
7
|
-
import {getDataTypeFromTypedArray} from '../table/simple-table/data-type';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Create a schema for mesh attributes data
|
|
11
|
-
* @param attributes
|
|
12
|
-
* @param metadata
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export function deduceMeshSchema(
|
|
16
|
-
attributes: MeshAttributes,
|
|
17
|
-
metadata: Record<string, string> = {}
|
|
18
|
-
): Schema {
|
|
19
|
-
const fields = deduceMeshFields(attributes);
|
|
20
|
-
return {fields, metadata};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Create arrow-like schema field for mesh attribute
|
|
25
|
-
* @param attributeName
|
|
26
|
-
* @param attribute
|
|
27
|
-
* @param optionalMetadata
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
export function deduceMeshField(
|
|
31
|
-
name: string,
|
|
32
|
-
attribute: MeshAttribute,
|
|
33
|
-
optionalMetadata?: Record<string, string>
|
|
34
|
-
): Field {
|
|
35
|
-
const type = getDataTypeFromTypedArray(attribute.value);
|
|
36
|
-
const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
|
|
37
|
-
return {
|
|
38
|
-
name,
|
|
39
|
-
type: {type: 'fixed-size-list', listSize: attribute.size, children: [{name: 'value', type}]},
|
|
40
|
-
nullable: false,
|
|
41
|
-
metadata
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create fields array for mesh attributes
|
|
47
|
-
* @param attributes
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
function deduceMeshFields(attributes: MeshAttributes): Field[] {
|
|
51
|
-
const fields: Field[] = [];
|
|
52
|
-
for (const attributeName in attributes) {
|
|
53
|
-
const attribute: MeshAttribute = attributes[attributeName];
|
|
54
|
-
fields.push(deduceMeshField(attributeName, attribute));
|
|
55
|
-
}
|
|
56
|
-
return fields;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Make metadata by mesh attribute properties
|
|
61
|
-
* @param attribute
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
export function makeMeshAttributeMetadata(attribute: MeshAttribute): Record<string, string> {
|
|
65
|
-
const result: Record<string, string> = {};
|
|
66
|
-
if ('byteOffset' in attribute) {
|
|
67
|
-
result.byteOffset = attribute.byteOffset!.toString(10);
|
|
68
|
-
}
|
|
69
|
-
if ('byteStride' in attribute) {
|
|
70
|
-
result.byteStride = attribute.byteStride!.toString(10);
|
|
71
|
-
}
|
|
72
|
-
if ('normalized' in attribute) {
|
|
73
|
-
result.normalized = attribute.normalized!.toString();
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
/* Problem with arrow dependency...
|
|
6
|
-
import {
|
|
7
|
-
Table,
|
|
8
|
-
Schema,
|
|
9
|
-
RecordBatch,
|
|
10
|
-
FixedSizeList,
|
|
11
|
-
Field,
|
|
12
|
-
Data,
|
|
13
|
-
FixedSizeListVector
|
|
14
|
-
} from 'apache-arrow';
|
|
15
|
-
import {AbstractVector} from 'apache-arrow/vector';
|
|
16
|
-
import {getArrowType, getArrowVector} from '../table/arrow/arrow-type-utils';
|
|
17
|
-
import type {Mesh} from './mesh-types';
|
|
18
|
-
import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* * Convert a loaders.gl Mesh to an Apache Arrow Table
|
|
22
|
-
* @param mesh
|
|
23
|
-
* @param metadata
|
|
24
|
-
* @param batchSize
|
|
25
|
-
* @returns
|
|
26
|
-
*
|
|
27
|
-
export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
28
|
-
const vectors: AbstractVector[] = [];
|
|
29
|
-
const fields: Field[] = [];
|
|
30
|
-
for (const attributeKey in mesh.attributes) {
|
|
31
|
-
const attribute = mesh.attributes[attributeKey];
|
|
32
|
-
const {value, size = 1} = attribute;
|
|
33
|
-
const type = getArrowType(value);
|
|
34
|
-
const vector = getArrowVector(value);
|
|
35
|
-
const listType = new FixedSizeList(size, new Field('value', type));
|
|
36
|
-
const field = new Field(attributeKey, listType, false, makeMeshAttributeMetadata(attribute));
|
|
37
|
-
const data = new Data(listType, 0, value.length / size, 0, undefined, [vector]);
|
|
38
|
-
const listVector = new FixedSizeListVector(data);
|
|
39
|
-
vectors.push(listVector);
|
|
40
|
-
fields.push(field);
|
|
41
|
-
}
|
|
42
|
-
const schema = new Schema(fields, mesh?.schema?.metadata || new Map<string, string>());
|
|
43
|
-
const recordBatch = new RecordBatch(schema, vectors[0].length, vectors);
|
|
44
|
-
const table = new Table(schema, recordBatch);
|
|
45
|
-
return table;
|
|
46
|
-
}
|
|
47
|
-
*/
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {DataType} from './arrow-like-type';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* ArrowJS `Field` API-compatible class for row-based tables
|
|
9
|
-
* https://loaders.gl/arrowjs/docs/api-reference/field
|
|
10
|
-
* A field holds name, nullable, and metadata information about a table "column"
|
|
11
|
-
* A Schema is essentially a list of fields
|
|
12
|
-
*/
|
|
13
|
-
export class ArrowLikeField {
|
|
14
|
-
name: string;
|
|
15
|
-
type: DataType;
|
|
16
|
-
nullable: boolean;
|
|
17
|
-
metadata: Map<string, string>;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
name: string,
|
|
21
|
-
type: DataType,
|
|
22
|
-
nullable = false,
|
|
23
|
-
metadata: Map<string, string> = new Map()
|
|
24
|
-
) {
|
|
25
|
-
this.name = name;
|
|
26
|
-
this.type = type;
|
|
27
|
-
this.nullable = nullable;
|
|
28
|
-
this.metadata = metadata;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get typeId(): number {
|
|
32
|
-
return this.type && this.type.typeId;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
clone(): ArrowLikeField {
|
|
36
|
-
return new ArrowLikeField(this.name, this.type, this.nullable, this.metadata);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
compareTo(other: this): boolean {
|
|
40
|
-
return (
|
|
41
|
-
this.name === other.name &&
|
|
42
|
-
this.type === other.type &&
|
|
43
|
-
this.nullable === other.nullable &&
|
|
44
|
-
this.metadata === other.metadata
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
toString(): string {
|
|
49
|
-
return `${JSON.stringify(this.type)}${this.nullable ? ', nullable' : ''}${
|
|
50
|
-
this.metadata ? `, metadata: ${JSON.stringify(this.metadata)}` : ''
|
|
51
|
-
}`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {DataType} from './arrow-like-type';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* ArrowJS `Field` API-compatible class for row-based tables
|
|
9
|
-
* https://loaders.gl/arrowjs/docs/api-reference/field
|
|
10
|
-
* A field holds name, nullable, and metadata information about a table "column"
|
|
11
|
-
* A Schema is essentially a list of fields
|
|
12
|
-
*/
|
|
13
|
-
export interface Field {
|
|
14
|
-
name: string;
|
|
15
|
-
type: DataType;
|
|
16
|
-
nullable: boolean;
|
|
17
|
-
metadata: Map<string, string>;
|
|
18
|
-
|
|
19
|
-
// constructor(
|
|
20
|
-
// name: string,
|
|
21
|
-
// type: DataType,
|
|
22
|
-
// nullable?,
|
|
23
|
-
// metadata?
|
|
24
|
-
// );
|
|
25
|
-
|
|
26
|
-
typeId(): number;
|
|
27
|
-
|
|
28
|
-
clone(): Field;
|
|
29
|
-
|
|
30
|
-
compareTo(other: this): boolean;
|
|
31
|
-
|
|
32
|
-
toString();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface Schema {
|
|
36
|
-
fields: Field[];
|
|
37
|
-
metadata: Map<string, string>;
|
|
38
|
-
|
|
39
|
-
// constructor(
|
|
40
|
-
// fields: Field[] ,
|
|
41
|
-
// metadata: Map<string, string>
|
|
42
|
-
// )
|
|
43
|
-
|
|
44
|
-
// TODO - arrow only seems to compare fields, not metadata
|
|
45
|
-
compareTo(other: Schema): boolean;
|
|
46
|
-
|
|
47
|
-
select(...columnNames: string[]): Schema;
|
|
48
|
-
|
|
49
|
-
selectAt(...columnIndices: number[]): Schema;
|
|
50
|
-
|
|
51
|
-
assign(schemaOrFields: Schema | Field[]): Schema;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface ArrowLikeVector {
|
|
55
|
-
table: Table;
|
|
56
|
-
columnName: string;
|
|
57
|
-
|
|
58
|
-
// constructor(table: Table, columnName: string);
|
|
59
|
-
|
|
60
|
-
get(rowIndex: number): unknown;
|
|
61
|
-
toArray(): ArrayLike<unknown>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Class that provides an API similar to Apache Arrow Table class
|
|
66
|
-
* Forwards methods directly if the underlying table is Arrow, otherwise calls accessor functions
|
|
67
|
-
*/
|
|
68
|
-
export interface Table {
|
|
69
|
-
schema: Schema;
|
|
70
|
-
|
|
71
|
-
// constructor(table: Table);
|
|
72
|
-
|
|
73
|
-
data: any;
|
|
74
|
-
|
|
75
|
-
numCols: number;
|
|
76
|
-
|
|
77
|
-
length(): number;
|
|
78
|
-
|
|
79
|
-
getChild(columnName: string): ArrowLikeVector;
|
|
80
|
-
|
|
81
|
-
// getChildAt(columnIndex: number): ArrowLikeVector {
|
|
82
|
-
// return
|
|
83
|
-
// }
|
|
84
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {SchemaMetadata, Field} from '../../../types/schema';
|
|
6
|
-
import {ArrowLikeField} from './arrow-like-field';
|
|
7
|
-
|
|
8
|
-
export class ArrowLikeSchema {
|
|
9
|
-
fields: ArrowLikeField[];
|
|
10
|
-
metadata: Map<string, string>;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
fields: ArrowLikeField[] | Field[],
|
|
14
|
-
metadata: SchemaMetadata | Map<string, string> = new Map<string, string>()
|
|
15
|
-
) {
|
|
16
|
-
// checkNames(fields);
|
|
17
|
-
// For kepler fields, create arrow compatible `Fields` that have kepler fields as `metadata`
|
|
18
|
-
this.fields = fields.map(
|
|
19
|
-
(field) => new ArrowLikeField(field.name, field.type, field.nullable, field.metadata)
|
|
20
|
-
);
|
|
21
|
-
this.metadata =
|
|
22
|
-
metadata instanceof Map ? metadata : new Map<string, string>(Object.entries(metadata));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// TODO - arrow only seems to compare fields, not metadata
|
|
26
|
-
compareTo(other: ArrowLikeSchema): boolean {
|
|
27
|
-
if (this.metadata !== other.metadata) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if (this.fields.length !== other.fields.length) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
for (let i = 0; i < this.fields.length; ++i) {
|
|
34
|
-
if (!this.fields[i].compareTo(other.fields[i])) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
select(...columnNames: string[]): ArrowLikeSchema {
|
|
42
|
-
// Ensure column names reference valid fields
|
|
43
|
-
const nameMap = Object.create(null);
|
|
44
|
-
for (const name of columnNames) {
|
|
45
|
-
nameMap[name] = true;
|
|
46
|
-
}
|
|
47
|
-
const selectedFields = this.fields.filter((field) => nameMap[field.name]);
|
|
48
|
-
return new ArrowLikeSchema(selectedFields, this.metadata);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
selectAt(...columnIndices: number[]): ArrowLikeSchema {
|
|
52
|
-
// Ensure column indices reference valid fields
|
|
53
|
-
const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
|
|
54
|
-
return new ArrowLikeSchema(selectedFields, this.metadata);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
assign(schemaOrFields: ArrowLikeSchema | ArrowLikeField[]): ArrowLikeSchema {
|
|
58
|
-
let fields: ArrowLikeField[];
|
|
59
|
-
let metadata = this.metadata;
|
|
60
|
-
|
|
61
|
-
if (schemaOrFields instanceof ArrowLikeSchema) {
|
|
62
|
-
const otherArrowLikeSchema = schemaOrFields;
|
|
63
|
-
fields = otherArrowLikeSchema.fields;
|
|
64
|
-
metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherArrowLikeSchema.metadata);
|
|
65
|
-
} else {
|
|
66
|
-
fields = schemaOrFields;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Create a merged list of fields, overwrite fields in place, new fields at end
|
|
70
|
-
const fieldMap: {[key: string]: ArrowLikeField} = Object.create(null);
|
|
71
|
-
|
|
72
|
-
for (const field of this.fields) {
|
|
73
|
-
fieldMap[field.name] = field;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
for (const field of fields) {
|
|
77
|
-
fieldMap[field.name] = field;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const mergedFields = Object.values(fieldMap);
|
|
81
|
-
|
|
82
|
-
return new ArrowLikeSchema(mergedFields, metadata);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Warn if any duplicated field names
|
|
87
|
-
// function checkNames(fields: Field[]): void {
|
|
88
|
-
// const usedNames: Record<string, boolean> = {};
|
|
89
|
-
// for (const field of fields) {
|
|
90
|
-
// if (usedNames[field.name]) {
|
|
91
|
-
// // eslint-disable-next-line
|
|
92
|
-
// console.warn('ArrowLikeSchema: duplicated field name', field.name, field);
|
|
93
|
-
// }
|
|
94
|
-
// usedNames[field.name] = true;
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
|
-
|
|
98
|
-
function mergeMaps<T>(m1: T, m2: T): T {
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
return new Map([...(m1 || new Map()), ...(m2 || new Map())]);
|
|
101
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {Table} from '../../../types/category-table';
|
|
6
|
-
|
|
7
|
-
import {ArrowLikeSchema} from './arrow-like-schema';
|
|
8
|
-
|
|
9
|
-
import {deduceTableSchema} from '../simple-table/table-schema';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
getTableCell,
|
|
13
|
-
getTableLength,
|
|
14
|
-
getTableNumCols
|
|
15
|
-
// getTableCell,
|
|
16
|
-
// getTableRowShape,
|
|
17
|
-
// getTableColumnIndex,
|
|
18
|
-
// getTableColumnName,
|
|
19
|
-
// getTableRowAsObject,
|
|
20
|
-
// getTableRowAsArray
|
|
21
|
-
} from '../simple-table/table-accessors';
|
|
22
|
-
|
|
23
|
-
class ArrowLikeVector {
|
|
24
|
-
table: Table;
|
|
25
|
-
columnName: string;
|
|
26
|
-
|
|
27
|
-
constructor(table: Table, columnName: string) {
|
|
28
|
-
this.table = table;
|
|
29
|
-
this.columnName = columnName;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get(rowIndex: number): unknown {
|
|
33
|
-
return getTableCell(this.table, rowIndex, this.columnName);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
toArray(): ArrayLike<unknown> {
|
|
37
|
-
switch (this.table.shape) {
|
|
38
|
-
case 'arrow-table':
|
|
39
|
-
const arrowTable = this.table.data as any;
|
|
40
|
-
return arrowTable.getChild(this.columnName)?.toArray();
|
|
41
|
-
case 'columnar-table':
|
|
42
|
-
return this.table.data[this.columnName];
|
|
43
|
-
default:
|
|
44
|
-
throw new Error(this.table.shape);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Class that provides an API similar to Apache Arrow Table class
|
|
51
|
-
* Forwards methods directly if the underlying table is Arrow, otherwise calls accessor functions
|
|
52
|
-
*/
|
|
53
|
-
export class ArrowLikeTable {
|
|
54
|
-
schema: ArrowLikeSchema;
|
|
55
|
-
table: Table;
|
|
56
|
-
|
|
57
|
-
constructor(table: Table) {
|
|
58
|
-
const schema = table.schema || deduceTableSchema(table);
|
|
59
|
-
this.schema = new ArrowLikeSchema(schema.fields, schema.metadata);
|
|
60
|
-
this.table = {...table, schema};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// get schema() {
|
|
64
|
-
// return this.table.schema;
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
get data() {
|
|
68
|
-
return this.table.shape === 'geojson-table' ? this.table.features : this.table.data;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get numCols(): number {
|
|
72
|
-
return getTableNumCols(this.table);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get length(): number {
|
|
76
|
-
return getTableLength(this.table);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
getChild(columnName: string): ArrowLikeVector {
|
|
80
|
-
return new ArrowLikeVector(this.table, columnName);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// getChildAt(columnIndex: number): ArrowLikeVector {
|
|
84
|
-
// return
|
|
85
|
-
// }
|
|
86
|
-
}
|