@loaders.gl/parquet 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/index.cjs +10 -205
  2. package/dist/index.d.ts +0 -3
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +0 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/parsers/get-parquet-schema.js +1 -1
  7. package/dist/lib/parsers/get-parquet-schema.js.map +1 -1
  8. package/dist/lib/parsers/parse-parquet-to-rows.d.ts.map +1 -1
  9. package/dist/lib/parsers/parse-parquet-to-rows.js +3 -2
  10. package/dist/lib/parsers/parse-parquet-to-rows.js.map +1 -1
  11. package/dist/lib/wasm/encode-parquet-wasm.d.ts +7 -8
  12. package/dist/lib/wasm/encode-parquet-wasm.d.ts.map +1 -1
  13. package/dist/lib/wasm/encode-parquet-wasm.js +2 -2
  14. package/dist/lib/wasm/encode-parquet-wasm.js.map +1 -1
  15. package/dist/lib/wasm/parse-parquet-wasm.d.ts +2 -2
  16. package/dist/lib/wasm/parse-parquet-wasm.d.ts.map +1 -1
  17. package/dist/lib/wasm/parse-parquet-wasm.js +3 -3
  18. package/dist/lib/wasm/parse-parquet-wasm.js.map +1 -1
  19. package/dist/parquet-wasm-loader.d.ts +2 -2
  20. package/dist/parquet-wasm-loader.d.ts.map +1 -1
  21. package/dist/parquet-wasm-loader.js.map +1 -1
  22. package/dist/parquet-wasm-writer.d.ts +2 -2
  23. package/dist/parquet-wasm-writer.d.ts.map +1 -1
  24. package/dist/parquet-wasm-writer.js.map +1 -1
  25. package/dist/parquet-writer.d.ts.map +1 -1
  26. package/dist/parquet-writer.js +3 -2
  27. package/dist/parquet-writer.js.map +1 -1
  28. package/package.json +8 -8
  29. package/src/index.ts +2 -10
  30. package/src/lib/parsers/get-parquet-schema.ts +1 -1
  31. package/src/lib/parsers/parse-parquet-to-rows.ts +4 -2
  32. package/src/lib/wasm/encode-parquet-wasm.ts +11 -10
  33. package/src/lib/wasm/parse-parquet-wasm.ts +6 -7
  34. package/src/parquet-wasm-loader.ts +2 -2
  35. package/src/parquet-wasm-writer.ts +2 -2
  36. package/src/parquet-writer.ts +3 -2
  37. package/dist/lib/geo/decode-geo-column.d.ts +0 -4
  38. package/dist/lib/geo/decode-geo-column.d.ts.map +0 -1
  39. package/dist/lib/geo/decode-geo-column.js +0 -47
  40. package/dist/lib/geo/decode-geo-column.js.map +0 -1
  41. package/dist/lib/geo/decode-geo-metadata.d.ts +0 -44
  42. package/dist/lib/geo/decode-geo-metadata.d.ts.map +0 -1
  43. package/dist/lib/geo/decode-geo-metadata.js +0 -89
  44. package/dist/lib/geo/decode-geo-metadata.js.map +0 -1
  45. package/dist/lib/geo/geoparquet-metadata-schema.d.ts +0 -79
  46. package/dist/lib/geo/geoparquet-metadata-schema.d.ts.map +0 -1
  47. package/dist/lib/geo/geoparquet-metadata-schema.js +0 -76
  48. package/dist/lib/geo/geoparquet-metadata-schema.js.map +0 -1
  49. package/dist/lib/geo/geoparquet-metadata-schema.json +0 -60
  50. package/src/lib/geo/decode-geo-column.ts +0 -55
  51. package/src/lib/geo/decode-geo-metadata.ts +0 -177
  52. package/src/lib/geo/geoparquet-metadata-schema.json +0 -60
  53. package/src/lib/geo/geoparquet-metadata-schema.ts +0 -70
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/parquet",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Framework-independent loader for Apache Parquet files",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,12 +57,12 @@
57
57
  "base64-js and ieee754 are used by buffer polyfill"
58
58
  ],
59
59
  "dependencies": {
60
- "@loaders.gl/bson": "4.0.0",
61
- "@loaders.gl/compression": "4.0.0",
62
- "@loaders.gl/gis": "4.0.0",
63
- "@loaders.gl/loader-utils": "4.0.0",
64
- "@loaders.gl/schema": "4.0.0",
65
- "@loaders.gl/wkt": "4.0.0",
60
+ "@loaders.gl/bson": "4.0.2",
61
+ "@loaders.gl/compression": "4.0.2",
62
+ "@loaders.gl/gis": "4.0.2",
63
+ "@loaders.gl/loader-utils": "4.0.2",
64
+ "@loaders.gl/schema": "4.0.2",
65
+ "@loaders.gl/wkt": "4.0.2",
66
66
  "async-mutex": "^0.2.2",
67
67
  "base64-js": "^1.3.1",
68
68
  "brotli": "^1.3.2",
@@ -88,5 +88,5 @@
88
88
  "@types/varint": "^5.0.0",
89
89
  "apache-arrow": "^13.0.0"
90
90
  },
91
- "gitHead": "9b4211dc0ecd4134a1638ac0a29c5ea9008fd971"
91
+ "gitHead": "471058d109d5652f28c32c1f296fd632f9a5c806"
92
92
  }
package/src/index.ts CHANGED
@@ -12,7 +12,7 @@ import type {
12
12
  GeoJSONTable,
13
13
  GeoJSONTableBatch
14
14
  } from '@loaders.gl/schema';
15
- // import type {Table as ApacheArrowTable} from 'apache-arrow';
15
+ // import type * as arrow from 'apache-arrow';
16
16
 
17
17
  // ParquetLoader
18
18
 
@@ -59,7 +59,7 @@ export const ParquetColumnarLoader: LoaderWithParser<
59
59
  };
60
60
 
61
61
  // export const ParquetWasmLoader: LoaderWithParser<
62
- // ApacheArrowTable,
62
+ // arrow.Table,
63
63
  // never,
64
64
  // ParquetWasmLoaderOptions
65
65
  // > = {
@@ -86,13 +86,5 @@ export {
86
86
  convertParquetSchema as convertParquetToArrowSchema
87
87
  } from './lib/arrow/convert-schema-from-parquet';
88
88
 
89
- // Geo Metadata
90
- // import {default as GEOPARQUET_METADATA_SCHEMA} from './lib/geo/geoparquet-metadata-schema.json';
91
- // export {GEOPARQUET_METADATA_SCHEMA};
92
- export {GEOPARQUET_METADATA_JSON_SCHEMA} from './lib/geo/geoparquet-metadata-schema';
93
-
94
- export type {GeoMetadata} from './lib/geo/decode-geo-metadata';
95
- export {getGeoMetadata, setGeoMetadata, unpackGeoMetadata} from './lib/geo/decode-geo-metadata';
96
-
97
89
  // Experimental
98
90
  export {BufferPolyfill, installBufferPolyfill} from './buffer-polyfill';
@@ -2,7 +2,7 @@
2
2
  import {Schema} from '@loaders.gl/schema';
3
3
  import {ParquetReader} from '../../parquetjs/parser/parquet-reader';
4
4
  import {convertParquetSchema} from '../arrow/convert-schema-from-parquet';
5
- import {unpackGeoMetadata, unpackJSONStringMetadata} from '../geo/decode-geo-metadata';
5
+ import {unpackGeoMetadata, unpackJSONStringMetadata} from '@loaders.gl/gis';
6
6
 
7
7
  export async function getSchemaFromParquetReader(reader: ParquetReader): Promise<Schema> {
8
8
  const parquetSchema = await reader.getSchema();
@@ -2,12 +2,14 @@
2
2
  // import {ColumnarTableBatch} from '@loaders.gl/schema';
3
3
  import {BlobFile} from '@loaders.gl/loader-utils';
4
4
  import {GeoJSONTable, ObjectRowTable, ObjectRowTableBatch} from '@loaders.gl/schema';
5
+ import {convertWKBTableToGeoJSON} from '@loaders.gl/gis';
6
+ import {WKTLoader, WKBLoader} from '@loaders.gl/wkt';
7
+
5
8
  import type {ParquetLoaderOptions} from '../../parquet-loader';
6
9
  import type {ParquetRow} from '../../parquetjs/schema/declare';
7
10
  import {ParquetReader} from '../../parquetjs/parser/parquet-reader';
8
11
  import {getSchemaFromParquetReader} from './get-parquet-schema';
9
12
  import {installBufferPolyfill} from '../../buffer-polyfill';
10
- import {convertWKBTableToGeoJSON} from '../geo/decode-geo-column';
11
13
 
12
14
  export async function parseParquet(
13
15
  arrayBuffer: ArrayBuffer,
@@ -45,7 +47,7 @@ export async function parseParquet(
45
47
 
46
48
  case 'geojson-table':
47
49
  try {
48
- return convertWKBTableToGeoJSON(objectRowTable, schema);
50
+ return convertWKBTableToGeoJSON(objectRowTable, schema, [WKTLoader, WKBLoader]);
49
51
  } catch (error) {
50
52
  return objectRowTable;
51
53
  }
@@ -1,7 +1,6 @@
1
- import type {Table} from 'apache-arrow';
2
1
  import type {WriterOptions} from '@loaders.gl/loader-utils';
3
2
 
4
- import {RecordBatchStreamWriter} from 'apache-arrow';
3
+ import * as arrow from 'apache-arrow';
5
4
  import {loadWasm} from './load-wasm';
6
5
 
7
6
  export type ParquetWriterOptions = WriterOptions & {
@@ -11,9 +10,12 @@ export type ParquetWriterOptions = WriterOptions & {
11
10
  };
12
11
 
13
12
  /**
14
- * Encode Arrow Table to Parquet buffer
13
+ * Encode Arrow arrow.Table to Parquet buffer
15
14
  */
16
- export async function encode(table: Table, options?: ParquetWriterOptions): Promise<ArrayBuffer> {
15
+ export async function encode(
16
+ table: arrow.Table,
17
+ options?: ParquetWriterOptions
18
+ ): Promise<ArrayBuffer> {
17
19
  const wasmUrl = options?.parquet?.wasmUrl;
18
20
  const wasm = await loadWasm(wasmUrl);
19
21
 
@@ -28,13 +30,12 @@ export async function encode(table: Table, options?: ParquetWriterOptions): Prom
28
30
  }
29
31
 
30
32
  /**
31
- * Serialize a {@link Table} to the IPC format. This function is a convenience
32
- * wrapper for {@link RecordBatchStreamWriter} and {@link RecordBatchFileWriter}.
33
+ * Serialize a table to the IPC format. This function is a convenience
33
34
  * Opposite of {@link tableFromIPC}.
34
35
  *
35
- * @param table The Table to serialize.
36
- * @param type Whether to serialize the Table as a file or a stream.
36
+ * @param table The arrow.Table to serialize.
37
+ * @param type Whether to serialize the arrow.Table as a file or a stream.
37
38
  */
38
- export function tableToIPC(table: Table): Uint8Array {
39
- return RecordBatchStreamWriter.writeAll(table).toUint8Array(true);
39
+ export function tableToIPC(table: arrow.Table): Uint8Array {
40
+ return arrow.RecordBatchStreamWriter.writeAll(table).toUint8Array(true);
40
41
  }
@@ -1,7 +1,6 @@
1
1
  // eslint-disable
2
- import type {RecordBatch} from 'apache-arrow';
3
2
  import type {LoaderOptions} from '@loaders.gl/loader-utils';
4
- import {Table as ArrowTable, RecordBatchStreamReader} from 'apache-arrow';
3
+ import * as arrow from 'apache-arrow';
5
4
  import {loadWasm} from './load-wasm/load-wasm-node';
6
5
 
7
6
  export type ParquetWasmLoaderOptions = LoaderOptions & {
@@ -14,7 +13,7 @@ export type ParquetWasmLoaderOptions = LoaderOptions & {
14
13
  export async function parseParquetWasm(
15
14
  arrayBuffer: ArrayBuffer,
16
15
  options?: ParquetWasmLoaderOptions
17
- ): Promise<ArrowTable> {
16
+ ): Promise<arrow.Table> {
18
17
  const wasmUrl = options?.parquet?.wasmUrl;
19
18
  const wasm = await loadWasm(wasmUrl);
20
19
 
@@ -32,11 +31,11 @@ export async function parseParquetWasm(
32
31
  * Deserialize the IPC format into a {@link Table}. This function is a
33
32
  * convenience wrapper for {@link RecordBatchReader}. Opposite of {@link tableToIPC}.
34
33
  */
35
- function tableFromIPC(input: ArrayBuffer): ArrowTable {
36
- const reader = RecordBatchStreamReader.from(input);
37
- const recordBatches: RecordBatch[] = [];
34
+ function tableFromIPC(input: ArrayBuffer): arrow.Table {
35
+ const reader = arrow.RecordBatchStreamReader.from(input);
36
+ const recordBatches: arrow.RecordBatch[] = [];
38
37
  for (const recordBatch of reader) {
39
38
  recordBatches.push(recordBatch);
40
39
  }
41
- return new ArrowTable(recordBatches);
40
+ return new arrow.Table(recordBatches);
42
41
  }
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) vis.gl contributors
3
3
 
4
4
  import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
5
- import type {Table as ArrowTable} from 'apache-arrow';
5
+ import type * as arrow from 'apache-arrow';
6
6
 
7
7
  // __VERSION__ is injected by babel-plugin-version-inline
8
8
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -17,7 +17,7 @@ export type ParquetWasmLoaderOptions = LoaderOptions & {
17
17
  };
18
18
 
19
19
  /** Parquet WASM table loader */
20
- export const ParquetWasmLoader: Loader<ArrowTable, never, ParquetWasmLoaderOptions> = {
20
+ export const ParquetWasmLoader: Loader<arrow.Table, never, ParquetWasmLoaderOptions> = {
21
21
  name: 'Apache Parquet',
22
22
  id: 'parquet-wasm',
23
23
  module: 'parquet',
@@ -3,14 +3,14 @@
3
3
 
4
4
  import type {Writer} from '@loaders.gl/loader-utils';
5
5
  import {encode, ParquetWriterOptions} from './lib/wasm/encode-parquet-wasm';
6
- import type {Table as ArrowTable} from 'apache-arrow';
6
+ import type * as arrow from 'apache-arrow';
7
7
 
8
8
  // __VERSION__ is injected by babel-plugin-version-inline
9
9
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
10
10
  const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
11
 
12
12
  /** Parquet WASM writer */
13
- export const ParquetWasmWriter: Writer<ArrowTable, never, ParquetWriterOptions> = {
13
+ export const ParquetWasmWriter: Writer<arrow.Table, never, ParquetWriterOptions> = {
14
14
  name: 'Apache Parquet',
15
15
  id: 'parquet-wasm',
16
16
  module: 'parquet',
@@ -17,9 +17,10 @@ export const ParquetWriter: Writer<Table, TableBatch, ParquetWriterOptions> = {
17
17
  version: VERSION,
18
18
  extensions: ['parquet'],
19
19
  mimeTypes: ['application/octet-stream'],
20
- encodeSync,
21
20
  binary: true,
22
- options: {}
21
+ options: {},
22
+ encode: async (data, options) => encodeSync(data, options),
23
+ encodeSync
23
24
  };
24
25
 
25
26
  function encodeSync(data, options?: ParquetWriterOptions) {
@@ -1,4 +0,0 @@
1
- import type { ArrayRowTable, GeoJSONTable, ObjectRowTable, Schema } from '@loaders.gl/schema';
2
- /** TODO - move to loaders.gl/gis? */
3
- export declare function convertWKBTableToGeoJSON(table: ArrayRowTable | ObjectRowTable, schema: Schema): GeoJSONTable;
4
- //# sourceMappingURL=decode-geo-column.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode-geo-column.d.ts","sourceRoot":"","sources":["../../../src/lib/geo/decode-geo-column.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAQ5F,qCAAqC;AACrC,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,aAAa,GAAG,cAAc,EACrC,MAAM,EAAE,MAAM,GACb,YAAY,CAoBd"}
@@ -1,47 +0,0 @@
1
- import { getTableLength, getTableRowAsObject } from '@loaders.gl/schema';
2
- import { WKBLoader, WKTLoader } from '@loaders.gl/wkt';
3
- import { getGeoMetadata } from "./decode-geo-metadata.js";
4
- export function convertWKBTableToGeoJSON(table, schema) {
5
- const geoMetadata = getGeoMetadata(schema);
6
- const primaryColumn = geoMetadata === null || geoMetadata === void 0 ? void 0 : geoMetadata.primary_column;
7
- if (!primaryColumn) {
8
- throw new Error('no geometry column');
9
- }
10
- const columnMetadata = geoMetadata.columns[primaryColumn];
11
- const features = [];
12
- const length = getTableLength(table);
13
- for (let rowIndex = 0; rowIndex < length; rowIndex++) {
14
- const row = getTableRowAsObject(table, rowIndex);
15
- const geometry = parseGeometry(row[primaryColumn], columnMetadata);
16
- delete row[primaryColumn];
17
- const feature = {
18
- type: 'Feature',
19
- geometry: geometry,
20
- properties: row
21
- };
22
- features.push(feature);
23
- }
24
- return {
25
- shape: 'geojson-table',
26
- schema,
27
- type: 'FeatureCollection',
28
- features
29
- };
30
- }
31
- function parseGeometry(geometry, columnMetadata) {
32
- var _WKTLoader$parseTextS, _WKBLoader$parseSync;
33
- switch (columnMetadata.encoding) {
34
- case 'wkt':
35
- return ((_WKTLoader$parseTextS = WKTLoader.parseTextSync) === null || _WKTLoader$parseTextS === void 0 ? void 0 : _WKTLoader$parseTextS.call(WKTLoader, geometry)) || null;
36
- case 'wkb':
37
- default:
38
- const arrayBuffer = ArrayBuffer.isView(geometry) ? geometry.buffer.slice(geometry.byteOffset, geometry.byteOffset + geometry.byteLength) : geometry;
39
- const geojson = (_WKBLoader$parseSync = WKBLoader.parseSync) === null || _WKBLoader$parseSync === void 0 ? void 0 : _WKBLoader$parseSync.call(WKBLoader, arrayBuffer, {
40
- wkb: {
41
- shape: 'geometry'
42
- }
43
- });
44
- return geojson;
45
- }
46
- }
47
- //# sourceMappingURL=decode-geo-column.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode-geo-column.js","names":["getTableLength","getTableRowAsObject","WKBLoader","WKTLoader","getGeoMetadata","convertWKBTableToGeoJSON","table","schema","geoMetadata","primaryColumn","primary_column","Error","columnMetadata","columns","features","length","rowIndex","row","geometry","parseGeometry","feature","type","properties","push","shape","_WKTLoader$parseTextS","_WKBLoader$parseSync","encoding","parseTextSync","call","arrayBuffer","ArrayBuffer","isView","buffer","slice","byteOffset","byteLength","geojson","parseSync","wkb"],"sources":["../../../src/lib/geo/decode-geo-column.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {ArrayRowTable, GeoJSONTable, ObjectRowTable, Schema} from '@loaders.gl/schema';\nimport type {Feature, Geometry} from '@loaders.gl/schema';\nimport {getTableLength, getTableRowAsObject} from '@loaders.gl/schema';\n// import {binaryToGeometry} from '@loaders.gl/gis';\nimport {WKBLoader, WKTLoader} from '@loaders.gl/wkt';\n\nimport {GeoColumnMetadata, getGeoMetadata} from './decode-geo-metadata';\n\n/** TODO - move to loaders.gl/gis? */\nexport function convertWKBTableToGeoJSON(\n table: ArrayRowTable | ObjectRowTable,\n schema: Schema\n): GeoJSONTable {\n const geoMetadata = getGeoMetadata(schema);\n const primaryColumn = geoMetadata?.primary_column;\n if (!primaryColumn) {\n throw new Error('no geometry column');\n }\n const columnMetadata = geoMetadata.columns[primaryColumn];\n\n const features: Feature[] = [];\n\n const length = getTableLength(table);\n for (let rowIndex = 0; rowIndex < length; rowIndex++) {\n const row = getTableRowAsObject(table, rowIndex);\n const geometry = parseGeometry(row[primaryColumn], columnMetadata);\n delete row[primaryColumn];\n const feature: Feature = {type: 'Feature', geometry: geometry!, properties: row};\n features.push(feature);\n }\n\n return {shape: 'geojson-table', schema, type: 'FeatureCollection', features};\n}\n\nfunction parseGeometry(geometry: unknown, columnMetadata: GeoColumnMetadata): Geometry | null {\n switch (columnMetadata.encoding) {\n case 'wkt':\n return WKTLoader.parseTextSync?.(geometry as string) || null;\n case 'wkb':\n default:\n const arrayBuffer = ArrayBuffer.isView(geometry)\n ? geometry.buffer.slice(geometry.byteOffset, geometry.byteOffset + geometry.byteLength)\n : (geometry as ArrayBuffer);\n const geojson = WKBLoader.parseSync?.(arrayBuffer, {\n wkb: {shape: 'geometry'}\n }) as unknown as Geometry;\n return geojson; // binaryGeometry ? binaryToGeometry(binaryGeometry) : null;\n // const binaryGeometry = WKBLoader.parseSync?.(geometry);\n // ts-ignore\n // return binaryGeometry ? binaryToGeometry(binaryGeometry) : null;\n }\n}\n"],"mappings":"AAKA,SAAQA,cAAc,EAAEC,mBAAmB,QAAO,oBAAoB;AAEtE,SAAQC,SAAS,EAAEC,SAAS,QAAO,iBAAiB;AAAC,SAE1BC,cAAc;AAGzC,OAAO,SAASC,wBAAwBA,CACtCC,KAAqC,EACrCC,MAAc,EACA;EACd,MAAMC,WAAW,GAAGJ,cAAc,CAACG,MAAM,CAAC;EAC1C,MAAME,aAAa,GAAGD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,cAAc;EACjD,IAAI,CAACD,aAAa,EAAE;IAClB,MAAM,IAAIE,KAAK,CAAC,oBAAoB,CAAC;EACvC;EACA,MAAMC,cAAc,GAAGJ,WAAW,CAACK,OAAO,CAACJ,aAAa,CAAC;EAEzD,MAAMK,QAAmB,GAAG,EAAE;EAE9B,MAAMC,MAAM,GAAGf,cAAc,CAACM,KAAK,CAAC;EACpC,KAAK,IAAIU,QAAQ,GAAG,CAAC,EAAEA,QAAQ,GAAGD,MAAM,EAAEC,QAAQ,EAAE,EAAE;IACpD,MAAMC,GAAG,GAAGhB,mBAAmB,CAACK,KAAK,EAAEU,QAAQ,CAAC;IAChD,MAAME,QAAQ,GAAGC,aAAa,CAACF,GAAG,CAACR,aAAa,CAAC,EAAEG,cAAc,CAAC;IAClE,OAAOK,GAAG,CAACR,aAAa,CAAC;IACzB,MAAMW,OAAgB,GAAG;MAACC,IAAI,EAAE,SAAS;MAAEH,QAAQ,EAAEA,QAAS;MAAEI,UAAU,EAAEL;IAAG,CAAC;IAChFH,QAAQ,CAACS,IAAI,CAACH,OAAO,CAAC;EACxB;EAEA,OAAO;IAACI,KAAK,EAAE,eAAe;IAAEjB,MAAM;IAAEc,IAAI,EAAE,mBAAmB;IAAEP;EAAQ,CAAC;AAC9E;AAEA,SAASK,aAAaA,CAACD,QAAiB,EAAEN,cAAiC,EAAmB;EAAA,IAAAa,qBAAA,EAAAC,oBAAA;EAC5F,QAAQd,cAAc,CAACe,QAAQ;IAC7B,KAAK,KAAK;MACR,OAAO,EAAAF,qBAAA,GAAAtB,SAAS,CAACyB,aAAa,cAAAH,qBAAA,uBAAvBA,qBAAA,CAAAI,IAAA,CAAA1B,SAAS,EAAiBe,QAAkB,CAAC,KAAI,IAAI;IAC9D,KAAK,KAAK;IACV;MACE,MAAMY,WAAW,GAAGC,WAAW,CAACC,MAAM,CAACd,QAAQ,CAAC,GAC5CA,QAAQ,CAACe,MAAM,CAACC,KAAK,CAAChB,QAAQ,CAACiB,UAAU,EAAEjB,QAAQ,CAACiB,UAAU,GAAGjB,QAAQ,CAACkB,UAAU,CAAC,GACpFlB,QAAwB;MAC7B,MAAMmB,OAAO,IAAAX,oBAAA,GAAGxB,SAAS,CAACoC,SAAS,cAAAZ,oBAAA,uBAAnBA,oBAAA,CAAAG,IAAA,CAAA3B,SAAS,EAAa4B,WAAW,EAAE;QACjDS,GAAG,EAAE;UAACf,KAAK,EAAE;QAAU;MACzB,CAAC,CAAwB;MACzB,OAAOa,OAAO;EAIlB;AACF"}
@@ -1,44 +0,0 @@
1
- import { Schema } from '@loaders.gl/schema';
2
- type GeometryType = 'Point' | 'LineString' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Point Z' | 'LineString Z' | 'Polygon Z' | 'MultiPoint Z' | 'MultiLineString Z' | 'MultiPolygon Z' | 'GeometryCollection Z';
3
- /**
4
- * A geoarrow / geoparquet geo metadata object
5
- * (stored in stringified form in the top level metadata 'geo' key)
6
- * @see https://github.com/opengeospatial/geoparquet/blob/main/format-specs/geoparquet.md
7
- * @see https://github.com/geoarrow/geoarrow/blob/main/metadata.md
8
- * */
9
- export type GeoMetadata = {
10
- version?: string;
11
- primary_column?: string;
12
- columns: Record<string, GeoColumnMetadata>;
13
- [key: string]: unknown;
14
- };
15
- /** A geoarrow / geoparquet geo metadata for one geometry column */
16
- export type GeoColumnMetadata = {
17
- encoding: 'wkb' | 'wkt';
18
- geometry_types: GeometryType[];
19
- crs?: object | null;
20
- orientation?: 'counterclockwise';
21
- bbox?: [number, number, number, number] | [number, number, number, number, number, number];
22
- edges?: 'planar' | 'spherical';
23
- epoch?: number;
24
- [key: string]: unknown;
25
- };
26
- /** Parse a key with stringified arrow metadata */
27
- export declare function parseJSONStringMetadata(schema: Schema, metadataKey: string): Record<string, unknown> | null;
28
- export declare function unpackJSONStringMetadata(schema: Schema, metadataKey: string): void;
29
- /**
30
- * Reads the GeoMetadata object from the metadata
31
- * @note geoarrow / parquet schema is stringified into a single key-value pair in the parquet metadata */
32
- export declare function getGeoMetadata(schema: Schema): GeoMetadata | null;
33
- /**
34
- * Stores a geoarrow / geoparquet geo metadata object in the schema
35
- * @note geoarrow / geoparquet geo metadata is a single stringified JSON field
36
- */
37
- export declare function setGeoMetadata(schema: Schema, geoMetadata: GeoMetadata): void;
38
- /**
39
- * Unpacks geo metadata into separate metadata fields (parses the long JSON string)
40
- * @note geoarrow / parquet schema is stringified into a single key-value pair in the parquet metadata
41
- */
42
- export declare function unpackGeoMetadata(schema: Schema): void;
43
- export {};
44
- //# sourceMappingURL=decode-geo-metadata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode-geo-metadata.d.ts","sourceRoot":"","sources":["../../../src/lib/geo/decode-geo-metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAQ,MAAM,oBAAoB,CAAC;AAIjD,KAAK,YAAY,GACb,OAAO,GACP,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,oBAAoB,G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,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,CAG7E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA6BtD"}
@@ -1,89 +0,0 @@
1
- export function parseJSONStringMetadata(schema, metadataKey) {
2
- const stringifiedMetadata = schema.metadata[metadataKey];
3
- if (!stringifiedMetadata) {
4
- return null;
5
- }
6
- try {
7
- const metadata = JSON.parse(stringifiedMetadata);
8
- if (!metadata || typeof metadata !== 'object') {
9
- return null;
10
- }
11
- return metadata;
12
- } catch {
13
- return null;
14
- }
15
- }
16
- export function unpackJSONStringMetadata(schema, metadataKey) {
17
- const json = parseJSONStringMetadata(schema, metadataKey);
18
- for (const [key, value] of Object.entries(json || {})) {
19
- schema.metadata[`${metadataKey}.${key}`] = typeof value === 'string' ? value : JSON.stringify(value);
20
- }
21
- }
22
- export function getGeoMetadata(schema) {
23
- const geoMetadata = parseJSONStringMetadata(schema, 'geo');
24
- return geoMetadata;
25
- }
26
- export function setGeoMetadata(schema, geoMetadata) {
27
- const stringifiedGeoMetadata = JSON.stringify(geoMetadata);
28
- schema.metadata.geo = stringifiedGeoMetadata;
29
- }
30
- export function unpackGeoMetadata(schema) {
31
- const geoMetadata = getGeoMetadata(schema);
32
- if (!geoMetadata) {
33
- return;
34
- }
35
- const {
36
- version,
37
- primary_column,
38
- columns
39
- } = geoMetadata;
40
- if (version) {
41
- schema.metadata['geo.version'] = version;
42
- }
43
- if (primary_column) {
44
- schema.metadata['geo.primary_column'] = primary_column;
45
- }
46
- schema.metadata['geo.columns'] = Object.keys(columns || {}).join('');
47
- for (const [columnName, columnMetadata] of Object.entries(columns || {})) {
48
- const field = schema.fields.find(field => field.name === columnName);
49
- if (field) {
50
- if (field.name === primary_column) {
51
- setFieldMetadata(field, 'geo.primary_field', 'true');
52
- }
53
- unpackGeoFieldMetadata(field, columnMetadata);
54
- }
55
- }
56
- }
57
- function unpackGeoFieldMetadata(field, columnMetadata) {
58
- for (const [key, value] of Object.entries(columnMetadata || {})) {
59
- switch (key) {
60
- case 'geometry_type':
61
- setFieldMetadata(field, `geo.${key}`, value.join(','));
62
- break;
63
- case 'bbox':
64
- setFieldMetadata(field, `geo.crs.${key}`, JSON.stringify(value));
65
- break;
66
- case 'crs':
67
- for (const [crsKey, crsValue] of Object.entries(value || {})) {
68
- switch (crsKey) {
69
- case 'id':
70
- const crsId = typeof crsValue === 'object' ? `${crsValue === null || crsValue === void 0 ? void 0 : crsValue.authority}:${crsValue === null || crsValue === void 0 ? void 0 : crsValue.code}` : JSON.stringify(crsValue);
71
- setFieldMetadata(field, `geo.crs.${crsKey}`, crsId);
72
- break;
73
- default:
74
- setFieldMetadata(field, `geo.crs.${crsKey}`, typeof crsValue === 'string' ? crsValue : JSON.stringify(crsValue));
75
- break;
76
- }
77
- }
78
- break;
79
- case 'edges':
80
- default:
81
- setFieldMetadata(field, `geo.${key}`, typeof value === 'string' ? value : JSON.stringify(value));
82
- }
83
- }
84
- }
85
- function setFieldMetadata(field, key, value) {
86
- field.metadata = field.metadata || {};
87
- field.metadata[key] = value;
88
- }
89
- //# sourceMappingURL=decode-geo-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decode-geo-metadata.js","names":["parseJSONStringMetadata","schema","metadataKey","stringifiedMetadata","metadata","JSON","parse","unpackJSONStringMetadata","json","key","value","Object","entries","stringify","getGeoMetadata","geoMetadata","setGeoMetadata","stringifiedGeoMetadata","geo","unpackGeoMetadata","version","primary_column","columns","keys","join","columnName","columnMetadata","field","fields","find","name","setFieldMetadata","unpackGeoFieldMetadata","crsKey","crsValue","crsId","authority","code"],"sources":["../../../src/lib/geo/decode-geo-metadata.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\nimport {Schema, Field} from '@loaders.gl/schema';\n\n/* eslint-disable camelcase */\n\ntype GeometryType =\n | 'Point'\n | 'LineString'\n | 'Polygon'\n | 'MultiPoint'\n | 'MultiLineString'\n | 'MultiPolygon'\n | 'GeometryCollection'\n | 'Point Z'\n | 'LineString Z'\n | 'Polygon Z'\n | 'MultiPoint Z'\n | 'MultiLineString Z'\n | 'MultiPolygon Z'\n | 'GeometryCollection Z';\n\n/**\n * A geoarrow / geoparquet geo metadata object\n * (stored in stringified form in the top level metadata 'geo' key)\n * @see https://github.com/opengeospatial/geoparquet/blob/main/format-specs/geoparquet.md\n * @see https://github.com/geoarrow/geoarrow/blob/main/metadata.md\n * */\nexport type GeoMetadata = {\n version?: string;\n primary_column?: string;\n columns: Record<string, GeoColumnMetadata>;\n [key: string]: unknown;\n};\n\n/** A geoarrow / geoparquet geo metadata for one geometry column */\nexport type GeoColumnMetadata = {\n encoding: 'wkb' | 'wkt';\n geometry_types: GeometryType[];\n crs?: object | null;\n orientation?: 'counterclockwise';\n bbox?: [number, number, number, number] | [number, number, number, number, number, number];\n edges?: 'planar' | 'spherical';\n epoch?: number;\n [key: string]: unknown;\n};\n\n/** Parse a key with stringified arrow metadata */\nexport function parseJSONStringMetadata(\n schema: Schema,\n metadataKey: string\n): Record<string, unknown> | null {\n const stringifiedMetadata = schema.metadata[metadataKey];\n if (!stringifiedMetadata) {\n return null;\n }\n\n try {\n const metadata = JSON.parse(stringifiedMetadata);\n if (!metadata || typeof metadata !== 'object') {\n return null;\n }\n return metadata;\n } catch {\n return null;\n }\n}\n\nexport function unpackJSONStringMetadata(schema: Schema, metadataKey: string): void {\n const json = parseJSONStringMetadata(schema, metadataKey);\n for (const [key, value] of Object.entries(json || {})) {\n schema.metadata[`${metadataKey}.${key}`] =\n typeof value === 'string' ? value : JSON.stringify(value);\n }\n}\n\n// GEO METADATA\n\n/**\n * Reads the GeoMetadata object from the metadata\n * @note geoarrow / parquet schema is stringified into a single key-value pair in the parquet metadata */\nexport function getGeoMetadata(schema: Schema): GeoMetadata | null {\n const geoMetadata = parseJSONStringMetadata(schema, 'geo') as GeoMetadata;\n return geoMetadata;\n}\n\n/**\n * Stores a geoarrow / geoparquet geo metadata object in the schema\n * @note geoarrow / geoparquet geo metadata is a single stringified JSON field\n */\nexport function setGeoMetadata(schema: Schema, geoMetadata: GeoMetadata): void {\n const stringifiedGeoMetadata = JSON.stringify(geoMetadata);\n schema.metadata.geo = stringifiedGeoMetadata;\n}\n\n/**\n * Unpacks geo metadata into separate metadata fields (parses the long JSON string)\n * @note geoarrow / parquet schema is stringified into a single key-value pair in the parquet metadata\n */\nexport function unpackGeoMetadata(schema: Schema): void {\n const geoMetadata = getGeoMetadata(schema);\n if (!geoMetadata) {\n return;\n }\n\n // Store Parquet Schema Level Metadata\n\n const {version, primary_column, columns} = geoMetadata;\n if (version) {\n schema.metadata['geo.version'] = version;\n }\n\n if (primary_column) {\n schema.metadata['geo.primary_column'] = primary_column;\n }\n\n // store column names as comma separated list\n schema.metadata['geo.columns'] = Object.keys(columns || {}).join('');\n\n for (const [columnName, columnMetadata] of Object.entries(columns || {})) {\n const field = schema.fields.find((field) => field.name === columnName);\n if (field) {\n if (field.name === primary_column) {\n setFieldMetadata(field, 'geo.primary_field', 'true');\n }\n unpackGeoFieldMetadata(field, columnMetadata);\n }\n }\n}\n\n// eslint-disable-next-line complexity\nfunction unpackGeoFieldMetadata(field: Field, columnMetadata): void {\n for (const [key, value] of Object.entries(columnMetadata || {})) {\n switch (key) {\n case 'geometry_type':\n setFieldMetadata(field, `geo.${key}`, (value as string[]).join(','));\n break;\n case 'bbox':\n setFieldMetadata(field, `geo.crs.${key}`, JSON.stringify(value));\n break;\n case 'crs':\n // @ts-ignore\n for (const [crsKey, crsValue] of Object.entries(value || {})) {\n switch (crsKey) {\n case 'id':\n const crsId =\n typeof crsValue === 'object'\n ? // @ts-ignore\n `${crsValue?.authority}:${crsValue?.code}`\n : JSON.stringify(crsValue);\n setFieldMetadata(field, `geo.crs.${crsKey}`, crsId);\n break;\n default:\n setFieldMetadata(\n field,\n `geo.crs.${crsKey}`,\n typeof crsValue === 'string' ? crsValue : JSON.stringify(crsValue)\n );\n break;\n }\n }\n break;\n case 'edges':\n default:\n setFieldMetadata(\n field,\n `geo.${key}`,\n typeof value === 'string' ? value : JSON.stringify(value)\n );\n }\n }\n}\n\nfunction setFieldMetadata(field: Field, key: string, value: string): void {\n field.metadata = field.metadata || {};\n field.metadata[key] = value;\n}\n"],"mappings":"AAgDA,OAAO,SAASA,uBAAuBA,CACrCC,MAAc,EACdC,WAAmB,EACa;EAChC,MAAMC,mBAAmB,GAAGF,MAAM,CAACG,QAAQ,CAACF,WAAW,CAAC;EACxD,IAAI,CAACC,mBAAmB,EAAE;IACxB,OAAO,IAAI;EACb;EAEA,IAAI;IACF,MAAMC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACH,mBAAmB,CAAC;IAChD,IAAI,CAACC,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;MAC7C,OAAO,IAAI;IACb;IACA,OAAOA,QAAQ;EACjB,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEA,OAAO,SAASG,wBAAwBA,CAACN,MAAc,EAAEC,WAAmB,EAAQ;EAClF,MAAMM,IAAI,GAAGR,uBAAuB,CAACC,MAAM,EAAEC,WAAW,CAAC;EACzD,KAAK,MAAM,CAACO,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACJ,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE;IACrDP,MAAM,CAACG,QAAQ,CAAE,GAAEF,WAAY,IAAGO,GAAI,EAAC,CAAC,GACtC,OAAOC,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGL,IAAI,CAACQ,SAAS,CAACH,KAAK,CAAC;EAC7D;AACF;AAOA,OAAO,SAASI,cAAcA,CAACb,MAAc,EAAsB;EACjE,MAAMc,WAAW,GAAGf,uBAAuB,CAACC,MAAM,EAAE,KAAK,CAAgB;EACzE,OAAOc,WAAW;AACpB;AAMA,OAAO,SAASC,cAAcA,CAACf,MAAc,EAAEc,WAAwB,EAAQ;EAC7E,MAAME,sBAA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AAK,CAACvB,QAAQ,GAAGuB,KAAK,CAACvB,QAAQ,IAAI,CAAC,CAAC;EACrCuB,KAAK,CAACvB,QAAQ,CAACK,GAAG,CAAC,GAAGC,KAAK;AAC7B"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Geoparquet JSON schema for geo metadata
3
- * @see https://github.com/geoarrow/geoarrow/blob/main/metadata.md
4
- * @see https://github.com/opengeospatial/geoparquet/blob/main/format-specs/geoparquet.md
5
- */
6
- export declare const GEOPARQUET_METADATA_JSON_SCHEMA: {
7
- $schema: string;
8
- title: string;
9
- description: string;
10
- type: string;
11
- required: string[];
12
- properties: {
13
- version: {
14
- type: string;
15
- const: string;
16
- };
17
- primary_column: {
18
- type: string;
19
- minLength: number;
20
- };
21
- columns: {
22
- type: string;
23
- minProperties: number;
24
- patternProperties: {
25
- '.+': {
26
- type: string;
27
- required: string[];
28
- properties: {
29
- encoding: {
30
- type: string;
31
- const: string;
32
- };
33
- geometry_types: {
34
- type: string;
35
- uniqueItems: boolean;
36
- items: {
37
- type: string;
38
- pattern: string;
39
- };
40
- };
41
- crs: {
42
- oneOf: ({
43
- $ref: string;
44
- type?: undefined;
45
- } | {
46
- type: string;
47
- $ref?: undefined;
48
- })[];
49
- };
50
- edges: {
51
- type: string;
52
- enum: string[];
53
- };
54
- orientation: {
55
- type: string;
56
- const: string;
57
- };
58
- bbox: {
59
- type: string;
60
- items: {
61
- type: string;
62
- };
63
- oneOf: {
64
- description: string;
65
- minItems: number;
66
- maxItems: number;
67
- }[];
68
- };
69
- epoch: {
70
- type: string;
71
- };
72
- };
73
- };
74
- };
75
- additionalProperties: boolean;
76
- };
77
- };
78
- };
79
- //# sourceMappingURL=geoparquet-metadata-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geoparquet-metadata-schema.d.ts","sourceRoot":"","sources":["../../../src/lib/geo/geoparquet-metadata-schema.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D3C,CAAC"}
@@ -1,76 +0,0 @@
1
- export const GEOPARQUET_METADATA_JSON_SCHEMA = {
2
- $schema: 'http://json-schema.org/draft-07/schema#',
3
- title: 'GeoParquet',
4
- description: 'Parquet metadata included in the geo field.',
5
- type: 'object',
6
- required: ['version', 'primary_column', 'columns'],
7
- properties: {
8
- version: {
9
- type: 'string',
10
- const: '1.0.0-beta.1'
11
- },
12
- primary_column: {
13
- type: 'string',
14
- minLength: 1
15
- },
16
- columns: {
17
- type: 'object',
18
- minProperties: 1,
19
- patternProperties: {
20
- '.+': {
21
- type: 'object',
22
- required: ['encoding', 'geometry_types'],
23
- properties: {
24
- encoding: {
25
- type: 'string',
26
- const: 'WKB'
27
- },
28
- geometry_types: {
29
- type: 'array',
30
- uniqueItems: true,
31
- items: {
32
- type: 'string',
33
- pattern: '^(GeometryCollection|(Multi)?(Point|LineString|Polygon))( Z)?$'
34
- }
35
- },
36
- crs: {
37
- oneOf: [{
38
- $ref: 'https://proj.org/schemas/v0.5/projjson.schema.json'
39
- }, {
40
- type: 'null'
41
- }]
42
- },
43
- edges: {
44
- type: 'string',
45
- enum: ['planar', 'spherical']
46
- },
47
- orientation: {
48
- type: 'string',
49
- const: 'counterclockwise'
50
- },
51
- bbox: {
52
- type: 'array',
53
- items: {
54
- type: 'number'
55
- },
56
- oneOf: [{
57
- description: '2D bbox consisting of (xmin, ymin, xmax, ymax)',
58
- minItems: 4,
59
- maxItems: 4
60
- }, {
61
- description: '3D bbox consisting of (xmin, ymin, zmin, xmax, ymax, zmax)',
62
- minItems: 6,
63
- maxItems: 6
64
- }]
65
- },
66
- epoch: {
67
- type: 'number'
68
- }
69
- }
70
- }
71
- },
72
- additionalProperties: false
73
- }
74
- }
75
- };
76
- //# sourceMappingURL=geoparquet-metadata-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geoparquet-metadata-schema.js","names":["GEOPARQUET_METADATA_JSON_SCHEMA","$schema","title","description","type","required","properties","version","const","primary_column","minLength","columns","minProperties","patternProperties","encoding","geometry_types","uniqueItems","items","pattern","crs","oneOf","$ref","edges","enum","orientation","bbox","minItems","maxItems","epoch","additionalProperties"],"sources":["../../../src/lib/geo/geoparquet-metadata-schema.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\n\n/**\n * Geoparquet JSON schema for geo metadata\n * @see https://github.com/geoarrow/geoarrow/blob/main/metadata.md\n * @see https://github.com/opengeospatial/geoparquet/blob/main/format-specs/geoparquet.md\n */\nexport const GEOPARQUET_METADATA_JSON_SCHEMA = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n title: 'GeoParquet',\n description: 'Parquet metadata included in the geo field.',\n type: 'object',\n required: ['version', 'primary_column', 'columns'],\n properties: {\n version: {type: 'string', const: '1.0.0-beta.1'},\n primary_column: {type: 'string', minLength: 1},\n columns: {\n type: 'object',\n minProperties: 1,\n patternProperties: {\n '.+': {\n type: 'object',\n required: ['encoding', 'geometry_types'],\n properties: {\n encoding: {type: 'string', const: 'WKB'},\n geometry_types: {\n type: 'array',\n uniqueItems: true,\n items: {\n type: 'string',\n pattern: '^(GeometryCollection|(Multi)?(Point|LineString|Polygon))( Z)?$'\n }\n },\n crs: {\n oneOf: [\n {\n $ref: 'https://proj.org/schemas/v0.5/projjson.schema.json'\n },\n {type: 'null'}\n ]\n },\n edges: {type: 'string', enum: ['planar', 'spherical']},\n orientation: {type: 'string', const: 'counterclockwise'},\n bbox: {\n type: 'array',\n items: {type: 'number'},\n oneOf: [\n {\n description: '2D bbox consisting of (xmin, ymin, xmax, ymax)',\n minItems: 4,\n maxItems: 4\n },\n {\n description: '3D bbox consisting of (xmin, ymin, zmin, xmax, ymax, zmax)',\n minItems: 6,\n maxItems: 6\n }\n ]\n },\n epoch: {type: 'number'}\n }\n }\n },\n additionalProperties: false\n }\n }\n};\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