@loaders.gl/gis 3.4.14 → 3.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/index.js +8 -8
- package/dist/es5/lib/binary-to-geojson.js +93 -117
- package/dist/es5/lib/binary-to-geojson.js.map +1 -1
- package/dist/es5/lib/extract-geometry-info.js +72 -149
- package/dist/es5/lib/extract-geometry-info.js.map +1 -1
- package/dist/es5/lib/flat-geojson-to-binary.js +130 -162
- package/dist/es5/lib/flat-geojson-to-binary.js.map +1 -1
- package/dist/es5/lib/geojson-to-binary.js +9 -7
- package/dist/es5/lib/geojson-to-binary.js.map +1 -1
- package/dist/es5/lib/geojson-to-flat-geojson.js +38 -71
- package/dist/es5/lib/geojson-to-flat-geojson.js.map +1 -1
- package/dist/es5/lib/transform.js +9 -19
- package/dist/es5/lib/transform.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,77 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.TEST_EXPORTS = void 0;
|
|
8
7
|
exports.flatGeojsonToBinary = flatGeojsonToBinary;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
8
|
var _polygon = require("@math.gl/polygon");
|
|
11
|
-
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; } } }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
9
|
function flatGeojsonToBinary(features, geometryInfo, options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, geometryInfo), {
|
|
10
|
+
const propArrayTypes = extractNumericPropTypes(features);
|
|
11
|
+
const numericPropKeys = Object.keys(propArrayTypes).filter(k => propArrayTypes[k] !== Array);
|
|
12
|
+
return fillArrays(features, {
|
|
13
|
+
propArrayTypes,
|
|
14
|
+
...geometryInfo
|
|
15
|
+
}, {
|
|
24
16
|
numericPropKeys: options && options.numericPropKeys || numericPropKeys,
|
|
25
17
|
PositionDataType: options ? options.PositionDataType : Float32Array,
|
|
26
18
|
triangulate: options ? options.triangulate : true
|
|
27
19
|
});
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
extractNumericPropTypes
|
|
21
|
+
const TEST_EXPORTS = {
|
|
22
|
+
extractNumericPropTypes
|
|
31
23
|
};
|
|
32
24
|
exports.TEST_EXPORTS = TEST_EXPORTS;
|
|
33
25
|
function extractNumericPropTypes(features) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (feature.properties) {
|
|
41
|
-
for (var _key in feature.properties) {
|
|
42
|
-
var val = feature.properties[_key];
|
|
43
|
-
propArrayTypes[_key] = deduceArrayType(val, propArrayTypes[_key]);
|
|
44
|
-
}
|
|
26
|
+
const propArrayTypes = {};
|
|
27
|
+
for (const feature of features) {
|
|
28
|
+
if (feature.properties) {
|
|
29
|
+
for (const key in feature.properties) {
|
|
30
|
+
const val = feature.properties[key];
|
|
31
|
+
propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
|
|
45
32
|
}
|
|
46
33
|
}
|
|
47
|
-
} catch (err) {
|
|
48
|
-
_iterator.e(err);
|
|
49
|
-
} finally {
|
|
50
|
-
_iterator.f();
|
|
51
34
|
}
|
|
52
35
|
return propArrayTypes;
|
|
53
36
|
}
|
|
54
37
|
function fillArrays(features, geometryInfo, options) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
triangulate =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
38
|
+
const {
|
|
39
|
+
pointPositionsCount,
|
|
40
|
+
pointFeaturesCount,
|
|
41
|
+
linePositionsCount,
|
|
42
|
+
linePathsCount,
|
|
43
|
+
lineFeaturesCount,
|
|
44
|
+
polygonPositionsCount,
|
|
45
|
+
polygonObjectsCount,
|
|
46
|
+
polygonRingsCount,
|
|
47
|
+
polygonFeaturesCount,
|
|
48
|
+
propArrayTypes,
|
|
49
|
+
coordLength
|
|
50
|
+
} = geometryInfo;
|
|
51
|
+
const {
|
|
52
|
+
numericPropKeys = [],
|
|
53
|
+
PositionDataType = Float32Array,
|
|
54
|
+
triangulate = true
|
|
55
|
+
} = options;
|
|
56
|
+
const hasGlobalId = features[0] && 'id' in features[0];
|
|
57
|
+
const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
|
|
58
|
+
const points = {
|
|
75
59
|
type: 'Point',
|
|
76
60
|
positions: new PositionDataType(pointPositionsCount * coordLength),
|
|
77
61
|
globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),
|
|
@@ -80,7 +64,7 @@ function fillArrays(features, geometryInfo, options) {
|
|
|
80
64
|
properties: [],
|
|
81
65
|
fields: []
|
|
82
66
|
};
|
|
83
|
-
|
|
67
|
+
const lines = {
|
|
84
68
|
type: 'LineString',
|
|
85
69
|
pathIndices: linePositionsCount > 65535 ? new Uint32Array(linePathsCount + 1) : new Uint16Array(linePathsCount + 1),
|
|
86
70
|
positions: new PositionDataType(linePositionsCount * coordLength),
|
|
@@ -90,7 +74,7 @@ function fillArrays(features, geometryInfo, options) {
|
|
|
90
74
|
properties: [],
|
|
91
75
|
fields: []
|
|
92
76
|
};
|
|
93
|
-
|
|
77
|
+
const polygons = {
|
|
94
78
|
type: 'Polygon',
|
|
95
79
|
polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
|
|
96
80
|
primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
|
|
@@ -104,26 +88,16 @@ function fillArrays(features, geometryInfo, options) {
|
|
|
104
88
|
if (triangulate) {
|
|
105
89
|
polygons.triangles = [];
|
|
106
90
|
}
|
|
107
|
-
for (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
113
|
-
var propName = _step2.value;
|
|
114
|
-
var T = propArrayTypes[propName];
|
|
115
|
-
object.numericProps[propName] = new T(object.positions.length / coordLength);
|
|
116
|
-
}
|
|
117
|
-
} catch (err) {
|
|
118
|
-
_iterator2.e(err);
|
|
119
|
-
} finally {
|
|
120
|
-
_iterator2.f();
|
|
91
|
+
for (const object of [points, lines, polygons]) {
|
|
92
|
+
for (const propName of numericPropKeys) {
|
|
93
|
+
const T = propArrayTypes[propName];
|
|
94
|
+
object.numericProps[propName] = new T(object.positions.length / coordLength);
|
|
121
95
|
}
|
|
122
96
|
}
|
|
123
97
|
lines.pathIndices[linePathsCount] = linePositionsCount;
|
|
124
98
|
polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;
|
|
125
99
|
polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;
|
|
126
|
-
|
|
100
|
+
const indexMap = {
|
|
127
101
|
pointPosition: 0,
|
|
128
102
|
pointFeature: 0,
|
|
129
103
|
linePosition: 0,
|
|
@@ -135,59 +109,50 @@ function fillArrays(features, geometryInfo, options) {
|
|
|
135
109
|
polygonFeature: 0,
|
|
136
110
|
feature: 0
|
|
137
111
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
indexMap.polygonFeature++;
|
|
175
|
-
break;
|
|
176
|
-
default:
|
|
177
|
-
throw new Error('Invalid geometry type');
|
|
178
|
-
}
|
|
179
|
-
indexMap.feature++;
|
|
112
|
+
for (const feature of features) {
|
|
113
|
+
const geometry = feature.geometry;
|
|
114
|
+
const properties = feature.properties || {};
|
|
115
|
+
switch (geometry.type) {
|
|
116
|
+
case 'Point':
|
|
117
|
+
handlePoint(geometry, points, indexMap, coordLength, properties);
|
|
118
|
+
points.properties.push(keepStringProperties(properties, numericPropKeys));
|
|
119
|
+
if (hasGlobalId) {
|
|
120
|
+
points.fields.push({
|
|
121
|
+
id: feature.id
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
indexMap.pointFeature++;
|
|
125
|
+
break;
|
|
126
|
+
case 'LineString':
|
|
127
|
+
handleLineString(geometry, lines, indexMap, coordLength, properties);
|
|
128
|
+
lines.properties.push(keepStringProperties(properties, numericPropKeys));
|
|
129
|
+
if (hasGlobalId) {
|
|
130
|
+
lines.fields.push({
|
|
131
|
+
id: feature.id
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
indexMap.lineFeature++;
|
|
135
|
+
break;
|
|
136
|
+
case 'Polygon':
|
|
137
|
+
handlePolygon(geometry, polygons, indexMap, coordLength, properties);
|
|
138
|
+
polygons.properties.push(keepStringProperties(properties, numericPropKeys));
|
|
139
|
+
if (hasGlobalId) {
|
|
140
|
+
polygons.fields.push({
|
|
141
|
+
id: feature.id
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
indexMap.polygonFeature++;
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
throw new Error('Invalid geometry type');
|
|
180
148
|
}
|
|
181
|
-
|
|
182
|
-
_iterator3.e(err);
|
|
183
|
-
} finally {
|
|
184
|
-
_iterator3.f();
|
|
149
|
+
indexMap.feature++;
|
|
185
150
|
}
|
|
186
151
|
return makeAccessorObjects(points, lines, polygons, coordLength);
|
|
187
152
|
}
|
|
188
153
|
function handlePoint(geometry, points, indexMap, coordLength, properties) {
|
|
189
154
|
points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
|
|
190
|
-
|
|
155
|
+
const nPositions = geometry.data.length / coordLength;
|
|
191
156
|
fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);
|
|
192
157
|
points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
|
|
193
158
|
points.featureIds.fill(indexMap.pointFeature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
|
|
@@ -195,75 +160,76 @@ function handlePoint(geometry, points, indexMap, coordLength, properties) {
|
|
|
195
160
|
}
|
|
196
161
|
function handleLineString(geometry, lines, indexMap, coordLength, properties) {
|
|
197
162
|
lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
|
|
198
|
-
|
|
163
|
+
const nPositions = geometry.data.length / coordLength;
|
|
199
164
|
fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
|
|
200
165
|
lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);
|
|
201
166
|
lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);
|
|
202
|
-
for (
|
|
203
|
-
|
|
204
|
-
|
|
167
|
+
for (let i = 0, il = geometry.indices.length; i < il; ++i) {
|
|
168
|
+
const start = geometry.indices[i];
|
|
169
|
+
const end = i === il - 1 ? geometry.data.length : geometry.indices[i + 1];
|
|
205
170
|
lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;
|
|
206
171
|
indexMap.linePosition += (end - start) / coordLength;
|
|
207
172
|
}
|
|
208
173
|
}
|
|
209
174
|
function handlePolygon(geometry, polygons, indexMap, coordLength, properties) {
|
|
210
175
|
polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
|
|
211
|
-
|
|
176
|
+
const nPositions = geometry.data.length / coordLength;
|
|
212
177
|
fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
|
|
213
178
|
polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
|
|
214
179
|
polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
|
|
215
|
-
for (
|
|
216
|
-
|
|
180
|
+
for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {
|
|
181
|
+
const startPosition = indexMap.polygonPosition;
|
|
217
182
|
polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
for (
|
|
222
|
-
|
|
223
|
-
|
|
183
|
+
const areas = geometry.areas[l];
|
|
184
|
+
const indices = geometry.indices[l];
|
|
185
|
+
const nextIndices = geometry.indices[l + 1];
|
|
186
|
+
for (let i = 0, il = indices.length; i < il; ++i) {
|
|
187
|
+
const start = indices[i];
|
|
188
|
+
const end = i === il - 1 ? nextIndices === undefined ? geometry.data.length : nextIndices[0] : indices[i + 1];
|
|
224
189
|
polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
|
|
225
190
|
indexMap.polygonPosition += (end - start) / coordLength;
|
|
226
191
|
}
|
|
227
|
-
|
|
192
|
+
const endPosition = indexMap.polygonPosition;
|
|
228
193
|
triangulatePolygon(polygons, areas, indices, {
|
|
229
|
-
startPosition
|
|
230
|
-
endPosition
|
|
231
|
-
coordLength
|
|
194
|
+
startPosition,
|
|
195
|
+
endPosition,
|
|
196
|
+
coordLength
|
|
232
197
|
});
|
|
233
198
|
}
|
|
234
199
|
}
|
|
235
200
|
function triangulatePolygon(polygons, areas, indices, _ref) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
201
|
+
let {
|
|
202
|
+
startPosition,
|
|
203
|
+
endPosition,
|
|
204
|
+
coordLength
|
|
205
|
+
} = _ref;
|
|
239
206
|
if (!polygons.triangles) {
|
|
240
207
|
return;
|
|
241
208
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
var triangles = (0, _polygon.earcut)(polygonPositions, holes, coordLength, areas);
|
|
250
|
-
for (var t = 0, tl = triangles.length; t < tl; ++t) {
|
|
209
|
+
const start = startPosition * coordLength;
|
|
210
|
+
const end = endPosition * coordLength;
|
|
211
|
+
const polygonPositions = polygons.positions.subarray(start, end);
|
|
212
|
+
const offset = indices[0];
|
|
213
|
+
const holes = indices.slice(1).map(n => (n - offset) / coordLength);
|
|
214
|
+
const triangles = (0, _polygon.earcut)(polygonPositions, holes, coordLength, areas);
|
|
215
|
+
for (let t = 0, tl = triangles.length; t < tl; ++t) {
|
|
251
216
|
polygons.triangles.push(startPosition + triangles[t]);
|
|
252
217
|
}
|
|
253
218
|
}
|
|
254
219
|
function wrapProps(obj, size) {
|
|
255
|
-
|
|
256
|
-
for (
|
|
257
|
-
returnObj[
|
|
258
|
-
value: obj[
|
|
259
|
-
size
|
|
220
|
+
const returnObj = {};
|
|
221
|
+
for (const key in obj) {
|
|
222
|
+
returnObj[key] = {
|
|
223
|
+
value: obj[key],
|
|
224
|
+
size
|
|
260
225
|
};
|
|
261
226
|
}
|
|
262
227
|
return returnObj;
|
|
263
228
|
}
|
|
264
229
|
function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
265
|
-
|
|
266
|
-
points:
|
|
230
|
+
const binaryFeatures = {
|
|
231
|
+
points: {
|
|
232
|
+
...points,
|
|
267
233
|
positions: {
|
|
268
234
|
value: points.positions,
|
|
269
235
|
size: coordLength
|
|
@@ -277,8 +243,9 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
|
277
243
|
size: 1
|
|
278
244
|
},
|
|
279
245
|
numericProps: wrapProps(points.numericProps, 1)
|
|
280
|
-
}
|
|
281
|
-
lines:
|
|
246
|
+
},
|
|
247
|
+
lines: {
|
|
248
|
+
...lines,
|
|
282
249
|
positions: {
|
|
283
250
|
value: lines.positions,
|
|
284
251
|
size: coordLength
|
|
@@ -296,8 +263,9 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
|
296
263
|
size: 1
|
|
297
264
|
},
|
|
298
265
|
numericProps: wrapProps(lines.numericProps, 1)
|
|
299
|
-
}
|
|
300
|
-
polygons:
|
|
266
|
+
},
|
|
267
|
+
polygons: {
|
|
268
|
+
...polygons,
|
|
301
269
|
positions: {
|
|
302
270
|
value: polygons.positions,
|
|
303
271
|
size: coordLength
|
|
@@ -319,7 +287,7 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
|
319
287
|
size: 1
|
|
320
288
|
},
|
|
321
289
|
numericProps: wrapProps(polygons.numericProps, 1)
|
|
322
|
-
}
|
|
290
|
+
}
|
|
323
291
|
};
|
|
324
292
|
if (polygons.triangles) {
|
|
325
293
|
binaryFeatures.polygons.triangles = {
|
|
@@ -330,18 +298,18 @@ function makeAccessorObjects(points, lines, polygons, coordLength) {
|
|
|
330
298
|
return binaryFeatures;
|
|
331
299
|
}
|
|
332
300
|
function fillNumericProperties(object, properties, index, length) {
|
|
333
|
-
for (
|
|
301
|
+
for (const numericPropName in object.numericProps) {
|
|
334
302
|
if (numericPropName in properties) {
|
|
335
|
-
|
|
303
|
+
const value = properties[numericPropName];
|
|
336
304
|
object.numericProps[numericPropName].fill(value, index, index + length);
|
|
337
305
|
}
|
|
338
306
|
}
|
|
339
307
|
}
|
|
340
308
|
function keepStringProperties(properties, numericKeys) {
|
|
341
|
-
|
|
342
|
-
for (
|
|
343
|
-
if (!numericKeys.includes(
|
|
344
|
-
props[
|
|
309
|
+
const props = {};
|
|
310
|
+
for (const key in properties) {
|
|
311
|
+
if (!numericKeys.includes(key)) {
|
|
312
|
+
props[key] = properties[key];
|
|
345
313
|
}
|
|
346
314
|
}
|
|
347
315
|
return props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat-geojson-to-binary.js","names":["_polygon","require","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","arguments","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","flatGeojsonToBinary","features","geometryInfo","options","propArrayTypes","extractNumericPropTypes","numericPropKeys","k","fillArrays","PositionDataType","Float32Array","triangulate","TEST_EXPORTS","exports","_iterator","_step","feature","properties","val","deduceArrayType","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLength","_options$numericPropK","_options$PositionData","_options$triangulate","hasGlobalId","GlobalFeatureIdsDataType","Uint32Array","Uint16Array","points","type","positions","globalFeatureIds","featureIds","numericProps","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","triangles","_i","_arr","_iterator2","_step2","propName","T","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","_iterator3","_step3","geometry","handlePoint","keepStringProperties","id","handleLineString","handlePolygon","Error","makeAccessorObjects","set","data","nPositions","fillNumericProperties","fill","il","indices","start","end","l","ll","startPosition","areas","nextIndices","undefined","endPosition","triangulatePolygon","_ref","polygonPositions","subarray","offset","holes","map","earcut","t","tl","wrapProps","obj","size","returnObj","binaryFeatures","index","numericPropName","numericKeys","props","includes","x","Number","isFinite","Float64Array","Math","fround"],"sources":["../../../src/lib/flat-geojson-to-binary.ts"],"sourcesContent":["/* eslint-disable indent */\nimport {earcut} from '@math.gl/polygon';\nimport type {\n BinaryAttribute,\n BinaryFeatures,\n BinaryPolygonFeatures,\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 triangulate: options ? options.triangulate : true\n }\n );\n}\n\n/**\n * Options for `flatGeojsonToBinary`\n */\nexport type FlatGeojsonToBinaryOptions = {\n numericPropKeys?: string[];\n PositionDataType?: Float32ArrayConstructor | Float64ArrayConstructor;\n triangulate?: boolean;\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, triangulate = true} = 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 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 if (triangulate) {\n polygons.triangles = [];\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 if (!polygons.triangles) {\n return;\n }\n\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 // @ts-expect-error TODO can earcut handle binary arrays? Add tests?\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 const binaryFeatures = {\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 globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n numericProps: wrapProps(polygons.numericProps, 1)\n } as BinaryPolygonFeatures\n };\n\n if (polygons.triangles) {\n binaryFeatures.polygons.triangles = {value: new Uint32Array(polygons.triangles), size: 1};\n }\n\n return binaryFeatures;\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"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAAwC,SAAAC,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAO,CAAA,UAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,QAAAH,CAAA,IAAAT,CAAA,CAAAQ,MAAA,WAAAK,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAS,CAAA,UAAAM,CAAA,WAAAA,EAAAC,EAAA,UAAAA,EAAA,KAAAC,CAAA,EAAAP,CAAA,gBAAAQ,SAAA,iJAAAC,gBAAA,SAAAC,MAAA,UAAAC,GAAA,WAAAV,CAAA,WAAAA,EAAA,IAAAT,EAAA,GAAAA,EAAA,CAAAoB,IAAA,CAAAtB,CAAA,MAAAY,CAAA,WAAAA,EAAA,QAAAW,IAAA,GAAArB,EAAA,CAAAsB,IAAA,IAAAL,gBAAA,GAAAI,IAAA,CAAAV,IAAA,SAAAU,IAAA,KAAAR,CAAA,WAAAA,EAAAU,GAAA,IAAAL,MAAA,SAAAC,GAAA,GAAAI,GAAA,KAAAR,CAAA,WAAAA,EAAA,eAAAE,gBAAA,IAAAjB,EAAA,CAAAwB,MAAA,UAAAxB,EAAA,CAAAwB,MAAA,oBAAAN,MAAA,QAAAC,GAAA;AAAA,S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C,EACjCuC,UAA2D,EAC3D0F,KAAa,EACblK,MAAc,EACR;EACN,KAAK,IAAMmK,eAAe,IAAIlI,MAAM,CAACgE,YAAY,EAAE;IACjD,IAAIkE,eAAe,IAAI3F,UAAU,EAAE;MACjC,IAAMlE,KAAK,GAAGkE,UAAU,CAAC2F,eAAe,CAAW;MACnDlI,MAAM,CAACgE,YAAY,CAACkE,eAAe,CAAC,CAAC5B,IAAI,CAACjI,KAAK,EAAE4J,KAAK,EAAEA,KAAK,GAAGlK,MAAM,CAAC;IACzE;EACF;AACF;AASA,SAAS6H,oBAAoBA,CAC3BrD,UAA2D,EAC3D4F,WAAqB,EACrB;EACA,IAAMC,KAAK,GAAG,CAAC,CAAC;EAChB,KAAK,IAAMpH,KAAG,IAAIuB,UAAU,EAAE;IAC5B,IAAI,CAAC4F,WAAW,CAACE,QAAQ,CAACrH,KAAG,CAAC,EAAE;MAC9BoH,KAAK,CAACpH,KAAG,CAAC,GAAGuB,UAAU,CAACvB,KAAG,CAAC;IAC9B;EACF;EACA,OAAOoH,KAAK;AACd;AAUA,SAAS3F,eAAeA,CAAC6F,CAAM,EAAE9I,WAAiC,EAAwB;EACxF,IAAIA,WAAW,KAAK5B,KAAK,IAAI,CAAC2K,MAAM,CAACC,QAAQ,CAACF,CAAC,CAAC,EAAE;IAChD,OAAO1K,KAAK;EACd;EAGA,OAAO4B,WAAW,KAAKiJ,YAAY,IAAIC,IAAI,CAACC,MAAM,CAACL,CAAC,CAAC,KAAKA,CAAC,GAAGG,YAAY,GAAGzG,YAAY;AAC3F"}
|
|
1
|
+
{"version":3,"file":"flat-geojson-to-binary.js","names":["_polygon","require","flatGeojsonToBinary","features","geometryInfo","options","propArrayTypes","extractNumericPropTypes","numericPropKeys","Object","keys","filter","k","Array","fillArrays","PositionDataType","Float32Array","triangulate","TEST_EXPORTS","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","_ref","polygonPositions","subarray","offset","holes","slice","map","n","earcut","t","tl","wrapProps","obj","size","returnObj","value","binaryFeatures","index","numericPropName","numericKeys","props","includes","x","constructor","Number","isFinite","Float64Array","Math","fround"],"sources":["../../../src/lib/flat-geojson-to-binary.ts"],"sourcesContent":["/* eslint-disable indent */\nimport {earcut} from '@math.gl/polygon';\nimport type {\n BinaryAttribute,\n BinaryFeatures,\n BinaryPolygonFeatures,\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 triangulate: options ? options.triangulate : true\n }\n );\n}\n\n/**\n * Options for `flatGeojsonToBinary`\n */\nexport type FlatGeojsonToBinaryOptions = {\n numericPropKeys?: string[];\n PositionDataType?: Float32ArrayConstructor | Float64ArrayConstructor;\n triangulate?: boolean;\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, triangulate = true} = 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 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 if (triangulate) {\n polygons.triangles = [];\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 if (!polygons.triangles) {\n return;\n }\n\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 // @ts-expect-error TODO can earcut handle binary arrays? Add tests?\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 const binaryFeatures = {\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 globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n numericProps: wrapProps(polygons.numericProps, 1)\n } as BinaryPolygonFeatures\n };\n\n if (polygons.triangles) {\n binaryFeatures.polygons.triangles = {value: new Uint32Array(polygons.triangles), size: 1};\n }\n\n return binaryFeatures;\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"],"mappings":";;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AA2BO,SAASC,mBAAmBA,CACjCC,QAAuB,EACvBC,YAAiC,EACjCC,OAAoC,EACpC;EACA,MAAMC,cAAc,GAAGC,uBAAuB,CAACJ,QAAQ,CAAC;EACxD,MAAMK,eAAe,GAAGC,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAACK,MAAM,CAAEC,CAAC,IAAKN,cAAc,CAACM,CAAC,CAAC,KAAKC,KAAK,CAAC;EAC9F,OAAOC,UAAU,CACfX,QAAQ,EACR;IACEG,cAAc;IACd,GAAGF;EACL,CAAC,EACD;IACEI,eAAe,EAAGH,OAAO,IAAIA,OAAO,CAACG,eAAe,IAAKA,eAAe;IACxEO,gBAAgB,EAAEV,OAAO,GAAGA,OAAO,CAACU,gBAAgB,GAAGC,YAAY;IACnEC,WAAW,EAAEZ,OAAO,GAAGA,OAAO,CAACY,WAAW,GAAG;EAC/C,CACF,CAAC;AACH;AAWO,MAAMC,YAAY,GAAG;EAC1BX;AACF,CAAC;AAACY,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAQF,SAASX,uBAAuBA,CAACJ,QAAuB,EAEtD;EACA,MAAMG,cAAc,GAAG,CAAC,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AAC3F,GAAG,CAAC,GAAGD,UAAU,CAACC,GAAG,CAAC;IAC9B;EACF;EACA,OAAO2F,KAAK;AACd;AAUA,SAASzF,eAAeA,CAAC2F,CAAM,EAAEC,WAAiC,EAAwB;EACxF,IAAIA,WAAW,KAAKvG,KAAK,IAAI,CAACwG,MAAM,CAACC,QAAQ,CAACH,CAAC,CAAC,EAAE;IAChD,OAAOtG,KAAK;EACd;EAGA,OAAOuG,WAAW,KAAKG,YAAY,IAAIC,IAAI,CAACC,MAAM,CAACN,CAAC,CAAC,KAAKA,CAAC,GAAGI,YAAY,GAAGvG,YAAY;AAC3F"}
|
|
@@ -8,16 +8,18 @@ var _extractGeometryInfo = require("./extract-geometry-info");
|
|
|
8
8
|
var _geojsonToFlatGeojson = require("./geojson-to-flat-geojson");
|
|
9
9
|
var _flatGeojsonToBinary = require("./flat-geojson-to-binary");
|
|
10
10
|
function geojsonToBinary(features) {
|
|
11
|
-
|
|
11
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
12
12
|
fixRingWinding: true,
|
|
13
13
|
triangulate: true
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const geometryInfo = (0, _extractGeometryInfo.extractGeometryInfo)(features);
|
|
16
|
+
const coordLength = geometryInfo.coordLength;
|
|
17
|
+
const {
|
|
18
|
+
fixRingWinding
|
|
19
|
+
} = options;
|
|
20
|
+
const flatFeatures = (0, _geojsonToFlatGeojson.geojsonToFlatGeojson)(features, {
|
|
21
|
+
coordLength,
|
|
22
|
+
fixRingWinding
|
|
21
23
|
});
|
|
22
24
|
return (0, _flatGeojsonToBinary.flatGeojsonToBinary)(flatFeatures, geometryInfo, {
|
|
23
25
|
numericPropKeys: options.numericPropKeys,
|