@loaders.gl/gis 3.1.3 → 4.0.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 (54) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/bundle.js.map +1 -0
  3. package/dist/index.js +6 -18
  4. package/dist/index.js.map +1 -0
  5. package/dist/lib/binary-to-geojson.js +242 -201
  6. package/dist/lib/binary-to-geojson.js.map +1 -0
  7. package/dist/lib/extract-geometry-info.js +102 -93
  8. package/dist/lib/extract-geometry-info.js.map +1 -0
  9. package/dist/lib/flat-geojson-to-binary-types.js +2 -2
  10. package/dist/{es5/lib → lib}/flat-geojson-to-binary-types.js.map +0 -0
  11. package/dist/lib/flat-geojson-to-binary.js +309 -345
  12. package/dist/lib/flat-geojson-to-binary.js.map +1 -0
  13. package/dist/lib/geojson-to-binary.js +20 -23
  14. package/dist/lib/geojson-to-binary.js.map +1 -0
  15. package/dist/lib/geojson-to-flat-geojson.js +104 -116
  16. package/dist/lib/geojson-to-flat-geojson.js.map +1 -0
  17. package/dist/lib/transform.js +42 -51
  18. package/dist/lib/transform.js.map +1 -0
  19. package/package.json +6 -6
  20. package/dist/es5/bundle.js +0 -7
  21. package/dist/es5/bundle.js.map +0 -1
  22. package/dist/es5/index.js +0 -64
  23. package/dist/es5/index.js.map +0 -1
  24. package/dist/es5/lib/binary-to-geojson.js +0 -330
  25. package/dist/es5/lib/binary-to-geojson.js.map +0 -1
  26. package/dist/es5/lib/extract-geometry-info.js +0 -204
  27. package/dist/es5/lib/extract-geometry-info.js.map +0 -1
  28. package/dist/es5/lib/flat-geojson-to-binary-types.js +0 -2
  29. package/dist/es5/lib/flat-geojson-to-binary.js +0 -397
  30. package/dist/es5/lib/flat-geojson-to-binary.js.map +0 -1
  31. package/dist/es5/lib/geojson-to-binary.js +0 -30
  32. package/dist/es5/lib/geojson-to-binary.js.map +0 -1
  33. package/dist/es5/lib/geojson-to-flat-geojson.js +0 -169
  34. package/dist/es5/lib/geojson-to-flat-geojson.js.map +0 -1
  35. package/dist/es5/lib/transform.js +0 -73
  36. package/dist/es5/lib/transform.js.map +0 -1
  37. package/dist/esm/bundle.js +0 -5
  38. package/dist/esm/bundle.js.map +0 -1
  39. package/dist/esm/index.js +0 -6
  40. package/dist/esm/index.js.map +0 -1
  41. package/dist/esm/lib/binary-to-geojson.js +0 -274
  42. package/dist/esm/lib/binary-to-geojson.js.map +0 -1
  43. package/dist/esm/lib/extract-geometry-info.js +0 -105
  44. package/dist/esm/lib/extract-geometry-info.js.map +0 -1
  45. package/dist/esm/lib/flat-geojson-to-binary-types.js +0 -2
  46. package/dist/esm/lib/flat-geojson-to-binary-types.js.map +0 -1
  47. package/dist/esm/lib/flat-geojson-to-binary.js +0 -339
  48. package/dist/esm/lib/flat-geojson-to-binary.js.map +0 -1
  49. package/dist/esm/lib/geojson-to-binary.js +0 -21
  50. package/dist/esm/lib/geojson-to-binary.js.map +0 -1
  51. package/dist/esm/lib/geojson-to-flat-geojson.js +0 -116
  52. package/dist/esm/lib/geojson-to-flat-geojson.js.map +0 -1
  53. package/dist/esm/lib/transform.js +0 -50
  54. package/dist/esm/lib/transform.js.map +0 -1
@@ -1,397 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.flatGeojsonToBinary = flatGeojsonToBinary;
9
- exports.TEST_EXPORTS = void 0;
10
-
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
-
13
- var _polygon = require("@math.gl/polygon");
14
-
15
- 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; } } }; }
16
-
17
- 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); }
18
-
19
- 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; }
20
-
21
- 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; }
22
-
23
- 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; }
24
-
25
- function flatGeojsonToBinary(features, geometryInfo, options) {
26
- var propArrayTypes = extractNumericPropTypes(features);
27
- var numericPropKeys = Object.keys(propArrayTypes).filter(function (k) {
28
- return propArrayTypes[k] !== Array;
29
- });
30
- return fillArrays(features, _objectSpread({
31
- propArrayTypes: propArrayTypes
32
- }, geometryInfo), {
33
- numericPropKeys: options && options.numericPropKeys || numericPropKeys,
34
- PositionDataType: options ? options.PositionDataType : Float32Array
35
- });
36
- }
37
-
38
- var TEST_EXPORTS = {
39
- extractNumericPropTypes: extractNumericPropTypes
40
- };
41
- exports.TEST_EXPORTS = TEST_EXPORTS;
42
-
43
- function extractNumericPropTypes(features) {
44
- var propArrayTypes = {};
45
-
46
- var _iterator = _createForOfIteratorHelper(features),
47
- _step;
48
-
49
- try {
50
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
51
- var feature = _step.value;
52
-
53
- if (feature.properties) {
54
- for (var _key in feature.properties) {
55
- var val = feature.properties[_key];
56
- propArrayTypes[_key] = deduceArrayType(val, propArrayTypes[_key]);
57
- }
58
- }
59
- }
60
- } catch (err) {
61
- _iterator.e(err);
62
- } finally {
63
- _iterator.f();
64
- }
65
-
66
- return propArrayTypes;
67
- }
68
-
69
- function fillArrays(features, geometryInfo, options) {
70
- var pointPositionsCount = geometryInfo.pointPositionsCount,
71
- pointFeaturesCount = geometryInfo.pointFeaturesCount,
72
- linePositionsCount = geometryInfo.linePositionsCount,
73
- linePathsCount = geometryInfo.linePathsCount,
74
- lineFeaturesCount = geometryInfo.lineFeaturesCount,
75
- polygonPositionsCount = geometryInfo.polygonPositionsCount,
76
- polygonObjectsCount = geometryInfo.polygonObjectsCount,
77
- polygonRingsCount = geometryInfo.polygonRingsCount,
78
- polygonFeaturesCount = geometryInfo.polygonFeaturesCount,
79
- propArrayTypes = geometryInfo.propArrayTypes,
80
- coordLength = geometryInfo.coordLength;
81
- var _options$numericPropK = options.numericPropKeys,
82
- numericPropKeys = _options$numericPropK === void 0 ? [] : _options$numericPropK,
83
- _options$PositionData = options.PositionDataType,
84
- PositionDataType = _options$PositionData === void 0 ? Float32Array : _options$PositionData;
85
- var hasGlobalId = features[0] && 'id' in features[0];
86
- var GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
87
- var points = {
88
- type: 'Point',
89
- positions: new PositionDataType(pointPositionsCount * coordLength),
90
- globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),
91
- featureIds: pointFeaturesCount > 65535 ? new Uint32Array(pointPositionsCount) : new Uint16Array(pointPositionsCount),
92
- numericProps: {},
93
- properties: [],
94
- fields: []
95
- };
96
- var lines = {
97
- type: 'LineString',
98
- pathIndices: linePositionsCount > 65535 ? new Uint32Array(linePathsCount + 1) : new Uint16Array(linePathsCount + 1),
99
- positions: new PositionDataType(linePositionsCount * coordLength),
100
- globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),
101
- featureIds: lineFeaturesCount > 65535 ? new Uint32Array(linePositionsCount) : new Uint16Array(linePositionsCount),
102
- numericProps: {},
103
- properties: [],
104
- fields: []
105
- };
106
- var polygons = {
107
- type: 'Polygon',
108
- polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
109
- primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
110
- positions: new PositionDataType(polygonPositionsCount * coordLength),
111
- triangles: [],
112
- globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
113
- featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
114
- numericProps: {},
115
- properties: [],
116
- fields: []
117
- };
118
-
119
- for (var _i = 0, _arr = [points, lines, polygons]; _i < _arr.length; _i++) {
120
- var object = _arr[_i];
121
-
122
- var _iterator2 = _createForOfIteratorHelper(numericPropKeys),
123
- _step2;
124
-
125
- try {
126
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
127
- var propName = _step2.value;
128
- var T = propArrayTypes[propName];
129
- object.numericProps[propName] = new T(object.positions.length / coordLength);
130
- }
131
- } catch (err) {
132
- _iterator2.e(err);
133
- } finally {
134
- _iterator2.f();
135
- }
136
- }
137
-
138
- lines.pathIndices[linePathsCount] = linePositionsCount;
139
- polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;
140
- polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;
141
- var indexMap = {
142
- pointPosition: 0,
143
- pointFeature: 0,
144
- linePosition: 0,
145
- linePath: 0,
146
- lineFeature: 0,
147
- polygonPosition: 0,
148
- polygonObject: 0,
149
- polygonRing: 0,
150
- polygonFeature: 0,
151
- feature: 0
152
- };
153
-
154
- var _iterator3 = _createForOfIteratorHelper(features),
155
- _step3;
156
-
157
- try {
158
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
159
- var feature = _step3.value;
160
- var geometry = feature.geometry;
161
- var properties = feature.properties || {};
162
-
163
- switch (geometry.type) {
164
- case 'Point':
165
- handlePoint(geometry, points, indexMap, coordLength, properties);
166
- points.properties.push(keepStringProperties(properties, numericPropKeys));
167
-
168
- if (hasGlobalId) {
169
- points.fields.push({
170
- id: feature.id
171
- });
172
- }
173
-
174
- indexMap.pointFeature++;
175
- break;
176
-
177
- case 'LineString':
178
- handleLineString(geometry, lines, indexMap, coordLength, properties);
179
- lines.properties.push(keepStringProperties(properties, numericPropKeys));
180
-
181
- if (hasGlobalId) {
182
- lines.fields.push({
183
- id: feature.id
184
- });
185
- }
186
-
187
- indexMap.lineFeature++;
188
- break;
189
-
190
- case 'Polygon':
191
- handlePolygon(geometry, polygons, indexMap, coordLength, properties);
192
- polygons.properties.push(keepStringProperties(properties, numericPropKeys));
193
-
194
- if (hasGlobalId) {
195
- polygons.fields.push({
196
- id: feature.id
197
- });
198
- }
199
-
200
- indexMap.polygonFeature++;
201
- break;
202
-
203
- default:
204
- throw new Error('Invalid geometry type');
205
- }
206
-
207
- indexMap.feature++;
208
- }
209
- } catch (err) {
210
- _iterator3.e(err);
211
- } finally {
212
- _iterator3.f();
213
- }
214
-
215
- return makeAccessorObjects(points, lines, polygons, coordLength);
216
- }
217
-
218
- function handlePoint(geometry, points, indexMap, coordLength, properties) {
219
- points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
220
- var nPositions = geometry.data.length / coordLength;
221
- fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);
222
- points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
223
- points.featureIds.fill(indexMap.pointFeature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
224
- indexMap.pointPosition += nPositions;
225
- }
226
-
227
- function handleLineString(geometry, lines, indexMap, coordLength, properties) {
228
- lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
229
- var nPositions = geometry.data.length / coordLength;
230
- fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
231
- lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);
232
- lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);
233
-
234
- for (var i = 0, il = geometry.indices.length; i < il; ++i) {
235
- var start = geometry.indices[i];
236
- var end = i === il - 1 ? geometry.data.length : geometry.indices[i + 1];
237
- lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;
238
- indexMap.linePosition += (end - start) / coordLength;
239
- }
240
- }
241
-
242
- function handlePolygon(geometry, polygons, indexMap, coordLength, properties) {
243
- polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
244
- var nPositions = geometry.data.length / coordLength;
245
- fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
246
- polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
247
- polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
248
-
249
- for (var l = 0, ll = geometry.indices.length; l < ll; ++l) {
250
- var startPosition = indexMap.polygonPosition;
251
- polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
252
- var areas = geometry.areas[l];
253
- var indices = geometry.indices[l];
254
- var nextIndices = geometry.indices[l + 1];
255
-
256
- for (var i = 0, il = indices.length; i < il; ++i) {
257
- var start = indices[i];
258
- var end = i === il - 1 ? nextIndices === undefined ? geometry.data.length : nextIndices[0] : indices[i + 1];
259
- polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
260
- indexMap.polygonPosition += (end - start) / coordLength;
261
- }
262
-
263
- var endPosition = indexMap.polygonPosition;
264
- triangulatePolygon(polygons, areas, indices, {
265
- startPosition: startPosition,
266
- endPosition: endPosition,
267
- coordLength: coordLength
268
- });
269
- }
270
- }
271
-
272
- function triangulatePolygon(polygons, areas, indices, _ref) {
273
- var startPosition = _ref.startPosition,
274
- endPosition = _ref.endPosition,
275
- coordLength = _ref.coordLength;
276
- var start = startPosition * coordLength;
277
- var end = endPosition * coordLength;
278
- var polygonPositions = polygons.positions.subarray(start, end);
279
- var offset = indices[0];
280
- var holes = indices.slice(1).map(function (n) {
281
- return (n - offset) / coordLength;
282
- });
283
- var triangles = (0, _polygon.earcut)(polygonPositions, holes, coordLength, areas);
284
-
285
- for (var t = 0, tl = triangles.length; t < tl; ++t) {
286
- polygons.triangles.push(startPosition + triangles[t]);
287
- }
288
- }
289
-
290
- function wrapProps(obj, size) {
291
- var returnObj = {};
292
-
293
- for (var _key2 in obj) {
294
- returnObj[_key2] = {
295
- value: obj[_key2],
296
- size: size
297
- };
298
- }
299
-
300
- return returnObj;
301
- }
302
-
303
- function makeAccessorObjects(points, lines, polygons, coordLength) {
304
- return {
305
- points: _objectSpread(_objectSpread({}, points), {}, {
306
- positions: {
307
- value: points.positions,
308
- size: coordLength
309
- },
310
- globalFeatureIds: {
311
- value: points.globalFeatureIds,
312
- size: 1
313
- },
314
- featureIds: {
315
- value: points.featureIds,
316
- size: 1
317
- },
318
- numericProps: wrapProps(points.numericProps, 1)
319
- }),
320
- lines: _objectSpread(_objectSpread({}, lines), {}, {
321
- positions: {
322
- value: lines.positions,
323
- size: coordLength
324
- },
325
- pathIndices: {
326
- value: lines.pathIndices,
327
- size: 1
328
- },
329
- globalFeatureIds: {
330
- value: lines.globalFeatureIds,
331
- size: 1
332
- },
333
- featureIds: {
334
- value: lines.featureIds,
335
- size: 1
336
- },
337
- numericProps: wrapProps(lines.numericProps, 1)
338
- }),
339
- polygons: _objectSpread(_objectSpread({}, polygons), {}, {
340
- positions: {
341
- value: polygons.positions,
342
- size: coordLength
343
- },
344
- polygonIndices: {
345
- value: polygons.polygonIndices,
346
- size: 1
347
- },
348
- primitivePolygonIndices: {
349
- value: polygons.primitivePolygonIndices,
350
- size: 1
351
- },
352
- triangles: {
353
- value: new Uint32Array(polygons.triangles),
354
- size: 1
355
- },
356
- globalFeatureIds: {
357
- value: polygons.globalFeatureIds,
358
- size: 1
359
- },
360
- featureIds: {
361
- value: polygons.featureIds,
362
- size: 1
363
- },
364
- numericProps: wrapProps(polygons.numericProps, 1)
365
- })
366
- };
367
- }
368
-
369
- function fillNumericProperties(object, properties, index, length) {
370
- for (var numericPropName in object.numericProps) {
371
- if (numericPropName in properties) {
372
- var value = properties[numericPropName];
373
- object.numericProps[numericPropName].fill(value, index, index + length);
374
- }
375
- }
376
- }
377
-
378
- function keepStringProperties(properties, numericKeys) {
379
- var props = {};
380
-
381
- for (var _key3 in properties) {
382
- if (!numericKeys.includes(_key3)) {
383
- props[_key3] = properties[_key3];
384
- }
385
- }
386
-
387
- return props;
388
- }
389
-
390
- function deduceArrayType(x, constructor) {
391
- if (constructor === Array || !Number.isFinite(x)) {
392
- return Array;
393
- }
394
-
395
- return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
396
- }
397
- //# sourceMappingURL=flat-geojson-to-binary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/flat-geojson-to-binary.ts"],"names":["flatGeojsonToBinary","features","geometryInfo","options","propArrayTypes","extractNumericPropTypes","numericPropKeys","Object","keys","filter","k","Array","fillArrays","PositionDataType","Float32Array","TEST_EXPORTS","feature","properties","key","val","deduceArrayType","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLength","hasGlobalId","GlobalFeatureIdsDataType","length","Uint32Array","Uint16Array","points","type","positions","globalFeatureIds","featureIds","numericProps","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","triangles","object","propName","T","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","geometry","handlePoint","push","keepStringProperties","id","handleLineString","handlePolygon","Error","makeAccessorObjects","set","data","nPositions","fillNumericProperties","fill","i","il","indices","start","end","l","ll","startPosition","areas","nextIndices","undefined","endPosition","triangulatePolygon","polygonPositions","subarray","offset","holes","slice","map","n","t","tl","wrapProps","obj","size","returnObj","value","index","numericPropName","numericKeys","props","includes","x","constructor","Number","isFinite","Float64Array","Math","fround"],"mappings":";;;;;;;;;;;;AACA;;;;;;;;;;;;AA0BO,SAASA,mBAAT,CACLC,QADK,EAELC,YAFK,EAGLC,OAHK,EAIL;AACA,MAAMC,cAAc,GAAGC,uBAAuB,CAACJ,QAAD,CAA9C;AACA,MAAMK,eAAe,GAAGC,MAAM,CAACC,IAAP,CAAYJ,cAAZ,EAA4BK,MAA5B,CAAmC,UAACC,CAAD;AAAA,WAAON,cAAc,CAACM,CAAD,CAAd,KAAsBC,KAA7B;AAAA,GAAnC,CAAxB;AACA,SAAOC,UAAU,CACfX,QADe;AAGbG,IAAAA,cAAc,EAAdA;AAHa,KAIVF,YAJU,GAMf;AACEI,IAAAA,eAAe,EAAGH,OAAO,IAAIA,OAAO,CAACG,eAApB,IAAwCA,eAD3D;AAEEO,IAAAA,gBAAgB,EAAEV,OAAO,GAAGA,OAAO,CAACU,gBAAX,GAA8BC;AAFzD,GANe,CAAjB;AAWD;;AAUM,IAAMC,YAAY,GAAG;AAC1BV,EAAAA,uBAAuB,EAAv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AACR,YAAP,CAAoB+D,eAApB,EAAqC7B,IAArC,CAA0C2B,KAA1C,EAAiDC,KAAjD,EAAwDA,KAAK,GAAGtE,MAAhE;AACD;AACF;AACF;;AASD,SAASgC,oBAAT,CACEhD,UADF,EAEEwF,WAFF,EAGE;AACA,MAAMC,KAAK,GAAG,EAAd;;AACA,OAAK,IAAMxF,KAAX,IAAkBD,UAAlB,EAA8B;AAC5B,QAAI,CAACwF,WAAW,CAACE,QAAZ,CAAqBzF,KAArB,CAAL,EAAgC;AAC9BwF,MAAAA,KAAK,CAACxF,KAAD,CAAL,GAAaD,UAAU,CAACC,KAAD,CAAvB;AACD;AACF;;AACD,SAAOwF,KAAP;AACD;;AAUD,SAAStF,eAAT,CAAyBwF,CAAzB,EAAiCC,WAAjC,EAA0F;AACxF,MAAIA,WAAW,KAAKlG,KAAhB,IAAyB,CAACmG,MAAM,CAACC,QAAP,CAAgBH,CAAhB,CAA9B,EAAkD;AAChD,WAAOjG,KAAP;AACD;;AAGD,SAAOkG,WAAW,KAAKG,YAAhB,IAAgCC,IAAI,CAACC,MAAL,CAAYN,CAAZ,MAAmBA,CAAnD,GAAuDI,YAAvD,GAAsElG,YAA7E;AACD","sourcesContent":["/* eslint-disable indent */\nimport {earcut} from '@math.gl/polygon';\nimport type {\n BinaryAttribute,\n BinaryFeatures,\n FlatFeature,\n FlatPoint,\n FlatLineString,\n FlatPolygon,\n GeojsonGeometryInfo,\n TypedArray\n} from '@loaders.gl/schema';\nimport {PropArrayConstructor, Lines, Points, Polygons} from './flat-geojson-to-binary-types';\n\n/**\n * Convert binary features to flat binary arrays. Similar to\n * `geojsonToBinary` helper function, except that it expects\n * a binary representation of the feature data, which enables\n * 2X-3X speed increase in parse speed, compared to using\n * geoJSON. See `binary-vector-tile/VectorTileFeature` for\n * data format detais\n *\n * @param features\n * @param geometryInfo\n * @param options\n * @returns filled arrays\n */\nexport function flatGeojsonToBinary(\n features: FlatFeature[],\n geometryInfo: GeojsonGeometryInfo,\n options?: FlatGeojsonToBinaryOptions\n) {\n const propArrayTypes = extractNumericPropTypes(features);\n const numericPropKeys = Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array);\n return fillArrays(\n features,\n {\n propArrayTypes,\n ...geometryInfo\n },\n {\n numericPropKeys: (options && options.numericPropKeys) || numericPropKeys,\n PositionDataType: options ? options.PositionDataType : Float32Array\n }\n );\n}\n\n/**\n * Options for `flatGeojsonToBinary`\n */\nexport type FlatGeojsonToBinaryOptions = {\n numericPropKeys?: string[];\n PositionDataType?: Float32ArrayConstructor | Float64ArrayConstructor;\n};\n\nexport const TEST_EXPORTS = {\n extractNumericPropTypes\n};\n\n/**\n * Extracts properties that are always numeric\n *\n * @param features\n * @returns object with numeric types\n */\nfunction extractNumericPropTypes(features: FlatFeature[]): {\n [key: string]: PropArrayConstructor;\n} {\n const propArrayTypes = {};\n for (const feature of features) {\n if (feature.properties) {\n for (const key in feature.properties) {\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, Array is stored to prevent rechecking in the future\n // Additionally, detects if 64 bit precision is required\n const val = feature.properties[key];\n propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);\n }\n }\n }\n\n return propArrayTypes;\n}\n\n/**\n * Fills coordinates into pre-allocated typed arrays\n *\n * @param features\n * @param geometryInfo\n * @param options\n * @returns an accessor object with value and size keys\n */\n// eslint-disable-next-line complexity\nfunction fillArrays(\n features: FlatFeature[],\n geometryInfo: GeojsonGeometryInfo & {\n propArrayTypes: {[key: string]: PropArrayConstructor};\n },\n options: FlatGeojsonToBinaryOptions\n) {\n const {\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount,\n propArrayTypes,\n coordLength\n } = geometryInfo;\n const {numericPropKeys = [], PositionDataType = Float32Array} = options;\n const hasGlobalId = features[0] && 'id' in features[0];\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points: Points = {\n type: 'Point',\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds:\n pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: [],\n fields: []\n };\n const lines: Lines = {\n type: 'LineString',\n pathIndices:\n linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n positions: new PositionDataType(linePositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds:\n lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: [],\n fields: []\n };\n const polygons: Polygons = {\n type: 'Polygon',\n polygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n triangles: [],\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds:\n polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: [],\n fields: []\n };\n\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n const T = propArrayTypes[propName];\n object.numericProps[propName] = new T(object.positions.length / coordLength) as TypedArray;\n }\n }\n\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties = feature.properties || {};\n\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n if (hasGlobalId) {\n points.fields.push({id: feature.id});\n }\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n if (hasGlobalId) {\n lines.fields.push({id: feature.id});\n }\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n if (hasGlobalId) {\n polygons.fields.push({id: feature.id});\n }\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n\n indexMap.feature++;\n }\n\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n\n/**\n * Fills (Multi)Point coordinates into points object of arrays\n *\n * @param geometry\n * @param points\n * @param indexMap\n * @param coordLength\n * @param properties\n */\nfunction handlePoint(\n geometry: FlatPoint,\n points: Points,\n indexMap: {\n pointPosition: number;\n pointFeature: number;\n linePosition?: number;\n linePath?: number;\n lineFeature?: number;\n polygonPosition?: number;\n polygonObject?: number;\n polygonRing?: number;\n polygonFeature?: number;\n feature: number;\n },\n coordLength: number,\n properties: {[x: string]: string | number | boolean | null}\n): void {\n points.positions.set(geometry.data, indexMap.pointPosition * coordLength);\n\n const nPositions = geometry.data.length / coordLength;\n fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);\n points.globalFeatureIds.fill(\n indexMap.feature,\n indexMap.pointPosition,\n indexMap.pointPosition + nPositions\n );\n points.featureIds.fill(\n indexMap.pointFeature,\n indexMap.pointPosition,\n indexMap.pointPosition + nPositions\n );\n\n indexMap.pointPosition += nPositions;\n}\n\n/**\n * Fills (Multi)LineString coordinates into lines object of arrays\n *\n * @param geometry\n * @param lines\n * @param indexMap\n * @param coordLength\n * @param properties\n */\nfunction handleLineString(\n geometry: FlatLineString,\n lines: Lines,\n indexMap: {\n pointPosition?: number;\n pointFeature?: number;\n linePosition: number;\n linePath: number;\n lineFeature: number;\n polygonPosition?: number;\n polygonObject?: number;\n polygonRing?: number;\n polygonFeature?: number;\n feature: number;\n },\n coordLength: number,\n properties: {[x: string]: string | number | boolean | null}\n): void {\n lines.positions.set(geometry.data, indexMap.linePosition * coordLength);\n\n const nPositions = geometry.data.length / coordLength;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n\n lines.globalFeatureIds.fill(\n indexMap.feature,\n indexMap.linePosition,\n indexMap.linePosition + nPositions\n );\n lines.featureIds.fill(\n indexMap.lineFeature,\n indexMap.linePosition,\n indexMap.linePosition + nPositions\n );\n\n for (let i = 0, il = geometry.indices.length; i < il; ++i) {\n // Extract range of data we are working with, defined by start\n // and end indices (these index into the geometry.data array)\n const start = geometry.indices[i];\n const end =\n i === il - 1\n ? geometry.data.length // last line, so read to end of data\n : geometry.indices[i + 1]; // start index for next line\n\n lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;\n indexMap.linePosition += (end - start) / coordLength;\n }\n}\n\n/**\n * Fills (Multi)Polygon coordinates into polygons object of arrays\n *\n * @param geometry\n * @param polygons\n * @param indexMap\n * @param coordLength\n * @param properties\n */\nfunction handlePolygon(\n geometry: FlatPolygon,\n polygons: Polygons,\n indexMap: {\n pointPosition?: number;\n pointFeature?: number;\n linePosition?: number;\n linePath?: number;\n lineFeature?: number;\n polygonPosition: number;\n polygonObject: number;\n polygonRing: number;\n polygonFeature: number;\n feature: number;\n },\n coordLength: number,\n properties: {[x: string]: string | number | boolean | null}\n): void {\n polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);\n\n const nPositions = geometry.data.length / coordLength;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n polygons.globalFeatureIds.fill(\n indexMap.feature,\n indexMap.polygonPosition,\n indexMap.polygonPosition + nPositions\n );\n polygons.featureIds.fill(\n indexMap.polygonFeature,\n indexMap.polygonPosition,\n indexMap.polygonPosition + nPositions\n );\n\n // Unlike Point & LineString geometry.indices is a 2D array\n for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {\n const startPosition = indexMap.polygonPosition;\n polygons.polygonIndices[indexMap.polygonObject++] = startPosition;\n\n const areas = geometry.areas[l];\n const indices = geometry.indices[l];\n const nextIndices = geometry.indices[l + 1];\n\n for (let i = 0, il = indices.length; i < il; ++i) {\n const start = indices[i];\n const end =\n i === il - 1\n ? // last line, so either read to:\n nextIndices === undefined\n ? geometry.data.length // end of data (no next indices)\n : nextIndices[0] // start of first line in nextIndices\n : indices[i + 1]; // start index for next line\n\n polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;\n indexMap.polygonPosition += (end - start) / coordLength;\n }\n\n const endPosition = indexMap.polygonPosition;\n triangulatePolygon(polygons, areas, indices, {startPosition, endPosition, coordLength});\n }\n}\n\n/**\n * Triangulate polygon using earcut\n *\n * @param polygons\n * @param areas\n * @param indices\n * @param param3\n */\nfunction triangulatePolygon(\n polygons: Polygons,\n areas: number[],\n indices: number[],\n {\n startPosition,\n endPosition,\n coordLength\n }: {startPosition: number; endPosition: number; coordLength: number}\n): void {\n const start = startPosition * coordLength;\n const end = endPosition * coordLength;\n\n // Extract positions and holes for just this polygon\n const polygonPositions = polygons.positions.subarray(start, end);\n\n // Holes are referenced relative to outer polygon\n const offset = indices[0];\n const holes = indices.slice(1).map((n: number) => (n - offset) / coordLength);\n\n // Compute triangulation\n const triangles = earcut(polygonPositions, holes, coordLength, areas);\n\n // Indices returned by triangulation are relative to start\n // of polygon, so we need to offset\n for (let t = 0, tl = triangles.length; t < tl; ++t) {\n polygons.triangles.push(startPosition + triangles[t]);\n }\n}\n\n/**\n * Wraps an object containing array into accessors\n *\n * @param obj\n * @param size\n */\nfunction wrapProps(\n obj: {[key: string]: TypedArray},\n size: number\n): {[key: string]: BinaryAttribute} {\n const returnObj = {};\n for (const key in obj) {\n returnObj[key] = {value: obj[key], size};\n }\n return returnObj;\n}\n\n/**\n * Wrap each array in an accessor object with value and size keys\n *\n * @param points\n * @param lines\n * @param polygons\n * @param coordLength\n * @returns object\n */\nfunction makeAccessorObjects(\n points: Points,\n lines: Lines,\n polygons: Polygons,\n coordLength: number\n): BinaryFeatures {\n return {\n points: {\n ...points,\n positions: {value: points.positions, size: coordLength},\n globalFeatureIds: {value: points.globalFeatureIds, size: 1},\n featureIds: {value: points.featureIds, size: 1},\n numericProps: wrapProps(points.numericProps, 1)\n },\n lines: {\n ...lines,\n positions: {value: lines.positions, size: coordLength},\n pathIndices: {value: lines.pathIndices, size: 1},\n globalFeatureIds: {value: lines.globalFeatureIds, size: 1},\n featureIds: {value: lines.featureIds, size: 1},\n numericProps: wrapProps(lines.numericProps, 1)\n },\n polygons: {\n ...polygons,\n positions: {value: polygons.positions, size: coordLength},\n polygonIndices: {value: polygons.polygonIndices, size: 1},\n primitivePolygonIndices: {value: polygons.primitivePolygonIndices, size: 1},\n triangles: {value: new Uint32Array(polygons.triangles), size: 1},\n globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n numericProps: wrapProps(polygons.numericProps, 1)\n }\n };\n}\n\n/**\n * Add numeric properties to object\n *\n * @param object\n * @param properties\n * @param index\n * @param length\n */\nfunction fillNumericProperties(\n object: Points | Lines | Polygons,\n properties: {[x: string]: string | number | boolean | null},\n index: number,\n length: number\n): void {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n const value = properties[numericPropName] as number;\n object.numericProps[numericPropName].fill(value, index, index + length);\n }\n }\n}\n\n/**\n * Keep string properties in object\n *\n * @param properties\n * @param numericKeys\n * @returns object\n */\nfunction keepStringProperties(\n properties: {[x: string]: string | number | boolean | null},\n numericKeys: string[]\n) {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n\n/**\n *\n * Deduce correct array constructor to use for a given value\n *\n * @param x value to test\n * @param constructor previous constructor deduced\n * @returns PropArrayConstructor\n */\nfunction deduceArrayType(x: any, constructor: PropArrayConstructor): PropArrayConstructor {\n if (constructor === Array || !Number.isFinite(x)) {\n return Array;\n }\n\n // If this or previous value required 64bits use Float64Array\n return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;\n}\n"],"file":"flat-geojson-to-binary.js"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.geojsonToBinary = geojsonToBinary;
7
-
8
- var _extractGeometryInfo = require("./extract-geometry-info");
9
-
10
- var _geojsonToFlatGeojson = require("./geojson-to-flat-geojson");
11
-
12
- var _flatGeojsonToBinary = require("./flat-geojson-to-binary");
13
-
14
- function geojsonToBinary(features) {
15
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
16
- fixRingWinding: true
17
- };
18
- var geometryInfo = (0, _extractGeometryInfo.extractGeometryInfo)(features);
19
- var coordLength = geometryInfo.coordLength;
20
- var fixRingWinding = options.fixRingWinding;
21
- var flatFeatures = (0, _geojsonToFlatGeojson.geojsonToFlatGeojson)(features, {
22
- coordLength: coordLength,
23
- fixRingWinding: fixRingWinding
24
- });
25
- return (0, _flatGeojsonToBinary.flatGeojsonToBinary)(flatFeatures, geometryInfo, {
26
- numericPropKeys: options.numericPropKeys,
27
- PositionDataType: options.PositionDataType || Float32Array
28
- });
29
- }
30
- //# sourceMappingURL=geojson-to-binary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/geojson-to-binary.ts"],"names":["geojsonToBinary","features","options","fixRingWinding","geometryInfo","coordLength","flatFeatures","numericPropKeys","PositionDataType","Float32Array"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAkBO,SAASA,eAAT,CACLC,QADK,EAGW;AAAA,MADhBC,OACgB,uEADkB;AAACC,IAAAA,cAAc,EAAE;AAAjB,GAClB;AAChB,MAAMC,YAAY,GAAG,8CAAoBH,QAApB,CAArB;AACA,MAAMI,WAAW,GAAGD,YAAY,CAACC,WAAjC;AACA,MAAOF,cAAP,GAAyBD,OAAzB,CAAOC,cAAP;AACA,MAAMG,YAAY,GAAG,gDAAqBL,QAArB,EAA+B;AAACI,IAAAA,WAAW,EAAXA,WAAD;AAAcF,IAAAA,cAAc,EAAdA;AAAd,GAA/B,CAArB;AACA,SAAO,8CAAoBG,YAApB,EAAkCF,YAAlC,EAAgD;AACrDG,IAAAA,eAAe,EAAEL,OAAO,CAACK,eAD4B;AAErDC,IAAAA,gBAAgB,EAAEN,OAAO,CAACM,gBAAR,IAA4BC;AAFO,GAAhD,CAAP;AAID","sourcesContent":["import type {Feature} from '@loaders.gl/schema';\nimport type {BinaryFeatures} from '@loaders.gl/schema';\n\nimport {extractGeometryInfo} from './extract-geometry-info';\nimport {geojsonToFlatGeojson} from './geojson-to-flat-geojson';\nimport {flatGeojsonToBinary} from './flat-geojson-to-binary';\n\n/**\n * Options for `geojsonToBinary`\n */\nexport type GeojsonToBinaryOptions = {\n fixRingWinding: boolean;\n numericPropKeys?: string[];\n PositionDataType?: Float32ArrayConstructor | Float64ArrayConstructor;\n};\n\n/**\n * Convert GeoJSON features to flat binary arrays\n *\n * @param features\n * @param options\n * @returns features in binary format, grouped by geometry type\n */\nexport function geojsonToBinary(\n features: Feature[],\n options: GeojsonToBinaryOptions = {fixRingWinding: true}\n): BinaryFeatures {\n const geometryInfo = extractGeometryInfo(features);\n const coordLength = geometryInfo.coordLength;\n const {fixRingWinding} = options;\n const flatFeatures = geojsonToFlatGeojson(features, {coordLength, fixRingWinding});\n return flatGeojsonToBinary(flatFeatures, geometryInfo, {\n numericPropKeys: options.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array\n });\n}\n"],"file":"geojson-to-binary.js"}
@@ -1,169 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.geojsonToFlatGeojson = geojsonToFlatGeojson;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _polygon = require("@math.gl/polygon");
15
-
16
- 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; }
17
-
18
- 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; }
19
-
20
- 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; } } }; }
21
-
22
- 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); }
23
-
24
- 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; }
25
-
26
- function geojsonToFlatGeojson(features) {
27
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
28
- coordLength: 2,
29
- fixRingWinding: true
30
- };
31
- return features.map(function (feature) {
32
- return flattenFeature(feature, options);
33
- });
34
- }
35
-
36
- function flattenPoint(coordinates, data, indices, options) {
37
- indices.push(data.length);
38
- data.push.apply(data, (0, _toConsumableArray2.default)(coordinates));
39
-
40
- for (var i = coordinates.length; i < options.coordLength; i++) {
41
- data.push(0);
42
- }
43
- }
44
-
45
- function flattenLineString(coordinates, data, indices, options) {
46
- indices.push(data.length);
47
-
48
- var _iterator = _createForOfIteratorHelper(coordinates),
49
- _step;
50
-
51
- try {
52
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
53
- var c = _step.value;
54
- data.push.apply(data, (0, _toConsumableArray2.default)(c));
55
-
56
- for (var i = c.length; i < options.coordLength; i++) {
57
- data.push(0);
58
- }
59
- }
60
- } catch (err) {
61
- _iterator.e(err);
62
- } finally {
63
- _iterator.f();
64
- }
65
- }
66
-
67
- function flattenPolygon(coordinates, data, indices, areas, options) {
68
- var count = 0;
69
- var ringAreas = [];
70
- var polygons = [];
71
-
72
- var _iterator2 = _createForOfIteratorHelper(coordinates),
73
- _step2;
74
-
75
- try {
76
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
77
- var lineString = _step2.value;
78
- var lineString2d = lineString.map(function (p) {
79
- return p.slice(0, 2);
80
- });
81
- var area = (0, _polygon.getPolygonSignedArea)(lineString2d.flat());
82
- var ccw = area < 0;
83
-
84
- if (options.fixRingWinding && (count === 0 && !ccw || count > 0 && ccw)) {
85
- lineString.reverse();
86
- area = -area;
87
- }
88
-
89
- ringAreas.push(area);
90
- flattenLineString(lineString, data, polygons, options);
91
- count++;
92
- }
93
- } catch (err) {
94
- _iterator2.e(err);
95
- } finally {
96
- _iterator2.f();
97
- }
98
-
99
- if (count > 0) {
100
- areas.push(ringAreas);
101
- indices.push(polygons);
102
- }
103
- }
104
-
105
- function flattenFeature(feature, options) {
106
- var geometry = feature.geometry;
107
-
108
- if (geometry.type === 'GeometryCollection') {
109
- throw new Error('GeometryCollection type not supported');
110
- }
111
-
112
- var data = [];
113
- var indices = [];
114
- var areas;
115
- var type;
116
-
117
- switch (geometry.type) {
118
- case 'Point':
119
- type = 'Point';
120
- flattenPoint(geometry.coordinates, data, indices, options);
121
- break;
122
-
123
- case 'MultiPoint':
124
- type = 'Point';
125
- geometry.coordinates.map(function (c) {
126
- return flattenPoint(c, data, indices, options);
127
- });
128
- break;
129
-
130
- case 'LineString':
131
- type = 'LineString';
132
- flattenLineString(geometry.coordinates, data, indices, options);
133
- break;
134
-
135
- case 'MultiLineString':
136
- type = 'LineString';
137
- geometry.coordinates.map(function (c) {
138
- return flattenLineString(c, data, indices, options);
139
- });
140
- break;
141
-
142
- case 'Polygon':
143
- type = 'Polygon';
144
- areas = [];
145
- flattenPolygon(geometry.coordinates, data, indices, areas, options);
146
- break;
147
-
148
- case 'MultiPolygon':
149
- type = 'Polygon';
150
- areas = [];
151
- geometry.coordinates.map(function (c) {
152
- return flattenPolygon(c, data, indices, areas, options);
153
- });
154
- break;
155
-
156
- default:
157
- throw new Error("Unknown type: ".concat(type));
158
- }
159
-
160
- return _objectSpread(_objectSpread({}, feature), {}, {
161
- geometry: {
162
- type: type,
163
- indices: indices,
164
- data: data,
165
- areas: areas
166
- }
167
- });
168
- }
169
- //# sourceMappingURL=geojson-to-flat-geojson.js.map