@loaders.gl/json 4.0.0-alpha.9 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +132 -82
- package/dist/es5/geojson-loader.js +30 -21
- package/dist/es5/geojson-loader.js.map +1 -1
- package/dist/es5/geojson-writer.js.map +1 -1
- package/dist/es5/json-loader.js +2 -2
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/json-writer.js +1 -1
- package/dist/es5/json-writer.js.map +1 -1
- package/dist/es5/lib/encoder-utils/encode-table-row.js +54 -0
- package/dist/es5/lib/encoder-utils/encode-table-row.js.map +1 -0
- package/dist/es5/lib/encoder-utils/encode-utils.js.map +1 -0
- package/dist/es5/lib/encoder-utils/utf8-encoder.js.map +1 -0
- package/dist/es5/lib/encoders/geojson-encoder.js +47 -84
- package/dist/es5/lib/encoders/geojson-encoder.js.map +1 -1
- package/dist/es5/lib/encoders/json-encoder.js +3 -3
- package/dist/es5/lib/encoders/json-encoder.js.map +1 -1
- package/dist/es5/lib/parsers/parse-json-in-batches.js +1 -1
- package/dist/es5/lib/parsers/parse-json-in-batches.js.map +1 -1
- package/dist/es5/lib/parsers/parse-ndjson-in-batches.js.map +1 -1
- package/dist/es5/ndgeoson-loader.js +10 -13
- package/dist/es5/ndgeoson-loader.js.map +1 -1
- package/dist/es5/ndjson-loader.js +1 -1
- package/dist/es5/ndjson-loader.js.map +1 -1
- package/dist/esm/geojson-loader.js +31 -22
- package/dist/esm/geojson-loader.js.map +1 -1
- package/dist/esm/geojson-writer.js.map +1 -1
- package/dist/esm/json-loader.js +2 -2
- package/dist/esm/json-loader.js.map +1 -1
- package/dist/esm/json-writer.js +1 -1
- package/dist/esm/json-writer.js.map +1 -1
- package/dist/esm/lib/encoder-utils/encode-table-row.js +44 -0
- package/dist/esm/lib/encoder-utils/encode-table-row.js.map +1 -0
- package/dist/esm/lib/encoder-utils/encode-utils.js.map +1 -0
- package/dist/esm/lib/encoder-utils/utf8-encoder.js.map +1 -0
- package/dist/esm/lib/encoders/geojson-encoder.js +9 -52
- package/dist/esm/lib/encoders/geojson-encoder.js.map +1 -1
- package/dist/esm/lib/encoders/json-encoder.js +3 -3
- package/dist/esm/lib/encoders/json-encoder.js.map +1 -1
- package/dist/esm/lib/parsers/parse-json-in-batches.js +1 -1
- package/dist/esm/lib/parsers/parse-json-in-batches.js.map +1 -1
- package/dist/esm/lib/parsers/parse-ndjson-in-batches.js.map +1 -1
- package/dist/esm/ndgeoson-loader.js +9 -11
- package/dist/esm/ndgeoson-loader.js.map +1 -1
- package/dist/esm/ndjson-loader.js +1 -1
- package/dist/esm/ndjson-loader.js.map +1 -1
- package/dist/geojson-loader.d.ts +3 -2
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-worker.js +55 -209
- package/dist/geojson-writer.d.ts +8 -3
- package/dist/geojson-writer.d.ts.map +1 -1
- package/dist/json-loader.d.ts +1 -1
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/json-writer.d.ts +13 -3
- package/dist/json-writer.d.ts.map +1 -1
- package/dist/lib/encoder-utils/encode-table-row.d.ts +7 -0
- package/dist/lib/encoder-utils/encode-table-row.d.ts.map +1 -0
- package/dist/lib/encoder-utils/encode-utils.d.ts.map +1 -0
- package/dist/lib/encoder-utils/utf8-encoder.d.ts.map +1 -0
- package/dist/lib/encoders/geojson-encoder.d.ts +2 -8
- package/dist/lib/encoders/geojson-encoder.d.ts.map +1 -1
- package/dist/lib/encoders/json-encoder.d.ts +1 -10
- package/dist/lib/encoders/json-encoder.d.ts.map +1 -1
- package/dist/lib/parsers/parse-json-in-batches.d.ts.map +1 -1
- package/dist/lib/parsers/parse-ndjson-in-batches.d.ts +2 -2
- package/dist/lib/parsers/parse-ndjson-in-batches.d.ts.map +1 -1
- package/dist/ndgeoson-loader.d.ts +4 -24
- package/dist/ndgeoson-loader.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/geojson-loader.ts +42 -27
- package/src/geojson-writer.ts +8 -3
- package/src/json-loader.ts +2 -2
- package/src/json-writer.ts +12 -4
- package/src/lib/encoder-utils/encode-table-row.ts +69 -0
- package/src/lib/encoders/geojson-encoder.ts +15 -78
- package/src/lib/encoders/json-encoder.ts +3 -11
- package/src/lib/parsers/parse-json-in-batches.ts +2 -1
- package/src/lib/parsers/parse-ndjson-in-batches.ts +2 -2
- package/src/ndgeoson-loader.ts +16 -13
- package/dist/bundle.js +0 -5
- package/dist/es5/lib/encoders/encode-utils.js.map +0 -1
- package/dist/es5/lib/encoders/utf8-encoder.js.map +0 -1
- package/dist/esm/lib/encoders/encode-utils.js.map +0 -1
- package/dist/esm/lib/encoders/utf8-encoder.js.map +0 -1
- package/dist/geojson-loader.js +0 -77
- package/dist/geojson-writer.js +0 -22
- package/dist/index.js +0 -24
- package/dist/json-loader.js +0 -42
- package/dist/json-writer.js +0 -18
- package/dist/lib/clarinet/clarinet.js +0 -535
- package/dist/lib/encoders/encode-utils.d.ts.map +0 -1
- package/dist/lib/encoders/encode-utils.js +0 -47
- package/dist/lib/encoders/geojson-encoder.js +0 -104
- package/dist/lib/encoders/json-encoder.js +0 -22
- package/dist/lib/encoders/utf8-encoder.d.ts.map +0 -1
- package/dist/lib/encoders/utf8-encoder.js +0 -32
- package/dist/lib/json-parser/json-parser.js +0 -98
- package/dist/lib/json-parser/streaming-json-parser.js +0 -100
- package/dist/lib/jsonpath/jsonpath.js +0 -89
- package/dist/lib/parsers/parse-json-in-batches.js +0 -100
- package/dist/lib/parsers/parse-json.js +0 -32
- package/dist/lib/parsers/parse-ndjson-in-batches.js +0 -36
- package/dist/lib/parsers/parse-ndjson.js +0 -17
- package/dist/ndgeoson-loader.js +0 -37
- package/dist/ndjson-loader.js +0 -27
- package/dist/workers/geojson-worker.js +0 -5
- /package/dist/es5/lib/{encoders → encoder-utils}/encode-utils.js +0 -0
- /package/dist/es5/lib/{encoders → encoder-utils}/utf8-encoder.js +0 -0
- /package/dist/esm/lib/{encoders → encoder-utils}/encode-utils.js +0 -0
- /package/dist/esm/lib/{encoders → encoder-utils}/utf8-encoder.js +0 -0
- /package/dist/lib/{encoders → encoder-utils}/encode-utils.d.ts +0 -0
- /package/dist/lib/{encoders → encoder-utils}/utf8-encoder.d.ts +0 -0
- /package/src/lib/{encoders → encoder-utils}/encode-utils.ts +0 -0
- /package/src/lib/{encoders → encoder-utils}/utf8-encoder.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseNDJSONSync } from './lib/parsers/parse-ndjson';
|
|
2
2
|
import { parseNDJSONInBatches } from './lib/parsers/parse-ndjson-in-batches';
|
|
3
|
-
const VERSION = typeof "4.0.0-
|
|
3
|
+
const VERSION = typeof "4.0.0-beta.1" !== 'undefined' ? "4.0.0-beta.1" : 'latest';
|
|
4
4
|
export const NDJSONLoader = {
|
|
5
5
|
name: 'NDJSON',
|
|
6
6
|
id: 'ndjson',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndjson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options"],"sources":["../../src/ndjson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {ObjectRowTable, ArrayRowTable, TableBatch} from '@loaders.gl/schema';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport const NDJSONLoader: LoaderWithParser<\n ObjectRowTable | ArrayRowTable,\n TableBatch,\n LoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'jsonl'],\n mimeTypes: [\n 'application/x-ndjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/json-seq'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {}\n};\n"],"mappings":"AAIA,SAAQA,eAAe,QAAO,4BAA4B;AAC1D,SAAQC,oBAAoB,QAAO,uCAAuC;AAI1E,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"ndjson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options"],"sources":["../../src/ndjson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {ObjectRowTable, ArrayRowTable, TableBatch} from '@loaders.gl/schema';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport const NDJSONLoader: LoaderWithParser<\n ObjectRowTable | ArrayRowTable,\n TableBatch,\n LoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'jsonl'],\n mimeTypes: [\n 'application/x-ndjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/json-seq'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {}\n};\n"],"mappings":"AAIA,SAAQA,eAAe,QAAO,4BAA4B;AAC1D,SAAQC,oBAAoB,QAAO,uCAAuC;AAI1E,MAAMC,OAAO,GAAG,qBAAkB,KAAK,WAAW,oBAAiB,QAAQ;AAE3E,OAAO,MAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC/BC,SAAS,EAAE,CACT,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,MAAOC,WAAwB,IAAKb,eAAe,CAAC,IAAIc,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,CAAC;EACjGG,aAAa,EAAEhB,eAAe;EAC9BiB,cAAc,EAAEhB,oBAAoB;EACpCiB,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/geojson-loader.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Loader, LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { GeoJSON, TableBatch } from '@loaders.gl/schema';
|
|
2
3
|
import type { JSONLoaderOptions } from './json-loader';
|
|
3
4
|
export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
4
5
|
geojson?: {
|
|
@@ -11,6 +12,6 @@ export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
|
11
12
|
/**
|
|
12
13
|
* GeoJSON loader
|
|
13
14
|
*/
|
|
14
|
-
export declare const GeoJSONWorkerLoader: Loader
|
|
15
|
-
export declare const GeoJSONLoader: LoaderWithParser
|
|
15
|
+
export declare const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions>;
|
|
16
|
+
export declare const GeoJSONLoader: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions>;
|
|
16
17
|
//# sourceMappingURL=geojson-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAC,OAAO,EAAgB,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AASrD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAsBjF,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAOrF,CAAC"}
|
package/dist/geojson-worker.js
CHANGED
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
options,
|
|
126
126
|
context: {
|
|
127
127
|
...context,
|
|
128
|
-
|
|
128
|
+
_parse: parseOnMainThread
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
WorkerBody.postMessage("done", { result });
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
function parseOnMainThread(arrayBuffer, options) {
|
|
141
|
+
function parseOnMainThread(arrayBuffer, loader, options, context) {
|
|
142
142
|
return new Promise((resolve, reject) => {
|
|
143
143
|
const id = requestId++;
|
|
144
144
|
const onMessage = (type, payload2) => {
|
|
@@ -162,7 +162,12 @@
|
|
|
162
162
|
WorkerBody.postMessage("process", payload);
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
async function parseData({
|
|
165
|
+
async function parseData({
|
|
166
|
+
loader,
|
|
167
|
+
arrayBuffer,
|
|
168
|
+
options,
|
|
169
|
+
context
|
|
170
|
+
}) {
|
|
166
171
|
let data;
|
|
167
172
|
let parser;
|
|
168
173
|
if (loader.parseSync || loader.parse) {
|
|
@@ -687,7 +692,8 @@
|
|
|
687
692
|
...geometryInfo
|
|
688
693
|
}, {
|
|
689
694
|
numericPropKeys: options && options.numericPropKeys || numericPropKeys,
|
|
690
|
-
PositionDataType: options ? options.PositionDataType : Float32Array
|
|
695
|
+
PositionDataType: options ? options.PositionDataType : Float32Array,
|
|
696
|
+
triangulate: options ? options.triangulate : true
|
|
691
697
|
});
|
|
692
698
|
}
|
|
693
699
|
function extractNumericPropTypes(features) {
|
|
@@ -716,7 +722,7 @@
|
|
|
716
722
|
propArrayTypes,
|
|
717
723
|
coordLength
|
|
718
724
|
} = geometryInfo;
|
|
719
|
-
const { numericPropKeys = [], PositionDataType = Float32Array } = options;
|
|
725
|
+
const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;
|
|
720
726
|
const hasGlobalId = features[0] && "id" in features[0];
|
|
721
727
|
const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
|
|
722
728
|
const points = {
|
|
@@ -743,13 +749,15 @@
|
|
|
743
749
|
polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
|
|
744
750
|
primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
|
|
745
751
|
positions: new PositionDataType(polygonPositionsCount * coordLength),
|
|
746
|
-
triangles: [],
|
|
747
752
|
globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
|
|
748
753
|
featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
|
|
749
754
|
numericProps: {},
|
|
750
755
|
properties: [],
|
|
751
756
|
fields: []
|
|
752
757
|
};
|
|
758
|
+
if (triangulate) {
|
|
759
|
+
polygons.triangles = [];
|
|
760
|
+
}
|
|
753
761
|
for (const object of [points, lines, polygons]) {
|
|
754
762
|
for (const propName of numericPropKeys) {
|
|
755
763
|
const T = propArrayTypes[propName];
|
|
@@ -854,6 +862,9 @@
|
|
|
854
862
|
endPosition,
|
|
855
863
|
coordLength
|
|
856
864
|
}) {
|
|
865
|
+
if (!polygons.triangles) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
857
868
|
const start = startPosition * coordLength;
|
|
858
869
|
const end = endPosition * coordLength;
|
|
859
870
|
const polygonPositions = polygons.positions.subarray(start, end);
|
|
@@ -872,7 +883,7 @@
|
|
|
872
883
|
return returnObj;
|
|
873
884
|
}
|
|
874
885
|
function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
875
|
-
|
|
886
|
+
const binaryFeatures = {
|
|
876
887
|
points: {
|
|
877
888
|
...points,
|
|
878
889
|
positions: { value: points.positions, size: coordLength },
|
|
@@ -893,12 +904,15 @@
|
|
|
893
904
|
positions: { value: polygons.positions, size: coordLength },
|
|
894
905
|
polygonIndices: { value: polygons.polygonIndices, size: 1 },
|
|
895
906
|
primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
|
|
896
|
-
triangles: { value: new Uint32Array(polygons.triangles), size: 1 },
|
|
897
907
|
globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
|
|
898
908
|
featureIds: { value: polygons.featureIds, size: 1 },
|
|
899
909
|
numericProps: wrapProps(polygons.numericProps, 1)
|
|
900
910
|
}
|
|
901
911
|
};
|
|
912
|
+
if (binaryFeatures.polygons && polygons.triangles) {
|
|
913
|
+
binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
|
|
914
|
+
}
|
|
915
|
+
return binaryFeatures;
|
|
902
916
|
}
|
|
903
917
|
function fillNumericProperties(object, properties, index, length) {
|
|
904
918
|
for (const numericPropName in object.numericProps) {
|
|
@@ -1093,14 +1107,15 @@
|
|
|
1093
1107
|
}
|
|
1094
1108
|
|
|
1095
1109
|
// ../gis/src/lib/geojson-to-binary.ts
|
|
1096
|
-
function geojsonToBinary(features, options = { fixRingWinding: true }) {
|
|
1110
|
+
function geojsonToBinary(features, options = { fixRingWinding: true, triangulate: true }) {
|
|
1097
1111
|
const geometryInfo = extractGeometryInfo(features);
|
|
1098
1112
|
const coordLength = geometryInfo.coordLength;
|
|
1099
1113
|
const { fixRingWinding } = options;
|
|
1100
1114
|
const flatFeatures = geojsonToFlatGeojson(features, { coordLength, fixRingWinding });
|
|
1101
1115
|
return flatGeojsonToBinary(flatFeatures, geometryInfo, {
|
|
1102
1116
|
numericPropKeys: options.numericPropKeys,
|
|
1103
|
-
PositionDataType: options.PositionDataType || Float32Array
|
|
1117
|
+
PositionDataType: options.PositionDataType || Float32Array,
|
|
1118
|
+
triangulate: options.triangulate
|
|
1104
1119
|
});
|
|
1105
1120
|
}
|
|
1106
1121
|
|
|
@@ -1464,184 +1479,6 @@
|
|
|
1464
1479
|
}
|
|
1465
1480
|
};
|
|
1466
1481
|
|
|
1467
|
-
// ../schema/src/lib/table/simple-table/data-type.ts
|
|
1468
|
-
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
1469
|
-
if (value instanceof Date) {
|
|
1470
|
-
return "date-millisecond";
|
|
1471
|
-
}
|
|
1472
|
-
if (value instanceof Number) {
|
|
1473
|
-
return defaultNumberType;
|
|
1474
|
-
}
|
|
1475
|
-
if (typeof value === "string") {
|
|
1476
|
-
return "utf8";
|
|
1477
|
-
}
|
|
1478
|
-
if (value === null || value === "undefined") {
|
|
1479
|
-
return "null";
|
|
1480
|
-
}
|
|
1481
|
-
return "null";
|
|
1482
|
-
}
|
|
1483
|
-
function getDataTypeFromArray(array) {
|
|
1484
|
-
let type = getDataTypeFromTypedArray(array);
|
|
1485
|
-
if (type !== "null") {
|
|
1486
|
-
return { type, nullable: false };
|
|
1487
|
-
}
|
|
1488
|
-
if (array.length > 0) {
|
|
1489
|
-
type = getDataTypeFromValue(array[0]);
|
|
1490
|
-
return { type, nullable: true };
|
|
1491
|
-
}
|
|
1492
|
-
return { type: "null", nullable: true };
|
|
1493
|
-
}
|
|
1494
|
-
function getDataTypeFromTypedArray(array) {
|
|
1495
|
-
switch (array.constructor) {
|
|
1496
|
-
case Int8Array:
|
|
1497
|
-
return "int8";
|
|
1498
|
-
case Uint8Array:
|
|
1499
|
-
case Uint8ClampedArray:
|
|
1500
|
-
return "uint8";
|
|
1501
|
-
case Int16Array:
|
|
1502
|
-
return "int16";
|
|
1503
|
-
case Uint16Array:
|
|
1504
|
-
return "uint16";
|
|
1505
|
-
case Int32Array:
|
|
1506
|
-
return "int32";
|
|
1507
|
-
case Uint32Array:
|
|
1508
|
-
return "uint32";
|
|
1509
|
-
case Float32Array:
|
|
1510
|
-
return "float32";
|
|
1511
|
-
case Float64Array:
|
|
1512
|
-
return "float64";
|
|
1513
|
-
default:
|
|
1514
|
-
return "null";
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
// ../schema/src/lib/table/simple-table/table-schema.ts
|
|
1519
|
-
function deduceTableSchema(table) {
|
|
1520
|
-
switch (table.shape) {
|
|
1521
|
-
case "array-row-table":
|
|
1522
|
-
case "object-row-table":
|
|
1523
|
-
return deduceSchemaFromRows(table.data);
|
|
1524
|
-
case "columnar-table":
|
|
1525
|
-
return deduceSchemaFromColumns(table.data);
|
|
1526
|
-
case "arrow-table":
|
|
1527
|
-
default:
|
|
1528
|
-
throw new Error("Deduce schema");
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
function deduceSchemaFromColumns(columnarTable) {
|
|
1532
|
-
const fields = [];
|
|
1533
|
-
for (const [columnName, column] of Object.entries(columnarTable)) {
|
|
1534
|
-
const field = deduceFieldFromColumn(column, columnName);
|
|
1535
|
-
fields.push(field);
|
|
1536
|
-
}
|
|
1537
|
-
return { fields, metadata: {} };
|
|
1538
|
-
}
|
|
1539
|
-
function deduceSchemaFromRows(rowTable) {
|
|
1540
|
-
if (!rowTable.length) {
|
|
1541
|
-
throw new Error("deduce from empty table");
|
|
1542
|
-
}
|
|
1543
|
-
const fields = [];
|
|
1544
|
-
const row0 = rowTable[0];
|
|
1545
|
-
for (const [columnName, value] of Object.entries(row0)) {
|
|
1546
|
-
fields.push(deduceFieldFromValue(value, columnName));
|
|
1547
|
-
}
|
|
1548
|
-
return { fields, metadata: {} };
|
|
1549
|
-
}
|
|
1550
|
-
function deduceFieldFromColumn(column, name) {
|
|
1551
|
-
if (ArrayBuffer.isView(column)) {
|
|
1552
|
-
const type = getDataTypeFromArray(column);
|
|
1553
|
-
return {
|
|
1554
|
-
name,
|
|
1555
|
-
type: type.type || "null",
|
|
1556
|
-
nullable: type.nullable
|
|
1557
|
-
};
|
|
1558
|
-
}
|
|
1559
|
-
if (Array.isArray(column) && column.length > 0) {
|
|
1560
|
-
const value = column[0];
|
|
1561
|
-
const type = getDataTypeFromValue(value);
|
|
1562
|
-
return {
|
|
1563
|
-
name,
|
|
1564
|
-
type,
|
|
1565
|
-
nullable: true
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
|
-
throw new Error("empty table");
|
|
1569
|
-
}
|
|
1570
|
-
function deduceFieldFromValue(value, name) {
|
|
1571
|
-
const type = getDataTypeFromValue(value);
|
|
1572
|
-
return {
|
|
1573
|
-
name,
|
|
1574
|
-
type,
|
|
1575
|
-
nullable: true
|
|
1576
|
-
};
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
// ../schema/src/lib/table/simple-table/make-table.ts
|
|
1580
|
-
function makeTableFromData(data) {
|
|
1581
|
-
let table;
|
|
1582
|
-
switch (getTableShapeFromData(data)) {
|
|
1583
|
-
case "array-row-table":
|
|
1584
|
-
table = { shape: "array-row-table", data };
|
|
1585
|
-
break;
|
|
1586
|
-
case "object-row-table":
|
|
1587
|
-
table = { shape: "object-row-table", data };
|
|
1588
|
-
break;
|
|
1589
|
-
case "columnar-table":
|
|
1590
|
-
table = { shape: "columnar-table", data };
|
|
1591
|
-
break;
|
|
1592
|
-
default:
|
|
1593
|
-
throw new Error("table");
|
|
1594
|
-
}
|
|
1595
|
-
const schema = deduceTableSchema(table);
|
|
1596
|
-
return { ...table, schema };
|
|
1597
|
-
}
|
|
1598
|
-
function getTableShapeFromData(data) {
|
|
1599
|
-
if (Array.isArray(data)) {
|
|
1600
|
-
if (data.length === 0) {
|
|
1601
|
-
throw new Error("cannot deduce type of empty table");
|
|
1602
|
-
}
|
|
1603
|
-
const firstRow = data[0];
|
|
1604
|
-
if (Array.isArray(firstRow)) {
|
|
1605
|
-
return "array-row-table";
|
|
1606
|
-
}
|
|
1607
|
-
if (firstRow && typeof firstRow === "object") {
|
|
1608
|
-
return "object-row-table";
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
if (data && typeof data === "object") {
|
|
1612
|
-
return "columnar-table";
|
|
1613
|
-
}
|
|
1614
|
-
throw new Error("invalid table");
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
// src/lib/parsers/parse-json.ts
|
|
1618
|
-
function parseJSONSync(jsonText, options) {
|
|
1619
|
-
try {
|
|
1620
|
-
const json = JSON.parse(jsonText);
|
|
1621
|
-
if (options.json?.table) {
|
|
1622
|
-
const data = getFirstArray(json) || json;
|
|
1623
|
-
return makeTableFromData(data);
|
|
1624
|
-
}
|
|
1625
|
-
return json;
|
|
1626
|
-
} catch (error) {
|
|
1627
|
-
throw new Error("JSONLoader: failed to parse JSON");
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
function getFirstArray(json) {
|
|
1631
|
-
if (Array.isArray(json)) {
|
|
1632
|
-
return json;
|
|
1633
|
-
}
|
|
1634
|
-
if (json && typeof json === "object") {
|
|
1635
|
-
for (const value of Object.values(json)) {
|
|
1636
|
-
const array = getFirstArray(value);
|
|
1637
|
-
if (array) {
|
|
1638
|
-
return array;
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
return null;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
1482
|
// src/lib/clarinet/clarinet.ts
|
|
1646
1483
|
var MAX_BUFFER_LENGTH = Number.MAX_SAFE_INTEGER;
|
|
1647
1484
|
var STATE;
|
|
@@ -2361,7 +2198,7 @@ Char: ${this.c}`;
|
|
|
2361
2198
|
const { jsonpaths } = options.json || {};
|
|
2362
2199
|
let isFirstChunk = true;
|
|
2363
2200
|
const schema = null;
|
|
2364
|
-
const shape = options?.json?.shape || "row-table";
|
|
2201
|
+
const shape = options?.json?.shape || "object-row-table";
|
|
2365
2202
|
const tableBatchBuilder = new TableBatchBuilder(schema, {
|
|
2366
2203
|
...options,
|
|
2367
2204
|
shape
|
|
@@ -2417,18 +2254,7 @@ Char: ${this.c}`;
|
|
|
2417
2254
|
}
|
|
2418
2255
|
|
|
2419
2256
|
// src/geojson-loader.ts
|
|
2420
|
-
var VERSION = true ? "4.0.0-
|
|
2421
|
-
var DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
2422
|
-
geojson: {
|
|
2423
|
-
shape: "object-row-table"
|
|
2424
|
-
},
|
|
2425
|
-
json: {
|
|
2426
|
-
jsonpaths: ["$", "$.features"]
|
|
2427
|
-
},
|
|
2428
|
-
gis: {
|
|
2429
|
-
format: "geojson"
|
|
2430
|
-
}
|
|
2431
|
-
};
|
|
2257
|
+
var VERSION = true ? "4.0.0-beta.1" : "latest";
|
|
2432
2258
|
var GeoJSONWorkerLoader = {
|
|
2433
2259
|
name: "GeoJSON",
|
|
2434
2260
|
id: "geojson",
|
|
@@ -2439,7 +2265,18 @@ Char: ${this.c}`;
|
|
|
2439
2265
|
mimeTypes: ["application/geo+json"],
|
|
2440
2266
|
category: "geometry",
|
|
2441
2267
|
text: true,
|
|
2442
|
-
options:
|
|
2268
|
+
options: {
|
|
2269
|
+
geojson: {
|
|
2270
|
+
shape: "object-row-table"
|
|
2271
|
+
},
|
|
2272
|
+
json: {
|
|
2273
|
+
shape: "object-row-table",
|
|
2274
|
+
jsonpaths: ["$", "$.features"]
|
|
2275
|
+
},
|
|
2276
|
+
gis: {
|
|
2277
|
+
format: "geojson"
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2443
2280
|
};
|
|
2444
2281
|
var GeoJSONLoader = {
|
|
2445
2282
|
...GeoJSONWorkerLoader,
|
|
@@ -2451,21 +2288,30 @@ Char: ${this.c}`;
|
|
|
2451
2288
|
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
|
2452
2289
|
}
|
|
2453
2290
|
function parseTextSync(text, options) {
|
|
2454
|
-
options = { ...
|
|
2455
|
-
options.
|
|
2291
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
2292
|
+
options.geojson = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
2456
2293
|
options.gis = options.gis || {};
|
|
2457
|
-
|
|
2458
|
-
|
|
2294
|
+
let geojson;
|
|
2295
|
+
try {
|
|
2296
|
+
geojson = JSON.parse(text);
|
|
2297
|
+
} catch {
|
|
2298
|
+
geojson = {};
|
|
2299
|
+
}
|
|
2300
|
+
const table = {
|
|
2301
|
+
shape: "geojson-table",
|
|
2302
|
+
type: "FeatureCollection",
|
|
2303
|
+
features: geojson?.features || []
|
|
2304
|
+
};
|
|
2459
2305
|
switch (options.gis.format) {
|
|
2460
2306
|
case "binary":
|
|
2461
|
-
return geojsonToBinary(table.
|
|
2307
|
+
return geojsonToBinary(table.features);
|
|
2462
2308
|
default:
|
|
2463
2309
|
return table;
|
|
2464
2310
|
}
|
|
2465
2311
|
}
|
|
2466
2312
|
function parseInBatches(asyncIterator, options) {
|
|
2467
|
-
options = { ...
|
|
2468
|
-
options.json = { ...
|
|
2313
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
2314
|
+
options.json = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
2469
2315
|
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
2470
2316
|
switch (options.gis.format) {
|
|
2471
2317
|
case "binary":
|
package/dist/geojson-writer.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { Writer } from '@loaders.gl/loader-utils';
|
|
1
|
+
import type { Writer, WriterOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { Table, TableBatch } from '@loaders.gl/schema';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export type GeoJSONWriterOptions = WriterOptions & {
|
|
4
|
+
geojson?: {
|
|
5
|
+
featureArray?: boolean;
|
|
6
|
+
geometryColumn?: number | null;
|
|
7
|
+
};
|
|
8
|
+
chunkSize?: number;
|
|
9
|
+
};
|
|
5
10
|
export declare const GeoJSONWriter: Writer<Table, TableBatch, GeoJSONWriterOptions>;
|
|
6
11
|
//# sourceMappingURL=geojson-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-writer.d.ts","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"geojson-writer.d.ts","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG1D,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,oBAAoB,CAgBzE,CAAC"}
|
package/dist/json-loader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Table, TableBatch } from '@loaders.gl/schema';
|
|
2
2
|
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
3
3
|
type ParseJSONOptions = {
|
|
4
|
-
shape
|
|
4
|
+
shape: 'object-row-table';
|
|
5
5
|
table?: boolean;
|
|
6
6
|
jsonpaths?: string[];
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-loader.d.ts","sourceRoot":"","sources":["../src/json-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAQ9E,KAAK,gBAAgB,GAAG;IACtB,KAAK,
|
|
1
|
+
{"version":3,"file":"json-loader.d.ts","sourceRoot":"","sources":["../src/json-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAQ9E,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAWF,eAAO,MAAM,UAAU,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,iBAAiB,CAa7E,CAAC"}
|
package/dist/json-writer.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import type { Writer } from '@loaders.gl/loader-utils';
|
|
1
|
+
import type { Writer, WriterOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { Table, TableBatch } from '@loaders.gl/schema';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export type JSONWriterOptions = WriterOptions & {
|
|
4
|
+
json?: {
|
|
5
|
+
shape?: 'object-row-table' | 'array-row-table';
|
|
6
|
+
wrapper?: (table: TableJSON) => unknown;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type RowArray = unknown[];
|
|
10
|
+
type RowObject = {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
type TableJSON = RowArray[] | RowObject[];
|
|
5
14
|
export declare const JSONWriter: Writer<Table, TableBatch, JSONWriterOptions>;
|
|
15
|
+
export {};
|
|
6
16
|
//# sourceMappingURL=json-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-writer.d.ts","sourceRoot":"","sources":["../src/json-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"json-writer.d.ts","sourceRoot":"","sources":["../src/json-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG1D,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,kBAAkB,GAAG,iBAAiB,CAAC;QAC/C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;KACzC,CAAC;CACH,CAAC;AAEF,KAAK,QAAQ,GAAG,OAAO,EAAE,CAAC;AAC1B,KAAK,SAAS,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC;AAC1C,KAAK,SAAS,GAAG,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,iBAAiB,CAYnE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Table } from '@loaders.gl/schema';
|
|
2
|
+
import { Utf8ArrayBufferEncoder } from './utf8-encoder';
|
|
3
|
+
/**
|
|
4
|
+
* Encode a row. Currently this ignores properties in the geometry column.
|
|
5
|
+
*/
|
|
6
|
+
export declare function encodeTableRow(table: Table, rowIndex: number, geometryColumnIndex: number, utf8Encoder: Utf8ArrayBufferEncoder): void;
|
|
7
|
+
//# sourceMappingURL=encode-table-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode-table-row.d.ts","sourceRoot":"","sources":["../../../src/lib/encoder-utils/encode-table-row.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,EAAsB,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AAMtD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,sBAAsB,GAClC,IAAI,CAMN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/encoder-utils/encode-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAsD,MAAM,oBAAoB,CAAC;AAE9F,KAAK,GAAG,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAsB9D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,oBAAoB,GAAE,MAAM,EAAO,GAClC;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CASjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8-encoder.d.ts","sourceRoot":"","sources":["../../../src/lib/encoder-utils/utf8-encoder.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAkC;gBAEzC,SAAS,EAAE,MAAM;IAI7B,IAAI,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAOhC,MAAM,IAAI,OAAO;IAIjB,mBAAmB,IAAI,eAAe;IAItC,cAAc,IAAI,MAAM;CAMzB"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { TableBatch } from '@loaders.gl/schema';
|
|
2
|
-
|
|
3
|
-
geojson?: {
|
|
4
|
-
featureArray?: boolean;
|
|
5
|
-
geometryColumn?: number | null;
|
|
6
|
-
};
|
|
7
|
-
chunkSize?: number;
|
|
8
|
-
};
|
|
1
|
+
import type { TableBatch } from '@loaders.gl/schema';
|
|
2
|
+
import type { GeoJSONWriterOptions } from '../../geojson-writer';
|
|
9
3
|
/**
|
|
10
4
|
* Encode a table as GeoJSON
|
|
11
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-encoder.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/geojson-encoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geojson-encoder.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/geojson-encoder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAKnD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAE/D;;GAEG;AAEH,wBAAuB,6BAA6B,CAClD,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,0BAA0B;AACpE,SAAS,GAAE,oBAAyB,GACnC,aAAa,CAAC,WAAW,CAAC,CA0D5B"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { Table } from '@loaders.gl/schema';
|
|
2
|
-
type
|
|
3
|
-
type RowObject = {
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
};
|
|
6
|
-
type TableJSON = RowArray[] | RowObject[];
|
|
7
|
-
export type JSONWriterOptions = {
|
|
8
|
-
shape?: 'object-row-table' | 'array-row-table';
|
|
9
|
-
wrapper?: (table: TableJSON) => unknown;
|
|
10
|
-
};
|
|
2
|
+
import type { JSONWriterOptions } from '../../json-writer';
|
|
11
3
|
/**
|
|
12
4
|
* Encode a table as a JSON string
|
|
13
5
|
*/
|
|
14
6
|
export declare function encodeTableAsJSON(table: Table, options?: JSONWriterOptions): string;
|
|
15
|
-
export {};
|
|
16
7
|
//# sourceMappingURL=json-encoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-encoder.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/json-encoder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAkB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"json-encoder.d.ts","sourceRoot":"","sources":["../../../src/lib/encoders/json-encoder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAkB,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAYnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-json-in-batches.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-json-in-batches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAQzD,wBAAuB,kBAAkB,CACvC,mBAAmB,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EACvE,OAAO,EAAE,iBAAiB,GACzB,aAAa,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"parse-json-in-batches.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-json-in-batches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAQzD,wBAAuB,kBAAkB,CACvC,mBAAmB,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EACvE,OAAO,EAAE,iBAAiB,GACzB,aAAa,CAAC,UAAU,CAAC,CAgF3B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,OAmB5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TableBatch } from '@loaders.gl/schema';
|
|
2
2
|
import { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
3
|
-
export declare function parseNDJSONInBatches(binaryAsyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>, options?: LoaderOptions): AsyncIterable<
|
|
3
|
+
export declare function parseNDJSONInBatches(binaryAsyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>, options?: LoaderOptions): AsyncIterable<TableBatch>;
|
|
4
4
|
//# sourceMappingURL=parse-ndjson-in-batches.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-ndjson-in-batches.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-ndjson-in-batches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"parse-ndjson-in-batches.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-ndjson-in-batches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,aAAa,EAId,MAAM,0BAA0B,CAAC;AAElC,wBAAuB,oBAAoB,CACzC,mBAAmB,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,EACvE,OAAO,CAAC,EAAE,aAAa,GACtB,aAAa,CAAC,UAAU,CAAC,CA+B3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ArrayRowTable, ObjectRowTable, Batch } from '@loaders.gl/schema';
|
|
3
|
+
/** Options for NDGeoJSONLoader */
|
|
4
4
|
export type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
5
5
|
geojson?: {
|
|
6
6
|
shape?: 'object-row-table';
|
|
@@ -9,26 +9,6 @@ export type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
|
9
9
|
format: 'geojson';
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
id: string;
|
|
15
|
-
module: string;
|
|
16
|
-
version: any;
|
|
17
|
-
extensions: string[];
|
|
18
|
-
mimeTypes: string[];
|
|
19
|
-
category: string;
|
|
20
|
-
text: boolean;
|
|
21
|
-
parse: (arrayBuffer: ArrayBuffer) => Promise<import("@loaders.gl/schema").ArrayRowTable | import("@loaders.gl/schema").ObjectRowTable>;
|
|
22
|
-
parseTextSync: typeof parseNDJSONSync;
|
|
23
|
-
parseInBatches: typeof parseNDJSONInBatches;
|
|
24
|
-
options: {
|
|
25
|
-
geojson: {
|
|
26
|
-
shape: string;
|
|
27
|
-
};
|
|
28
|
-
gis: {
|
|
29
|
-
format: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare const _typecheckNDJSONLoader: LoaderWithParser;
|
|
12
|
+
/** NDGeoJSONLoader */
|
|
13
|
+
export declare const NDJSONLoader: LoaderWithParser<ArrayRowTable | ObjectRowTable, Batch, NDGeoJSONLoaderOptions>;
|
|
34
14
|
//# sourceMappingURL=ndgeoson-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndgeoson-loader.d.ts","sourceRoot":"","sources":["../src/ndgeoson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ndgeoson-loader.d.ts","sourceRoot":"","sources":["../src/ndgeoson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAG9E,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAMxE,kCAAkC;AAClC,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,EAAE,SAAS,CAAC;KACnB,CAAC;CACH,CAAC;AAEF,sBAAsB;AACtB,eAAO,MAAM,YAAY,EAAE,gBAAgB,CACzC,aAAa,GAAG,cAAc,EAC9B,KAAK,EACL,sBAAsB,CA2BvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/json",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@loaders.gl/gis": "4.0.0-
|
|
39
|
-
"@loaders.gl/loader-utils": "4.0.0-
|
|
40
|
-
"@loaders.gl/schema": "4.0.0-
|
|
38
|
+
"@loaders.gl/gis": "4.0.0-beta.1",
|
|
39
|
+
"@loaders.gl/loader-utils": "4.0.0-beta.1",
|
|
40
|
+
"@loaders.gl/schema": "4.0.0-beta.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "35c625e67132b0784e597d9ddabae8aefea29ff2"
|
|
43
43
|
}
|