@loaders.gl/gis 3.0.13 → 3.0.14

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,13 +1,30 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.geojsonToBinary = geojsonToBinary;
7
9
  exports.TEST_EXPORTS = void 0;
8
10
 
9
- function geojsonToBinary(features, options = {}) {
10
- const firstPassData = firstPass(features);
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+
13
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
14
+
15
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
16
+
17
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
+
19
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
20
+
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+
23
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24
+
25
+ function geojsonToBinary(features) {
26
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
+ var firstPassData = firstPass(features);
11
28
  return secondPass(features, firstPassData, {
12
29
  coordLength: options.coordLength || firstPassData.coordLength,
13
30
  numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,
@@ -15,143 +32,222 @@ function geojsonToBinary(features, options = {}) {
15
32
  });
16
33
  }
17
34
 
18
- const TEST_EXPORTS = {
19
- firstPass,
20
- secondPass
35
+ var TEST_EXPORTS = {
36
+ firstPass: firstPass,
37
+ secondPass: secondPass
21
38
  };
22
39
  exports.TEST_EXPORTS = TEST_EXPORTS;
23
40
 
24
41
  function firstPass(features) {
25
- let pointPositionsCount = 0;
26
- let pointFeaturesCount = 0;
27
- let linePositionsCount = 0;
28
- let linePathsCount = 0;
29
- let lineFeaturesCount = 0;
30
- let polygonPositionsCount = 0;
31
- let polygonObjectsCount = 0;
32
- let polygonRingsCount = 0;
33
- let polygonFeaturesCount = 0;
34
- const coordLengths = new Set();
35
- const numericPropKeys = {};
36
-
37
- for (const feature of features) {
38
- const geometry = feature.geometry;
39
-
40
- switch (geometry.type) {
41
- case 'Point':
42
- pointFeaturesCount++;
43
- pointPositionsCount++;
44
- coordLengths.add(geometry.coordinates.length);
45
- break;
46
-
47
- case 'MultiPoint':
48
- pointFeaturesCount++;
49
- pointPositionsCount += geometry.coordinates.length;
50
-
51
- for (const point of geometry.coordinates) {
52
- coordLengths.add(point.length);
53
- }
54
-
55
- break;
56
-
57
- case 'LineString':
58
- lineFeaturesCount++;
59
- linePositionsCount += geometry.coordinates.length;
60
- linePathsCount++;
61
-
62
- for (const coord of geometry.coordinates) {
63
- coordLengths.add(coord.length);
64
- }
65
-
66
- break;
42
+ var pointPositionsCount = 0;
43
+ var pointFeaturesCount = 0;
44
+ var linePositionsCount = 0;
45
+ var linePathsCount = 0;
46
+ var lineFeaturesCount = 0;
47
+ var polygonPositionsCount = 0;
48
+ var polygonObjectsCount = 0;
49
+ var polygonRingsCount = 0;
50
+ var polygonFeaturesCount = 0;
51
+ var coordLengths = new Set();
52
+ var numericPropKeys = {};
53
+
54
+ var _iterator = _createForOfIteratorHelper(features),
55
+ _step;
56
+
57
+ try {
58
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
59
+ var feature = _step.value;
60
+ var geometry = feature.geometry;
61
+
62
+ switch (geometry.type) {
63
+ case 'Point':
64
+ pointFeaturesCount++;
65
+ pointPositionsCount++;
66
+ coordLengths.add(geometry.coordinates.length);
67
+ break;
68
+
69
+ case 'MultiPoint':
70
+ pointFeaturesCount++;
71
+ pointPositionsCount += geometry.coordinates.length;
72
+
73
+ var _iterator2 = _createForOfIteratorHelper(geometry.coordinates),
74
+ _step2;
75
+
76
+ try {
77
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
78
+ var point = _step2.value;
79
+ coordLengths.add(point.length);
80
+ }
81
+ } catch (err) {
82
+ _iterator2.e(err);
83
+ } finally {
84
+ _iterator2.f();
85
+ }
67
86
 
68
- case 'MultiLineString':
69
- lineFeaturesCount++;
87
+ break;
70
88
 
71
- for (const line of geometry.coordinates) {
72
- linePositionsCount += line.length;
89
+ case 'LineString':
90
+ lineFeaturesCount++;
91
+ linePositionsCount += geometry.coordinates.length;
73
92
  linePathsCount++;
74
93
 
75
- for (const coord of line) {
76
- coordLengths.add(coord.length);
94
+ var _iterator3 = _createForOfIteratorHelper(geometry.coordinates),
95
+ _step3;
96
+
97
+ try {
98
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
99
+ var coord = _step3.value;
100
+ coordLengths.add(coord.length);
101
+ }
102
+ } catch (err) {
103
+ _iterator3.e(err);
104
+ } finally {
105
+ _iterator3.f();
77
106
  }
78
- }
79
-
80
- break;
81
107
 
82
- case 'Polygon':
83
- polygonFeaturesCount++;
84
- polygonObjectsCount++;
85
- polygonRingsCount += geometry.coordinates.length;
86
- polygonPositionsCount += flatten(geometry.coordinates).length;
87
-
88
- for (const coord of flatten(geometry.coordinates)) {
89
- coordLengths.add(coord.length);
90
- }
91
-
92
- break;
108
+ break;
109
+
110
+ case 'MultiLineString':
111
+ lineFeaturesCount++;
112
+
113
+ var _iterator4 = _createForOfIteratorHelper(geometry.coordinates),
114
+ _step4;
115
+
116
+ try {
117
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
118
+ var line = _step4.value;
119
+ linePositionsCount += line.length;
120
+ linePathsCount++;
121
+
122
+ var _iterator5 = _createForOfIteratorHelper(line),
123
+ _step5;
124
+
125
+ try {
126
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
127
+ var _coord = _step5.value;
128
+ coordLengths.add(_coord.length);
129
+ }
130
+ } catch (err) {
131
+ _iterator5.e(err);
132
+ } finally {
133
+ _iterator5.f();
134
+ }
135
+ }
136
+ } catch (err) {
137
+ _iterator4.e(err);
138
+ } finally {
139
+ _iterator4.f();
140
+ }
93
141
 
94
- case 'MultiPolygon':
95
- polygonFeaturesCount++;
142
+ break;
96
143
 
97
- for (const polygon of geometry.coordinates) {
144
+ case 'Polygon':
145
+ polygonFeaturesCount++;
98
146
  polygonObjectsCount++;
99
- polygonRingsCount += polygon.length;
100
- polygonPositionsCount += flatten(polygon).length;
147
+ polygonRingsCount += geometry.coordinates.length;
148
+ polygonPositionsCount += flatten(geometry.coordinates).length;
149
+
150
+ var _iterator6 = _createForOfIteratorHelper(flatten(geometry.coordinates)),
151
+ _step6;
152
+
153
+ try {
154
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
155
+ var _coord2 = _step6.value;
156
+ coordLengths.add(_coord2.length);
157
+ }
158
+ } catch (err) {
159
+ _iterator6.e(err);
160
+ } finally {
161
+ _iterator6.f();
162
+ }
101
163
 
102
- for (const coord of flatten(polygon)) {
103
- coordLengths.add(coord.length);
164
+ break;
165
+
166
+ case 'MultiPolygon':
167
+ polygonFeaturesCount++;
168
+
169
+ var _iterator7 = _createForOfIteratorHelper(geometry.coordinates),
170
+ _step7;
171
+
172
+ try {
173
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
174
+ var polygon = _step7.value;
175
+ polygonObjectsCount++;
176
+ polygonRingsCount += polygon.length;
177
+ polygonPositionsCount += flatten(polygon).length;
178
+
179
+ var _iterator8 = _createForOfIteratorHelper(flatten(polygon)),
180
+ _step8;
181
+
182
+ try {
183
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
184
+ var _coord3 = _step8.value;
185
+ coordLengths.add(_coord3.length);
186
+ }
187
+ } catch (err) {
188
+ _iterator8.e(err);
189
+ } finally {
190
+ _iterator8.f();
191
+ }
192
+ }
193
+ } catch (err) {
194
+ _iterator7.e(err);
195
+ } finally {
196
+ _iterator7.f();
104
197
  }
105
- }
106
198
 
107
- break;
199
+ break;
108
200
 
109
- default:
110
- throw new Error("Unsupported geometry type: ".concat(geometry.type));
111
- }
201
+ default:
202
+ throw new Error("Unsupported geometry type: ".concat(geometry.type));
203
+ }
112
204
 
113
- if (feature.properties) {
114
- for (const key in feature.properties) {
115
- const val = feature.properties[key];
116
- numericPropKeys[key] = numericPropKeys[key] || numericPropKeys[key] === undefined ? isNumeric(val) : numericPropKeys[key];
205
+ if (feature.properties) {
206
+ for (var key in feature.properties) {
207
+ var val = feature.properties[key];
208
+ numericPropKeys[key] = numericPropKeys[key] || numericPropKeys[key] === undefined ? isNumeric(val) : numericPropKeys[key];
209
+ }
117
210
  }
118
211
  }
212
+ } catch (err) {
213
+ _iterator.e(err);
214
+ } finally {
215
+ _iterator.f();
119
216
  }
120
217
 
121
218
  return {
122
- coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,
123
- pointPositionsCount,
124
- pointFeaturesCount,
125
- linePositionsCount,
126
- linePathsCount,
127
- lineFeaturesCount,
128
- polygonPositionsCount,
129
- polygonObjectsCount,
130
- polygonRingsCount,
131
- polygonFeaturesCount,
132
- numericPropKeys: Object.keys(numericPropKeys).filter(k => numericPropKeys[k])
219
+ coordLength: coordLengths.size > 0 ? Math.max.apply(Math, (0, _toConsumableArray2.default)(coordLengths)) : 2,
220
+ pointPositionsCount: pointPositionsCount,
221
+ pointFeaturesCount: pointFeaturesCount,
222
+ linePositionsCount: linePositionsCount,
223
+ linePathsCount: linePathsCount,
224
+ lineFeaturesCount: lineFeaturesCount,
225
+ polygonPositionsCount: polygonPositionsCount,
226
+ polygonObjectsCount: polygonObjectsCount,
227
+ polygonRingsCount: polygonRingsCount,
228
+ polygonFeaturesCount: polygonFeaturesCount,
229
+ numericPropKeys: Object.keys(numericPropKeys).filter(function (k) {
230
+ return numericPropKeys[k];
231
+ })
133
232
  };
134
233
  }
135
234
 
136
235
  function secondPass(features, firstPassData, options) {
137
- const {
138
- pointPositionsCount,
139
- pointFeaturesCount,
140
- linePositionsCount,
141
- linePathsCount,
142
- lineFeaturesCount,
143
- polygonPositionsCount,
144
- polygonObjectsCount,
145
- polygonRingsCount,
146
- polygonFeaturesCount
147
- } = firstPassData;
148
- const {
149
- coordLength,
150
- numericPropKeys,
151
- PositionDataType = Float32Array
152
- } = options;
153
- const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
154
- const points = {
236
+ var pointPositionsCount = firstPassData.pointPositionsCount,
237
+ pointFeaturesCount = firstPassData.pointFeaturesCount,
238
+ linePositionsCount = firstPassData.linePositionsCount,
239
+ linePathsCount = firstPassData.linePathsCount,
240
+ lineFeaturesCount = firstPassData.lineFeaturesCount,
241
+ polygonPositionsCount = firstPassData.polygonPositionsCount,
242
+ polygonObjectsCount = firstPassData.polygonObjectsCount,
243
+ polygonRingsCount = firstPassData.polygonRingsCount,
244
+ polygonFeaturesCount = firstPassData.polygonFeaturesCount;
245
+ var coordLength = options.coordLength,
246
+ numericPropKeys = options.numericPropKeys,
247
+ _options$PositionData = options.PositionDataType,
248
+ PositionDataType = _options$PositionData === void 0 ? Float32Array : _options$PositionData;
249
+ var GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
250
+ var points = {
155
251
  positions: new PositionDataType(pointPositionsCount * coordLength),
156
252
  globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),
157
253
  featureIds: pointFeaturesCount > 65535 ? new Uint32Array(pointPositionsCount) : new Uint16Array(pointPositionsCount),
@@ -159,7 +255,7 @@ function secondPass(features, firstPassData, options) {
159
255
  properties: Array(),
160
256
  fields: Array()
161
257
  };
162
- const lines = {
258
+ var lines = {
163
259
  positions: new PositionDataType(linePositionsCount * coordLength),
164
260
  pathIndices: linePositionsCount > 65535 ? new Uint32Array(linePathsCount + 1) : new Uint16Array(linePathsCount + 1),
165
261
  globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),
@@ -168,7 +264,7 @@ function secondPass(features, firstPassData, options) {
168
264
  properties: Array(),
169
265
  fields: Array()
170
266
  };
171
- const polygons = {
267
+ var polygons = {
172
268
  positions: new PositionDataType(polygonPositionsCount * coordLength),
173
269
  polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
174
270
  primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
@@ -179,16 +275,28 @@ function secondPass(features, firstPassData, options) {
179
275
  fields: Array()
180
276
  };
181
277
 
182
- for (const object of [points, lines, polygons]) {
183
- for (const propName of numericPropKeys || []) {
184
- object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);
278
+ for (var _i = 0, _arr = [points, lines, polygons]; _i < _arr.length; _i++) {
279
+ var object = _arr[_i];
280
+
281
+ var _iterator9 = _createForOfIteratorHelper(numericPropKeys || []),
282
+ _step9;
283
+
284
+ try {
285
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
286
+ var propName = _step9.value;
287
+ object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);
288
+ }
289
+ } catch (err) {
290
+ _iterator9.e(err);
291
+ } finally {
292
+ _iterator9.f();
185
293
  }
186
294
  }
187
295
 
188
296
  lines.pathIndices[linePathsCount] = linePositionsCount;
189
297
  polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;
190
298
  polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;
191
- const indexMap = {
299
+ var indexMap = {
192
300
  pointPosition: 0,
193
301
  pointFeature: 0,
194
302
  linePosition: 0,
@@ -201,52 +309,62 @@ function secondPass(features, firstPassData, options) {
201
309
  feature: 0
202
310
  };
203
311
 
204
- for (const feature of features) {
205
- const geometry = feature.geometry;
206
- const properties = feature.properties || {};
207
-
208
- switch (geometry.type) {
209
- case 'Point':
210
- handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);
211
- points.properties.push(keepStringProperties(properties, numericPropKeys));
212
- indexMap.pointFeature++;
213
- break;
214
-
215
- case 'MultiPoint':
216
- handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);
217
- points.properties.push(keepStringProperties(properties, numericPropKeys));
218
- indexMap.pointFeature++;
219
- break;
220
-
221
- case 'LineString':
222
- handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);
223
- lines.properties.push(keepStringProperties(properties, numericPropKeys));
224
- indexMap.lineFeature++;
225
- break;
226
-
227
- case 'MultiLineString':
228
- handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);
229
- lines.properties.push(keepStringProperties(properties, numericPropKeys));
230
- indexMap.lineFeature++;
231
- break;
232
-
233
- case 'Polygon':
234
- handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);
235
- polygons.properties.push(keepStringProperties(properties, numericPropKeys));
236
- indexMap.polygonFeature++;
237
- break;
238
-
239
- case 'MultiPolygon':
240
- handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);
241
- polygons.properties.push(keepStringProperties(properties, numericPropKeys));
242
- indexMap.polygonFeature++;
243
- break;
244
-
245
- default:
246
- throw new Error('Invalid geometry type');
247
- }
312
+ var _iterator10 = _createForOfIteratorHelper(features),
313
+ _step10;
314
+
315
+ try {
316
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
317
+ var feature = _step10.value;
318
+ var geometry = feature.geometry;
319
+ var properties = feature.properties || {};
320
+
321
+ switch (geometry.type) {
322
+ case 'Point':
323
+ handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);
324
+ points.properties.push(keepStringProperties(properties, numericPropKeys));
325
+ indexMap.pointFeature++;
326
+ break;
327
+
328
+ case 'MultiPoint':
329
+ handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);
330
+ points.properties.push(keepStringProperties(properties, numericPropKeys));
331
+ indexMap.pointFeature++;
332
+ break;
333
+
334
+ case 'LineString':
335
+ handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);
336
+ lines.properties.push(keepStringProperties(properties, numericPropKeys));
337
+ indexMap.lineFeature++;
338
+ break;
339
+
340
+ case 'MultiLineString':
341
+ handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);
342
+ lines.properties.push(keepStringProperties(properties, numericPropKeys));
343
+ indexMap.lineFeature++;
344
+ break;
345
+
346
+ case 'Polygon':
347
+ handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);
348
+ polygons.properties.push(keepStringProperties(properties, numericPropKeys));
349
+ indexMap.polygonFeature++;
350
+ break;
351
+
352
+ case 'MultiPolygon':
353
+ handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);
354
+ polygons.properties.push(keepStringProperties(properties, numericPropKeys));
355
+ indexMap.polygonFeature++;
356
+ break;
357
+
358
+ default:
359
+ throw new Error('Invalid geometry type');
360
+ }
248
361
 
249
- indexMap.feature++;
362
+ indexMap.feature++;
363
+ }
364
+ } catch (err) {
365
+ _iterator10.e(err);
366
+ } finally {
367
+ _iterator10.f();
250
368
  }
251
369
 
252
370
  return makeAccessorObjects(points, lines, polygons, coordLength);
@@ -261,8 +379,18 @@ function handlePoint(coords, points, indexMap, coordLength, properties) {
261
379
  }
262
380
 
263
381
  function handleMultiPoint(coords, points, indexMap, coordLength, properties) {
264
- for (const point of coords) {
265
- handlePoint(point, points, indexMap, coordLength, properties);
382
+ var _iterator11 = _createForOfIteratorHelper(coords),
383
+ _step11;
384
+
385
+ try {
386
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
387
+ var point = _step11.value;
388
+ handlePoint(point, points, indexMap, coordLength, properties);
389
+ }
390
+ } catch (err) {
391
+ _iterator11.e(err);
392
+ } finally {
393
+ _iterator11.f();
266
394
  }
267
395
  }
268
396
 
@@ -270,7 +398,7 @@ function handleLineString(coords, lines, indexMap, coordLength, properties) {
270
398
  lines.pathIndices[indexMap.linePath] = indexMap.linePosition;
271
399
  indexMap.linePath++;
272
400
  fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);
273
- const nPositions = coords.length;
401
+ var nPositions = coords.length;
274
402
  fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
275
403
  lines.globalFeatureIds.set(new Uint32Array(nPositions).fill(indexMap.feature), indexMap.linePosition);
276
404
  lines.featureIds.set(new Uint32Array(nPositions).fill(indexMap.lineFeature), indexMap.linePosition);
@@ -278,8 +406,18 @@ function handleLineString(coords, lines, indexMap, coordLength, properties) {
278
406
  }
279
407
 
280
408
  function handleMultiLineString(coords, lines, indexMap, coordLength, properties) {
281
- for (const line of coords) {
282
- handleLineString(line, lines, indexMap, coordLength, properties);
409
+ var _iterator12 = _createForOfIteratorHelper(coords),
410
+ _step12;
411
+
412
+ try {
413
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
414
+ var line = _step12.value;
415
+ handleLineString(line, lines, indexMap, coordLength, properties);
416
+ }
417
+ } catch (err) {
418
+ _iterator12.e(err);
419
+ } finally {
420
+ _iterator12.f();
283
421
  }
284
422
  }
285
423
 
@@ -287,27 +425,47 @@ function handlePolygon(coords, polygons, indexMap, coordLength, properties) {
287
425
  polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;
288
426
  indexMap.polygonObject++;
289
427
 
290
- for (const ring of coords) {
291
- polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;
292
- indexMap.polygonRing++;
293
- fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);
294
- const nPositions = ring.length;
295
- fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
296
- polygons.globalFeatureIds.set(new Uint32Array(nPositions).fill(indexMap.feature), indexMap.polygonPosition);
297
- polygons.featureIds.set(new Uint32Array(nPositions).fill(indexMap.polygonFeature), indexMap.polygonPosition);
298
- indexMap.polygonPosition += nPositions;
428
+ var _iterator13 = _createForOfIteratorHelper(coords),
429
+ _step13;
430
+
431
+ try {
432
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
433
+ var ring = _step13.value;
434
+ polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;
435
+ indexMap.polygonRing++;
436
+ fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);
437
+ var nPositions = ring.length;
438
+ fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
439
+ polygons.globalFeatureIds.set(new Uint32Array(nPositions).fill(indexMap.feature), indexMap.polygonPosition);
440
+ polygons.featureIds.set(new Uint32Array(nPositions).fill(indexMap.polygonFeature), indexMap.polygonPosition);
441
+ indexMap.polygonPosition += nPositions;
442
+ }
443
+ } catch (err) {
444
+ _iterator13.e(err);
445
+ } finally {
446
+ _iterator13.f();
299
447
  }
300
448
  }
301
449
 
302
450
  function handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {
303
- for (const polygon of coords) {
304
- handlePolygon(polygon, polygons, indexMap, coordLength, properties);
451
+ var _iterator14 = _createForOfIteratorHelper(coords),
452
+ _step14;
453
+
454
+ try {
455
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
456
+ var polygon = _step14.value;
457
+ handlePolygon(polygon, polygons, indexMap, coordLength, properties);
458
+ }
459
+ } catch (err) {
460
+ _iterator14.e(err);
461
+ } finally {
462
+ _iterator14.f();
305
463
  }
306
464
  }
307
465
 
308
466
  function makeAccessorObjects(points, lines, polygons, coordLength) {
309
- const returnObj = {
310
- points: { ...points,
467
+ var returnObj = {
468
+ points: _objectSpread(_objectSpread({}, points), {}, {
311
469
  positions: {
312
470
  value: points.positions,
313
471
  size: coordLength
@@ -321,8 +479,8 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
321
479
  size: 1
322
480
  },
323
481
  type: 'Point'
324
- },
325
- lines: { ...lines,
482
+ }),
483
+ lines: _objectSpread(_objectSpread({}, lines), {}, {
326
484
  pathIndices: {
327
485
  value: lines.pathIndices,
328
486
  size: 1
@@ -340,8 +498,8 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
340
498
  size: 1
341
499
  },
342
500
  type: 'LineString'
343
- },
344
- polygons: { ...polygons,
501
+ }),
502
+ polygons: _objectSpread(_objectSpread({}, polygons), {}, {
345
503
  polygonIndices: {
346
504
  value: polygons.polygonIndices,
347
505
  size: 1
@@ -363,11 +521,11 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
363
521
  size: 1
364
522
  },
365
523
  type: 'Polygon'
366
- }
524
+ })
367
525
  };
368
526
 
369
- for (const geomType in returnObj) {
370
- for (const numericProp in returnObj[geomType].numericProps) {
527
+ for (var geomType in returnObj) {
528
+ for (var numericProp in returnObj[geomType].numericProps) {
371
529
  returnObj[geomType].numericProps[numericProp] = {
372
530
  value: returnObj[geomType].numericProps[numericProp],
373
531
  size: 1
@@ -379,7 +537,7 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
379
537
  }
380
538
 
381
539
  function fillNumericProperties(object, properties, index, length) {
382
- for (const numericPropName in object.numericProps) {
540
+ for (var numericPropName in object.numericProps) {
383
541
  if (numericPropName in properties) {
384
542
  object.numericProps[numericPropName].set(new Array(length).fill(properties[numericPropName]), index);
385
543
  }
@@ -387,9 +545,9 @@ function fillNumericProperties(object, properties, index, length) {
387
545
  }
388
546
 
389
547
  function keepStringProperties(properties, numericKeys) {
390
- const props = {};
548
+ var props = {};
391
549
 
392
- for (const key in properties) {
550
+ for (var key in properties) {
393
551
  if (!numericKeys.includes(key)) {
394
552
  props[key] = properties[key];
395
553
  }
@@ -399,16 +557,28 @@ function keepStringProperties(properties, numericKeys) {
399
557
  }
400
558
 
401
559
  function fillCoords(array, coords, startVertex, coordLength) {
402
- let index = startVertex * coordLength;
560
+ var index = startVertex * coordLength;
561
+
562
+ var _iterator15 = _createForOfIteratorHelper(coords),
563
+ _step15;
403
564
 
404
- for (const coord of coords) {
405
- array.set(coord, index);
406
- index += coordLength;
565
+ try {
566
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
567
+ var coord = _step15.value;
568
+ array.set(coord, index);
569
+ index += coordLength;
570
+ }
571
+ } catch (err) {
572
+ _iterator15.e(err);
573
+ } finally {
574
+ _iterator15.f();
407
575
  }
408
576
  }
409
577
 
410
578
  function flatten(arrays) {
411
- return [].concat(...arrays);
579
+ var _ref;
580
+
581
+ return (_ref = []).concat.apply(_ref, (0, _toConsumableArray2.default)(arrays));
412
582
  }
413
583
 
414
584
  function isNumeric(x) {