@loaders.gl/schema 4.0.0-alpha.23 → 4.0.0-alpha.24
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/dist.min.js +517 -927
- package/dist/es5/index.js +7 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/table/simple-table/convert-table.js +24 -0
- package/dist/es5/lib/table/simple-table/convert-table.js.map +1 -1
- package/dist/es5/types/binary-geometries.js.map +1 -1
- package/dist/es5/types/category-gis.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/table/simple-table/convert-table.js +22 -0
- package/dist/esm/lib/table/simple-table/convert-table.js.map +1 -1
- package/dist/esm/types/binary-geometries.js.map +1 -1
- package/dist/esm/types/category-gis.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/table/simple-table/convert-table.d.ts +34 -1
- package/dist/lib/table/simple-table/convert-table.d.ts.map +1 -1
- package/dist/types/binary-geometries.d.ts +9 -7
- package/dist/types/binary-geometries.d.ts.map +1 -1
- package/dist/types/category-gis.d.ts +1 -1
- package/dist/types/category-gis.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +8 -4
- package/src/lib/table/simple-table/convert-table.ts +73 -1
- package/src/types/binary-geometries.ts +10 -7
- package/src/types/category-gis.ts +5 -4
- package/dist/bundle.js +0 -5
- package/dist/index.js +0 -92
- package/dist/lib/mesh/convert-mesh.js +0 -40
- package/dist/lib/mesh/deduce-mesh-schema.js +0 -66
- package/dist/lib/mesh/mesh-to-arrow-table.js +0 -44
- package/dist/lib/mesh/mesh-utils.js +0 -51
- package/dist/lib/table/arrow/arrow-type-utils.js +0 -53
- package/dist/lib/table/arrow/convert-schema-arrow.js +0 -187
- package/dist/lib/table/arrow/convert-table-to-arrow.js +0 -57
- package/dist/lib/table/arrow-api/arrow-like-field.js +0 -34
- package/dist/lib/table/arrow-api/arrow-like-schema.js +0 -81
- package/dist/lib/table/arrow-api/arrow-like-table.js +0 -53
- package/dist/lib/table/arrow-api/arrow-like-type.js +0 -463
- package/dist/lib/table/arrow-api/enum.js +0 -97
- package/dist/lib/table/arrow-api/get-type-info.js +0 -29
- package/dist/lib/table/arrow-api/index.js +0 -25
- package/dist/lib/table/batches/base-table-batch-aggregator.js +0 -60
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js +0 -92
- package/dist/lib/table/batches/row-table-batch-aggregator.js +0 -81
- package/dist/lib/table/batches/table-batch-aggregator.js +0 -3
- package/dist/lib/table/batches/table-batch-builder.js +0 -152
- package/dist/lib/table/simple-table/convert-table.js +0 -65
- package/dist/lib/table/simple-table/data-type.js +0 -93
- package/dist/lib/table/simple-table/make-table.js +0 -95
- package/dist/lib/table/simple-table/row-utils.js +0 -33
- package/dist/lib/table/simple-table/table-accessors.js +0 -319
- package/dist/lib/table/simple-table/table-column.js +0 -41
- package/dist/lib/table/simple-table/table-schema.js +0 -85
- package/dist/lib/utils/assert.js +0 -12
- package/dist/lib/utils/async-queue.js +0 -92
- package/dist/types/binary-geometries.js +0 -2
- package/dist/types/category-gis.js +0 -3
- package/dist/types/category-image.js +0 -2
- package/dist/types/category-mesh.js +0 -3
- package/dist/types/category-table.js +0 -3
- package/dist/types/category-texture.js +0 -3
- package/dist/types/flat-geometries.js +0 -3
- package/dist/types/schema.js +0 -3
- package/dist/types/types.js +0 -2
package/dist/es5/index.js
CHANGED
|
@@ -250,6 +250,12 @@ Object.defineProperty(exports, "Utf8", {
|
|
|
250
250
|
return _arrowApi.Utf8;
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
|
+
Object.defineProperty(exports, "convertTable", {
|
|
254
|
+
enumerable: true,
|
|
255
|
+
get: function get() {
|
|
256
|
+
return _convertTable.convertTable;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
253
259
|
Object.defineProperty(exports, "convertToArrayRow", {
|
|
254
260
|
enumerable: true,
|
|
255
261
|
get: function get() {
|
|
@@ -394,6 +400,7 @@ var _columnarTableBatchAggregator = require("./lib/table/batches/columnar-table-
|
|
|
394
400
|
var _tableAccessors = require("./lib/table/simple-table/table-accessors");
|
|
395
401
|
var _arrowLikeTable = require("./lib/table/arrow-api/arrow-like-table");
|
|
396
402
|
var _makeTable = require("./lib/table/simple-table/make-table");
|
|
403
|
+
var _convertTable = require("./lib/table/simple-table/convert-table");
|
|
397
404
|
var _tableSchema = require("./lib/table/simple-table/table-schema");
|
|
398
405
|
var _rowUtils = require("./lib/table/simple-table/row-utils");
|
|
399
406
|
var _dataType = require("./lib/table/simple-table/data-type");
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_tableBatchBuilder","require","_rowTableBatchAggregator","_columnarTableBatchAggregator","_tableAccessors","_arrowLikeTable","_makeTable","_tableSchema","_rowUtils","_dataType","_meshUtils","_deduceMeshSchema","_arrowApi","_getTypeInfo","_arrowTypeUtils","_asyncQueue","_interopRequireDefault"],"sources":["../../src/index.ts"],"sourcesContent":["// COMMON CATEGORY\nexport type {\n TypedArray,\n TypedArrayConstructor,\n NumberArray,\n ArrayType,\n AnyArray\n} from './types/types';\n\nexport type {Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata} from './types/schema';\n\n// TABLE CATEGORY TYPES\nexport type {\n Table,\n RowTable,\n ArrayRowTable,\n ObjectRowTable,\n GeoJSONRowTable,\n ColumnarTable,\n ArrowTable,\n Tables\n} from './types/category-table';\nexport type {\n TableBatch,\n ArrayRowTableBatch,\n ObjectRowTableBatch,\n GeoJSONRowTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './types/category-table';\n\n// TABLE CATEGORY UTILS\nexport {TableBatchBuilder} from './lib/table/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/table/batches/table-batch-aggregator';\nexport {RowTableBatchAggregator} from './lib/table/batches/row-table-batch-aggregator';\nexport {ColumnarTableBatchAggregator} from './lib/table/batches/columnar-table-batch-aggregator';\n\nexport {\n getTableLength,\n getTableNumCols,\n getTableCell,\n getTableRowShape,\n getTableColumnIndex,\n getTableColumnName,\n getTableRowAsObject,\n getTableRowAsArray,\n makeRowIterator,\n makeArrayRowIterator,\n makeObjectRowIterator\n} from './lib/table/simple-table/table-accessors';\n\nexport {ArrowLikeTable} from './lib/table/arrow-api/arrow-like-table';\n\nexport {makeTableFromData} from './lib/table/simple-table/make-table';\nexport {deduceTableSchema} from './lib/table/simple-table/table-schema';\nexport {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';\nexport {getDataTypeFromArray} from './lib/table/simple-table/data-type';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './types/category-mesh';\n\nexport {getMeshSize, getMeshBoundingBox} from './lib/mesh/mesh-utils';\n// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177\n// export {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './lib/mesh/deduce-mesh-schema';\n\n// TEXTURES\nexport type {TextureLevel, GPUTextureFormat} from './types/category-texture';\n\n// IMAGES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './types/category-image';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from './types/category-gis';\n\nexport type {GeojsonGeometryInfo} from './types/category-gis';\n\n// GIS CATEGORY - FLAT GEOJSON\nexport type {\n FlatFeature,\n FlatIndexedGeometry,\n FlatGeometry,\n FlatGeometryType,\n FlatPoint,\n FlatLineString,\n FlatPolygon\n} from './types/category-gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './types/category-gis';\nexport type {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["_tableBatchBuilder","require","_rowTableBatchAggregator","_columnarTableBatchAggregator","_tableAccessors","_arrowLikeTable","_makeTable","_convertTable","_tableSchema","_rowUtils","_dataType","_meshUtils","_deduceMeshSchema","_arrowApi","_getTypeInfo","_arrowTypeUtils","_asyncQueue","_interopRequireDefault"],"sources":["../../src/index.ts"],"sourcesContent":["// COMMON CATEGORY\nexport type {\n TypedArray,\n BigTypedArray,\n TypedArrayConstructor,\n BigTypedArrayConstructor,\n NumberArray,\n ArrayType,\n AnyArray\n} from './types/types';\n\nexport type {Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata} from './types/schema';\n\n// TABLE CATEGORY TYPES\nexport type {\n Table,\n RowTable,\n ArrayRowTable,\n ObjectRowTable,\n GeoJSONRowTable,\n ColumnarTable,\n ArrowTable,\n Tables\n} from './types/category-table';\nexport type {\n TableBatch,\n ArrayRowTableBatch,\n ObjectRowTableBatch,\n GeoJSONRowTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './types/category-table';\n\n// TABLE CATEGORY UTILS\nexport {TableBatchBuilder} from './lib/table/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/table/batches/table-batch-aggregator';\nexport {RowTableBatchAggregator} from './lib/table/batches/row-table-batch-aggregator';\nexport {ColumnarTableBatchAggregator} from './lib/table/batches/columnar-table-batch-aggregator';\n\nexport {\n getTableLength,\n getTableNumCols,\n getTableCell,\n getTableRowShape,\n getTableColumnIndex,\n getTableColumnName,\n getTableRowAsObject,\n getTableRowAsArray,\n makeRowIterator,\n makeArrayRowIterator,\n makeObjectRowIterator\n} from './lib/table/simple-table/table-accessors';\n\nexport {ArrowLikeTable} from './lib/table/arrow-api/arrow-like-table';\n\nexport {makeTableFromData} from './lib/table/simple-table/make-table';\nexport {convertTable} from './lib/table/simple-table/convert-table';\nexport {deduceTableSchema} from './lib/table/simple-table/table-schema';\nexport {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';\nexport {getDataTypeFromArray} from './lib/table/simple-table/data-type';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './types/category-mesh';\n\nexport {getMeshSize, getMeshBoundingBox} from './lib/mesh/mesh-utils';\n// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177\n// export {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './lib/mesh/deduce-mesh-schema';\n\n// TEXTURES\nexport type {TextureLevel, GPUTextureFormat} from './types/category-texture';\n\n// IMAGES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './types/category-image';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from './types/category-gis';\n\nexport type {GeojsonGeometryInfo} from './types/category-gis';\n\n// GIS CATEGORY - FLAT GEOJSON\nexport type {\n FlatFeature,\n FlatIndexedGeometry,\n FlatGeometry,\n FlatGeometryType,\n FlatPoint,\n FlatLineString,\n FlatPolygon\n} from './types/category-gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './types/category-gis';\nexport type {\n BinaryFeatureCollection,\n BinaryFeature,\n BinaryPointFeature,\n BinaryLineFeature,\n BinaryPolygonFeature\n} from './types/category-gis';\n\n// SCHEMA\nexport {\n Schema as ArrowLikeSchema,\n Field as ArrowLikeField,\n DataType as ArrowLikeDataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/table/arrow-api';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {getTypeInfo} from './lib/table/arrow-api/get-type-info';\nexport {getArrowType} from './lib/table/arrow/arrow-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AAcA,IAAAI,eAAA,GAAAJ,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAYA,IAAAU,UAAA,GAAAV,OAAA;AAGA,IAAAW,iBAAA,GAAAX,OAAA;AA6DA,IAAAY,SAAA,GAAAZ,OAAA;AA0CA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,eAAA,GAAAd,OAAA;AAEA,IAAAe,WAAA,GAAAC,sBAAA,CAAAhB,OAAA"}
|
|
@@ -4,7 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.convertTable = convertTable;
|
|
7
8
|
exports.makeArrayRowTable = makeArrayRowTable;
|
|
9
|
+
exports.makeArrowTable = makeArrowTable;
|
|
8
10
|
exports.makeColumnarTable = makeColumnarTable;
|
|
9
11
|
exports.makeObjectRowTable = makeObjectRowTable;
|
|
10
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -16,6 +18,28 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
function convertTable(table, shape) {
|
|
22
|
+
switch (shape) {
|
|
23
|
+
case 'object-row-table':
|
|
24
|
+
return makeObjectRowTable(table);
|
|
25
|
+
case 'array-row-table':
|
|
26
|
+
return makeArrayRowTable(table);
|
|
27
|
+
case 'columnar-table':
|
|
28
|
+
return makeColumnarTable(table);
|
|
29
|
+
case 'arrow-table':
|
|
30
|
+
return makeArrowTable(table);
|
|
31
|
+
default:
|
|
32
|
+
throw new Error(shape);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function makeArrowTable(table) {
|
|
36
|
+
var _globalThis$__luma;
|
|
37
|
+
var _makeArrowTable = (_globalThis$__luma = globalThis.__luma) === null || _globalThis$__luma === void 0 ? void 0 : _globalThis$__luma._makeArrowTable;
|
|
38
|
+
if (!_makeArrowTable) {
|
|
39
|
+
throw new Error('');
|
|
40
|
+
}
|
|
41
|
+
return _makeArrowTable(table);
|
|
42
|
+
}
|
|
19
43
|
function makeColumnarTable(table) {
|
|
20
44
|
var _table$schema;
|
|
21
45
|
var schema = table.schema || (0, _tableSchema.deduceTableSchema)(table);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-table.js","names":["_tableAccessors","require","_tableSchema","_tableColumn","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","arguments","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","makeColumnarTable","table","_table$schema","schema","deduceTableSchema","fields","shape","getTableLength","columns","_iterator","_step","field","column","makeColumnFromField","rowIndex","getTableCell","data","makeArrayRowTable","getTableRowAsArray","makeObjectRowTable","getTableRowAsObject"],"sources":["../../../../../src/lib/table/simple-table/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport {\n getTableCell,\n getTableLength,\n getTableRowAsArray,\n getTableRowAsObject\n} from './table-accessors';\nimport {Table, ArrayRowTable, ObjectRowTable, ColumnarTable} from '../../../types/category-table';\nimport {deduceTableSchema} from './table-schema';\nimport {makeColumnFromField} from './table-column';\n\n/** Convert any simple table into columnar format */\nexport function makeColumnarTable(table: Table): ColumnarTable {\n // TODO - should schema really be optional?\n const schema = table.schema || deduceTableSchema(table);\n const fields = table.schema?.fields || [];\n\n if (table.shape === 'columnar-table') {\n return {...table, schema};\n }\n\n const length = getTableLength(table);\n\n const columns: {[column: string]: ArrayLike<unknown>} = {};\n for (const field of fields) {\n const column = makeColumnFromField(field, length);\n columns[field.name] = column;\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n column[rowIndex] = getTableCell(table, rowIndex, field.name);\n }\n }\n\n return {\n shape: 'columnar-table',\n schema,\n data: columns\n };\n}\n\n/** Convert any table into array row format */\nexport function makeArrayRowTable(table: Table): ArrayRowTable {\n if (table.shape === 'array-row-table') {\n return table;\n }\n const length = getTableLength(table);\n const data = new Array<unknown[]>(length);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n data[rowIndex] = getTableRowAsArray(table, rowIndex);\n }\n return {\n shape: 'array-row-table',\n schema: table.schema,\n data\n };\n}\n\n/** Convert any table into object row format */\nexport function makeObjectRowTable(table: Table): ObjectRowTable {\n if (table.shape === 'object-row-table') {\n return table;\n }\n const length = getTableLength(table);\n const data = new Array<{[key: string]: unknown}>(length);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n data[rowIndex] = getTableRowAsObject(table, rowIndex);\n }\n return {\n shape: 'object-row-table',\n schema: table.schema,\n data\n };\n}\n"],"mappings":";;;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,EAACN,KAAK,CAAC;EACpC,IAAMe,IAAI,GAAG,IAAI1E,KAAK,CAA2BG,MAAM,CAAC;EACxD,KAAK,IAAIqE,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAGrE,MAAM,EAAEqE,QAAQ,EAAE,EAAE;IACpDE,IAAI,CAACF,QAAQ,CAAC,GAAG,IAAAM,mCAAmB,EAACnB,KAAK,EAAEa,QAAQ,CAAC;EACvD;EACA,OAAO;IACLR,KAAK,EAAE,kBAAkB;IACzBH,MAAM,EAAEF,KAAK,CAACE,MAAM;IACpBa,IAAI,EAAJA;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"convert-table.js","names":["_tableAccessors","require","_tableSchema","_tableColumn","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","arguments","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","convertTable","table","shape","makeObjectRowTable","makeArrayRowTable","makeColumnarTable","makeArrowTable","Error","_globalThis$__luma","_makeArrowTable","globalThis","__luma","_table$schema","schema","deduceTableSchema","fields","getTableLength","columns","_iterator","_step","field","column","makeColumnFromField","rowIndex","getTableCell","data","getTableRowAsArray","getTableRowAsObject"],"sources":["../../../../../src/lib/table/simple-table/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport {\n getTableCell,\n getTableLength,\n getTableRowAsArray,\n getTableRowAsObject\n} from './table-accessors';\nimport {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n ColumnarTable,\n ArrowTable\n} from '../../../types/category-table';\nimport {deduceTableSchema} from './table-schema';\nimport {makeColumnFromField} from './table-column';\n\nexport function convertTable(table: Table, shape: 'object-row-table'): ObjectRowTable;\nexport function convertTable(table: Table, shape: 'array-row-table'): ArrayRowTable;\nexport function convertTable(table: Table, shape: 'columnar-table'): ColumnarTable;\nexport function convertTable(table: Table, shape: 'arrow-table'): ArrowTable;\n\n/**\n * Convert a table to a different shape\n * @param table\n * @param shape\n * @returns\n */\nexport function convertTable(\n table: Table,\n shape: 'object-row-table' | 'array-row-table' | 'columnar-table' | 'arrow-table'\n) {\n switch (shape) {\n case 'object-row-table':\n return makeObjectRowTable(table);\n case 'array-row-table':\n return makeArrayRowTable(table);\n case 'columnar-table':\n return makeColumnarTable(table);\n case 'arrow-table':\n return makeArrowTable(table);\n default:\n throw new Error(shape);\n }\n}\n\n/**\n * Convert a table to apache arrow format\n * @note this depends on the `@loaders.gl/arrow module being imported\n */\nexport function makeArrowTable(table: Table): Table {\n const _makeArrowTable = globalThis.__luma?._makeArrowTable;\n if (!_makeArrowTable) {\n throw new Error('');\n }\n return _makeArrowTable(table);\n}\n\n/** Convert any simple table into columnar format */\nexport function makeColumnarTable(table: Table): ColumnarTable {\n // TODO - should schema really be optional?\n const schema = table.schema || deduceTableSchema(table);\n const fields = table.schema?.fields || [];\n\n if (table.shape === 'columnar-table') {\n return {...table, schema};\n }\n\n const length = getTableLength(table);\n\n const columns: {[column: string]: ArrayLike<unknown>} = {};\n for (const field of fields) {\n const column = makeColumnFromField(field, length);\n columns[field.name] = column;\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n column[rowIndex] = getTableCell(table, rowIndex, field.name);\n }\n }\n\n return {\n shape: 'columnar-table',\n schema,\n data: columns\n };\n}\n\n/** Convert any table into array row format */\nexport function makeArrayRowTable(table: Table): ArrayRowTable {\n if (table.shape === 'array-row-table') {\n return table;\n }\n const length = getTableLength(table);\n const data = new Array<unknown[]>(length);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n data[rowIndex] = getTableRowAsArray(table, rowIndex);\n }\n return {\n shape: 'array-row-table',\n schema: table.schema,\n data\n };\n}\n\n/** Convert any table into object row format */\nexport function makeObjectRowTable(table: Table): ObjectRowTable {\n if (table.shape === 'object-row-table') {\n return table;\n }\n const length = getTableLength(table);\n const data = new Array<{[key: string]: unknown}>(length);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n data[rowIndex] = getTableRowAsObject(table, rowIndex);\n }\n return {\n shape: 'object-row-table',\n schema: table.schema,\n data\n };\n}\n\n/**\n/**\n *\n * @note - should be part of schema module\nexport function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {\n const tableKeys = ;\n const tableRowsCount = columnarTable[tableKeys[0]].length;\n\n const objectRows: ObjectRowTable['data'] = [];\n\n for (let index = 0; index < tableRowsCount; index++) {\n const objectRow = {};\n for (const fieldName of Object.keys(columnarTable.data)) {\n objectRow[fieldName] = columnarTable[fieldName][index];\n }\n objectRows.push(objectRow);\n }\n\n return {\n shape: 'object-row-table',\n data: objectRows\n };\n}\n */\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAaA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAAmD,SAAAG,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAO,CAAA,UAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,QAAAH,CAAA,IAAAT,CAAA,CAAAQ,MAAA,WAAAK,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAS,CA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ACd;EACA,IAAMxD,MAAM,GAAG,IAAAuE,8BAAc,EAACf,KAAK,CAAC;EACpC,IAAMwB,IAAI,GAAG,IAAInF,KAAK,CAA2BG,MAAM,CAAC;EACxD,KAAK,IAAI8E,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAG9E,MAAM,EAAE8E,QAAQ,EAAE,EAAE;IACpDE,IAAI,CAACF,QAAQ,CAAC,GAAG,IAAAI,mCAAmB,EAAC1B,KAAK,EAAEsB,QAAQ,CAAC;EACvD;EACA,OAAO;IACLrB,KAAK,EAAE,kBAAkB;IACzBW,MAAM,EAAEZ,KAAK,CAACY,MAAM;IACpBY,IAAI,EAAJA;EACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-geometries.js","names":[],"sources":["../../../src/types/binary-geometries.ts"],"sourcesContent":["// GIS\nimport type {TypedArray} from './types';\n\n// BINARY FORMAT GEOMETRY\n\nexport type BinaryAttribute = {value: TypedArray; size: number};\nexport type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';\n\ntype NumericProps = {[key: string]: BinaryAttribute};\ntype Properties = object[];\n\n/**\n * Represent a single Geometry, similar to a GeoJSON Geometry\n */\nexport type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;\n\n/** Binary point geometry: an array of positions */\nexport type BinaryPointGeometry = {\n type: 'Point';\n positions: BinaryAttribute;\n};\n\n/** Binary line geometry, array of positions and indices to the start of each line */\nexport type BinaryLineGeometry = {\n type: 'LineString';\n positions: BinaryAttribute;\n pathIndices: BinaryAttribute;\n};\n\n/** Binary polygon geometry, an array of positions to each primitite polygon and polygon */\nexport type BinaryPolygonGeometry = {\n type: 'Polygon';\n positions: BinaryAttribute;\n polygonIndices: BinaryAttribute;\n primitivePolygonIndices: BinaryAttribute;\n triangles?: BinaryAttribute;\n};\n\n/** Common properties for binary geometries */\nexport type BinaryProperties = {\n featureIds: BinaryAttribute;\n globalFeatureIds: BinaryAttribute;\n numericProps: NumericProps;\n properties: Properties;\n fields?: Properties;\n};\n\nexport type
|
|
1
|
+
{"version":3,"file":"binary-geometries.js","names":[],"sources":["../../../src/types/binary-geometries.ts"],"sourcesContent":["// GIS\nimport type {TypedArray} from './types';\n\n// BINARY FORMAT GEOMETRY\n\nexport type BinaryAttribute = {value: TypedArray; size: number};\nexport type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';\n\ntype NumericProps = {[key: string]: BinaryAttribute};\ntype Properties = object[];\n\n/**\n * Represent a single Geometry, similar to a GeoJSON Geometry\n */\nexport type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;\n\n/** Binary point geometry: an array of positions */\nexport type BinaryPointGeometry = {\n type: 'Point';\n positions: BinaryAttribute;\n};\n\n/** Binary line geometry, array of positions and indices to the start of each line */\nexport type BinaryLineGeometry = {\n type: 'LineString';\n positions: BinaryAttribute;\n pathIndices: BinaryAttribute;\n};\n\n/** Binary polygon geometry, an array of positions to each primitite polygon and polygon */\nexport type BinaryPolygonGeometry = {\n type: 'Polygon';\n positions: BinaryAttribute;\n polygonIndices: BinaryAttribute;\n primitivePolygonIndices: BinaryAttribute;\n triangles?: BinaryAttribute;\n};\n\n/** Common properties for binary geometries */\nexport type BinaryProperties = {\n featureIds: BinaryAttribute;\n globalFeatureIds: BinaryAttribute;\n numericProps: NumericProps;\n properties: Properties;\n fields?: Properties;\n};\n\n/** Binary feature + binary attributes */\nexport type BinaryFeature = BinaryPointFeature | BinaryLineFeature | BinaryPolygonFeature;\n\nexport type BinaryPointFeature = BinaryPointGeometry & BinaryProperties;\nexport type BinaryLineFeature = BinaryLineGeometry & BinaryProperties;\nexport type BinaryPolygonFeature = BinaryPolygonGeometry & BinaryProperties;\n\n/**\n * Represent a collection of Features, similar to a GeoJSON FeatureCollection\n */\nexport type BinaryFeatureCollection = {\n points?: BinaryPointFeature;\n lines?: BinaryLineFeature;\n polygons?: BinaryPolygonFeature;\n};\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-gis.js","names":[],"sources":["../../../src/types/category-gis.ts"],"sourcesContent":["// GIS\n\n// NORMAL GEOJSON FORMAT GEOMETRY\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties\n} from 'geojson';\n\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from 'geojson';\n\n// FLAT GEOJSON FORMAT GEOMETRY\nexport type {\n FlatGeometryType,\n FlatIndexedGeometry,\n FlatPoint,\n FlatLineString,\n FlatPolygon,\n FlatGeometry,\n FlatFeature\n} from './flat-geometries';\n\n// BINARY FORMAT GEOMETRY\nexport type {\n BinaryAttribute,\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryProperties,\n
|
|
1
|
+
{"version":3,"file":"category-gis.js","names":[],"sources":["../../../src/types/category-gis.ts"],"sourcesContent":["// GIS\n\n// NORMAL GEOJSON FORMAT GEOMETRY\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties\n} from 'geojson';\n\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from 'geojson';\n\n// FLAT GEOJSON FORMAT GEOMETRY\nexport type {\n FlatGeometryType,\n FlatIndexedGeometry,\n FlatPoint,\n FlatLineString,\n FlatPolygon,\n FlatGeometry,\n FlatFeature\n} from './flat-geometries';\n\n// BINARY FORMAT GEOMETRY\nexport type {\n BinaryAttribute,\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryProperties,\n BinaryFeatureCollection,\n BinaryFeature,\n BinaryPointFeature,\n BinaryLineFeature,\n BinaryPolygonFeature\n} from './binary-geometries';\n\n/** Aggregate information for converting GeoJSON into other formats */\nexport type GeojsonGeometryInfo = {\n coordLength: number;\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n"],"mappings":""}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { ColumnarTableBatchAggregator } from './lib/table/batches/columnar-table
|
|
|
4
4
|
export { getTableLength, getTableNumCols, getTableCell, getTableRowShape, getTableColumnIndex, getTableColumnName, getTableRowAsObject, getTableRowAsArray, makeRowIterator, makeArrayRowIterator, makeObjectRowIterator } from './lib/table/simple-table/table-accessors';
|
|
5
5
|
export { ArrowLikeTable } from './lib/table/arrow-api/arrow-like-table';
|
|
6
6
|
export { makeTableFromData } from './lib/table/simple-table/make-table';
|
|
7
|
+
export { convertTable } from './lib/table/simple-table/convert-table';
|
|
7
8
|
export { deduceTableSchema } from './lib/table/simple-table/table-schema';
|
|
8
9
|
export { convertToObjectRow, convertToArrayRow } from './lib/table/simple-table/row-utils';
|
|
9
10
|
export { getDataTypeFromArray } from './lib/table/simple-table/data-type';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TableBatchBuilder","RowTableBatchAggregator","ColumnarTableBatchAggregator","getTableLength","getTableNumCols","getTableCell","getTableRowShape","getTableColumnIndex","getTableColumnName","getTableRowAsObject","getTableRowAsArray","makeRowIterator","makeArrayRowIterator","makeObjectRowIterator","ArrowLikeTable","makeTableFromData","deduceTableSchema","convertToObjectRow","convertToArrayRow","getDataTypeFromArray","getMeshSize","getMeshBoundingBox","deduceMeshSchema","deduceMeshField","makeMeshAttributeMetadata","Schema","ArrowLikeSchema","Field","ArrowLikeField","DataType","ArrowLikeDataType","Null","Binary","Bool","Int","Int8","Int16","Int32","Int64","Uint8","Uint16","Uint32","Uint64","Float","Float16","Float32","Float64","Utf8","Date","DateDay","DateMillisecond","Time","TimeMillisecond","TimeSecond","Timestamp","TimestampSecond","TimestampMillisecond","TimestampMicrosecond","TimestampNanosecond","Interval","IntervalDayTime","IntervalYearMonth","FixedSizeList","Struct","getTypeInfo","getArrowType","default","AsyncQueue"],"sources":["../../src/index.ts"],"sourcesContent":["// COMMON CATEGORY\nexport type {\n TypedArray,\n TypedArrayConstructor,\n NumberArray,\n ArrayType,\n AnyArray\n} from './types/types';\n\nexport type {Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata} from './types/schema';\n\n// TABLE CATEGORY TYPES\nexport type {\n Table,\n RowTable,\n ArrayRowTable,\n ObjectRowTable,\n GeoJSONRowTable,\n ColumnarTable,\n ArrowTable,\n Tables\n} from './types/category-table';\nexport type {\n TableBatch,\n ArrayRowTableBatch,\n ObjectRowTableBatch,\n GeoJSONRowTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './types/category-table';\n\n// TABLE CATEGORY UTILS\nexport {TableBatchBuilder} from './lib/table/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/table/batches/table-batch-aggregator';\nexport {RowTableBatchAggregator} from './lib/table/batches/row-table-batch-aggregator';\nexport {ColumnarTableBatchAggregator} from './lib/table/batches/columnar-table-batch-aggregator';\n\nexport {\n getTableLength,\n getTableNumCols,\n getTableCell,\n getTableRowShape,\n getTableColumnIndex,\n getTableColumnName,\n getTableRowAsObject,\n getTableRowAsArray,\n makeRowIterator,\n makeArrayRowIterator,\n makeObjectRowIterator\n} from './lib/table/simple-table/table-accessors';\n\nexport {ArrowLikeTable} from './lib/table/arrow-api/arrow-like-table';\n\nexport {makeTableFromData} from './lib/table/simple-table/make-table';\nexport {deduceTableSchema} from './lib/table/simple-table/table-schema';\nexport {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';\nexport {getDataTypeFromArray} from './lib/table/simple-table/data-type';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './types/category-mesh';\n\nexport {getMeshSize, getMeshBoundingBox} from './lib/mesh/mesh-utils';\n// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177\n// export {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './lib/mesh/deduce-mesh-schema';\n\n// TEXTURES\nexport type {TextureLevel, GPUTextureFormat} from './types/category-texture';\n\n// IMAGES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './types/category-image';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from './types/category-gis';\n\nexport type {GeojsonGeometryInfo} from './types/category-gis';\n\n// GIS CATEGORY - FLAT GEOJSON\nexport type {\n FlatFeature,\n FlatIndexedGeometry,\n FlatGeometry,\n FlatGeometryType,\n FlatPoint,\n FlatLineString,\n FlatPolygon\n} from './types/category-gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './types/category-gis';\nexport type {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["TableBatchBuilder","RowTableBatchAggregator","ColumnarTableBatchAggregator","getTableLength","getTableNumCols","getTableCell","getTableRowShape","getTableColumnIndex","getTableColumnName","getTableRowAsObject","getTableRowAsArray","makeRowIterator","makeArrayRowIterator","makeObjectRowIterator","ArrowLikeTable","makeTableFromData","convertTable","deduceTableSchema","convertToObjectRow","convertToArrayRow","getDataTypeFromArray","getMeshSize","getMeshBoundingBox","deduceMeshSchema","deduceMeshField","makeMeshAttributeMetadata","Schema","ArrowLikeSchema","Field","ArrowLikeField","DataType","ArrowLikeDataType","Null","Binary","Bool","Int","Int8","Int16","Int32","Int64","Uint8","Uint16","Uint32","Uint64","Float","Float16","Float32","Float64","Utf8","Date","DateDay","DateMillisecond","Time","TimeMillisecond","TimeSecond","Timestamp","TimestampSecond","TimestampMillisecond","TimestampMicrosecond","TimestampNanosecond","Interval","IntervalDayTime","IntervalYearMonth","FixedSizeList","Struct","getTypeInfo","getArrowType","default","AsyncQueue"],"sources":["../../src/index.ts"],"sourcesContent":["// COMMON CATEGORY\nexport type {\n TypedArray,\n BigTypedArray,\n TypedArrayConstructor,\n BigTypedArrayConstructor,\n NumberArray,\n ArrayType,\n AnyArray\n} from './types/types';\n\nexport type {Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata} from './types/schema';\n\n// TABLE CATEGORY TYPES\nexport type {\n Table,\n RowTable,\n ArrayRowTable,\n ObjectRowTable,\n GeoJSONRowTable,\n ColumnarTable,\n ArrowTable,\n Tables\n} from './types/category-table';\nexport type {\n TableBatch,\n ArrayRowTableBatch,\n ObjectRowTableBatch,\n GeoJSONRowTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './types/category-table';\n\n// TABLE CATEGORY UTILS\nexport {TableBatchBuilder} from './lib/table/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/table/batches/table-batch-aggregator';\nexport {RowTableBatchAggregator} from './lib/table/batches/row-table-batch-aggregator';\nexport {ColumnarTableBatchAggregator} from './lib/table/batches/columnar-table-batch-aggregator';\n\nexport {\n getTableLength,\n getTableNumCols,\n getTableCell,\n getTableRowShape,\n getTableColumnIndex,\n getTableColumnName,\n getTableRowAsObject,\n getTableRowAsArray,\n makeRowIterator,\n makeArrayRowIterator,\n makeObjectRowIterator\n} from './lib/table/simple-table/table-accessors';\n\nexport {ArrowLikeTable} from './lib/table/arrow-api/arrow-like-table';\n\nexport {makeTableFromData} from './lib/table/simple-table/make-table';\nexport {convertTable} from './lib/table/simple-table/convert-table';\nexport {deduceTableSchema} from './lib/table/simple-table/table-schema';\nexport {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';\nexport {getDataTypeFromArray} from './lib/table/simple-table/data-type';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './types/category-mesh';\n\nexport {getMeshSize, getMeshBoundingBox} from './lib/mesh/mesh-utils';\n// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177\n// export {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './lib/mesh/deduce-mesh-schema';\n\n// TEXTURES\nexport type {TextureLevel, GPUTextureFormat} from './types/category-texture';\n\n// IMAGES\nexport type {ImageDataType, ImageType, ImageTypeEnum} from './types/category-image';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties,\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from './types/category-gis';\n\nexport type {GeojsonGeometryInfo} from './types/category-gis';\n\n// GIS CATEGORY - FLAT GEOJSON\nexport type {\n FlatFeature,\n FlatIndexedGeometry,\n FlatGeometry,\n FlatGeometryType,\n FlatPoint,\n FlatLineString,\n FlatPolygon\n} from './types/category-gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './types/category-gis';\nexport type {\n BinaryFeatureCollection,\n BinaryFeature,\n BinaryPointFeature,\n BinaryLineFeature,\n BinaryPolygonFeature\n} from './types/category-gis';\n\n// SCHEMA\nexport {\n Schema as ArrowLikeSchema,\n Field as ArrowLikeField,\n DataType as ArrowLikeDataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/table/arrow-api';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {getTypeInfo} from './lib/table/arrow-api/get-type-info';\nexport {getArrowType} from './lib/table/arrow/arrow-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"mappings":"AAkCA,SAAQA,iBAAiB,QAAO,yCAAyC;AAEzE,SAAQC,uBAAuB,QAAO,gDAAgD;AACtF,SAAQC,4BAA4B,QAAO,qDAAqD;AAEhG,SACEC,cAAc,EACdC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,kBAAkB,EAClBC,mBAAmB,EACnBC,kBAAkB,EAClBC,eAAe,EACfC,oBAAoB,EACpBC,qBAAqB,QAChB,0CAA0C;AAEjD,SAAQC,cAAc,QAAO,wCAAwC;AAErE,SAAQC,iBAAiB,QAAO,qCAAqC;AACrE,SAAQC,YAAY,QAAO,wCAAwC;AACnE,SAAQC,iBAAiB,QAAO,uCAAuC;AACvE,SAAQC,kBAAkB,EAAEC,iBAAiB,QAAO,oCAAoC;AACxF,SAAQC,oBAAoB,QAAO,oCAAoC;AAYvE,SAAQC,WAAW,EAAEC,kBAAkB,QAAO,uBAAuB;AAGrE,SACEC,gBAAgB,EAChBC,eAAe,EACfC,yBAAyB,QACpB,+BAA+B;AAyDtC,SACEC,MAAM,IAAIC,eAAe,EACzBC,KAAK,IAAIC,cAAc,EACvBC,QAAQ,IAAIC,iBAAiB,EAC7BC,IAAI,EACJC,MAAM,EACNC,IAAI,EACJC,GAAG,EACHC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,MAAM,EACNC,MAAM,EACNC,MAAM,EACNC,KAAK,EACLC,OAAO,EACPC,OAAO,EACPC,OAAO,EACPC,IAAI,EACJC,IAAI,EACJC,OAAO,EACPC,eAAe,EACfC,IAAI,EACJC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,oBAAoB,EACpBC,oBAAoB,EACpBC,mBAAmB,EACnBC,QAAQ,EACRC,eAAe,EACfC,iBAAiB,EACjBC,aAAa,EACbC,MAAM,QACD,uBAAuB;AAK9B,SAAQC,WAAW,QAAO,qCAAqC;AAC/D,SAAQC,YAAY,QAAO,oCAAoC;AAE/D,SAAQC,OAAO,IAAIC,UAAU,QAAO,yBAAyB"}
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { getTableCell, getTableLength, getTableRowAsArray, getTableRowAsObject } from './table-accessors';
|
|
2
2
|
import { deduceTableSchema } from './table-schema';
|
|
3
3
|
import { makeColumnFromField } from './table-column';
|
|
4
|
+
export function convertTable(table, shape) {
|
|
5
|
+
switch (shape) {
|
|
6
|
+
case 'object-row-table':
|
|
7
|
+
return makeObjectRowTable(table);
|
|
8
|
+
case 'array-row-table':
|
|
9
|
+
return makeArrayRowTable(table);
|
|
10
|
+
case 'columnar-table':
|
|
11
|
+
return makeColumnarTable(table);
|
|
12
|
+
case 'arrow-table':
|
|
13
|
+
return makeArrowTable(table);
|
|
14
|
+
default:
|
|
15
|
+
throw new Error(shape);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function makeArrowTable(table) {
|
|
19
|
+
var _globalThis$__luma;
|
|
20
|
+
const _makeArrowTable = (_globalThis$__luma = globalThis.__luma) === null || _globalThis$__luma === void 0 ? void 0 : _globalThis$__luma._makeArrowTable;
|
|
21
|
+
if (!_makeArrowTable) {
|
|
22
|
+
throw new Error('');
|
|
23
|
+
}
|
|
24
|
+
return _makeArrowTable(table);
|
|
25
|
+
}
|
|
4
26
|
export function makeColumnarTable(table) {
|
|
5
27
|
var _table$schema;
|
|
6
28
|
const schema = table.schema || deduceTableSchema(table);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-table.js","names":["getTableCell","getTableLength","getTableRowAsArray","getTableRowAsObject","deduceTableSchema","makeColumnFromField","
|
|
1
|
+
{"version":3,"file":"convert-table.js","names":["getTableCell","getTableLength","getTableRowAsArray","getTableRowAsObject","deduceTableSchema","makeColumnFromField","convertTable","table","shape","makeObjectRowTable","makeArrayRowTable","makeColumnarTable","makeArrowTable","Error","_globalThis$__luma","_makeArrowTable","globalThis","__luma","_table$schema","schema","fields","length","columns","field","column","name","rowIndex","data","Array"],"sources":["../../../../../src/lib/table/simple-table/convert-table.ts"],"sourcesContent":["// loaders.gl, MIT license\nimport {\n getTableCell,\n getTableLength,\n getTableRowAsArray,\n getTableRowAsObject\n} from './table-accessors';\nimport {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n ColumnarTable,\n ArrowTable\n} from '../../../types/category-table';\nimport {deduceTableSchema} from './table-schema';\nimport {makeColumnFromField} from './table-column';\n\nexport function convertTable(table: Table, shape: 'object-row-table'): ObjectRowTable;\nexport function convertTable(table: Table, shape: 'array-row-table'): ArrayRowTable;\nexport function convertTable(table: Table, shape: 'columnar-table'): ColumnarTable;\nexport function convertTable(table: Table, shape: 'arrow-table'): ArrowTable;\n\n/**\n * Convert a table to a different shape\n * @param table\n * @param shape\n * @returns\n */\nexport function convertTable(\n table: Table,\n shape: 'object-row-table' | 'array-row-table' | 'columnar-table' | 'arrow-table'\n) {\n switch (shape) {\n case 'object-row-table':\n return makeObjectRowTable(table);\n case 'array-row-table':\n return makeArrayRowTable(table);\n case 'columnar-table':\n return makeColumnarTable(table);\n case 'arrow-table':\n return makeArrowTable(table);\n default:\n throw new Error(shape);\n }\n}\n\n/**\n * Convert a table to apache arrow format\n * @note this depends on the `@loaders.gl/arrow module being imported\n */\nexport function makeArrowTable(table: Table): Table {\n const _makeArrowTable = globalThis.__luma?._makeArrowTable;\n if (!_makeArrowTable) {\n throw new Error('');\n }\n return _makeArrowTable(table);\n}\n\n/** Convert any simple table into columnar format */\nexport function makeColumnarTable(table: Table): ColumnarTable {\n // TODO - should schema really be optional?\n const schema = table.schema || deduceTableSchema(table);\n const fields = table.schema?.fields || [];\n\n if (table.shape === 'columnar-table') {\n return {...table, schema};\n }\n\n const length = getTableLength(table);\n\n const columns: {[column: string]: ArrayLike<unknown>} = {};\n for (const field of fields) {\n const column = makeColumnFromField(field, length);\n columns[field.name] = column;\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n column[rowIndex] = getTableCell(table, rowIndex, field.name);\n }\n }\n\n return {\n shape: 'columnar-table',\n schema,\n data: columns\n };\n}\n\n/** Convert any table into array row format */\nexport function makeArrayRowTable(table: Table): ArrayRowTable {\n if (table.shape === 'array-row-table') {\n return table;\n }\n const length = getTableLength(table);\n const data = new Array<unknown[]>(length);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n data[rowIndex] = getTableRowAsArray(table, rowIndex);\n }\n return {\n shape: 'array-row-table',\n schema: table.schema,\n data\n };\n}\n\n/** Convert any table into object row format */\nexport function makeObjectRowTable(table: Table): ObjectRowTable {\n if (table.shape === 'object-row-table') {\n return table;\n }\n const length = getTableLength(table);\n const data = new Array<{[key: string]: unknown}>(length);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n data[rowIndex] = getTableRowAsObject(table, rowIndex);\n }\n return {\n shape: 'object-row-table',\n schema: table.schema,\n data\n };\n}\n\n/**\n/**\n *\n * @note - should be part of schema module\nexport function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {\n const tableKeys = ;\n const tableRowsCount = columnarTable[tableKeys[0]].length;\n\n const objectRows: ObjectRowTable['data'] = [];\n\n for (let index = 0; index < tableRowsCount; index++) {\n const objectRow = {};\n for (const fieldName of Object.keys(columnarTable.data)) {\n objectRow[fieldName] = columnarTable[fieldName][index];\n }\n objectRows.push(objectRow);\n }\n\n return {\n shape: 'object-row-table',\n data: objectRows\n };\n}\n */\n"],"mappings":"AACA,SACEA,YAAY,EACZC,cAAc,EACdC,kBAAkB,EAClBC,mBAAmB,QACd,mBAAmB;AAQ1B,SAAQC,iBAAiB,QAAO,gBAAgB;AAChD,SAAQC,mBAAmB,QAAO,gBAAgB;AAalD,OAAO,SAASC,YAAYA,CAC1BC,KAAY,EACZC,KAAgF,EAChF;EACA,QAAQA,KAAK;IACX,KAAK,kBAAkB;MACrB,OAAOC,kBAAkB,CAACF,KAAK,CAAC;IAClC,KAAK,iBAAiB;MACpB,OAAOG,iBAAiB,CAACH,KAAK,CAAC;IACjC,KAAK,gBAAgB;MACnB,OAAOI,iBAAiB,CAACJ,KAAK,CAAC;IACjC,KAAK,aAAa;MAChB,OAAOK,cAAc,CAACL,KAAK,CAAC;IAC9B;MACE,MAAM,IAAIM,KAAK,CAACL,KAAK,CAAC;EAC1B;AACF;AAMA,OAAO,SAASI,cAAcA,CAACL,KAAY,EAAS;EAAA,IAAAO,kBAAA;EAClD,MAAMC,eAAe,IAAAD,kBAAA,GAAGE,UAAU,CAACC,MAAM,cAAAH,kBAAA,uBAAjBA,kBAAA,CAAmBC,eAAe;EAC1D,IAAI,CAACA,eAAe,EAAE;IACpB,MAAM,IAAIF,KAAK,CAAC,EAAE,CAAC;EACrB;EACA,OAAOE,eAAe,CAACR,KAAK,CAAC;AAC/B;AAGA,OAAO,SAASI,iBAAiBA,CAACJ,KAAY,EAAiB;EAAA,IAAAW,aAAA;EAE7D,MAAMC,MAAM,GAAGZ,KAAK,CAACY,MAAM,IAAIf,iBAAiB,CAACG,KAAK,CAAC;EACvD,MAAMa,MAAM,GAAG,EAAAF,aAAA,GAAAX,KAAK,CAACY,MAAM,cAAAD,aAAA,uBAAZA,aAAA,CAAcE,MAAM,KAAI,EAAE;EAEzC,IAAIb,KAAK,CAACC,KAAK,KAAK,gBAAgB,EAAE;IACpC,OAAO;MAA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AAOD,KAAK;EACd;EACA,MAAMc,MAAM,GAAGpB,cAAc,CAACM,KAAK,CAAC;EACpC,MAAMoB,IAAI,GAAG,IAAIC,KAAK,CAA2BP,MAAM,CAAC;EACxD,KAAK,IAAIK,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAGL,MAAM,EAAEK,QAAQ,EAAE,EAAE;IACpDC,IAAI,CAACD,QAAQ,CAAC,GAAGvB,mBAAmB,CAACI,KAAK,EAAEmB,QAAQ,CAAC;EACvD;EACA,OAAO;IACLlB,KAAK,EAAE,kBAAkB;IACzBW,MAAM,EAAEZ,KAAK,CAACY,MAAM;IACpBQ;EACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-geometries.js","names":[],"sources":["../../../src/types/binary-geometries.ts"],"sourcesContent":["// GIS\nimport type {TypedArray} from './types';\n\n// BINARY FORMAT GEOMETRY\n\nexport type BinaryAttribute = {value: TypedArray; size: number};\nexport type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';\n\ntype NumericProps = {[key: string]: BinaryAttribute};\ntype Properties = object[];\n\n/**\n * Represent a single Geometry, similar to a GeoJSON Geometry\n */\nexport type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;\n\n/** Binary point geometry: an array of positions */\nexport type BinaryPointGeometry = {\n type: 'Point';\n positions: BinaryAttribute;\n};\n\n/** Binary line geometry, array of positions and indices to the start of each line */\nexport type BinaryLineGeometry = {\n type: 'LineString';\n positions: BinaryAttribute;\n pathIndices: BinaryAttribute;\n};\n\n/** Binary polygon geometry, an array of positions to each primitite polygon and polygon */\nexport type BinaryPolygonGeometry = {\n type: 'Polygon';\n positions: BinaryAttribute;\n polygonIndices: BinaryAttribute;\n primitivePolygonIndices: BinaryAttribute;\n triangles?: BinaryAttribute;\n};\n\n/** Common properties for binary geometries */\nexport type BinaryProperties = {\n featureIds: BinaryAttribute;\n globalFeatureIds: BinaryAttribute;\n numericProps: NumericProps;\n properties: Properties;\n fields?: Properties;\n};\n\nexport type
|
|
1
|
+
{"version":3,"file":"binary-geometries.js","names":[],"sources":["../../../src/types/binary-geometries.ts"],"sourcesContent":["// GIS\nimport type {TypedArray} from './types';\n\n// BINARY FORMAT GEOMETRY\n\nexport type BinaryAttribute = {value: TypedArray; size: number};\nexport type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';\n\ntype NumericProps = {[key: string]: BinaryAttribute};\ntype Properties = object[];\n\n/**\n * Represent a single Geometry, similar to a GeoJSON Geometry\n */\nexport type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;\n\n/** Binary point geometry: an array of positions */\nexport type BinaryPointGeometry = {\n type: 'Point';\n positions: BinaryAttribute;\n};\n\n/** Binary line geometry, array of positions and indices to the start of each line */\nexport type BinaryLineGeometry = {\n type: 'LineString';\n positions: BinaryAttribute;\n pathIndices: BinaryAttribute;\n};\n\n/** Binary polygon geometry, an array of positions to each primitite polygon and polygon */\nexport type BinaryPolygonGeometry = {\n type: 'Polygon';\n positions: BinaryAttribute;\n polygonIndices: BinaryAttribute;\n primitivePolygonIndices: BinaryAttribute;\n triangles?: BinaryAttribute;\n};\n\n/** Common properties for binary geometries */\nexport type BinaryProperties = {\n featureIds: BinaryAttribute;\n globalFeatureIds: BinaryAttribute;\n numericProps: NumericProps;\n properties: Properties;\n fields?: Properties;\n};\n\n/** Binary feature + binary attributes */\nexport type BinaryFeature = BinaryPointFeature | BinaryLineFeature | BinaryPolygonFeature;\n\nexport type BinaryPointFeature = BinaryPointGeometry & BinaryProperties;\nexport type BinaryLineFeature = BinaryLineGeometry & BinaryProperties;\nexport type BinaryPolygonFeature = BinaryPolygonGeometry & BinaryProperties;\n\n/**\n * Represent a collection of Features, similar to a GeoJSON FeatureCollection\n */\nexport type BinaryFeatureCollection = {\n points?: BinaryPointFeature;\n lines?: BinaryLineFeature;\n polygons?: BinaryPolygonFeature;\n};\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-gis.js","names":[],"sources":["../../../src/types/category-gis.ts"],"sourcesContent":["// GIS\n\n// NORMAL GEOJSON FORMAT GEOMETRY\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties\n} from 'geojson';\n\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from 'geojson';\n\n// FLAT GEOJSON FORMAT GEOMETRY\nexport type {\n FlatGeometryType,\n FlatIndexedGeometry,\n FlatPoint,\n FlatLineString,\n FlatPolygon,\n FlatGeometry,\n FlatFeature\n} from './flat-geometries';\n\n// BINARY FORMAT GEOMETRY\nexport type {\n BinaryAttribute,\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryProperties,\n
|
|
1
|
+
{"version":3,"file":"category-gis.js","names":[],"sources":["../../../src/types/category-gis.ts"],"sourcesContent":["// GIS\n\n// NORMAL GEOJSON FORMAT GEOMETRY\nexport type {\n GeoJSON,\n Feature,\n FeatureCollection,\n Geometry,\n Position,\n GeoJsonProperties\n} from 'geojson';\n\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon,\n GeometryCollection\n} from 'geojson';\n\n// FLAT GEOJSON FORMAT GEOMETRY\nexport type {\n FlatGeometryType,\n FlatIndexedGeometry,\n FlatPoint,\n FlatLineString,\n FlatPolygon,\n FlatGeometry,\n FlatFeature\n} from './flat-geometries';\n\n// BINARY FORMAT GEOMETRY\nexport type {\n BinaryAttribute,\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryProperties,\n BinaryFeatureCollection,\n BinaryFeature,\n BinaryPointFeature,\n BinaryLineFeature,\n BinaryPolygonFeature\n} from './binary-geometries';\n\n/** Aggregate information for converting GeoJSON into other formats */\nexport type GeojsonGeometryInfo = {\n coordLength: number;\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n"],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { TypedArray, TypedArrayConstructor, NumberArray, ArrayType, AnyArray } from './types/types';
|
|
1
|
+
export type { TypedArray, BigTypedArray, TypedArrayConstructor, BigTypedArrayConstructor, NumberArray, ArrayType, AnyArray } from './types/types';
|
|
2
2
|
export type { Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata } from './types/schema';
|
|
3
3
|
export type { Table, RowTable, ArrayRowTable, ObjectRowTable, GeoJSONRowTable, ColumnarTable, ArrowTable, Tables } from './types/category-table';
|
|
4
4
|
export type { TableBatch, ArrayRowTableBatch, ObjectRowTableBatch, GeoJSONRowTableBatch, ColumnarTableBatch, ArrowTableBatch } from './types/category-table';
|
|
@@ -9,6 +9,7 @@ export { ColumnarTableBatchAggregator } from './lib/table/batches/columnar-table
|
|
|
9
9
|
export { getTableLength, getTableNumCols, getTableCell, getTableRowShape, getTableColumnIndex, getTableColumnName, getTableRowAsObject, getTableRowAsArray, makeRowIterator, makeArrayRowIterator, makeObjectRowIterator } from './lib/table/simple-table/table-accessors';
|
|
10
10
|
export { ArrowLikeTable } from './lib/table/arrow-api/arrow-like-table';
|
|
11
11
|
export { makeTableFromData } from './lib/table/simple-table/make-table';
|
|
12
|
+
export { convertTable } from './lib/table/simple-table/convert-table';
|
|
12
13
|
export { deduceTableSchema } from './lib/table/simple-table/table-schema';
|
|
13
14
|
export { convertToObjectRow, convertToArrayRow } from './lib/table/simple-table/row-utils';
|
|
14
15
|
export { getDataTypeFromArray } from './lib/table/simple-table/data-type';
|
|
@@ -21,7 +22,7 @@ export type { GeoJSON, Feature, FeatureCollection, Geometry, Position, GeoJsonPr
|
|
|
21
22
|
export type { GeojsonGeometryInfo } from './types/category-gis';
|
|
22
23
|
export type { FlatFeature, FlatIndexedGeometry, FlatGeometry, FlatGeometryType, FlatPoint, FlatLineString, FlatPolygon } from './types/category-gis';
|
|
23
24
|
export type { BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryAttribute } from './types/category-gis';
|
|
24
|
-
export type {
|
|
25
|
+
export type { BinaryFeatureCollection, BinaryFeature, BinaryPointFeature, BinaryLineFeature, BinaryPolygonFeature } from './types/category-gis';
|
|
25
26
|
export { Schema as ArrowLikeSchema, Field as ArrowLikeField, DataType as ArrowLikeDataType, Null, Binary, Bool, Int, Int8, Int16, Int32, Int64, Uint8, Uint16, Uint32, Uint64, Float, Float16, Float32, Float64, Utf8, Date, DateDay, DateMillisecond, Time, TimeMillisecond, TimeSecond, Timestamp, TimestampSecond, TimestampMillisecond, TimestampMicrosecond, TimestampNanosecond, Interval, IntervalDayTime, IntervalYearMonth, FixedSizeList, Struct } from './lib/table/arrow-api';
|
|
26
27
|
export { getTypeInfo } from './lib/table/arrow-api/get-type-info';
|
|
27
28
|
export { getArrowType } from './lib/table/arrow/arrow-type-utils';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAGlG,YAAY,EACV,KAAK,EACL,QAAQ,EACR,aAAa,EACb,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,MAAM,EACP,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,U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,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,MAAM,IAAI,eAAe,EACzB,KAAK,IAAI,cAAc,EACvB,QAAQ,IAAI,iBAAiB,EAC7B,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,eAAe,EACf,IAAI,EACJ,eAAe,EACf,UAAU,EACV,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,MAAM,EACP,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAC,WAAW,EAAC,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
import { Table, ArrayRowTable, ObjectRowTable, ColumnarTable } from '../../../types/category-table';
|
|
1
|
+
import { Table, ArrayRowTable, ObjectRowTable, ColumnarTable, ArrowTable } from '../../../types/category-table';
|
|
2
|
+
export declare function convertTable(table: Table, shape: 'object-row-table'): ObjectRowTable;
|
|
3
|
+
export declare function convertTable(table: Table, shape: 'array-row-table'): ArrayRowTable;
|
|
4
|
+
export declare function convertTable(table: Table, shape: 'columnar-table'): ColumnarTable;
|
|
5
|
+
export declare function convertTable(table: Table, shape: 'arrow-table'): ArrowTable;
|
|
6
|
+
/**
|
|
7
|
+
* Convert a table to apache arrow format
|
|
8
|
+
* @note this depends on the `@loaders.gl/arrow module being imported
|
|
9
|
+
*/
|
|
10
|
+
export declare function makeArrowTable(table: Table): Table;
|
|
2
11
|
/** Convert any simple table into columnar format */
|
|
3
12
|
export declare function makeColumnarTable(table: Table): ColumnarTable;
|
|
4
13
|
/** Convert any table into array row format */
|
|
5
14
|
export declare function makeArrayRowTable(table: Table): ArrayRowTable;
|
|
6
15
|
/** Convert any table into object row format */
|
|
7
16
|
export declare function makeObjectRowTable(table: Table): ObjectRowTable;
|
|
17
|
+
/**
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @note - should be part of schema module
|
|
21
|
+
export function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {
|
|
22
|
+
const tableKeys = ;
|
|
23
|
+
const tableRowsCount = columnarTable[tableKeys[0]].length;
|
|
24
|
+
|
|
25
|
+
const objectRows: ObjectRowTable['data'] = [];
|
|
26
|
+
|
|
27
|
+
for (let index = 0; index < tableRowsCount; index++) {
|
|
28
|
+
const objectRow = {};
|
|
29
|
+
for (const fieldName of Object.keys(columnarTable.data)) {
|
|
30
|
+
objectRow[fieldName] = columnarTable[fieldName][index];
|
|
31
|
+
}
|
|
32
|
+
objectRows.push(objectRow);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
shape: 'object-row-table',
|
|
37
|
+
data: objectRows
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
*/
|
|
8
41
|
//# sourceMappingURL=convert-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/convert-table.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"convert-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/convert-table.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACX,MAAM,+BAA+B,CAAC;AAIvC,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAAC;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,GAAG,aAAa,CAAC;AACpF,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,GAAG,aAAa,CAAC;AACnF,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC;AA0B7E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAMlD;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAyB7D;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAc7D;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAc/D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
|
@@ -39,16 +39,18 @@ export type BinaryProperties = {
|
|
|
39
39
|
properties: Properties;
|
|
40
40
|
fields?: Properties;
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
export type
|
|
44
|
-
export type
|
|
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;
|
|
45
47
|
/**
|
|
46
48
|
* Represent a collection of Features, similar to a GeoJSON FeatureCollection
|
|
47
49
|
*/
|
|
48
|
-
export type
|
|
49
|
-
points?:
|
|
50
|
-
lines?:
|
|
51
|
-
polygons?:
|
|
50
|
+
export type BinaryFeatureCollection = {
|
|
51
|
+
points?: BinaryPointFeature;
|
|
52
|
+
lines?: BinaryLineFeature;
|
|
53
|
+
polygons?: BinaryPolygonFeature;
|
|
52
54
|
};
|
|
53
55
|
export {};
|
|
54
56
|
//# sourceMappingURL=binary-geometries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-geometries.d.ts","sourceRoot":"","sources":["../../src/types/binary-geometries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;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;I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3F,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,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { GeoJSON, Feature, FeatureCollection, Geometry, Position, GeoJsonProperties } from 'geojson';
|
|
2
2
|
export type { Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection } from 'geojson';
|
|
3
3
|
export type { FlatGeometryType, FlatIndexedGeometry, FlatPoint, FlatLineString, FlatPolygon, FlatGeometry, FlatFeature } from './flat-geometries';
|
|
4
|
-
export type { BinaryAttribute, BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryProperties,
|
|
4
|
+
export type { BinaryAttribute, BinaryGeometryType, BinaryGeometry, BinaryPointGeometry, BinaryLineGeometry, BinaryPolygonGeometry, BinaryProperties, BinaryFeatureCollection, BinaryFeature, BinaryPointFeature, BinaryLineFeature, BinaryPolygonFeature } from './binary-geometries';
|
|
5
5
|
/** Aggregate information for converting GeoJSON into other formats */
|
|
6
6
|
export type GeojsonGeometryInfo = {
|
|
7
7
|
coordLength: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-gis.d.ts","sourceRoot":"","sources":["../../src/types/category-gis.ts"],"names":[],"mappings":"AAGA,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,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"category-gis.d.ts","sourceRoot":"","sources":["../../src/types/category-gis.ts"],"names":[],"mappings":"AAGA,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,MAAM,mBAAmB,CAAC;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,MAAM,qBAAqB,CAAC;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/schema",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.24",
|
|
4
4
|
"description": "Table format APIs for JSON, CSV, etc...",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@types/geojson": "^7946.0.7"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05"
|
|
38
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// COMMON CATEGORY
|
|
2
2
|
export type {
|
|
3
3
|
TypedArray,
|
|
4
|
+
BigTypedArray,
|
|
4
5
|
TypedArrayConstructor,
|
|
6
|
+
BigTypedArrayConstructor,
|
|
5
7
|
NumberArray,
|
|
6
8
|
ArrayType,
|
|
7
9
|
AnyArray
|
|
@@ -52,6 +54,7 @@ export {
|
|
|
52
54
|
export {ArrowLikeTable} from './lib/table/arrow-api/arrow-like-table';
|
|
53
55
|
|
|
54
56
|
export {makeTableFromData} from './lib/table/simple-table/make-table';
|
|
57
|
+
export {convertTable} from './lib/table/simple-table/convert-table';
|
|
55
58
|
export {deduceTableSchema} from './lib/table/simple-table/table-schema';
|
|
56
59
|
export {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';
|
|
57
60
|
export {getDataTypeFromArray} from './lib/table/simple-table/data-type';
|
|
@@ -122,10 +125,11 @@ export type {
|
|
|
122
125
|
BinaryAttribute
|
|
123
126
|
} from './types/category-gis';
|
|
124
127
|
export type {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
BinaryFeatureCollection,
|
|
129
|
+
BinaryFeature,
|
|
130
|
+
BinaryPointFeature,
|
|
131
|
+
BinaryLineFeature,
|
|
132
|
+
BinaryPolygonFeature
|
|
129
133
|
} from './types/category-gis';
|
|
130
134
|
|
|
131
135
|
// SCHEMA
|
|
@@ -5,10 +5,57 @@ import {
|
|
|
5
5
|
getTableRowAsArray,
|
|
6
6
|
getTableRowAsObject
|
|
7
7
|
} from './table-accessors';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Table,
|
|
10
|
+
ArrayRowTable,
|
|
11
|
+
ObjectRowTable,
|
|
12
|
+
ColumnarTable,
|
|
13
|
+
ArrowTable
|
|
14
|
+
} from '../../../types/category-table';
|
|
9
15
|
import {deduceTableSchema} from './table-schema';
|
|
10
16
|
import {makeColumnFromField} from './table-column';
|
|
11
17
|
|
|
18
|
+
export function convertTable(table: Table, shape: 'object-row-table'): ObjectRowTable;
|
|
19
|
+
export function convertTable(table: Table, shape: 'array-row-table'): ArrayRowTable;
|
|
20
|
+
export function convertTable(table: Table, shape: 'columnar-table'): ColumnarTable;
|
|
21
|
+
export function convertTable(table: Table, shape: 'arrow-table'): ArrowTable;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Convert a table to a different shape
|
|
25
|
+
* @param table
|
|
26
|
+
* @param shape
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export function convertTable(
|
|
30
|
+
table: Table,
|
|
31
|
+
shape: 'object-row-table' | 'array-row-table' | 'columnar-table' | 'arrow-table'
|
|
32
|
+
) {
|
|
33
|
+
switch (shape) {
|
|
34
|
+
case 'object-row-table':
|
|
35
|
+
return makeObjectRowTable(table);
|
|
36
|
+
case 'array-row-table':
|
|
37
|
+
return makeArrayRowTable(table);
|
|
38
|
+
case 'columnar-table':
|
|
39
|
+
return makeColumnarTable(table);
|
|
40
|
+
case 'arrow-table':
|
|
41
|
+
return makeArrowTable(table);
|
|
42
|
+
default:
|
|
43
|
+
throw new Error(shape);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Convert a table to apache arrow format
|
|
49
|
+
* @note this depends on the `@loaders.gl/arrow module being imported
|
|
50
|
+
*/
|
|
51
|
+
export function makeArrowTable(table: Table): Table {
|
|
52
|
+
const _makeArrowTable = globalThis.__luma?._makeArrowTable;
|
|
53
|
+
if (!_makeArrowTable) {
|
|
54
|
+
throw new Error('');
|
|
55
|
+
}
|
|
56
|
+
return _makeArrowTable(table);
|
|
57
|
+
}
|
|
58
|
+
|
|
12
59
|
/** Convert any simple table into columnar format */
|
|
13
60
|
export function makeColumnarTable(table: Table): ColumnarTable {
|
|
14
61
|
// TODO - should schema really be optional?
|
|
@@ -70,3 +117,28 @@ export function makeObjectRowTable(table: Table): ObjectRowTable {
|
|
|
70
117
|
data
|
|
71
118
|
};
|
|
72
119
|
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @note - should be part of schema module
|
|
125
|
+
export function convertColumnarToRowFormatTable(columnarTable: ColumnarTable): ObjectRowTable {
|
|
126
|
+
const tableKeys = ;
|
|
127
|
+
const tableRowsCount = columnarTable[tableKeys[0]].length;
|
|
128
|
+
|
|
129
|
+
const objectRows: ObjectRowTable['data'] = [];
|
|
130
|
+
|
|
131
|
+
for (let index = 0; index < tableRowsCount; index++) {
|
|
132
|
+
const objectRow = {};
|
|
133
|
+
for (const fieldName of Object.keys(columnarTable.data)) {
|
|
134
|
+
objectRow[fieldName] = columnarTable[fieldName][index];
|
|
135
|
+
}
|
|
136
|
+
objectRows.push(objectRow);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
shape: 'object-row-table',
|
|
141
|
+
data: objectRows
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
*/
|