@loaders.gl/json 4.0.0-alpha.20 → 4.0.0-alpha.21
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 +16 -17
- package/dist/es5/geojson-loader.js +16 -17
- package/dist/es5/geojson-loader.js.map +1 -1
- package/dist/es5/json-loader.js +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/esm/geojson-loader.js +17 -18
- package/dist/esm/geojson-loader.js.map +1 -1
- package/dist/esm/json-loader.js +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/geojson-loader.d.ts +3 -2
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-loader.js +17 -16
- package/dist/geojson-worker.js +16 -17
- package/dist/ndgeoson-loader.d.ts +4 -24
- package/dist/ndgeoson-loader.d.ts.map +1 -1
- package/dist/ndgeoson-loader.js +10 -11
- package/package.json +5 -5
- package/src/geojson-loader.ts +23 -23
- package/src/ndgeoson-loader.ts +16 -13
package/dist/dist.min.js
CHANGED
|
@@ -2831,8 +2831,8 @@ Char: ${this.c}`;
|
|
|
2831
2831
|
return parseTextSync2(new TextDecoder().decode(arrayBuffer), options);
|
|
2832
2832
|
}
|
|
2833
2833
|
function parseTextSync2(text, options) {
|
|
2834
|
-
options = { ...
|
|
2835
|
-
options.
|
|
2834
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
2835
|
+
options.geojson = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
2836
2836
|
options.gis = options.gis || {};
|
|
2837
2837
|
const table = parseJSONSync(text, options);
|
|
2838
2838
|
table.shape = "geojson-row-table";
|
|
@@ -2844,8 +2844,8 @@ Char: ${this.c}`;
|
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
2846
|
function parseInBatches2(asyncIterator, options) {
|
|
2847
|
-
options = { ...
|
|
2848
|
-
options.json = { ...
|
|
2847
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
2848
|
+
options.json = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
2849
2849
|
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
2850
2850
|
switch (options.gis.format) {
|
|
2851
2851
|
case "binary":
|
|
@@ -2860,24 +2860,13 @@ Char: ${this.c}`;
|
|
|
2860
2860
|
yield batch;
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
var VERSION3,
|
|
2863
|
+
var VERSION3, GeoJSONWorkerLoader, GeoJSONLoader;
|
|
2864
2864
|
var init_geojson_loader = __esm({
|
|
2865
2865
|
"src/geojson-loader.ts"() {
|
|
2866
2866
|
init_src3();
|
|
2867
2867
|
init_parse_json();
|
|
2868
2868
|
init_parse_json_in_batches();
|
|
2869
2869
|
VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
2870
|
-
DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
2871
|
-
geojson: {
|
|
2872
|
-
shape: "object-row-table"
|
|
2873
|
-
},
|
|
2874
|
-
json: {
|
|
2875
|
-
jsonpaths: ["$", "$.features"]
|
|
2876
|
-
},
|
|
2877
|
-
gis: {
|
|
2878
|
-
format: "geojson"
|
|
2879
|
-
}
|
|
2880
|
-
};
|
|
2881
2870
|
GeoJSONWorkerLoader = {
|
|
2882
2871
|
name: "GeoJSON",
|
|
2883
2872
|
id: "geojson",
|
|
@@ -2888,7 +2877,17 @@ Char: ${this.c}`;
|
|
|
2888
2877
|
mimeTypes: ["application/geo+json"],
|
|
2889
2878
|
category: "geometry",
|
|
2890
2879
|
text: true,
|
|
2891
|
-
options:
|
|
2880
|
+
options: {
|
|
2881
|
+
geojson: {
|
|
2882
|
+
shape: "object-row-table"
|
|
2883
|
+
},
|
|
2884
|
+
json: {
|
|
2885
|
+
jsonpaths: ["$", "$.features"]
|
|
2886
|
+
},
|
|
2887
|
+
gis: {
|
|
2888
|
+
format: "geojson"
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2892
2891
|
};
|
|
2893
2892
|
GeoJSONLoader = {
|
|
2894
2893
|
...GeoJSONWorkerLoader,
|
|
@@ -17,18 +17,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
17
|
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; }
|
|
18
18
|
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
19
19
|
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function _throw(value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
20
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
21
|
-
var DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
22
|
-
geojson: {
|
|
23
|
-
shape: 'object-row-table'
|
|
24
|
-
},
|
|
25
|
-
json: {
|
|
26
|
-
jsonpaths: ['$', '$.features']
|
|
27
|
-
},
|
|
28
|
-
gis: {
|
|
29
|
-
format: 'geojson'
|
|
30
|
-
}
|
|
31
|
-
};
|
|
20
|
+
var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
32
21
|
var GeoJSONWorkerLoader = {
|
|
33
22
|
name: 'GeoJSON',
|
|
34
23
|
id: 'geojson',
|
|
@@ -39,7 +28,17 @@ var GeoJSONWorkerLoader = {
|
|
|
39
28
|
mimeTypes: ['application/geo+json'],
|
|
40
29
|
category: 'geometry',
|
|
41
30
|
text: true,
|
|
42
|
-
options:
|
|
31
|
+
options: {
|
|
32
|
+
geojson: {
|
|
33
|
+
shape: 'object-row-table'
|
|
34
|
+
},
|
|
35
|
+
json: {
|
|
36
|
+
jsonpaths: ['$', '$.features']
|
|
37
|
+
},
|
|
38
|
+
gis: {
|
|
39
|
+
format: 'geojson'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
43
42
|
};
|
|
44
43
|
exports.GeoJSONWorkerLoader = GeoJSONWorkerLoader;
|
|
45
44
|
var GeoJSONLoader = _objectSpread(_objectSpread({}, GeoJSONWorkerLoader), {}, {
|
|
@@ -66,8 +65,8 @@ function _parse() {
|
|
|
66
65
|
return _parse.apply(this, arguments);
|
|
67
66
|
}
|
|
68
67
|
function parseTextSync(text, options) {
|
|
69
|
-
options = _objectSpread(_objectSpread({},
|
|
70
|
-
options.
|
|
68
|
+
options = _objectSpread(_objectSpread({}, GeoJSONLoader.options), options);
|
|
69
|
+
options.geojson = _objectSpread(_objectSpread({}, GeoJSONLoader.options.geojson), options.geojson);
|
|
71
70
|
options.gis = options.gis || {};
|
|
72
71
|
var table = (0, _parseJson.parseJSONSync)(text, options);
|
|
73
72
|
table.shape = 'geojson-row-table';
|
|
@@ -79,8 +78,8 @@ function parseTextSync(text, options) {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
function parseInBatches(asyncIterator, options) {
|
|
82
|
-
options = _objectSpread(_objectSpread({},
|
|
83
|
-
options.json = _objectSpread(_objectSpread({},
|
|
81
|
+
options = _objectSpread(_objectSpread({}, GeoJSONLoader.options), options);
|
|
82
|
+
options.json = _objectSpread(_objectSpread({}, GeoJSONLoader.options.geojson), options.geojson);
|
|
84
83
|
var geojsonIterator = (0, _parseJsonInBatches.parseJSONInBatches)(asyncIterator, options);
|
|
85
84
|
switch (options.gis.format) {
|
|
86
85
|
case 'binary':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.js","names":["_gis","require","_parseJson","_parseJsonInBatches","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","_asyncIterator","iterable","method","async","sync","retry","Symbol","asyncIterator","iterator","call","AsyncFromSyncIterator","TypeError","s","AsyncFromSyncIteratorContinuation","r","Promise","reject","done","resolve","value","then","n","next","prototype","return","_return","ret","throw","_throw","thr","VERSION","DEFAULT_GEOJSON_LOADER_OPTIONS","geojson","shape","json","jsonpaths","gis","format","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","exports","GeoJSONLoader","parse","parseTextSync","parseInBatches","_x2","_x3","_parse","_asyncToGenerator2","_regenerator","mark","_callee2","arrayBuffer","wrap","_callee2$","_context2","prev","abrupt","TextDecoder","decode","stop","table","parseJSONSync","geojsonToBinary","data","geojsonIterator","parseJSONInBatches","makeBinaryGeometryIterator","_x","_makeBinaryGeometryIterator","_wrapAsyncGenerator2","_callee","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","batch","_callee$","_context","_awaitAsyncGenerator2","sent","t0","finish"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\nimport {GeoJSONRowTable} from '@loaders.gl/schema';\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 type GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\nconst DEFAULT_GEOJSON_LOADER_OPTIONS = {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: DEFAULT_GEOJSON_LOADER_OPTIONS\n};\n\nexport const GeoJSONLoader: LoaderWithParser = {\n ...GeoJSONWorkerLoader,\n parse,\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer, options) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text, options) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n options.gis = options.gis || {};\n const table = parseJSONSync(text, options) as GeoJSONRowTable;\n table.shape = 'geojson-row-table';\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.data);\n default:\n return table;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<any> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAIA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAAuE,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA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AAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"geojson-loader.js","names":["_gis","require","_parseJson","_parseJsonInBatches","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","_asyncIterator","iterable","method","async","sync","retry","Symbol","asyncIterator","iterator","call","AsyncFromSyncIterator","TypeError","s","AsyncFromSyncIteratorContinuation","r","Promise","reject","done","resolve","value","then","n","next","prototype","return","_return","ret","throw","_throw","thr","VERSION","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","geojson","shape","json","jsonpaths","gis","format","exports","GeoJSONLoader","parse","parseTextSync","parseInBatches","_x2","_x3","_parse","_asyncToGenerator2","_regenerator","mark","_callee2","arrayBuffer","wrap","_callee2$","_context2","prev","abrupt","TextDecoder","decode","stop","table","parseJSONSync","geojsonToBinary","data","geojsonIterator","parseJSONInBatches","makeBinaryGeometryIterator","_x","_makeBinaryGeometryIterator","_wrapAsyncGenerator2","_callee","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","batch","_callee$","_context","_awaitAsyncGenerator2","sent","t0","finish"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {GeoJSON, GeoJSONRowTable, TableBatch} from '@loaders.gl/schema';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-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 type GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n\nexport const GeoJSONLoader: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n ...GeoJSONWorkerLoader,\n // @ts-expect-error\n parse,\n // @ts-expect-error\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: GeoJSONLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.geojson = {...GeoJSONLoader.options.geojson, ...options.geojson};\n options.gis = options.gis || {};\n const table = parseJSONSync(text, options) as GeoJSONRowTable;\n table.shape = 'geojson-row-table';\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.data);\n default:\n return table;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<TableBatch> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.json = {...GeoJSONLoader.options.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}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;UAAAiE,QAAA,CAAAvB,IAAA;UAAAuB,QAAA,CAAAG,EAAA,GAAAH,QAAA;UAAAN,iBAAA;UAAAC,cAAA,GAAAK,QAAA,CAAAG,EAAA;QAAA;UAAAH,QAAA,CAAAvB,IAAA;UAAAuB,QAAA,CAAAvB,IAAA;UAAA,MAAAgB,yBAAA,IAAAG,SAAA,CAAA3D,MAAA;YAAA+D,QAAA,CAAAjE,IAAA;YAAA;UAAA;UAAAiE,QAAA,CAAAjE,IAAA;UAAA,WAAAkE,qBAAA,CAAA5F,OAAA,EAAAuF,SAAA,CAAA3D,MAAA;QAAA;UAAA+D,QAAA,CAAAvB,IAAA;UAAA,KAAAiB,iBAAA;YAAAM,QAAA,CAAAjE,IAAA;YAAA;UAAA;UAAA,MAAA4D,cAAA;QAAA;UAAA,OAAAK,QAAA,CAAAI,MAAA;QAAA;UAAA,OAAAJ,QAAA,CAAAI,MAAA;QAAA;QAAA;UAAA,OAAAJ,QAAA,CAAAnB,IAAA;MAAA;IAAA,GAAAW,OAAA;EAAA,CAEd;EAAA,OAAAF,2BAAA,CAAA3F,KAAA,OAAAI,SAAA;AAAA"}
|
package/dist/es5/json-loader.js
CHANGED
|
@@ -12,7 +12,7 @@ var _parseJson = require("./lib/parsers/parse-json");
|
|
|
12
12
|
var _parseJsonInBatches = require("./lib/parsers/parse-json-in-batches");
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
15
|
+
var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
16
16
|
var DEFAULT_JSON_LOADER_OPTIONS = {
|
|
17
17
|
json: {
|
|
18
18
|
shape: 'row-table',
|
|
@@ -4,20 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.NDJSONLoader = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseNdjson = require("./lib/parsers/parse-ndjson");
|
|
11
11
|
var _parseNdjsonInBatches = require("./lib/parsers/parse-ndjson-in-batches");
|
|
12
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
13
|
-
var DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
|
|
14
|
-
geojson: {
|
|
15
|
-
shape: 'object-row-table'
|
|
16
|
-
},
|
|
17
|
-
gis: {
|
|
18
|
-
format: 'geojson'
|
|
19
|
-
}
|
|
20
|
-
};
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
21
13
|
var NDJSONLoader = {
|
|
22
14
|
name: 'NDJSON',
|
|
23
15
|
id: 'ndjson',
|
|
@@ -46,9 +38,14 @@ var NDJSONLoader = {
|
|
|
46
38
|
}(),
|
|
47
39
|
parseTextSync: _parseNdjson.parseNDJSONSync,
|
|
48
40
|
parseInBatches: _parseNdjsonInBatches.parseNDJSONInBatches,
|
|
49
|
-
options:
|
|
41
|
+
options: {
|
|
42
|
+
geojson: {
|
|
43
|
+
shape: 'object-row-table'
|
|
44
|
+
},
|
|
45
|
+
gis: {
|
|
46
|
+
format: 'geojson'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
50
49
|
};
|
|
51
50
|
exports.NDJSONLoader = NDJSONLoader;
|
|
52
|
-
var _typecheckNDJSONLoader = NDJSONLoader;
|
|
53
|
-
exports._typecheckNDJSONLoader = _typecheckNDJSONLoader;
|
|
54
51
|
//# sourceMappingURL=ndgeoson-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndgeoson-loader.js","names":["_parseNdjson","require","_parseNdjsonInBatches","VERSION","
|
|
1
|
+
{"version":3,"file":"ndgeoson-loader.js","names":["_parseNdjson","require","_parseNdjsonInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","parseNDJSONSync","TextDecoder","decode","stop","_x","apply","arguments","parseTextSync","parseInBatches","parseNDJSONInBatches","options","geojson","shape","gis","format","exports"],"sources":["../../src/ndgeoson-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\nimport {ArrayRowTable, ObjectRowTable, Batch} from '@loaders.gl/schema';\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\n/** Options for NDGeoJSONLoader */\nexport type NDGeoJSONLoaderOptions = LoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\n/** NDGeoJSONLoader */\nexport const NDJSONLoader: LoaderWithParser<\n ArrayRowTable | ObjectRowTable,\n Batch,\n NDGeoJSONLoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'ndgeojson'],\n mimeTypes: [\n 'application/geo+x-ndjson',\n 'application/geo+x-ldjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/geo+json-seq',\n 'application/x-ndjson'\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 geojson: {\n shape: 'object-row-table'\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n"],"mappings":";;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAKA,IAAME,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAapE,IAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;EACnCC,SAAS,EAAE,CACT,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAwB;MAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WAAK,IAAAC,4BAAe,EAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACT,WAAW,CAAC,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAX,OAAA;IAAA;IAAA,SAAAN,MAAAkB,EAAA;MAAA,OAAAjB,MAAA,CAAAkB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAApB,KAAA;EAAA;EACjGqB,aAAa,EAAEP,4BAAe;EAC9BQ,cAAc,EAAEC,0CAAoB;EACpCC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,KAAK,EAAE;IACT,CAAC;IACDC,GAAG,EAAE;MACHC,MAAM,EAAE;IACV;EACF;AACF,CAAC;AAACC,OAAA,CAAAtC,YAAA,GAAAA,YAAA"}
|
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseNdjson = require("./lib/parsers/parse-ndjson");
|
|
11
11
|
var _parseNdjsonInBatches = require("./lib/parsers/parse-ndjson-in-batches");
|
|
12
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
13
13
|
var NDJSONLoader = {
|
|
14
14
|
name: 'NDJSON',
|
|
15
15
|
id: 'ndjson',
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import { parseJSONSync } from './lib/parsers/parse-json';
|
|
3
3
|
import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
|
|
4
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
5
|
-
const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
6
|
-
geojson: {
|
|
7
|
-
shape: 'object-row-table'
|
|
8
|
-
},
|
|
9
|
-
json: {
|
|
10
|
-
jsonpaths: ['$', '$.features']
|
|
11
|
-
},
|
|
12
|
-
gis: {
|
|
13
|
-
format: 'geojson'
|
|
14
|
-
}
|
|
15
|
-
};
|
|
4
|
+
const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
16
5
|
export const GeoJSONWorkerLoader = {
|
|
17
6
|
name: 'GeoJSON',
|
|
18
7
|
id: 'geojson',
|
|
@@ -23,7 +12,17 @@ export const GeoJSONWorkerLoader = {
|
|
|
23
12
|
mimeTypes: ['application/geo+json'],
|
|
24
13
|
category: 'geometry',
|
|
25
14
|
text: true,
|
|
26
|
-
options:
|
|
15
|
+
options: {
|
|
16
|
+
geojson: {
|
|
17
|
+
shape: 'object-row-table'
|
|
18
|
+
},
|
|
19
|
+
json: {
|
|
20
|
+
jsonpaths: ['$', '$.features']
|
|
21
|
+
},
|
|
22
|
+
gis: {
|
|
23
|
+
format: 'geojson'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
27
26
|
};
|
|
28
27
|
export const GeoJSONLoader = {
|
|
29
28
|
...GeoJSONWorkerLoader,
|
|
@@ -36,11 +35,11 @@ async function parse(arrayBuffer, options) {
|
|
|
36
35
|
}
|
|
37
36
|
function parseTextSync(text, options) {
|
|
38
37
|
options = {
|
|
39
|
-
...
|
|
38
|
+
...GeoJSONLoader.options,
|
|
40
39
|
...options
|
|
41
40
|
};
|
|
42
|
-
options.
|
|
43
|
-
...
|
|
41
|
+
options.geojson = {
|
|
42
|
+
...GeoJSONLoader.options.geojson,
|
|
44
43
|
...options.geojson
|
|
45
44
|
};
|
|
46
45
|
options.gis = options.gis || {};
|
|
@@ -55,11 +54,11 @@ function parseTextSync(text, options) {
|
|
|
55
54
|
}
|
|
56
55
|
function parseInBatches(asyncIterator, options) {
|
|
57
56
|
options = {
|
|
58
|
-
...
|
|
57
|
+
...GeoJSONLoader.options,
|
|
59
58
|
...options
|
|
60
59
|
};
|
|
61
60
|
options.json = {
|
|
62
|
-
...
|
|
61
|
+
...GeoJSONLoader.options.geojson,
|
|
63
62
|
...options.geojson
|
|
64
63
|
};
|
|
65
64
|
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.js","names":["geojsonToBinary","parseJSONSync","parseJSONInBatches","VERSION","
|
|
1
|
+
{"version":3,"file":"geojson-loader.js","names":["geojsonToBinary","parseJSONSync","parseJSONInBatches","VERSION","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","geojson","shape","json","jsonpaths","gis","format","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","table","data","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {GeoJSON, GeoJSONRowTable, TableBatch} from '@loaders.gl/schema';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-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 type GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n\nexport const GeoJSONLoader: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {\n ...GeoJSONWorkerLoader,\n // @ts-expect-error\n parse,\n // @ts-expect-error\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: GeoJSONLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.geojson = {...GeoJSONLoader.options.geojson, ...options.geojson};\n options.gis = options.gis || {};\n const table = parseJSONSync(text, options) as GeoJSONRowTable;\n table.shape = 'geojson-row-table';\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.data);\n default:\n return table;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<TableBatch> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...GeoJSONLoader.options, ...options};\n options.json = {...GeoJSONLoader.options.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}\n"],"mappings":"AAKA,SAAQA,eAAe,QAAO,iBAAiB;AAC/C,SAAQC,aAAa,QAAO,0BAA0B;AACtD,SAAQC,kBAAkB,QAAO,qCAAqC;AAItE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAc3E,OAAO,MAAMC,mBAAsE,GAAG;EACpFC,IAAI,EAAE,SAAS;EACfC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEL,OAAO;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zEA,OAAO,GAAG;IAAC,GAAGO,aAAa,CAACP,OAAO;IAAE,GAAGA;EAAO,CAAC;EAChDA,OAAO,CAACG,IAAI,GAAG;IAAC,GAAGI,aAAa,CAACP,OAAO,CAACC,OAAO;IAAE,GAAGD,OAAO,CAACC;EAAO,CAAC;EAErE,MAAMgB,eAAe,GAAG7B,kBAAkB,CAAC4B,aAAa,EAAEhB,OAAO,CAAC;EAElE,QAAQA,OAAO,CAACK,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOY,0BAA0B,CAACD,eAAe,CAAC;IACpD;MACE,OAAOA,eAAe;EAC1B;AACF;AAEA,gBAAgBC,0BAA0BA,CAACD,eAAe,EAAE;EAC1D,WAAW,MAAME,KAAK,IAAIF,eAAe,EAAE;IACzCE,KAAK,CAACJ,IAAI,GAAG7B,eAAe,CAACiC,KAAK,CAACJ,IAAI,CAAC;IACxC,MAAMI,KAAK;EACb;AACF"}
|
package/dist/esm/json-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseJSONSync } from './lib/parsers/parse-json';
|
|
2
2
|
import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
|
|
3
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
4
4
|
const DEFAULT_JSON_LOADER_OPTIONS = {
|
|
5
5
|
json: {
|
|
6
6
|
shape: 'row-table',
|
|
@@ -1,14 +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-alpha.
|
|
4
|
-
const DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
|
|
5
|
-
geojson: {
|
|
6
|
-
shape: 'object-row-table'
|
|
7
|
-
},
|
|
8
|
-
gis: {
|
|
9
|
-
format: 'geojson'
|
|
10
|
-
}
|
|
11
|
-
};
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
12
4
|
export const NDJSONLoader = {
|
|
13
5
|
name: 'NDJSON',
|
|
14
6
|
id: 'ndjson',
|
|
@@ -21,7 +13,13 @@ export const NDJSONLoader = {
|
|
|
21
13
|
parse: async arrayBuffer => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
22
14
|
parseTextSync: parseNDJSONSync,
|
|
23
15
|
parseInBatches: parseNDJSONInBatches,
|
|
24
|
-
options:
|
|
16
|
+
options: {
|
|
17
|
+
geojson: {
|
|
18
|
+
shape: 'object-row-table'
|
|
19
|
+
},
|
|
20
|
+
gis: {
|
|
21
|
+
format: 'geojson'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
25
24
|
};
|
|
26
|
-
export const _typecheckNDJSONLoader = NDJSONLoader;
|
|
27
25
|
//# sourceMappingURL=ndgeoson-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndgeoson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","
|
|
1
|
+
{"version":3,"file":"ndgeoson-loader.js","names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options","geojson","shape","gis","format"],"sources":["../../src/ndgeoson-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';\nimport {ArrayRowTable, ObjectRowTable, Batch} from '@loaders.gl/schema';\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\n/** Options for NDGeoJSONLoader */\nexport type NDGeoJSONLoaderOptions = LoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\n/** NDGeoJSONLoader */\nexport const NDJSONLoader: LoaderWithParser<\n ArrayRowTable | ObjectRowTable,\n Batch,\n NDGeoJSONLoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'ndgeojson'],\n mimeTypes: [\n 'application/geo+x-ndjson',\n 'application/geo+x-ldjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/geo+json-seq',\n 'application/x-ndjson'\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 geojson: {\n shape: 'object-row-table'\n },\n gis: {\n format: 'geojson'\n }\n }\n};\n"],"mappings":"AACA,SAAQA,eAAe,QAAO,4BAA4B;AAC1D,SAAQC,oBAAoB,QAAO,uCAAuC;AAK1E,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAa3E,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,WAAW,CAAC;EACnCC,SAAS,EAAE,CACT,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,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;IACPC,OAAO,EAAE;MACPC,KAAK,EAAE;IACT,CAAC;IACDC,GAAG,EAAE;MACHC,MAAM,EAAE;IACV;EACF;AACF,CAAC"}
|
|
@@ -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-alpha.
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
|
|
4
4
|
export const NDJSONLoader = {
|
|
5
5
|
name: 'NDJSON',
|
|
6
6
|
id: 'ndjson',
|
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,EAAmB,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC7E,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,CAqBjF,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAOrF,CAAC"}
|
package/dist/geojson-loader.js
CHANGED
|
@@ -8,17 +8,6 @@ const parse_json_in_batches_1 = require("./lib/parsers/parse-json-in-batches");
|
|
|
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
|
-
const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
12
|
-
geojson: {
|
|
13
|
-
shape: 'object-row-table'
|
|
14
|
-
},
|
|
15
|
-
json: {
|
|
16
|
-
jsonpaths: ['$', '$.features']
|
|
17
|
-
},
|
|
18
|
-
gis: {
|
|
19
|
-
format: 'geojson'
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
11
|
/**
|
|
23
12
|
* GeoJSON loader
|
|
24
13
|
*/
|
|
@@ -32,11 +21,23 @@ exports.GeoJSONWorkerLoader = {
|
|
|
32
21
|
mimeTypes: ['application/geo+json'],
|
|
33
22
|
category: 'geometry',
|
|
34
23
|
text: true,
|
|
35
|
-
options:
|
|
24
|
+
options: {
|
|
25
|
+
geojson: {
|
|
26
|
+
shape: 'object-row-table'
|
|
27
|
+
},
|
|
28
|
+
json: {
|
|
29
|
+
jsonpaths: ['$', '$.features']
|
|
30
|
+
},
|
|
31
|
+
gis: {
|
|
32
|
+
format: 'geojson'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
36
35
|
};
|
|
37
36
|
exports.GeoJSONLoader = {
|
|
38
37
|
...exports.GeoJSONWorkerLoader,
|
|
38
|
+
// @ts-expect-error
|
|
39
39
|
parse,
|
|
40
|
+
// @ts-expect-error
|
|
40
41
|
parseTextSync,
|
|
41
42
|
parseInBatches
|
|
42
43
|
};
|
|
@@ -45,8 +46,8 @@ async function parse(arrayBuffer, options) {
|
|
|
45
46
|
}
|
|
46
47
|
function parseTextSync(text, options) {
|
|
47
48
|
// Apps can call the parse method directly, we so apply default options here
|
|
48
|
-
options = { ...
|
|
49
|
-
options.
|
|
49
|
+
options = { ...exports.GeoJSONLoader.options, ...options };
|
|
50
|
+
options.geojson = { ...exports.GeoJSONLoader.options.geojson, ...options.geojson };
|
|
50
51
|
options.gis = options.gis || {};
|
|
51
52
|
const table = (0, parse_json_1.parseJSONSync)(text, options);
|
|
52
53
|
table.shape = 'geojson-row-table';
|
|
@@ -59,8 +60,8 @@ function parseTextSync(text, options) {
|
|
|
59
60
|
}
|
|
60
61
|
function parseInBatches(asyncIterator, options) {
|
|
61
62
|
// Apps can call the parse method directly, we so apply default options here
|
|
62
|
-
options = { ...
|
|
63
|
-
options.json = { ...
|
|
63
|
+
options = { ...exports.GeoJSONLoader.options, ...options };
|
|
64
|
+
options.json = { ...exports.GeoJSONLoader.options.geojson, ...options.geojson };
|
|
64
65
|
const geojsonIterator = (0, parse_json_in_batches_1.parseJSONInBatches)(asyncIterator, options);
|
|
65
66
|
switch (options.gis.format) {
|
|
66
67
|
case 'binary':
|
package/dist/geojson-worker.js
CHANGED
|
@@ -2427,18 +2427,7 @@ Char: ${this.c}`;
|
|
|
2427
2427
|
}
|
|
2428
2428
|
|
|
2429
2429
|
// src/geojson-loader.ts
|
|
2430
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
2431
|
-
var DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
2432
|
-
geojson: {
|
|
2433
|
-
shape: "object-row-table"
|
|
2434
|
-
},
|
|
2435
|
-
json: {
|
|
2436
|
-
jsonpaths: ["$", "$.features"]
|
|
2437
|
-
},
|
|
2438
|
-
gis: {
|
|
2439
|
-
format: "geojson"
|
|
2440
|
-
}
|
|
2441
|
-
};
|
|
2430
|
+
var VERSION = true ? "4.0.0-alpha.21" : "latest";
|
|
2442
2431
|
var GeoJSONWorkerLoader = {
|
|
2443
2432
|
name: "GeoJSON",
|
|
2444
2433
|
id: "geojson",
|
|
@@ -2449,7 +2438,17 @@ Char: ${this.c}`;
|
|
|
2449
2438
|
mimeTypes: ["application/geo+json"],
|
|
2450
2439
|
category: "geometry",
|
|
2451
2440
|
text: true,
|
|
2452
|
-
options:
|
|
2441
|
+
options: {
|
|
2442
|
+
geojson: {
|
|
2443
|
+
shape: "object-row-table"
|
|
2444
|
+
},
|
|
2445
|
+
json: {
|
|
2446
|
+
jsonpaths: ["$", "$.features"]
|
|
2447
|
+
},
|
|
2448
|
+
gis: {
|
|
2449
|
+
format: "geojson"
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2453
2452
|
};
|
|
2454
2453
|
var GeoJSONLoader = {
|
|
2455
2454
|
...GeoJSONWorkerLoader,
|
|
@@ -2461,8 +2460,8 @@ Char: ${this.c}`;
|
|
|
2461
2460
|
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
|
2462
2461
|
}
|
|
2463
2462
|
function parseTextSync(text, options) {
|
|
2464
|
-
options = { ...
|
|
2465
|
-
options.
|
|
2463
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
2464
|
+
options.geojson = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
2466
2465
|
options.gis = options.gis || {};
|
|
2467
2466
|
const table = parseJSONSync(text, options);
|
|
2468
2467
|
table.shape = "geojson-row-table";
|
|
@@ -2474,8 +2473,8 @@ Char: ${this.c}`;
|
|
|
2474
2473
|
}
|
|
2475
2474
|
}
|
|
2476
2475
|
function parseInBatches(asyncIterator, options) {
|
|
2477
|
-
options = { ...
|
|
2478
|
-
options.json = { ...
|
|
2476
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
2477
|
+
options.json = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
2479
2478
|
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
2480
2479
|
switch (options.gis.format) {
|
|
2481
2480
|
case "binary":
|
|
@@ -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/dist/ndgeoson-loader.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NDJSONLoader = void 0;
|
|
4
4
|
const parse_ndjson_1 = require("./lib/parsers/parse-ndjson");
|
|
5
5
|
const parse_ndjson_in_batches_1 = require("./lib/parsers/parse-ndjson-in-batches");
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
8
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
9
|
-
|
|
10
|
-
geojson: {
|
|
11
|
-
shape: 'object-row-table'
|
|
12
|
-
},
|
|
13
|
-
gis: {
|
|
14
|
-
format: 'geojson'
|
|
15
|
-
}
|
|
16
|
-
};
|
|
9
|
+
/** NDGeoJSONLoader */
|
|
17
10
|
exports.NDJSONLoader = {
|
|
18
11
|
name: 'NDJSON',
|
|
19
12
|
id: 'ndjson',
|
|
@@ -32,6 +25,12 @@ exports.NDJSONLoader = {
|
|
|
32
25
|
parse: async (arrayBuffer) => (0, parse_ndjson_1.parseNDJSONSync)(new TextDecoder().decode(arrayBuffer)),
|
|
33
26
|
parseTextSync: parse_ndjson_1.parseNDJSONSync,
|
|
34
27
|
parseInBatches: parse_ndjson_in_batches_1.parseNDJSONInBatches,
|
|
35
|
-
options:
|
|
28
|
+
options: {
|
|
29
|
+
geojson: {
|
|
30
|
+
shape: 'object-row-table'
|
|
31
|
+
},
|
|
32
|
+
gis: {
|
|
33
|
+
format: 'geojson'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
36
|
};
|
|
37
|
-
exports._typecheckNDJSONLoader = exports.NDJSONLoader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/json",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.21",
|
|
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-alpha.
|
|
39
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
40
|
-
"@loaders.gl/schema": "4.0.0-alpha.
|
|
38
|
+
"@loaders.gl/gis": "4.0.0-alpha.21",
|
|
39
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.21",
|
|
40
|
+
"@loaders.gl/schema": "4.0.0-alpha.21"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "df5d670b136192b26941396e944f9c46be788e83"
|
|
43
43
|
}
|
package/src/geojson-loader.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// loaders.gl, MIT license
|
|
2
2
|
|
|
3
3
|
import type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
4
|
+
import type {GeoJSON, GeoJSONRowTable, TableBatch} from '@loaders.gl/schema';
|
|
4
5
|
import type {JSONLoaderOptions} from './json-loader';
|
|
5
6
|
import {geojsonToBinary} from '@loaders.gl/gis';
|
|
6
7
|
import {parseJSONSync} from './lib/parsers/parse-json';
|
|
7
8
|
import {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';
|
|
8
|
-
import {GeoJSONRowTable} from '@loaders.gl/schema';
|
|
9
9
|
|
|
10
10
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
11
11
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
@@ -20,22 +20,10 @@ export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
24
|
-
geojson: {
|
|
25
|
-
shape: 'object-row-table'
|
|
26
|
-
},
|
|
27
|
-
json: {
|
|
28
|
-
jsonpaths: ['$', '$.features']
|
|
29
|
-
},
|
|
30
|
-
gis: {
|
|
31
|
-
format: 'geojson'
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
23
|
/**
|
|
36
24
|
* GeoJSON loader
|
|
37
25
|
*/
|
|
38
|
-
export const GeoJSONWorkerLoader: Loader = {
|
|
26
|
+
export const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {
|
|
39
27
|
name: 'GeoJSON',
|
|
40
28
|
id: 'geojson',
|
|
41
29
|
module: 'geojson',
|
|
@@ -45,24 +33,36 @@ export const GeoJSONWorkerLoader: Loader = {
|
|
|
45
33
|
mimeTypes: ['application/geo+json'],
|
|
46
34
|
category: 'geometry',
|
|
47
35
|
text: true,
|
|
48
|
-
options:
|
|
36
|
+
options: {
|
|
37
|
+
geojson: {
|
|
38
|
+
shape: 'object-row-table'
|
|
39
|
+
},
|
|
40
|
+
json: {
|
|
41
|
+
jsonpaths: ['$', '$.features']
|
|
42
|
+
},
|
|
43
|
+
gis: {
|
|
44
|
+
format: 'geojson'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
49
47
|
};
|
|
50
48
|
|
|
51
|
-
export const GeoJSONLoader: LoaderWithParser = {
|
|
49
|
+
export const GeoJSONLoader: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {
|
|
52
50
|
...GeoJSONWorkerLoader,
|
|
51
|
+
// @ts-expect-error
|
|
53
52
|
parse,
|
|
53
|
+
// @ts-expect-error
|
|
54
54
|
parseTextSync,
|
|
55
55
|
parseInBatches
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
async function parse(arrayBuffer, options) {
|
|
58
|
+
async function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions) {
|
|
59
59
|
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function parseTextSync(text, options) {
|
|
62
|
+
function parseTextSync(text: string, options?: GeoJSONLoaderOptions) {
|
|
63
63
|
// Apps can call the parse method directly, we so apply default options here
|
|
64
|
-
options = {...
|
|
65
|
-
options.
|
|
64
|
+
options = {...GeoJSONLoader.options, ...options};
|
|
65
|
+
options.geojson = {...GeoJSONLoader.options.geojson, ...options.geojson};
|
|
66
66
|
options.gis = options.gis || {};
|
|
67
67
|
const table = parseJSONSync(text, options) as GeoJSONRowTable;
|
|
68
68
|
table.shape = 'geojson-row-table';
|
|
@@ -74,10 +74,10 @@ function parseTextSync(text, options) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function parseInBatches(asyncIterator, options): AsyncIterable<
|
|
77
|
+
function parseInBatches(asyncIterator, options): AsyncIterable<TableBatch> {
|
|
78
78
|
// Apps can call the parse method directly, we so apply default options here
|
|
79
|
-
options = {...
|
|
80
|
-
options.json = {...
|
|
79
|
+
options = {...GeoJSONLoader.options, ...options};
|
|
80
|
+
options.json = {...GeoJSONLoader.options.geojson, ...options.geojson};
|
|
81
81
|
|
|
82
82
|
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
83
83
|
|
package/src/ndgeoson-loader.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
2
|
import {parseNDJSONSync} from './lib/parsers/parse-ndjson';
|
|
3
3
|
import {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';
|
|
4
|
+
import {ArrayRowTable, ObjectRowTable, Batch} from '@loaders.gl/schema';
|
|
4
5
|
|
|
5
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
8
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
8
9
|
|
|
10
|
+
/** Options for NDGeoJSONLoader */
|
|
9
11
|
export type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
10
12
|
geojson?: {
|
|
11
13
|
shape?: 'object-row-table';
|
|
@@ -15,16 +17,12 @@ export type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const NDJSONLoader = {
|
|
20
|
+
/** NDGeoJSONLoader */
|
|
21
|
+
export const NDJSONLoader: LoaderWithParser<
|
|
22
|
+
ArrayRowTable | ObjectRowTable,
|
|
23
|
+
Batch,
|
|
24
|
+
NDGeoJSONLoaderOptions
|
|
25
|
+
> = {
|
|
28
26
|
name: 'NDJSON',
|
|
29
27
|
id: 'ndjson',
|
|
30
28
|
module: 'json',
|
|
@@ -42,7 +40,12 @@ export const NDJSONLoader = {
|
|
|
42
40
|
parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
43
41
|
parseTextSync: parseNDJSONSync,
|
|
44
42
|
parseInBatches: parseNDJSONInBatches,
|
|
45
|
-
options:
|
|
43
|
+
options: {
|
|
44
|
+
geojson: {
|
|
45
|
+
shape: 'object-row-table'
|
|
46
|
+
},
|
|
47
|
+
gis: {
|
|
48
|
+
format: 'geojson'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
46
51
|
};
|
|
47
|
-
|
|
48
|
-
export const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;
|