@loaders.gl/gis 4.2.0-alpha.4 → 4.2.0-alpha.6

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 (34) hide show
  1. package/dist/index.cjs +35 -92
  2. package/dist/index.cjs.map +7 -0
  3. package/dist/index.d.ts +12 -12
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +6 -1
  6. package/dist/lib/binary-features/binary-to-geojson.js +175 -171
  7. package/dist/lib/binary-features/extract-geometry-info.js +88 -80
  8. package/dist/lib/binary-features/flat-geojson-to-binary-types.js +0 -1
  9. package/dist/lib/binary-features/flat-geojson-to-binary.d.ts +1 -1
  10. package/dist/lib/binary-features/flat-geojson-to-binary.d.ts.map +1 -1
  11. package/dist/lib/binary-features/flat-geojson-to-binary.js +346 -281
  12. package/dist/lib/binary-features/geojson-to-binary.js +17 -20
  13. package/dist/lib/binary-features/geojson-to-flat-geojson.js +111 -84
  14. package/dist/lib/binary-features/transform.js +44 -30
  15. package/dist/lib/geo/geoarrow-metadata.js +61 -34
  16. package/dist/lib/geo/geoparquet-metadata-schema.js +64 -71
  17. package/dist/lib/geo/geoparquet-metadata.d.ts.map +1 -1
  18. package/dist/lib/geo/geoparquet-metadata.js +97 -77
  19. package/dist/lib/tables/convert-table-to-geojson.js +38 -42
  20. package/package.json +7 -4
  21. package/src/lib/geo/geoparquet-metadata.ts +2 -1
  22. package/dist/index.js.map +0 -1
  23. package/dist/lib/binary-features/binary-to-geojson.js.map +0 -1
  24. package/dist/lib/binary-features/extract-geometry-info.js.map +0 -1
  25. package/dist/lib/binary-features/flat-geojson-to-binary-types.js.map +0 -1
  26. package/dist/lib/binary-features/flat-geojson-to-binary.js.map +0 -1
  27. package/dist/lib/binary-features/geojson-to-binary.js.map +0 -1
  28. package/dist/lib/binary-features/geojson-to-flat-geojson.js.map +0 -1
  29. package/dist/lib/binary-features/transform.js.map +0 -1
  30. package/dist/lib/geo/geoarrow-metadata.js.map +0 -1
  31. package/dist/lib/geo/geoparquet-metadata-schema.js.map +0 -1
  32. package/dist/lib/geo/geoparquet-metadata-schema.json +0 -60
  33. package/dist/lib/geo/geoparquet-metadata.js.map +0 -1
  34. package/dist/lib/tables/convert-table-to-geojson.js.map +0 -1
@@ -1,198 +1,202 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Convert binary geometry representation to GeoJSON
6
+ * @param data geometry data in binary representation
7
+ * @param options
8
+ * @param options.type Input data type: Point, LineString, or Polygon
9
+ * @param options.featureId Global feature id. If specified, only a single feature is extracted
10
+ * @return GeoJSON objects
11
+ */
1
12
  export function binaryToGeojson(data, options) {
2
- const globalFeatureId = options === null || options === void 0 ? void 0 : options.globalFeatureId;
3
- if (globalFeatureId !== undefined) {
4
- return getSingleFeature(data, globalFeatureId);
5
- }
6
- return parseFeatures(data, options === null || options === void 0 ? void 0 : options.type);
13
+ const globalFeatureId = options?.globalFeatureId;
14
+ if (globalFeatureId !== undefined) {
15
+ return getSingleFeature(data, globalFeatureId);
16
+ }
17
+ return parseFeatures(data, options?.type);
7
18
  }
19
+ /**
20
+ * Return a single feature from a binary geometry representation as GeoJSON
21
+ * @param data geometry data in binary representation
22
+ * @return GeoJSON feature
23
+ */
8
24
  function getSingleFeature(data, globalFeatureId) {
9
- const dataArray = normalizeInput(data);
10
- for (const data of dataArray) {
11
- let lastIndex = 0;
12
- let lastValue = data.featureIds.value[0];
13
- for (let i = 0; i < data.featureIds.value.length; i++) {
14
- const currValue = data.featureIds.value[i];
15
- if (currValue === lastValue) {
16
- continue;
17
- }
18
- if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {
19
- return parseFeature(data, lastIndex, i);
20
- }
21
- lastIndex = i;
22
- lastValue = currValue;
23
- }
24
- if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {
25
- return parseFeature(data, lastIndex, data.featureIds.value.length);
25
+ const dataArray = normalizeInput(data);
26
+ for (const data of dataArray) {
27
+ let lastIndex = 0;
28
+ let lastValue = data.featureIds.value[0];
29
+ // Scan through data until we find matching feature
30
+ for (let i = 0; i < data.featureIds.value.length; i++) {
31
+ const currValue = data.featureIds.value[i];
32
+ if (currValue === lastValue) {
33
+ // eslint-disable-next-line no-continue
34
+ continue;
35
+ }
36
+ if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {
37
+ return parseFeature(data, lastIndex, i);
38
+ }
39
+ lastIndex = i;
40
+ lastValue = currValue;
41
+ }
42
+ if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {
43
+ return parseFeature(data, lastIndex, data.featureIds.value.length);
44
+ }
26
45
  }
27
- }
28
- throw new Error(`featureId:${globalFeatureId} not found`);
46
+ throw new Error(`featureId:${globalFeatureId} not found`);
29
47
  }
30
48
  function parseFeatures(data, type) {
31
- const dataArray = normalizeInput(data, type);
32
- return parseFeatureCollection(dataArray);
49
+ const dataArray = normalizeInput(data, type);
50
+ return parseFeatureCollection(dataArray);
33
51
  }
52
+ /** Parse input binary data and return a valid GeoJSON geometry object */
34
53
  export function binaryToGeometry(data, startIndex, endIndex) {
35
- switch (data.type) {
36
- case 'Point':
37
- return pointToGeoJson(data, startIndex, endIndex);
38
- case 'LineString':
39
- return lineStringToGeoJson(data, startIndex, endIndex);
40
- case 'Polygon':
41
- return polygonToGeoJson(data, startIndex, endIndex);
42
- default:
43
- const unexpectedInput = data;
44
- throw new Error(`Unsupported geometry type: ${unexpectedInput === null || unexpectedInput === void 0 ? void 0 : unexpectedInput.type}`);
45
- }
54
+ switch (data.type) {
55
+ case 'Point':
56
+ return pointToGeoJson(data, startIndex, endIndex);
57
+ case 'LineString':
58
+ return lineStringToGeoJson(data, startIndex, endIndex);
59
+ case 'Polygon':
60
+ return polygonToGeoJson(data, startIndex, endIndex);
61
+ default:
62
+ const unexpectedInput = data;
63
+ throw new Error(`Unsupported geometry type: ${unexpectedInput?.type}`);
64
+ }
46
65
  }
66
+ // Normalize features
67
+ // Return an array of data objects, each of which have a type key
47
68
  function normalizeInput(data, type) {
48
- const features = [];
49
- if (data.points) {
50
- data.points.type = 'Point';
51
- features.push(data.points);
52
- }
53
- if (data.lines) {
54
- data.lines.type = 'LineString';
55
- features.push(data.lines);
56
- }
57
- if (data.polygons) {
58
- data.polygons.type = 'Polygon';
59
- features.push(data.polygons);
60
- }
61
- return features;
69
+ const features = [];
70
+ if (data.points) {
71
+ data.points.type = 'Point';
72
+ features.push(data.points);
73
+ }
74
+ if (data.lines) {
75
+ data.lines.type = 'LineString';
76
+ features.push(data.lines);
77
+ }
78
+ if (data.polygons) {
79
+ data.polygons.type = 'Polygon';
80
+ features.push(data.polygons);
81
+ }
82
+ return features;
62
83
  }
84
+ /** Parse input binary data and return an array of GeoJSON Features */
63
85
  function parseFeatureCollection(dataArray) {
64
- const features = [];
65
- for (const data of dataArray) {
66
- if (data.featureIds.value.length === 0) {
67
- continue;
68
- }
69
- let lastIndex = 0;
70
- let lastValue = data.featureIds.value[0];
71
- for (let i = 0; i < data.featureIds.value.length; i++) {
72
- const currValue = data.featureIds.value[i];
73
- if (currValue === lastValue) {
74
- continue;
75
- }
76
- features.push(parseFeature(data, lastIndex, i));
77
- lastIndex = i;
78
- lastValue = currValue;
86
+ const features = [];
87
+ for (const data of dataArray) {
88
+ if (data.featureIds.value.length === 0) {
89
+ // eslint-disable-next-line no-continue
90
+ continue;
91
+ }
92
+ let lastIndex = 0;
93
+ let lastValue = data.featureIds.value[0];
94
+ // Need to deduce start, end indices of each feature
95
+ for (let i = 0; i < data.featureIds.value.length; i++) {
96
+ const currValue = data.featureIds.value[i];
97
+ if (currValue === lastValue) {
98
+ // eslint-disable-next-line no-continue
99
+ continue;
100
+ }
101
+ features.push(parseFeature(data, lastIndex, i));
102
+ lastIndex = i;
103
+ lastValue = currValue;
104
+ }
105
+ // Last feature
106
+ features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
79
107
  }
80
- features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
81
- }
82
- return features;
108
+ return features;
83
109
  }
110
+ /** Parse input binary data and return a single GeoJSON Feature */
84
111
  function parseFeature(data, startIndex, endIndex) {
85
- const geometry = binaryToGeometry(data, startIndex, endIndex);
86
- const properties = parseProperties(data, startIndex, endIndex);
87
- const fields = parseFields(data, startIndex, endIndex);
88
- return {
89
- type: 'Feature',
90
- geometry,
91
- properties,
92
- ...fields
93
- };
112
+ const geometry = binaryToGeometry(data, startIndex, endIndex);
113
+ const properties = parseProperties(data, startIndex, endIndex);
114
+ const fields = parseFields(data, startIndex, endIndex);
115
+ return { type: 'Feature', geometry, properties, ...fields };
94
116
  }
95
- function parseFields(data) {
96
- let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
97
- let endIndex = arguments.length > 2 ? arguments[2] : undefined;
98
- return data.fields && data.fields[data.featureIds.value[startIndex]];
117
+ /** Parse input binary data and return an object of fields */
118
+ function parseFields(data, startIndex = 0, endIndex) {
119
+ return data.fields && data.fields[data.featureIds.value[startIndex]];
99
120
  }
100
- function parseProperties(data) {
101
- let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
102
- let endIndex = arguments.length > 2 ? arguments[2] : undefined;
103
- const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
104
- for (const key in data.numericProps) {
105
- properties[key] = data.numericProps[key].value[startIndex];
106
- }
107
- return properties;
121
+ /** Parse input binary data and return an object of properties */
122
+ function parseProperties(data, startIndex = 0, endIndex) {
123
+ const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
124
+ for (const key in data.numericProps) {
125
+ properties[key] = data.numericProps[key].value[startIndex];
126
+ }
127
+ return properties;
108
128
  }
109
- function polygonToGeoJson(data) {
110
- let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -Infinity;
111
- let endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
112
- const {
113
- positions
114
- } = data;
115
- const polygonIndices = data.polygonIndices.value.filter(x => x >= startIndex && x <= endIndex);
116
- const primitivePolygonIndices = data.primitivePolygonIndices.value.filter(x => x >= startIndex && x <= endIndex);
117
- const multi = polygonIndices.length > 2;
118
- if (!multi) {
129
+ /** Parse binary data of type Polygon */
130
+ function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
131
+ const { positions } = data;
132
+ const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
133
+ const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
134
+ const multi = polygonIndices.length > 2;
135
+ // Polygon
136
+ if (!multi) {
137
+ const coordinates = [];
138
+ for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
139
+ const startRingIndex = primitivePolygonIndices[i];
140
+ const endRingIndex = primitivePolygonIndices[i + 1];
141
+ const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
142
+ coordinates.push(ringCoordinates);
143
+ }
144
+ return { type: 'Polygon', coordinates };
145
+ }
146
+ // MultiPolygon
119
147
  const coordinates = [];
120
- for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
121
- const startRingIndex = primitivePolygonIndices[i];
122
- const endRingIndex = primitivePolygonIndices[i + 1];
123
- const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
124
- coordinates.push(ringCoordinates);
148
+ for (let i = 0; i < polygonIndices.length - 1; i++) {
149
+ const startPolygonIndex = polygonIndices[i];
150
+ const endPolygonIndex = polygonIndices[i + 1];
151
+ const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
152
+ coordinates.push(polygonCoordinates);
125
153
  }
126
- return {
127
- type: 'Polygon',
128
- coordinates
129
- };
130
- }
131
- const coordinates = [];
132
- for (let i = 0; i < polygonIndices.length - 1; i++) {
133
- const startPolygonIndex = polygonIndices[i];
134
- const endPolygonIndex = polygonIndices[i + 1];
135
- const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
136
- coordinates.push(polygonCoordinates);
137
- }
138
- return {
139
- type: 'MultiPolygon',
140
- coordinates
141
- };
154
+ return { type: 'MultiPolygon', coordinates };
142
155
  }
143
- function lineStringToGeoJson(data) {
144
- let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -Infinity;
145
- let endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
146
- const {
147
- positions
148
- } = data;
149
- const pathIndices = data.pathIndices.value.filter(x => x >= startIndex && x <= endIndex);
150
- const multi = pathIndices.length > 2;
151
- if (!multi) {
152
- const coordinates = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
153
- return {
154
- type: 'LineString',
155
- coordinates
156
- };
157
- }
158
- const coordinates = [];
159
- for (let i = 0; i < pathIndices.length - 1; i++) {
160
- const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
161
- coordinates.push(ringCoordinates);
162
- }
163
- return {
164
- type: 'MultiLineString',
165
- coordinates
166
- };
156
+ /** Parse binary data of type LineString */
157
+ function lineStringToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
158
+ const { positions } = data;
159
+ const pathIndices = data.pathIndices.value.filter((x) => x >= startIndex && x <= endIndex);
160
+ const multi = pathIndices.length > 2;
161
+ if (!multi) {
162
+ const coordinates = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
163
+ return { type: 'LineString', coordinates };
164
+ }
165
+ const coordinates = [];
166
+ for (let i = 0; i < pathIndices.length - 1; i++) {
167
+ const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
168
+ coordinates.push(ringCoordinates);
169
+ }
170
+ return { type: 'MultiLineString', coordinates };
167
171
  }
172
+ /** Parse binary data of type Point */
168
173
  function pointToGeoJson(data, startIndex, endIndex) {
169
- const {
170
- positions
171
- } = data;
172
- const coordinates = ringToGeoJson(positions, startIndex, endIndex);
173
- const multi = coordinates.length > 1;
174
- if (multi) {
175
- return {
176
- type: 'MultiPoint',
177
- coordinates
178
- };
179
- }
180
- return {
181
- type: 'Point',
182
- coordinates: coordinates[0]
183
- };
174
+ const { positions } = data;
175
+ const coordinates = ringToGeoJson(positions, startIndex, endIndex);
176
+ const multi = coordinates.length > 1;
177
+ if (multi) {
178
+ return { type: 'MultiPoint', coordinates };
179
+ }
180
+ return { type: 'Point', coordinates: coordinates[0] };
184
181
  }
182
+ /**
183
+ * Parse a linear ring of positions to a GeoJSON linear ring
184
+ *
185
+ * @param positions Positions TypedArray
186
+ * @param startIndex Start index to include in ring
187
+ * @param endIndex End index to include in ring
188
+ * @returns GeoJSON ring
189
+ */
185
190
  function ringToGeoJson(positions, startIndex, endIndex) {
186
- startIndex = startIndex || 0;
187
- endIndex = endIndex || positions.value.length / positions.size;
188
- const ringCoordinates = [];
189
- for (let j = startIndex; j < endIndex; j++) {
190
- const coord = Array();
191
- for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
192
- coord.push(Number(positions.value[k]));
191
+ startIndex = startIndex || 0;
192
+ endIndex = endIndex || positions.value.length / positions.size;
193
+ const ringCoordinates = [];
194
+ for (let j = startIndex; j < endIndex; j++) {
195
+ const coord = Array();
196
+ for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
197
+ coord.push(Number(positions.value[k]));
198
+ }
199
+ ringCoordinates.push(coord);
193
200
  }
194
- ringCoordinates.push(coord);
195
- }
196
- return ringCoordinates;
201
+ return ringCoordinates;
197
202
  }
198
- //# sourceMappingURL=binary-to-geojson.js.map
@@ -1,84 +1,92 @@
1
+ /**
2
+ * Initial scan over GeoJSON features
3
+ * Counts number of coordinates of each geometry type and
4
+ * keeps track of the max coordinate dimensions
5
+ */
6
+ // eslint-disable-next-line complexity, max-statements
1
7
  export function extractGeometryInfo(features) {
2
- let pointPositionsCount = 0;
3
- let pointFeaturesCount = 0;
4
- let linePositionsCount = 0;
5
- let linePathsCount = 0;
6
- let lineFeaturesCount = 0;
7
- let polygonPositionsCount = 0;
8
- let polygonObjectsCount = 0;
9
- let polygonRingsCount = 0;
10
- let polygonFeaturesCount = 0;
11
- const coordLengths = new Set();
12
- for (const feature of features) {
13
- const geometry = feature.geometry;
14
- switch (geometry.type) {
15
- case 'Point':
16
- pointFeaturesCount++;
17
- pointPositionsCount++;
18
- coordLengths.add(geometry.coordinates.length);
19
- break;
20
- case 'MultiPoint':
21
- pointFeaturesCount++;
22
- pointPositionsCount += geometry.coordinates.length;
23
- for (const point of geometry.coordinates) {
24
- coordLengths.add(point.length);
8
+ // Counts the number of _positions_, so [x, y, z] counts as one
9
+ let pointPositionsCount = 0;
10
+ let pointFeaturesCount = 0;
11
+ let linePositionsCount = 0;
12
+ let linePathsCount = 0;
13
+ let lineFeaturesCount = 0;
14
+ let polygonPositionsCount = 0;
15
+ let polygonObjectsCount = 0;
16
+ let polygonRingsCount = 0;
17
+ let polygonFeaturesCount = 0;
18
+ const coordLengths = new Set();
19
+ for (const feature of features) {
20
+ const geometry = feature.geometry;
21
+ switch (geometry.type) {
22
+ case 'Point':
23
+ pointFeaturesCount++;
24
+ pointPositionsCount++;
25
+ coordLengths.add(geometry.coordinates.length);
26
+ break;
27
+ case 'MultiPoint':
28
+ pointFeaturesCount++;
29
+ pointPositionsCount += geometry.coordinates.length;
30
+ for (const point of geometry.coordinates) {
31
+ coordLengths.add(point.length);
32
+ }
33
+ break;
34
+ case 'LineString':
35
+ lineFeaturesCount++;
36
+ linePositionsCount += geometry.coordinates.length;
37
+ linePathsCount++;
38
+ for (const coord of geometry.coordinates) {
39
+ coordLengths.add(coord.length);
40
+ }
41
+ break;
42
+ case 'MultiLineString':
43
+ lineFeaturesCount++;
44
+ for (const line of geometry.coordinates) {
45
+ linePositionsCount += line.length;
46
+ linePathsCount++;
47
+ // eslint-disable-next-line max-depth
48
+ for (const coord of line) {
49
+ coordLengths.add(coord.length);
50
+ }
51
+ }
52
+ break;
53
+ case 'Polygon':
54
+ polygonFeaturesCount++;
55
+ polygonObjectsCount++;
56
+ polygonRingsCount += geometry.coordinates.length;
57
+ const flattened = geometry.coordinates.flat();
58
+ polygonPositionsCount += flattened.length;
59
+ for (const coord of flattened) {
60
+ coordLengths.add(coord.length);
61
+ }
62
+ break;
63
+ case 'MultiPolygon':
64
+ polygonFeaturesCount++;
65
+ for (const polygon of geometry.coordinates) {
66
+ polygonObjectsCount++;
67
+ polygonRingsCount += polygon.length;
68
+ const flattened = polygon.flat();
69
+ polygonPositionsCount += flattened.length;
70
+ // eslint-disable-next-line max-depth
71
+ for (const coord of flattened) {
72
+ coordLengths.add(coord.length);
73
+ }
74
+ }
75
+ break;
76
+ default:
77
+ throw new Error(`Unsupported geometry type: ${geometry.type}`);
25
78
  }
26
- break;
27
- case 'LineString':
28
- lineFeaturesCount++;
29
- linePositionsCount += geometry.coordinates.length;
30
- linePathsCount++;
31
- for (const coord of geometry.coordinates) {
32
- coordLengths.add(coord.length);
33
- }
34
- break;
35
- case 'MultiLineString':
36
- lineFeaturesCount++;
37
- for (const line of geometry.coordinates) {
38
- linePositionsCount += line.length;
39
- linePathsCount++;
40
- for (const coord of line) {
41
- coordLengths.add(coord.length);
42
- }
43
- }
44
- break;
45
- case 'Polygon':
46
- polygonFeaturesCount++;
47
- polygonObjectsCount++;
48
- polygonRingsCount += geometry.coordinates.length;
49
- const flattened = geometry.coordinates.flat();
50
- polygonPositionsCount += flattened.length;
51
- for (const coord of flattened) {
52
- coordLengths.add(coord.length);
53
- }
54
- break;
55
- case 'MultiPolygon':
56
- polygonFeaturesCount++;
57
- for (const polygon of geometry.coordinates) {
58
- polygonObjectsCount++;
59
- polygonRingsCount += polygon.length;
60
- const flattened = polygon.flat();
61
- polygonPositionsCount += flattened.length;
62
- for (const coord of flattened) {
63
- coordLengths.add(coord.length);
64
- }
65
- }
66
- break;
67
- default:
68
- throw new Error(`Unsupported geometry type: ${geometry.type}`);
69
79
  }
70
- }
71
- return {
72
- coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,
73
- pointPositionsCount,
74
- pointFeaturesCount,
75
- linePositionsCount,
76
- linePathsCount,
77
- lineFeaturesCount,
78
- polygonPositionsCount,
79
- polygonObjectsCount,
80
- polygonRingsCount,
81
- polygonFeaturesCount
82
- };
80
+ return {
81
+ coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,
82
+ pointPositionsCount,
83
+ pointFeaturesCount,
84
+ linePositionsCount,
85
+ linePathsCount,
86
+ lineFeaturesCount,
87
+ polygonPositionsCount,
88
+ polygonObjectsCount,
89
+ polygonRingsCount,
90
+ polygonFeaturesCount
91
+ };
83
92
  }
84
- //# sourceMappingURL=extract-geometry-info.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=flat-geojson-to-binary-types.js.map
@@ -1,5 +1,5 @@
1
1
  import type { BinaryFeatureCollection, FlatFeature, GeojsonGeometryInfo } from '@loaders.gl/schema';
2
- import { PropArrayConstructor } from './flat-geojson-to-binary-types';
2
+ import { PropArrayConstructor } from "./flat-geojson-to-binary-types.js";
3
3
  /**
4
4
  * Convert binary features to flat binary arrays. Similar to
5
5
  * `geojsonToBinary` helper function, except that it expects
@@ -1 +1 @@
1
- {"version":3,"file":"flat-geojson-to-binary.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-features/flat-geojson-to-binary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,uBAAuB,EAEvB,WAAW,EAIX,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAA0B,MAAM,gCAAgC,CAAC;AAE7F;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,WAAW,EAAE,EACvB,YAAY,EAAE,mBAAmB,EACjC,OAAO,CAAC,EAAE,0BAA0B,2BAgBrC;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,CAAC;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF;;;;;GAKG;AACH,iBAAS,uBAAuB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG;IACzD,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACrC,CAgBA"}
1
+ {"version":3,"file":"flat-geojson-to-binary.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-features/flat-geojson-to-binary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,uBAAuB,EAEvB,WAAW,EAIX,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAA0B,0CAAuC;AAE7F;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,WAAW,EAAE,EACvB,YAAY,EAAE,mBAAmB,EACjC,OAAO,CAAC,EAAE,0BAA0B,2BAgBrC;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,CAAC;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF;;;;;GAKG;AACH,iBAAS,uBAAuB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG;IACzD,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACrC,CAgBA"}