@loaders.gl/wkt 4.2.0-alpha.4 → 4.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/dist.dev.js +133 -220
  2. package/dist/dist.min.js +10 -0
  3. package/dist/hex-wkb-loader.d.ts +1 -1
  4. package/dist/hex-wkb-loader.d.ts.map +1 -1
  5. package/dist/hex-wkb-loader.js +44 -28
  6. package/dist/index.cjs +77 -58
  7. package/dist/index.cjs.map +7 -0
  8. package/dist/index.d.ts +14 -14
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +4 -1
  11. package/dist/lib/encode-twkb.js +158 -143
  12. package/dist/lib/encode-wkb.js +247 -211
  13. package/dist/lib/encode-wkt-crs.d.ts +1 -1
  14. package/dist/lib/encode-wkt-crs.d.ts.map +1 -1
  15. package/dist/lib/encode-wkt-crs.js +32 -18
  16. package/dist/lib/encode-wkt.js +35 -27
  17. package/dist/lib/parse-hex-wkb.js +1 -2
  18. package/dist/lib/parse-twkb.js +215 -218
  19. package/dist/lib/parse-wkb-header.js +124 -95
  20. package/dist/lib/parse-wkb.d.ts +1 -1
  21. package/dist/lib/parse-wkb.d.ts.map +1 -1
  22. package/dist/lib/parse-wkb.js +210 -235
  23. package/dist/lib/parse-wkt-crs.js +110 -86
  24. package/dist/lib/parse-wkt.js +251 -185
  25. package/dist/lib/utils/base64-encoder.js +151 -5
  26. package/dist/lib/utils/binary-reader.js +63 -64
  27. package/dist/lib/utils/binary-writer.js +115 -109
  28. package/dist/lib/utils/hex-encoder.js +46 -32
  29. package/dist/lib/utils/hex-transcoder.js +40 -24
  30. package/dist/lib/utils/version.js +6 -1
  31. package/dist/twkb-loader.js +26 -17
  32. package/dist/twkb-writer.js +18 -13
  33. package/dist/wkb-loader.js +26 -17
  34. package/dist/wkb-writer.js +22 -17
  35. package/dist/wkt-crs-loader.d.ts +1 -1
  36. package/dist/wkt-crs-loader.d.ts.map +1 -1
  37. package/dist/wkt-crs-loader.js +22 -15
  38. package/dist/wkt-crs-writer.d.ts +2 -2
  39. package/dist/wkt-crs-writer.d.ts.map +1 -1
  40. package/dist/wkt-crs-writer.js +23 -15
  41. package/dist/wkt-loader.js +28 -20
  42. package/dist/wkt-writer.js +19 -14
  43. package/dist/workers/wkb-worker.js +3 -1
  44. package/dist/workers/wkt-worker.js +3 -1
  45. package/package.json +10 -6
  46. package/dist/hex-wkb-loader.js.map +0 -1
  47. package/dist/index.js.map +0 -1
  48. package/dist/lib/encode-twkb.js.map +0 -1
  49. package/dist/lib/encode-wkb.js.map +0 -1
  50. package/dist/lib/encode-wkt-crs.js.map +0 -1
  51. package/dist/lib/encode-wkt.js.map +0 -1
  52. package/dist/lib/parse-hex-wkb.js.map +0 -1
  53. package/dist/lib/parse-twkb.js.map +0 -1
  54. package/dist/lib/parse-wkb-header.js.map +0 -1
  55. package/dist/lib/parse-wkb.js.map +0 -1
  56. package/dist/lib/parse-wkt-crs.js.map +0 -1
  57. package/dist/lib/parse-wkt.js.map +0 -1
  58. package/dist/lib/utils/base64-encoder.js.map +0 -1
  59. package/dist/lib/utils/binary-reader.js.map +0 -1
  60. package/dist/lib/utils/binary-writer.js.map +0 -1
  61. package/dist/lib/utils/hex-encoder.js.map +0 -1
  62. package/dist/lib/utils/hex-transcoder.js.map +0 -1
  63. package/dist/lib/utils/version.js.map +0 -1
  64. package/dist/twkb-loader.js.map +0 -1
  65. package/dist/twkb-writer.js.map +0 -1
  66. package/dist/wkb-loader.js.map +0 -1
  67. package/dist/wkb-writer.js.map +0 -1
  68. package/dist/wkt-crs-loader.js.map +0 -1
  69. package/dist/wkt-crs-writer.js.map +0 -1
  70. package/dist/wkt-loader.js.map +0 -1
  71. package/dist/wkt-writer.js.map +0 -1
  72. package/dist/workers/wkb-worker.js.map +0 -1
  73. package/dist/workers/wkt-worker.js.map +0 -1
@@ -1,256 +1,253 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ // Forked from https://github.com/cschwarz/wkx under MIT license, Copyright (c) 2013 Christian Schwarz
1
5
  import { BinaryReader } from "./utils/binary-reader.js";
2
6
  import { WKBGeometryType } from "./parse-wkb-header.js";
7
+ /**
8
+ * Check if an array buffer might be a TWKB array buffer
9
+ * @param arrayBuffer The array buffer to check
10
+ * @returns false if this is definitely not a TWKB array buffer, true if it might be a TWKB array buffer
11
+ */
3
12
  export function isTWKB(arrayBuffer) {
4
- const binaryReader = new BinaryReader(arrayBuffer);
5
- const type = binaryReader.readUInt8();
6
- const geometryType = type & 0x0f;
7
- if (geometryType < 1 || geometryType > 7) {
8
- return false;
9
- }
10
- return true;
13
+ const binaryReader = new BinaryReader(arrayBuffer);
14
+ const type = binaryReader.readUInt8();
15
+ const geometryType = type & 0x0f;
16
+ // Only geometry types 1 to 7 (point to geometry collection are currently defined)
17
+ if (geometryType < 1 || geometryType > 7) {
18
+ return false;
19
+ }
20
+ return true;
11
21
  }
12
22
  export function parseTWKBGeometry(arrayBuffer) {
13
- const binaryReader = new BinaryReader(arrayBuffer);
14
- const context = parseTWKBHeader(binaryReader);
15
- if (context.hasSizeAttribute) {
16
- binaryReader.readVarInt();
17
- }
18
- if (context.hasBoundingBox) {
19
- let dimensions = 2;
20
- if (context.hasZ) {
21
- dimensions++;
22
- }
23
- if (context.hasM) {
24
- dimensions++;
23
+ const binaryReader = new BinaryReader(arrayBuffer);
24
+ const context = parseTWKBHeader(binaryReader);
25
+ if (context.hasSizeAttribute) {
26
+ binaryReader.readVarInt();
25
27
  }
26
- for (let i = 0; i < dimensions; i++) {
27
- binaryReader.readVarInt();
28
- binaryReader.readVarInt();
28
+ if (context.hasBoundingBox) {
29
+ let dimensions = 2;
30
+ if (context.hasZ) {
31
+ dimensions++;
32
+ }
33
+ if (context.hasM) {
34
+ dimensions++;
35
+ }
36
+ // TODO why are we throwing away these datums?
37
+ for (let i = 0; i < dimensions; i++) {
38
+ binaryReader.readVarInt();
39
+ binaryReader.readVarInt();
40
+ }
29
41
  }
30
- }
31
- return parseGeometry(binaryReader, context, context.geometryType);
42
+ return parseGeometry(binaryReader, context, context.geometryType);
32
43
  }
33
44
  function parseTWKBHeader(binaryReader) {
34
- const type = binaryReader.readUInt8();
35
- const metadataHeader = binaryReader.readUInt8();
36
- const geometryType = type & 0x0f;
37
- const precision = zigZagDecode(type >> 4);
38
- const hasExtendedPrecision = Boolean(metadataHeader >> 3 & 1);
39
- let hasZ = false;
40
- let hasM = false;
41
- let zPrecision = 0;
42
- let zPrecisionFactor = 1;
43
- let mPrecision = 0;
44
- let mPrecisionFactor = 1;
45
- if (hasExtendedPrecision) {
46
- const extendedPrecision = binaryReader.readUInt8();
47
- hasZ = (extendedPrecision & 0x01) === 0x01;
48
- hasM = (extendedPrecision & 0x02) === 0x02;
49
- zPrecision = zigZagDecode((extendedPrecision & 0x1c) >> 2);
50
- zPrecisionFactor = Math.pow(10, zPrecision);
51
- mPrecision = zigZagDecode((extendedPrecision & 0xe0) >> 5);
52
- mPrecisionFactor = Math.pow(10, mPrecision);
53
- }
54
- return {
55
- geometryType,
56
- precision,
57
- precisionFactor: Math.pow(10, precision),
58
- hasBoundingBox: Boolean(metadataHeader >> 0 & 1),
59
- hasSizeAttribute: Boolean(metadataHeader >> 1 & 1),
60
- hasIdList: Boolean(metadataHeader >> 2 & 1),
61
- hasExtendedPrecision,
62
- isEmpty: Boolean(metadataHeader >> 4 & 1),
63
- hasZ,
64
- hasM,
65
- zPrecision,
66
- zPrecisionFactor,
67
- mPrecision,
68
- mPrecisionFactor
69
- };
45
+ const type = binaryReader.readUInt8();
46
+ const metadataHeader = binaryReader.readUInt8();
47
+ const geometryType = type & 0x0f;
48
+ const precision = zigZagDecode(type >> 4);
49
+ const hasExtendedPrecision = Boolean((metadataHeader >> 3) & 1);
50
+ let hasZ = false;
51
+ let hasM = false;
52
+ let zPrecision = 0;
53
+ let zPrecisionFactor = 1;
54
+ let mPrecision = 0;
55
+ let mPrecisionFactor = 1;
56
+ if (hasExtendedPrecision) {
57
+ const extendedPrecision = binaryReader.readUInt8();
58
+ hasZ = (extendedPrecision & 0x01) === 0x01;
59
+ hasM = (extendedPrecision & 0x02) === 0x02;
60
+ zPrecision = zigZagDecode((extendedPrecision & 0x1c) >> 2);
61
+ zPrecisionFactor = Math.pow(10, zPrecision);
62
+ mPrecision = zigZagDecode((extendedPrecision & 0xe0) >> 5);
63
+ mPrecisionFactor = Math.pow(10, mPrecision);
64
+ }
65
+ return {
66
+ geometryType,
67
+ precision,
68
+ precisionFactor: Math.pow(10, precision),
69
+ hasBoundingBox: Boolean((metadataHeader >> 0) & 1),
70
+ hasSizeAttribute: Boolean((metadataHeader >> 1) & 1),
71
+ hasIdList: Boolean((metadataHeader >> 2) & 1),
72
+ hasExtendedPrecision,
73
+ isEmpty: Boolean((metadataHeader >> 4) & 1),
74
+ hasZ,
75
+ hasM,
76
+ zPrecision,
77
+ zPrecisionFactor,
78
+ mPrecision,
79
+ mPrecisionFactor
80
+ };
70
81
  }
71
82
  function parseGeometry(binaryReader, context, geometryType) {
72
- switch (geometryType) {
73
- case WKBGeometryType.Point:
74
- return parsePoint(binaryReader, context);
75
- case WKBGeometryType.LineString:
76
- return parseLineString(binaryReader, context);
77
- case WKBGeometryType.Polygon:
78
- return parsePolygon(binaryReader, context);
79
- case WKBGeometryType.MultiPoint:
80
- return parseMultiPoint(binaryReader, context);
81
- case WKBGeometryType.MultiLineString:
82
- return parseMultiLineString(binaryReader, context);
83
- case WKBGeometryType.MultiPolygon:
84
- return parseMultiPolygon(binaryReader, context);
85
- case WKBGeometryType.GeometryCollection:
86
- return parseGeometryCollection(binaryReader, context);
87
- default:
88
- throw new Error(`GeometryType ${geometryType} not supported`);
89
- }
83
+ switch (geometryType) {
84
+ case WKBGeometryType.Point:
85
+ return parsePoint(binaryReader, context);
86
+ case WKBGeometryType.LineString:
87
+ return parseLineString(binaryReader, context);
88
+ case WKBGeometryType.Polygon:
89
+ return parsePolygon(binaryReader, context);
90
+ case WKBGeometryType.MultiPoint:
91
+ return parseMultiPoint(binaryReader, context);
92
+ case WKBGeometryType.MultiLineString:
93
+ return parseMultiLineString(binaryReader, context);
94
+ case WKBGeometryType.MultiPolygon:
95
+ return parseMultiPolygon(binaryReader, context);
96
+ case WKBGeometryType.GeometryCollection:
97
+ return parseGeometryCollection(binaryReader, context);
98
+ default:
99
+ throw new Error(`GeometryType ${geometryType} not supported`);
100
+ }
90
101
  }
102
+ // GEOMETRIES
91
103
  function parsePoint(reader, context) {
92
- if (context.isEmpty) {
93
- return {
94
- type: 'Point',
95
- coordinates: []
96
- };
97
- }
98
- return {
99
- type: 'Point',
100
- coordinates: readFirstPoint(reader, context)
101
- };
104
+ if (context.isEmpty) {
105
+ return { type: 'Point', coordinates: [] };
106
+ }
107
+ return { type: 'Point', coordinates: readFirstPoint(reader, context) };
102
108
  }
103
109
  function parseLineString(reader, context) {
104
- if (context.isEmpty) {
105
- return {
106
- type: 'LineString',
107
- coordinates: []
108
- };
109
- }
110
- const pointCount = reader.readVarInt();
111
- const previousPoint = makePreviousPoint(context);
112
- const points = [];
113
- for (let i = 0; i < pointCount; i++) {
114
- points.push(parseNextPoint(reader, context, previousPoint));
115
- }
116
- return {
117
- type: 'LineString',
118
- coordinates: points
119
- };
110
+ if (context.isEmpty) {
111
+ return { type: 'LineString', coordinates: [] };
112
+ }
113
+ const pointCount = reader.readVarInt();
114
+ const previousPoint = makePreviousPoint(context);
115
+ const points = [];
116
+ for (let i = 0; i < pointCount; i++) {
117
+ points.push(parseNextPoint(reader, context, previousPoint));
118
+ }
119
+ return { type: 'LineString', coordinates: points };
120
120
  }
121
121
  function parsePolygon(reader, context) {
122
- if (context.isEmpty) {
123
- return {
124
- type: 'Polygon',
125
- coordinates: []
126
- };
127
- }
128
- const ringCount = reader.readVarInt();
129
- const previousPoint = makePreviousPoint(context);
130
- const exteriorRingLength = reader.readVarInt();
131
- const exteriorRing = [];
132
- for (let i = 0; i < exteriorRingLength; i++) {
133
- exteriorRing.push(parseNextPoint(reader, context, previousPoint));
134
- }
135
- const polygon = [exteriorRing];
136
- for (let i = 1; i < ringCount; i++) {
137
- const interiorRingCount = reader.readVarInt();
138
- const interiorRing = [];
139
- for (let j = 0; j < interiorRingCount; j++) {
140
- interiorRing.push(parseNextPoint(reader, context, previousPoint));
122
+ if (context.isEmpty) {
123
+ return { type: 'Polygon', coordinates: [] };
124
+ }
125
+ const ringCount = reader.readVarInt();
126
+ const previousPoint = makePreviousPoint(context);
127
+ const exteriorRingLength = reader.readVarInt();
128
+ const exteriorRing = [];
129
+ for (let i = 0; i < exteriorRingLength; i++) {
130
+ exteriorRing.push(parseNextPoint(reader, context, previousPoint));
131
+ }
132
+ const polygon = [exteriorRing];
133
+ for (let i = 1; i < ringCount; i++) {
134
+ const interiorRingCount = reader.readVarInt();
135
+ const interiorRing = [];
136
+ for (let j = 0; j < interiorRingCount; j++) {
137
+ interiorRing.push(parseNextPoint(reader, context, previousPoint));
138
+ }
139
+ polygon.push(interiorRing);
141
140
  }
142
- polygon.push(interiorRing);
143
- }
144
- return {
145
- type: 'Polygon',
146
- coordinates: polygon
147
- };
141
+ return { type: 'Polygon', coordinates: polygon };
148
142
  }
149
143
  function parseMultiPoint(reader, context) {
150
- if (context.isEmpty) {
151
- return {
152
- type: 'MultiPoint',
153
- coordinates: []
154
- };
155
- }
156
- const previousPoint = makePreviousPoint(context);
157
- const pointCount = reader.readVarInt();
158
- const coordinates = [];
159
- for (let i = 0; i < pointCount; i++) {
160
- coordinates.push(parseNextPoint(reader, context, previousPoint));
161
- }
162
- return {
163
- type: 'MultiPoint',
164
- coordinates
165
- };
144
+ if (context.isEmpty) {
145
+ return { type: 'MultiPoint', coordinates: [] };
146
+ }
147
+ const previousPoint = makePreviousPoint(context);
148
+ const pointCount = reader.readVarInt();
149
+ const coordinates = [];
150
+ for (let i = 0; i < pointCount; i++) {
151
+ coordinates.push(parseNextPoint(reader, context, previousPoint));
152
+ }
153
+ return { type: 'MultiPoint', coordinates };
166
154
  }
167
155
  function parseMultiLineString(reader, context) {
168
- if (context.isEmpty) {
169
- return {
170
- type: 'MultiLineString',
171
- coordinates: []
172
- };
173
- }
174
- const previousPoint = makePreviousPoint(context);
175
- const lineStringCount = reader.readVarInt();
176
- const coordinates = [];
177
- for (let i = 0; i < lineStringCount; i++) {
178
- const pointCount = reader.readVarInt();
179
- const lineString = [];
180
- for (let j = 0; j < pointCount; j++) {
181
- lineString.push(parseNextPoint(reader, context, previousPoint));
156
+ if (context.isEmpty) {
157
+ return { type: 'MultiLineString', coordinates: [] };
158
+ }
159
+ const previousPoint = makePreviousPoint(context);
160
+ const lineStringCount = reader.readVarInt();
161
+ const coordinates = [];
162
+ for (let i = 0; i < lineStringCount; i++) {
163
+ const pointCount = reader.readVarInt();
164
+ const lineString = [];
165
+ for (let j = 0; j < pointCount; j++) {
166
+ lineString.push(parseNextPoint(reader, context, previousPoint));
167
+ }
168
+ coordinates.push(lineString);
182
169
  }
183
- coordinates.push(lineString);
184
- }
185
- return {
186
- type: 'MultiLineString',
187
- coordinates
188
- };
170
+ return { type: 'MultiLineString', coordinates };
189
171
  }
190
172
  function parseMultiPolygon(reader, context) {
191
- if (context.isEmpty) {
192
- return {
193
- type: 'MultiPolygon',
194
- coordinates: []
195
- };
196
- }
197
- const previousPoint = makePreviousPoint(context);
198
- const polygonCount = reader.readVarInt();
199
- const polygons = [];
200
- for (let i = 0; i < polygonCount; i++) {
201
- const ringCount = reader.readVarInt();
202
- const exteriorPointCount = reader.readVarInt();
203
- const exteriorRing = [];
204
- for (let j = 0; j < exteriorPointCount; j++) {
205
- exteriorRing.push(parseNextPoint(reader, context, previousPoint));
173
+ if (context.isEmpty) {
174
+ return { type: 'MultiPolygon', coordinates: [] };
206
175
  }
207
- const polygon = exteriorRing ? [exteriorRing] : [];
208
- for (let j = 1; j < ringCount; j++) {
209
- const interiorRing = [];
210
- const interiorRingLength = reader.readVarInt();
211
- for (let k = 0; k < interiorRingLength; k++) {
212
- interiorRing.push(parseNextPoint(reader, context, previousPoint));
213
- }
214
- polygon.push(interiorRing);
176
+ const previousPoint = makePreviousPoint(context);
177
+ const polygonCount = reader.readVarInt();
178
+ const polygons = [];
179
+ for (let i = 0; i < polygonCount; i++) {
180
+ const ringCount = reader.readVarInt();
181
+ const exteriorPointCount = reader.readVarInt();
182
+ const exteriorRing = [];
183
+ for (let j = 0; j < exteriorPointCount; j++) {
184
+ exteriorRing.push(parseNextPoint(reader, context, previousPoint));
185
+ }
186
+ const polygon = exteriorRing ? [exteriorRing] : [];
187
+ for (let j = 1; j < ringCount; j++) {
188
+ const interiorRing = [];
189
+ const interiorRingLength = reader.readVarInt();
190
+ for (let k = 0; k < interiorRingLength; k++) {
191
+ interiorRing.push(parseNextPoint(reader, context, previousPoint));
192
+ }
193
+ polygon.push(interiorRing);
194
+ }
195
+ polygons.push(polygon);
215
196
  }
216
- polygons.push(polygon);
217
- }
218
- return {
219
- type: 'MultiPolygon',
220
- coordinates: polygons
221
- };
197
+ return { type: 'MultiPolygon', coordinates: polygons };
222
198
  }
199
+ /** Geometry collection not yet supported */
223
200
  function parseGeometryCollection(reader, context) {
224
- return {
225
- type: 'GeometryCollection',
226
- geometries: []
227
- };
228
- }
201
+ return { type: 'GeometryCollection', geometries: [] };
202
+ /**
203
+ if (context.isEmpty) {
204
+ return {type: 'GeometryCollection', geometries: []};
205
+ }
206
+
207
+ const geometryCount = reader.readVarInt();
208
+
209
+ const geometries: Geometry[] = new Array(geometryCount);
210
+ for (let i = 0; i < geometryCount; i++) {
211
+ const geometry = parseGeometry(reader, context, geometryType);
212
+ geometries.push(geometry);
213
+ }
214
+
215
+ return {type: 'GeometryCollection', geometries: []};
216
+ */
217
+ }
218
+ // HELPERS
219
+ /**
220
+ * Maps negative values to positive values while going back and
221
+ forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
222
+ */
229
223
  function zigZagDecode(value) {
230
- return value >> 1 ^ -(value & 1);
224
+ return (value >> 1) ^ -(value & 1);
231
225
  }
232
226
  function makePointCoordinates(x, y, z, m) {
233
- return z !== undefined ? m !== undefined ? [x, y, z, m] : [x, y, z] : [x, y];
227
+ return (z !== undefined ? (m !== undefined ? [x, y, z, m] : [x, y, z]) : [x, y]);
234
228
  }
235
229
  function makePreviousPoint(context) {
236
- return makePointCoordinates(0, 0, context.hasZ ? 0 : undefined, context.hasM ? 0 : undefined);
230
+ return makePointCoordinates(0, 0, context.hasZ ? 0 : undefined, context.hasM ? 0 : undefined);
237
231
  }
238
232
  function readFirstPoint(reader, context) {
239
- const x = zigZagDecode(reader.readVarInt()) / context.precisionFactor;
240
- const y = zigZagDecode(reader.readVarInt()) / context.precisionFactor;
241
- const z = context.hasZ ? zigZagDecode(reader.readVarInt()) / context.zPrecisionFactor : undefined;
242
- const m = context.hasM ? zigZagDecode(reader.readVarInt()) / context.mPrecisionFactor : undefined;
243
- return makePointCoordinates(x, y, z, m);
244
- }
233
+ const x = zigZagDecode(reader.readVarInt()) / context.precisionFactor;
234
+ const y = zigZagDecode(reader.readVarInt()) / context.precisionFactor;
235
+ const z = context.hasZ ? zigZagDecode(reader.readVarInt()) / context.zPrecisionFactor : undefined;
236
+ const m = context.hasM ? zigZagDecode(reader.readVarInt()) / context.mPrecisionFactor : undefined;
237
+ return makePointCoordinates(x, y, z, m);
238
+ }
239
+ /**
240
+ * Modifies previousPoint
241
+ */
245
242
  function parseNextPoint(reader, context, previousPoint) {
246
- previousPoint[0] += zigZagDecode(reader.readVarInt()) / context.precisionFactor;
247
- previousPoint[1] += zigZagDecode(reader.readVarInt()) / context.precisionFactor;
248
- if (context.hasZ) {
249
- previousPoint[2] += zigZagDecode(reader.readVarInt()) / context.zPrecisionFactor;
250
- }
251
- if (context.hasM) {
252
- previousPoint[3] += zigZagDecode(reader.readVarInt()) / context.mPrecisionFactor;
253
- }
254
- return previousPoint.slice();
243
+ previousPoint[0] += zigZagDecode(reader.readVarInt()) / context.precisionFactor;
244
+ previousPoint[1] += zigZagDecode(reader.readVarInt()) / context.precisionFactor;
245
+ if (context.hasZ) {
246
+ previousPoint[2] += zigZagDecode(reader.readVarInt()) / context.zPrecisionFactor;
247
+ }
248
+ if (context.hasM) {
249
+ previousPoint[3] += zigZagDecode(reader.readVarInt()) / context.mPrecisionFactor;
250
+ }
251
+ // Copy the point
252
+ return previousPoint.slice();
255
253
  }
256
- //# sourceMappingURL=parse-twkb.js.map