@loaders.gl/wkt 4.0.0-alpha.22 → 4.0.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,236 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const NUM_DIMENSIONS = {
4
- 0: 2,
5
- 1: 3,
6
- 2: 3,
7
- 3: 4 // 4D (ZM)
8
- };
9
- function parseWKB(arrayBuffer) {
10
- const view = new DataView(arrayBuffer);
11
- let offset = 0;
12
- // Check endianness of data
13
- const littleEndian = view.getUint8(offset) === 1;
14
- offset++;
15
- // 4-digit code representing dimension and type of geometry
16
- const geometryCode = view.getUint32(offset, littleEndian);
17
- offset += 4;
18
- const geometryType = geometryCode % 1000;
19
- const type = ((geometryCode - geometryType) / 1000);
20
- const dimension = NUM_DIMENSIONS[type];
21
- switch (geometryType) {
22
- case 1:
23
- const point = parsePoint(view, offset, dimension, littleEndian);
24
- return point.geometry;
25
- case 2:
26
- const line = parseLineString(view, offset, dimension, littleEndian);
27
- return line.geometry;
28
- case 3:
29
- const polygon = parsePolygon(view, offset, dimension, littleEndian);
30
- return polygon.geometry;
31
- case 4:
32
- const multiPoint = parseMultiPoint(view, offset, dimension, littleEndian);
33
- multiPoint.type = 'Point';
34
- return multiPoint;
35
- case 5:
36
- const multiLine = parseMultiLineString(view, offset, dimension, littleEndian);
37
- multiLine.type = 'LineString';
38
- return multiLine;
39
- case 6:
40
- const multiPolygon = parseMultiPolygon(view, offset, dimension, littleEndian);
41
- multiPolygon.type = 'Polygon';
42
- return multiPolygon;
43
- // case 7:
44
- // TODO: handle GeometryCollections
45
- // return parseGeometryCollection(view, offset, dimension, littleEndian);
46
- default:
47
- throw new Error(`WKB: Unsupported geometry type: ${geometryType}`);
48
- }
49
- }
50
- exports.default = parseWKB;
51
- // Primitives; parse point and linear ring
52
- function parsePoint(view, offset, dimension, littleEndian) {
53
- const positions = new Float64Array(dimension);
54
- for (let i = 0; i < dimension; i++) {
55
- positions[i] = view.getFloat64(offset, littleEndian);
56
- offset += 8;
57
- }
58
- return {
59
- geometry: { type: 'Point', positions: { value: positions, size: dimension } },
60
- offset
61
- };
62
- }
63
- function parseLineString(view, offset, dimension, littleEndian) {
64
- const nPoints = view.getUint32(offset, littleEndian);
65
- offset += 4;
66
- // Instantiate array
67
- const positions = new Float64Array(nPoints * dimension);
68
- for (let i = 0; i < nPoints * dimension; i++) {
69
- positions[i] = view.getFloat64(offset, littleEndian);
70
- offset += 8;
71
- }
72
- const pathIndices = [0];
73
- if (nPoints > 0) {
74
- pathIndices.push(nPoints);
75
- }
76
- return {
77
- geometry: {
78
- type: 'LineString',
79
- positions: { value: positions, size: dimension },
80
- pathIndices: { value: new Uint16Array(pathIndices), size: 1 }
81
- },
82
- offset
83
- };
84
- }
85
- // https://stackoverflow.com/a/55261098
86
- const cumulativeSum = (sum) => (value) => (sum += value);
87
- function parsePolygon(view, offset, dimension, littleEndian) {
88
- const nRings = view.getUint32(offset, littleEndian);
89
- offset += 4;
90
- const rings = [];
91
- for (let i = 0; i < nRings; i++) {
92
- const parsed = parseLineString(view, offset, dimension, littleEndian);
93
- const { positions } = parsed.geometry;
94
- offset = parsed.offset;
95
- rings.push(positions.value);
96
- }
97
- const concatenatedPositions = new Float64Array(concatTypedArrays(rings).buffer);
98
- const polygonIndices = [0];
99
- if (concatenatedPositions.length > 0) {
100
- polygonIndices.push(concatenatedPositions.length / dimension);
101
- }
102
- const primitivePolygonIndices = rings.map((l) => l.length / dimension).map(cumulativeSum(0));
103
- primitivePolygonIndices.unshift(0);
104
- return {
105
- geometry: {
106
- type: 'Polygon',
107
- positions: { value: concatenatedPositions, size: dimension },
108
- polygonIndices: {
109
- value: new Uint16Array(polygonIndices),
110
- size: 1
111
- },
112
- primitivePolygonIndices: { value: new Uint16Array(primitivePolygonIndices), size: 1 }
113
- },
114
- offset
115
- };
116
- }
117
- function parseMultiPoint(view, offset, dimension, littleEndian) {
118
- const nPoints = view.getUint32(offset, littleEndian);
119
- offset += 4;
120
- const binaryPointGeometries = [];
121
- for (let i = 0; i < nPoints; i++) {
122
- // Byte order for point
123
- const littleEndianPoint = view.getUint8(offset) === 1;
124
- offset++;
125
- // Assert point type
126
- if (view.getUint32(offset, littleEndianPoint) % 1000 !== 1) {
127
- throw new Error('WKB: Inner geometries of MultiPoint not of type Point');
128
- }
129
- offset += 4;
130
- const parsed = parsePoint(view, offset, dimension, littleEndianPoint);
131
- offset = parsed.offset;
132
- binaryPointGeometries.push(parsed.geometry);
133
- }
134
- return concatenateBinaryPointGeometries(binaryPointGeometries, dimension);
135
- }
136
- function parseMultiLineString(view, offset, dimension, littleEndian) {
137
- const nLines = view.getUint32(offset, littleEndian);
138
- offset += 4;
139
- const binaryLineGeometries = [];
140
- for (let i = 0; i < nLines; i++) {
141
- // Byte order for line
142
- const littleEndianLine = view.getUint8(offset) === 1;
143
- offset++;
144
- // Assert type LineString
145
- if (view.getUint32(offset, littleEndianLine) % 1000 !== 2) {
146
- throw new Error('WKB: Inner geometries of MultiLineString not of type LineString');
147
- }
148
- offset += 4;
149
- const parsed = parseLineString(view, offset, dimension, littleEndianLine);
150
- offset = parsed.offset;
151
- binaryLineGeometries.push(parsed.geometry);
152
- }
153
- return concatenateBinaryLineGeometries(binaryLineGeometries, dimension);
154
- }
155
- function parseMultiPolygon(view, offset, dimension, littleEndian) {
156
- const nPolygons = view.getUint32(offset, littleEndian);
157
- offset += 4;
158
- const binaryPolygonGeometries = [];
159
- for (let i = 0; i < nPolygons; i++) {
160
- // Byte order for polygon
161
- const littleEndianPolygon = view.getUint8(offset) === 1;
162
- offset++;
163
- // Assert type Polygon
164
- if (view.getUint32(offset, littleEndianPolygon) % 1000 !== 3) {
165
- throw new Error('WKB: Inner geometries of MultiPolygon not of type Polygon');
166
- }
167
- offset += 4;
168
- const parsed = parsePolygon(view, offset, dimension, littleEndianPolygon);
169
- offset = parsed.offset;
170
- binaryPolygonGeometries.push(parsed.geometry);
171
- }
172
- return concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension);
173
- }
174
- // TODO - move to loaders.gl/schema/gis
175
- function concatenateBinaryPointGeometries(binaryPointGeometries, dimension) {
176
- const positions = binaryPointGeometries.map((geometry) => geometry.positions.value);
177
- const concatenatedPositions = new Float64Array(concatTypedArrays(positions).buffer);
178
- return {
179
- type: 'Point',
180
- positions: { value: concatenatedPositions, size: dimension }
181
- };
182
- }
183
- function concatenateBinaryLineGeometries(binaryLineGeometries, dimension) {
184
- const lines = binaryLineGeometries.map((geometry) => geometry.positions.value);
185
- const concatenatedPositions = new Float64Array(concatTypedArrays(lines).buffer);
186
- const pathIndices = lines.map((line) => line.length / dimension).map(cumulativeSum(0));
187
- pathIndices.unshift(0);
188
- return {
189
- type: 'LineString',
190
- positions: { value: concatenatedPositions, size: dimension },
191
- pathIndices: { value: new Uint16Array(pathIndices), size: 1 }
192
- };
193
- }
194
- function concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension) {
195
- const polygons = [];
196
- const primitivePolygons = [];
197
- for (const binaryPolygon of binaryPolygonGeometries) {
198
- const { positions, primitivePolygonIndices } = binaryPolygon;
199
- polygons.push(positions.value);
200
- primitivePolygons.push(primitivePolygonIndices.value);
201
- }
202
- const concatenatedPositions = new Float64Array(concatTypedArrays(polygons).buffer);
203
- const polygonIndices = polygons.map((p) => p.length / dimension).map(cumulativeSum(0));
204
- polygonIndices.unshift(0);
205
- // Combine primitivePolygonIndices from each individual polygon
206
- const primitivePolygonIndices = [0];
207
- for (const primitivePolygon of primitivePolygons) {
208
- primitivePolygonIndices.push(...primitivePolygon
209
- .filter((x) => x > 0)
210
- .map((x) => x + primitivePolygonIndices[primitivePolygonIndices.length - 1]));
211
- }
212
- return {
213
- type: 'Polygon',
214
- positions: { value: concatenatedPositions, size: dimension },
215
- polygonIndices: { value: new Uint16Array(polygonIndices), size: 1 },
216
- primitivePolygonIndices: { value: new Uint16Array(primitivePolygonIndices), size: 1 }
217
- };
218
- }
219
- // TODO: remove copy; import from typed-array-utils
220
- // modules/math/src/geometry/typed-arrays/typed-array-utils.js
221
- function concatTypedArrays(arrays) {
222
- let byteLength = 0;
223
- for (let i = 0; i < arrays.length; ++i) {
224
- byteLength += arrays[i].byteLength;
225
- }
226
- const buffer = new Uint8Array(byteLength);
227
- let byteOffset = 0;
228
- for (let i = 0; i < arrays.length; ++i) {
229
- const data = new Uint8Array(arrays[i].buffer);
230
- byteLength = data.length;
231
- for (let j = 0; j < byteLength; ++j) {
232
- buffer[byteOffset++] = data[j];
233
- }
234
- }
235
- return buffer;
236
- }
@@ -1,227 +0,0 @@
1
- "use strict";
2
- // Fork of https://github.com/mapbox/wellknown under ISC license (MIT/BSD-2-clause equivalent)
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /* eslint-disable */
5
- // @ts-nocheck
6
- const numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
7
- // Matches sequences like '100 100' or '100 100 100'.
8
- const tuples = new RegExp('^' + numberRegexp.source + '(\\s' + numberRegexp.source + '){1,}');
9
- /**
10
- * Parse WKT and return GeoJSON.
11
- *
12
- * @param {string} _ A WKT geometry
13
- * @return {?Object} A GeoJSON geometry object
14
- **/
15
- function parseWKT(input) {
16
- const parts = input.split(';');
17
- let _ = parts.pop();
18
- const srid = (parts.shift() || '').split('=').pop();
19
- let i = 0;
20
- function $(re) {
21
- const match = _.substring(i).match(re);
22
- if (!match)
23
- return null;
24
- else {
25
- i += match[0].length;
26
- return match[0];
27
- }
28
- }
29
- function crs(obj) {
30
- if (obj && srid.match(/\d+/)) {
31
- obj.crs = {
32
- type: 'name',
33
- properties: {
34
- name: 'urn:ogc:def:crs:EPSG::' + srid
35
- }
36
- };
37
- }
38
- return obj;
39
- }
40
- function white() {
41
- $(/^\s*/);
42
- }
43
- function multicoords() {
44
- white();
45
- let depth = 0;
46
- const rings = [];
47
- const stack = [rings];
48
- let pointer = rings;
49
- let elem;
50
- while ((elem = $(/^(\()/) || $(/^(\))/) || $(/^(,)/) || $(tuples))) {
51
- if (elem === '(') {
52
- stack.push(pointer);
53
- pointer = [];
54
- stack[stack.length - 1].push(pointer);
55
- depth++;
56
- }
57
- else if (elem === ')') {
58
- // For the case: Polygon(), ...
59
- if (pointer.length === 0)
60
- return null;
61
- // @ts-ignore
62
- pointer = stack.pop();
63
- // the stack was empty, input was malformed
64
- if (!pointer)
65
- return null;
66
- depth--;
67
- if (depth === 0)
68
- break;
69
- }
70
- else if (elem === ',') {
71
- pointer = [];
72
- stack[stack.length - 1].push(pointer);
73
- }
74
- else if (!elem.split(/\s/g).some(isNaN)) {
75
- Array.prototype.push.apply(pointer, elem.split(/\s/g).map(parseFloat));
76
- }
77
- else {
78
- return null;
79
- }
80
- white();
81
- }
82
- if (depth !== 0)
83
- return null;
84
- return rings;
85
- }
86
- function coords() {
87
- const list = [];
88
- let item;
89
- let pt;
90
- while ((pt = $(tuples) || $(/^(,)/))) {
91
- if (pt === ',') {
92
- list.push(item);
93
- item = [];
94
- }
95
- else if (!pt.split(/\s/g).some(isNaN)) {
96
- if (!item)
97
- item = [];
98
- Array.prototype.push.apply(item, pt.split(/\s/g).map(parseFloat));
99
- }
100
- white();
101
- }
102
- if (item)
103
- list.push(item);
104
- else
105
- return null;
106
- return list.length ? list : null;
107
- }
108
- function point() {
109
- if (!$(/^(point(\sz)?)/i))
110
- return null;
111
- white();
112
- if (!$(/^(\()/))
113
- return null;
114
- const c = coords();
115
- if (!c)
116
- return null;
117
- white();
118
- if (!$(/^(\))/))
119
- return null;
120
- return {
121
- type: 'Point',
122
- coordinates: c[0]
123
- };
124
- }
125
- function multipoint() {
126
- if (!$(/^(multipoint)/i))
127
- return null;
128
- white();
129
- const newCoordsFormat = _.substring(_.indexOf('(') + 1, _.length - 1)
130
- .replace(/\(/g, '')
131
- .replace(/\)/g, '');
132
- _ = 'MULTIPOINT (' + newCoordsFormat + ')';
133
- const c = multicoords();
134
- if (!c)
135
- return null;
136
- white();
137
- return {
138
- type: 'MultiPoint',
139
- coordinates: c
140
- };
141
- }
142
- function multilinestring() {
143
- if (!$(/^(multilinestring)/i))
144
- return null;
145
- white();
146
- const c = multicoords();
147
- if (!c)
148
- return null;
149
- white();
150
- return {
151
- type: 'MultiLineString',
152
- coordinates: c
153
- };
154
- }
155
- function linestring() {
156
- if (!$(/^(linestring(\sz)?)/i))
157
- return null;
158
- white();
159
- if (!$(/^(\()/))
160
- return null;
161
- const c = coords();
162
- if (!c)
163
- return null;
164
- if (!$(/^(\))/))
165
- return null;
166
- return {
167
- type: 'LineString',
168
- coordinates: c
169
- };
170
- }
171
- function polygon() {
172
- if (!$(/^(polygon(\sz)?)/i))
173
- return null;
174
- white();
175
- const c = multicoords();
176
- if (!c)
177
- return null;
178
- return {
179
- type: 'Polygon',
180
- coordinates: c
181
- };
182
- }
183
- function multipolygon() {
184
- if (!$(/^(multipolygon)/i))
185
- return null;
186
- white();
187
- const c = multicoords();
188
- if (!c)
189
- return null;
190
- return {
191
- type: 'MultiPolygon',
192
- coordinates: c
193
- };
194
- }
195
- function geometrycollection() {
196
- const geometries = [];
197
- let geometry;
198
- if (!$(/^(geometrycollection)/i))
199
- return null;
200
- white();
201
- if (!$(/^(\()/))
202
- return null;
203
- while ((geometry = root())) {
204
- geometries.push(geometry);
205
- white();
206
- $(/^(,)/);
207
- white();
208
- }
209
- if (!$(/^(\))/))
210
- return null;
211
- return {
212
- type: 'GeometryCollection',
213
- geometries: geometries
214
- };
215
- }
216
- function root() {
217
- return (point() ||
218
- linestring() ||
219
- polygon() ||
220
- multipoint() ||
221
- multilinestring() ||
222
- multipolygon() ||
223
- geometrycollection());
224
- }
225
- return crs(root());
226
- }
227
- exports.default = parseWKT;
@@ -1,120 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- // Forked from https://github.com/cschwarz/wkx under MIT license, Copyright (c) 2013 Christian Schwarz
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- const LE = true;
6
- const BE = false;
7
- class BinaryWriter {
8
- constructor(size, allowResize) {
9
- this.byteOffset = 0;
10
- this.allowResize = false;
11
- this.arrayBuffer = new ArrayBuffer(size);
12
- this.dataView = new DataView(this.arrayBuffer);
13
- this.byteOffset = 0;
14
- this.allowResize = allowResize || false;
15
- }
16
- writeUInt8(value) {
17
- this._ensureSize(1);
18
- this.dataView.setUint8(this.byteOffset, value);
19
- this.byteOffset += 1;
20
- }
21
- writeUInt16LE(value) {
22
- this._ensureSize(2);
23
- this.dataView.setUint16(this.byteOffset, value, LE);
24
- this.byteOffset += 2;
25
- }
26
- writeUInt16BE(value) {
27
- this._ensureSize(2);
28
- this.dataView.setUint16(this.byteOffset, value, BE);
29
- this.byteOffset += 2;
30
- }
31
- writeUInt32LE(value) {
32
- this._ensureSize(4);
33
- this.dataView.setUint32(this.byteOffset, value, LE);
34
- this.byteOffset += 4;
35
- }
36
- writeUInt32BE(value) {
37
- this._ensureSize(4);
38
- this.dataView.setUint32(this.byteOffset, value, BE);
39
- this.byteOffset += 4;
40
- }
41
- writeInt8(value) {
42
- this._ensureSize(1);
43
- this.dataView.setInt8(this.byteOffset, value);
44
- this.byteOffset += 1;
45
- }
46
- writeInt16LE(value) {
47
- this._ensureSize(2);
48
- this.dataView.setInt16(this.byteOffset, value, LE);
49
- this.byteOffset += 2;
50
- }
51
- writeInt16BE(value) {
52
- this._ensureSize(2);
53
- this.dataView.setInt16(this.byteOffset, value, BE);
54
- this.byteOffset += 2;
55
- }
56
- writeInt32LE(value) {
57
- this._ensureSize(4);
58
- this.dataView.setInt32(this.byteOffset, value, LE);
59
- this.byteOffset += 4;
60
- }
61
- writeInt32BE(value) {
62
- this._ensureSize(4);
63
- this.dataView.setInt32(this.byteOffset, value, BE);
64
- this.byteOffset += 4;
65
- }
66
- writeFloatLE(value) {
67
- this._ensureSize(4);
68
- this.dataView.setFloat32(this.byteOffset, value, LE);
69
- this.byteOffset += 4;
70
- }
71
- writeFloatBE(value) {
72
- this._ensureSize(4);
73
- this.dataView.setFloat32(this.byteOffset, value, BE);
74
- this.byteOffset += 4;
75
- }
76
- writeDoubleLE(value) {
77
- this._ensureSize(8);
78
- this.dataView.setFloat64(this.byteOffset, value, LE);
79
- this.byteOffset += 8;
80
- }
81
- writeDoubleBE(value) {
82
- this._ensureSize(8);
83
- this.dataView.setFloat64(this.byteOffset, value, BE);
84
- this.byteOffset += 8;
85
- }
86
- /** A varint uses a variable number of bytes */
87
- writeVarInt(value) {
88
- // TODO - ensure size?
89
- let length = 1;
90
- while ((value & 0xffffff80) !== 0) {
91
- this.writeUInt8((value & 0x7f) | 0x80);
92
- value >>>= 7;
93
- length++;
94
- }
95
- this.writeUInt8(value & 0x7f);
96
- return length;
97
- }
98
- /** Append another ArrayBuffer to this ArrayBuffer */
99
- writeBuffer(arrayBuffer) {
100
- this._ensureSize(arrayBuffer.byteLength);
101
- const tempArray = new Uint8Array(this.arrayBuffer);
102
- tempArray.set(new Uint8Array(arrayBuffer), this.byteOffset);
103
- this.byteOffset += arrayBuffer.byteLength;
104
- }
105
- /** Resizes this.arrayBuffer if not enough space */
106
- _ensureSize(size) {
107
- if (this.arrayBuffer.byteLength < this.byteOffset + size) {
108
- if (this.allowResize) {
109
- const newArrayBuffer = new ArrayBuffer(this.byteOffset + size);
110
- const tempArray = new Uint8Array(newArrayBuffer);
111
- tempArray.set(new Uint8Array(this.arrayBuffer));
112
- this.arrayBuffer = newArrayBuffer;
113
- }
114
- else {
115
- throw new Error('BinaryWriter overflow');
116
- }
117
- }
118
- }
119
- }
120
- exports.default = BinaryWriter;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VERSION = void 0;
4
- // Version constant cannot be imported, it needs to correspond to the build version of **this** module.
5
- // __VERSION__ is injected by babel-plugin-version-inline
6
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- exports.VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports._typecheckWKBLoader = exports._typecheckWKBWorkerLoader = exports.WKBLoader = exports.WKBWorkerLoader = void 0;
7
- const version_1 = require("./lib/utils/version");
8
- const parse_wkb_1 = __importDefault(require("./lib/parse-wkb"));
9
- /**
10
- * Worker loader for WKB (Well-Known Binary)
11
- */
12
- exports.WKBWorkerLoader = {
13
- name: 'WKB',
14
- id: 'wkb',
15
- module: 'wkt',
16
- version: version_1.VERSION,
17
- worker: true,
18
- category: 'geometry',
19
- extensions: ['wkb'],
20
- mimeTypes: [],
21
- options: {
22
- wkb: {}
23
- }
24
- };
25
- /**
26
- * Loader for WKB (Well-Known Binary)
27
- */
28
- exports.WKBLoader = {
29
- ...exports.WKBWorkerLoader,
30
- parse: async (arrayBuffer) => (0, parse_wkb_1.default)(arrayBuffer),
31
- parseSync: parse_wkb_1.default
32
- };
33
- exports._typecheckWKBWorkerLoader = exports.WKBWorkerLoader;
34
- exports._typecheckWKBLoader = exports.WKBLoader;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WKBWriter = void 0;
7
- const version_1 = require("./lib/utils/version");
8
- const encode_wkb_1 = __importDefault(require("./lib/encode-wkb"));
9
- /**
10
- * WKB exporter
11
- */
12
- exports.WKBWriter = {
13
- name: 'WKB (Well Known Binary)',
14
- id: 'wkb',
15
- module: 'wkt',
16
- version: version_1.VERSION,
17
- extensions: ['wkb'],
18
- // @ts-ignore
19
- encodeSync: encode_wkb_1.default,
20
- options: {
21
- wkb: {
22
- hasZ: false,
23
- hasM: false
24
- }
25
- }
26
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WKTLoader = exports.WKTWorkerLoader = void 0;
7
- const version_1 = require("./lib/utils/version");
8
- const parse_wkt_1 = __importDefault(require("./lib/parse-wkt"));
9
- /**
10
- * Well-Known text loader
11
- */
12
- exports.WKTWorkerLoader = {
13
- name: 'WKT (Well-Known Text)',
14
- id: 'wkt',
15
- module: 'wkt',
16
- version: version_1.VERSION,
17
- worker: true,
18
- extensions: ['wkt'],
19
- mimeTypes: ['text/plain'],
20
- category: 'geometry',
21
- text: true,
22
- options: {
23
- wkt: {}
24
- }
25
- };
26
- /**
27
- * Well-Known text loader
28
- */
29
- exports.WKTLoader = {
30
- ...exports.WKTWorkerLoader,
31
- parse: async (arrayBuffer) => (0, parse_wkt_1.default)(new TextDecoder().decode(arrayBuffer)),
32
- parseTextSync: parse_wkt_1.default
33
- };