@loaders.gl/shapefile 4.2.0-alpha.5 → 4.2.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/dbf-loader.d.ts +25 -2
- package/dist/dbf-loader.d.ts.map +1 -1
- package/dist/dbf-loader.js +6 -1
- package/dist/dbf-worker.js +16 -7
- package/dist/dist.dev.js +30 -19
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +33 -22
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/lib/parsers/parse-dbf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-dbf.js +9 -5
- package/dist/lib/parsers/parse-shapefile.d.ts.map +1 -1
- package/dist/lib/parsers/parse-shapefile.js +3 -0
- package/dist/lib/parsers/parse-shp-geometry.d.ts.map +1 -1
- package/dist/lib/parsers/parse-shp-geometry.js +3 -0
- package/dist/lib/parsers/parse-shp-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-shp-header.js +3 -0
- package/dist/lib/parsers/parse-shp.d.ts.map +1 -1
- package/dist/lib/parsers/parse-shp.js +17 -14
- package/dist/lib/parsers/parse-shx.d.ts.map +1 -1
- package/dist/lib/parsers/parse-shx.js +3 -0
- package/dist/lib/parsers/types.d.ts.map +1 -1
- package/dist/lib/parsers/types.js +3 -0
- package/dist/lib/streaming/binary-chunk-reader.js +4 -0
- package/dist/lib/streaming/binary-reader.js +2 -0
- package/dist/shapefile-loader.d.ts +24 -3
- package/dist/shapefile-loader.d.ts.map +1 -1
- package/dist/shapefile-loader.js +4 -1
- package/dist/shp-loader.d.ts +27 -2
- package/dist/shp-loader.d.ts.map +1 -1
- package/dist/shp-loader.js +6 -1
- package/dist/shp-worker.js +24 -16
- package/dist/workers/dbf-worker.js +3 -0
- package/dist/workers/shp-worker.js +3 -0
- package/package.json +5 -5
- package/src/dbf-loader.ts +18 -3
- package/src/index.ts +9 -0
- package/src/lib/parsers/parse-dbf.ts +4 -0
- package/src/lib/parsers/parse-shapefile.ts +4 -0
- package/src/lib/parsers/parse-shp-geometry.ts +4 -0
- package/src/lib/parsers/parse-shp-header.ts +4 -0
- package/src/lib/parsers/parse-shp.ts +4 -0
- package/src/lib/parsers/parse-shx.ts +4 -0
- package/src/lib/parsers/types.ts +4 -0
- package/src/shapefile-loader.ts +8 -2
- package/src/shp-loader.ts +19 -3
- package/src/workers/dbf-worker.ts +4 -0
- package/src/workers/shp-worker.ts +4 -0
package/dist/dbf-loader.d.ts
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
export type DBFLoaderOptions = LoaderOptions & {
|
|
3
|
+
dbf?: {
|
|
4
|
+
encoding?: string;
|
|
5
|
+
/** Override the URL to the worker bundle (by default loads from unpkg.com) */
|
|
6
|
+
workerUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
2
9
|
/**
|
|
3
10
|
* DBFLoader - DBF files are used to contain non-geometry columns in Shapefiles
|
|
4
11
|
*/
|
|
5
|
-
export declare const DBFWorkerLoader:
|
|
12
|
+
export declare const DBFWorkerLoader: {
|
|
13
|
+
readonly name: "DBF";
|
|
14
|
+
readonly dataType: unknown;
|
|
15
|
+
readonly batchType: never;
|
|
16
|
+
readonly id: "dbf";
|
|
17
|
+
readonly module: "shapefile";
|
|
18
|
+
readonly version: any;
|
|
19
|
+
readonly worker: true;
|
|
20
|
+
readonly category: "table";
|
|
21
|
+
readonly extensions: ["dbf"];
|
|
22
|
+
readonly mimeTypes: ["application/x-dbf"];
|
|
23
|
+
readonly options: {
|
|
24
|
+
readonly dbf: {
|
|
25
|
+
readonly encoding: "latin1";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
6
29
|
/** DBF file loader */
|
|
7
30
|
export declare const DBFLoader: LoaderWithParser;
|
|
8
31
|
//# sourceMappingURL=dbf-loader.d.ts.map
|
package/dist/dbf-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbf-loader.d.ts","sourceRoot":"","sources":["../src/dbf-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dbf-loader.d.ts","sourceRoot":"","sources":["../src/dbf-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAOtF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,8EAA8E;QAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;CAiB2B,CAAC;AAExD,sBAAsB;AACtB,eAAO,MAAM,SAAS,EAAE,gBAOvB,CAAC"}
|
package/dist/dbf-loader.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { parseDBF, parseDBFInBatches } from "./lib/parsers/parse-dbf.js";
|
|
2
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
3
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
4
|
-
const VERSION = typeof "4.2.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
|
|
5
8
|
/**
|
|
6
9
|
* DBFLoader - DBF files are used to contain non-geometry columns in Shapefiles
|
|
7
10
|
*/
|
|
8
11
|
export const DBFWorkerLoader = {
|
|
9
12
|
name: 'DBF',
|
|
13
|
+
dataType: null,
|
|
14
|
+
batchType: null,
|
|
10
15
|
id: 'dbf',
|
|
11
16
|
module: 'shapefile',
|
|
12
17
|
version: VERSION,
|
package/dist/dbf-worker.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
(() => {
|
|
3
3
|
// src/lib/streaming/binary-chunk-reader.ts
|
|
4
4
|
var BinaryChunkReader = class {
|
|
5
|
+
offset;
|
|
6
|
+
arrayBuffers;
|
|
7
|
+
ended;
|
|
8
|
+
maxRewindBytes;
|
|
5
9
|
constructor(options) {
|
|
6
10
|
const { maxRewindBytes = 0 } = options || {};
|
|
7
11
|
this.offset = 0;
|
|
@@ -144,12 +148,13 @@
|
|
|
144
148
|
var LITTLE_ENDIAN = true;
|
|
145
149
|
var DBF_HEADER_SIZE = 32;
|
|
146
150
|
var DBFParser = class {
|
|
151
|
+
binaryReader = new BinaryChunkReader();
|
|
152
|
+
textDecoder;
|
|
153
|
+
state = 0 /* START */;
|
|
154
|
+
result = {
|
|
155
|
+
data: []
|
|
156
|
+
};
|
|
147
157
|
constructor(options) {
|
|
148
|
-
this.binaryReader = new BinaryChunkReader();
|
|
149
|
-
this.state = 0 /* START */;
|
|
150
|
-
this.result = {
|
|
151
|
-
data: []
|
|
152
|
-
};
|
|
153
158
|
this.textDecoder = new TextDecoder(options.encoding);
|
|
154
159
|
}
|
|
155
160
|
/**
|
|
@@ -372,9 +377,11 @@
|
|
|
372
377
|
}
|
|
373
378
|
|
|
374
379
|
// src/dbf-loader.ts
|
|
375
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
380
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
376
381
|
var DBFWorkerLoader = {
|
|
377
382
|
name: "DBF",
|
|
383
|
+
dataType: null,
|
|
384
|
+
batchType: null,
|
|
378
385
|
id: "dbf",
|
|
379
386
|
module: "shapefile",
|
|
380
387
|
version: VERSION,
|
|
@@ -456,7 +463,9 @@
|
|
|
456
463
|
}
|
|
457
464
|
getParentPort().then((parentPort2) => {
|
|
458
465
|
if (parentPort2) {
|
|
459
|
-
parentPort2.on("message",
|
|
466
|
+
parentPort2.on("message", (message) => {
|
|
467
|
+
handleMessage(message);
|
|
468
|
+
});
|
|
460
469
|
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
461
470
|
} else {
|
|
462
471
|
globalThis.onmessage = handleMessage;
|
package/dist/dist.dev.js
CHANGED
|
@@ -61,6 +61,10 @@ var __exports__ = (() => {
|
|
|
61
61
|
|
|
62
62
|
// src/lib/streaming/binary-chunk-reader.ts
|
|
63
63
|
var BinaryChunkReader = class {
|
|
64
|
+
offset;
|
|
65
|
+
arrayBuffers;
|
|
66
|
+
ended;
|
|
67
|
+
maxRewindBytes;
|
|
64
68
|
constructor(options) {
|
|
65
69
|
const { maxRewindBytes = 0 } = options || {};
|
|
66
70
|
this.offset = 0;
|
|
@@ -418,21 +422,21 @@ var __exports__ = (() => {
|
|
|
418
422
|
ERROR: 3
|
|
419
423
|
};
|
|
420
424
|
var SHPParser = class {
|
|
425
|
+
options = {};
|
|
426
|
+
binaryReader = new BinaryChunkReader({ maxRewindBytes: SHP_RECORD_HEADER_SIZE });
|
|
427
|
+
state = STATE.EXPECTING_HEADER;
|
|
428
|
+
result = {
|
|
429
|
+
geometries: [],
|
|
430
|
+
// Initialize with number values to make TS happy
|
|
431
|
+
// These are initialized for real in STATE.EXPECTING_HEADER
|
|
432
|
+
progress: {
|
|
433
|
+
bytesTotal: NaN,
|
|
434
|
+
bytesUsed: NaN,
|
|
435
|
+
rows: NaN
|
|
436
|
+
},
|
|
437
|
+
currentIndex: NaN
|
|
438
|
+
};
|
|
421
439
|
constructor(options) {
|
|
422
|
-
this.options = {};
|
|
423
|
-
this.binaryReader = new BinaryChunkReader({ maxRewindBytes: SHP_RECORD_HEADER_SIZE });
|
|
424
|
-
this.state = STATE.EXPECTING_HEADER;
|
|
425
|
-
this.result = {
|
|
426
|
-
geometries: [],
|
|
427
|
-
// Initialize with number values to make TS happy
|
|
428
|
-
// These are initialized for real in STATE.EXPECTING_HEADER
|
|
429
|
-
progress: {
|
|
430
|
-
bytesTotal: NaN,
|
|
431
|
-
bytesUsed: NaN,
|
|
432
|
-
rows: NaN
|
|
433
|
-
},
|
|
434
|
-
currentIndex: NaN
|
|
435
|
-
};
|
|
436
440
|
this.options = options;
|
|
437
441
|
}
|
|
438
442
|
write(arrayBuffer) {
|
|
@@ -542,6 +546,8 @@ var __exports__ = (() => {
|
|
|
542
546
|
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
543
547
|
var SHP_MAGIC_NUMBER2 = [0, 0, 39, 10];
|
|
544
548
|
var SHPWorkerLoader = {
|
|
549
|
+
dataType: null,
|
|
550
|
+
batchType: null,
|
|
545
551
|
name: "SHP",
|
|
546
552
|
id: "shp",
|
|
547
553
|
module: "shapefile",
|
|
@@ -6143,12 +6149,13 @@ var __exports__ = (() => {
|
|
|
6143
6149
|
var LITTLE_ENDIAN4 = true;
|
|
6144
6150
|
var DBF_HEADER_SIZE = 32;
|
|
6145
6151
|
var DBFParser = class {
|
|
6152
|
+
binaryReader = new BinaryChunkReader();
|
|
6153
|
+
textDecoder;
|
|
6154
|
+
state = 0 /* START */;
|
|
6155
|
+
result = {
|
|
6156
|
+
data: []
|
|
6157
|
+
};
|
|
6146
6158
|
constructor(options) {
|
|
6147
|
-
this.binaryReader = new BinaryChunkReader();
|
|
6148
|
-
this.state = 0 /* START */;
|
|
6149
|
-
this.result = {
|
|
6150
|
-
data: []
|
|
6151
|
-
};
|
|
6152
6159
|
this.textDecoder = new TextDecoder(options.encoding);
|
|
6153
6160
|
}
|
|
6154
6161
|
/**
|
|
@@ -6374,6 +6381,8 @@ var __exports__ = (() => {
|
|
|
6374
6381
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
6375
6382
|
var DBFWorkerLoader = {
|
|
6376
6383
|
name: "DBF",
|
|
6384
|
+
dataType: null,
|
|
6385
|
+
batchType: null,
|
|
6377
6386
|
id: "dbf",
|
|
6378
6387
|
module: "shapefile",
|
|
6379
6388
|
version: VERSION2,
|
|
@@ -6609,6 +6618,8 @@ var __exports__ = (() => {
|
|
|
6609
6618
|
|
|
6610
6619
|
// src/lib/streaming/binary-reader.ts
|
|
6611
6620
|
var BinaryReader = class {
|
|
6621
|
+
offset;
|
|
6622
|
+
arrayBuffer;
|
|
6612
6623
|
constructor(arrayBuffer) {
|
|
6613
6624
|
this.offset = 0;
|
|
6614
6625
|
this.arrayBuffer = arrayBuffer;
|