@math.gl/geoarrow 5.0.0-alpha.2 → 5.0.0-alpha.3
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/README.md +45 -15
- package/dist/builder-entry.cjs +561 -0
- package/dist/builder-entry.cjs.map +6 -0
- package/dist/builder-entry.d.ts +4 -0
- package/dist/builder-entry.d.ts.map +1 -0
- package/dist/builder-entry.js +5 -0
- package/dist/builder-entry.js.map +1 -0
- package/dist/builder.d.ts +12 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +112 -10
- package/dist/builder.js.map +1 -1
- package/dist/codecs.d.ts.map +1 -1
- package/dist/codecs.js +205 -7
- package/dist/codecs.js.map +1 -1
- package/dist/index.cjs +904 -120
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kernels.d.ts +8 -3
- package/dist/kernels.d.ts.map +1 -1
- package/dist/kernels.js +610 -107
- package/dist/kernels.js.map +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +28 -5
- package/dist/layout.js.map +1 -1
- package/dist/tessellation-entry.cjs +427 -0
- package/dist/tessellation-entry.cjs.map +6 -0
- package/dist/tessellation-entry.d.ts +4 -0
- package/dist/tessellation-entry.d.ts.map +1 -0
- package/dist/tessellation-entry.js +5 -0
- package/dist/tessellation-entry.js.map +1 -0
- package/dist/types.d.ts +37 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wkb-entry.cjs +1005 -0
- package/dist/wkb-entry.cjs.map +6 -0
- package/dist/wkb-entry.d.ts +3 -0
- package/dist/wkb-entry.d.ts.map +1 -0
- package/dist/wkb-entry.js +6 -0
- package/dist/wkb-entry.js.map +1 -0
- package/dist/worker.cjs +4 -0
- package/dist/worker.cjs.map +1 -1
- package/package.json +21 -6
- package/src/builder-entry.ts +18 -0
- package/src/builder.ts +133 -19
- package/src/codecs.ts +251 -9
- package/src/index.ts +1 -0
- package/src/kernels.ts +811 -133
- package/src/layout.ts +38 -13
- package/src/tessellation-entry.ts +7 -0
- package/src/types.ts +23 -4
- package/src/wkb-entry.ts +11 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// dist/tessellation-entry.js
|
|
20
|
+
var tessellation_entry_exports = {};
|
|
21
|
+
__export(tessellation_entry_exports, {
|
|
22
|
+
tessellateGeoArrowPolygons: () => tessellateGeoArrowPolygons
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(tessellation_entry_exports);
|
|
25
|
+
|
|
26
|
+
// dist/tessellate.js
|
|
27
|
+
var import_polygon = require("@math.gl/polygon");
|
|
28
|
+
|
|
29
|
+
// dist/types.js
|
|
30
|
+
function getGeoArrowDimensionSize(dimension) {
|
|
31
|
+
switch (dimension) {
|
|
32
|
+
case "xy":
|
|
33
|
+
return 2;
|
|
34
|
+
case "xyz":
|
|
35
|
+
case "xym":
|
|
36
|
+
return 3;
|
|
37
|
+
case "xyzm":
|
|
38
|
+
return 4;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function getGeoArrowGeometryType(encoding) {
|
|
42
|
+
switch (encoding) {
|
|
43
|
+
case "geoarrow.point":
|
|
44
|
+
return "Point";
|
|
45
|
+
case "geoarrow.linestring":
|
|
46
|
+
return "LineString";
|
|
47
|
+
case "geoarrow.polygon":
|
|
48
|
+
return "Polygon";
|
|
49
|
+
case "geoarrow.multipoint":
|
|
50
|
+
return "MultiPoint";
|
|
51
|
+
case "geoarrow.multilinestring":
|
|
52
|
+
return "MultiLineString";
|
|
53
|
+
case "geoarrow.multipolygon":
|
|
54
|
+
return "MultiPolygon";
|
|
55
|
+
case "geoarrow.geometrycollection":
|
|
56
|
+
return "GeometryCollection";
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// dist/layout.js
|
|
63
|
+
function isGeoArrowValueValid(validity, index) {
|
|
64
|
+
if (!validity)
|
|
65
|
+
return true;
|
|
66
|
+
const bitIndex = (validity.bitOffset || 0) + index;
|
|
67
|
+
return Boolean(validity.values[bitIndex >> 3] & 1 << (bitIndex & 7));
|
|
68
|
+
}
|
|
69
|
+
function getGeoArrowRowCount(column) {
|
|
70
|
+
return column.chunks.reduce((count, chunk) => count + chunk.length, 0);
|
|
71
|
+
}
|
|
72
|
+
function visitGeoArrowCoordinates(column, visitor) {
|
|
73
|
+
let rowOffset = 0;
|
|
74
|
+
for (const chunk of column.chunks) {
|
|
75
|
+
visitChunkCoordinates(chunk, column.encoding, rowOffset, visitor);
|
|
76
|
+
rowOffset += chunk.length;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function getGeoArrowVertexCount(column) {
|
|
80
|
+
if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt" || column.encoding === "geoarrow.box") {
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
let count = 0;
|
|
84
|
+
visitGeoArrowCoordinates(column, (coordinate) => {
|
|
85
|
+
count++;
|
|
86
|
+
return coordinate;
|
|
87
|
+
});
|
|
88
|
+
return count;
|
|
89
|
+
}
|
|
90
|
+
function materializeGeoArrowRows(column) {
|
|
91
|
+
if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt") {
|
|
92
|
+
throw new Error("Serialized GeoArrow columns must be decoded before materialization");
|
|
93
|
+
}
|
|
94
|
+
const rows = [];
|
|
95
|
+
for (const chunk of column.chunks) {
|
|
96
|
+
for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
|
|
97
|
+
rows.push(materializeGeometryRow(chunk, rowIndex, column.encoding));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return rows;
|
|
101
|
+
}
|
|
102
|
+
function materializeGeometryRow(array, rowIndex, encoding) {
|
|
103
|
+
if (!isGeoArrowValueValid(array.validity, rowIndex))
|
|
104
|
+
return null;
|
|
105
|
+
if (encoding === "geoarrow.geometry") {
|
|
106
|
+
if (array.kind !== "dense-union")
|
|
107
|
+
return null;
|
|
108
|
+
return materializeUnionRow(array, rowIndex);
|
|
109
|
+
}
|
|
110
|
+
if (encoding === "geoarrow.geometrycollection") {
|
|
111
|
+
if (array.kind !== "list")
|
|
112
|
+
return null;
|
|
113
|
+
const [first, last] = getListRange(array, rowIndex);
|
|
114
|
+
const geometries = [];
|
|
115
|
+
for (let index = first; index < last; index++) {
|
|
116
|
+
if (array.child.kind !== "dense-union")
|
|
117
|
+
continue;
|
|
118
|
+
const geometry = materializeUnionRow(array.child, index);
|
|
119
|
+
if (geometry)
|
|
120
|
+
geometries.push(geometry);
|
|
121
|
+
}
|
|
122
|
+
return { type: "GeometryCollection", geometries };
|
|
123
|
+
}
|
|
124
|
+
const geometryType = getGeoArrowGeometryType(encoding);
|
|
125
|
+
if (!geometryType || geometryType === "GeometryCollection")
|
|
126
|
+
return null;
|
|
127
|
+
const depth = getEncodingDepth(encoding);
|
|
128
|
+
const coordinates = readNestedCoordinates(array, rowIndex, depth);
|
|
129
|
+
if (!coordinates)
|
|
130
|
+
return null;
|
|
131
|
+
return { type: geometryType, coordinates };
|
|
132
|
+
}
|
|
133
|
+
function getGeoArrowOffset(offsets, index) {
|
|
134
|
+
const value = offsets[index];
|
|
135
|
+
const numericValue = typeof value === "bigint" ? Number(value) : value;
|
|
136
|
+
if (!Number.isSafeInteger(numericValue)) {
|
|
137
|
+
throw new Error(`GeoArrow offset ${String(value)} exceeds JavaScript's safe integer range`);
|
|
138
|
+
}
|
|
139
|
+
return numericValue;
|
|
140
|
+
}
|
|
141
|
+
function getListRange(list, rowIndex) {
|
|
142
|
+
const offsetIndex = (list.offset || 0) + rowIndex;
|
|
143
|
+
const baseValue = list.offsetBase ?? 0;
|
|
144
|
+
const base = typeof baseValue === "bigint" ? Number(baseValue) : baseValue;
|
|
145
|
+
return [
|
|
146
|
+
getGeoArrowOffset(list.offsets, offsetIndex) - base,
|
|
147
|
+
getGeoArrowOffset(list.offsets, offsetIndex + 1) - base
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
function visitChunkCoordinates(array, encoding, rowOffset, visitor) {
|
|
151
|
+
for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
|
|
152
|
+
if (!isGeoArrowValueValid(array.validity, rowIndex))
|
|
153
|
+
continue;
|
|
154
|
+
if (encoding === "geoarrow.geometry" && array.kind === "dense-union") {
|
|
155
|
+
visitUnionRowCoordinates(array, rowIndex, rowOffset + rowIndex, visitor);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (encoding === "geoarrow.geometrycollection" && array.kind === "list") {
|
|
159
|
+
const [first, last] = getListRange(array, rowIndex);
|
|
160
|
+
if (array.child.kind === "dense-union") {
|
|
161
|
+
for (let index = first; index < last; index++) {
|
|
162
|
+
visitUnionRowCoordinates(array.child, index, rowOffset + rowIndex, visitor);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const depth = getEncodingDepth(encoding);
|
|
168
|
+
visitNestedCoordinates(array, rowIndex, depth, rowOffset + rowIndex, visitor);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function visitUnionRowCoordinates(union, rowIndex, sourceRowIndex, visitor) {
|
|
172
|
+
if (!isGeoArrowValueValid(union.validity, rowIndex))
|
|
173
|
+
return;
|
|
174
|
+
const physicalIndex = (union.offset || 0) + rowIndex;
|
|
175
|
+
const typeId = union.typeIds[physicalIndex];
|
|
176
|
+
const valueOffset = union.valueOffsets[physicalIndex];
|
|
177
|
+
const child = union.children.find((candidate) => candidate.typeId === typeId);
|
|
178
|
+
if (!child)
|
|
179
|
+
return;
|
|
180
|
+
const encoding = child.encoding || getEncodingFromChildName(child.name);
|
|
181
|
+
if (encoding === "geoarrow.geometrycollection" && child.data.kind === "list") {
|
|
182
|
+
const [first, last] = getListRange(child.data, valueOffset);
|
|
183
|
+
if (child.data.child.kind === "dense-union") {
|
|
184
|
+
for (let index = first; index < last; index++) {
|
|
185
|
+
visitUnionRowCoordinates(child.data.child, index, sourceRowIndex, visitor);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
visitNestedCoordinates(child.data, valueOffset, getEncodingDepth(encoding), sourceRowIndex, visitor);
|
|
191
|
+
}
|
|
192
|
+
function visitNestedCoordinates(array, index, depth, rowIndex, visitor) {
|
|
193
|
+
if (depth === 0) {
|
|
194
|
+
const coordinate = readCoordinate(array, index);
|
|
195
|
+
if (coordinate)
|
|
196
|
+
visitor(coordinate, rowIndex);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (array.kind !== "list" || !isGeoArrowValueValid(array.validity, index))
|
|
200
|
+
return;
|
|
201
|
+
const [first, last] = getListRange(array, index);
|
|
202
|
+
for (let childIndex = first; childIndex < last; childIndex++) {
|
|
203
|
+
visitNestedCoordinates(array.child, childIndex, depth - 1, rowIndex, visitor);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function readNestedCoordinates(array, index, depth) {
|
|
207
|
+
if (depth === 0)
|
|
208
|
+
return readCoordinate(array, index);
|
|
209
|
+
if (array.kind !== "list" || !isGeoArrowValueValid(array.validity, index))
|
|
210
|
+
return null;
|
|
211
|
+
const [first, last] = getListRange(array, index);
|
|
212
|
+
const values = [];
|
|
213
|
+
for (let childIndex = first; childIndex < last; childIndex++) {
|
|
214
|
+
const value = readNestedCoordinates(array.child, childIndex, depth - 1);
|
|
215
|
+
if (value !== null)
|
|
216
|
+
values.push(value);
|
|
217
|
+
}
|
|
218
|
+
return values;
|
|
219
|
+
}
|
|
220
|
+
function readCoordinate(array, index) {
|
|
221
|
+
if (!isGeoArrowValueValid(array.validity, index))
|
|
222
|
+
return null;
|
|
223
|
+
if (array.kind === "fixed-size-list") {
|
|
224
|
+
const listIndex = (array.offset || 0) + index;
|
|
225
|
+
const coordinate = [];
|
|
226
|
+
for (let component = 0; component < array.size; component++) {
|
|
227
|
+
coordinate.push(readPrimitive(array.child, listIndex * array.size + component));
|
|
228
|
+
}
|
|
229
|
+
return coordinate;
|
|
230
|
+
}
|
|
231
|
+
if (array.kind === "struct") {
|
|
232
|
+
const structIndex = (array.offset || 0) + index;
|
|
233
|
+
const coordinate = [];
|
|
234
|
+
for (const name of ["x", "y", "z", "m"]) {
|
|
235
|
+
const child = array.children[name];
|
|
236
|
+
if (child)
|
|
237
|
+
coordinate.push(readPrimitive(child, structIndex));
|
|
238
|
+
}
|
|
239
|
+
return coordinate.length >= 2 ? coordinate : null;
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function readPrimitive(array, index) {
|
|
244
|
+
if (array.kind !== "primitive")
|
|
245
|
+
throw new Error("GeoArrow coordinate child must be primitive");
|
|
246
|
+
const valueIndex = (array.offset || 0) + index * (array.stride || 1);
|
|
247
|
+
return Number(array.values[valueIndex]);
|
|
248
|
+
}
|
|
249
|
+
function materializeUnionRow(union, rowIndex) {
|
|
250
|
+
if (!isGeoArrowValueValid(union.validity, rowIndex))
|
|
251
|
+
return null;
|
|
252
|
+
const physicalIndex = (union.offset || 0) + rowIndex;
|
|
253
|
+
const typeId = union.typeIds[physicalIndex];
|
|
254
|
+
const valueOffset = union.valueOffsets[physicalIndex];
|
|
255
|
+
const child = union.children.find((candidate) => candidate.typeId === typeId);
|
|
256
|
+
if (!child || valueOffset < 0 || valueOffset >= child.data.length)
|
|
257
|
+
return null;
|
|
258
|
+
return materializeGeometryRow(child.data, valueOffset, child.encoding || getEncodingFromChildName(child.name));
|
|
259
|
+
}
|
|
260
|
+
function getEncodingFromChildName(name) {
|
|
261
|
+
const normalized = name.replace(/[^a-z]/gi, "").toLowerCase();
|
|
262
|
+
switch (normalized) {
|
|
263
|
+
case "point":
|
|
264
|
+
return "geoarrow.point";
|
|
265
|
+
case "linestring":
|
|
266
|
+
return "geoarrow.linestring";
|
|
267
|
+
case "polygon":
|
|
268
|
+
return "geoarrow.polygon";
|
|
269
|
+
case "multipoint":
|
|
270
|
+
return "geoarrow.multipoint";
|
|
271
|
+
case "multilinestring":
|
|
272
|
+
return "geoarrow.multilinestring";
|
|
273
|
+
case "multipolygon":
|
|
274
|
+
return "geoarrow.multipolygon";
|
|
275
|
+
case "geometrycollection":
|
|
276
|
+
return "geoarrow.geometrycollection";
|
|
277
|
+
default:
|
|
278
|
+
throw new Error(`Unknown GeoArrow dense-union child ${name}`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function getEncodingDepth(encoding) {
|
|
282
|
+
switch (encoding) {
|
|
283
|
+
case "geoarrow.point":
|
|
284
|
+
return 0;
|
|
285
|
+
case "geoarrow.linestring":
|
|
286
|
+
case "geoarrow.multipoint":
|
|
287
|
+
return 1;
|
|
288
|
+
case "geoarrow.polygon":
|
|
289
|
+
case "geoarrow.multilinestring":
|
|
290
|
+
return 2;
|
|
291
|
+
case "geoarrow.multipolygon":
|
|
292
|
+
return 3;
|
|
293
|
+
default:
|
|
294
|
+
return 0;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// dist/kernels.js
|
|
299
|
+
function assertGeoArrowResourceLimits(column, options = {}) {
|
|
300
|
+
const rows = getGeoArrowRowCount(column);
|
|
301
|
+
if (rows > (options.maximumRows ?? Number.POSITIVE_INFINITY)) {
|
|
302
|
+
throw new Error(`GeoArrow row count ${rows} exceeds maximumRows`);
|
|
303
|
+
}
|
|
304
|
+
if (column.chunks.length > (options.maximumChunks ?? Number.POSITIVE_INFINITY)) {
|
|
305
|
+
throw new Error(`GeoArrow chunk count ${column.chunks.length} exceeds maximumChunks`);
|
|
306
|
+
}
|
|
307
|
+
const coordinates = getGeoArrowVertexCount(column);
|
|
308
|
+
if (coordinates > (options.maximumCoordinates ?? Number.POSITIVE_INFINITY)) {
|
|
309
|
+
throw new Error(`GeoArrow coordinate count ${coordinates} exceeds maximumCoordinates`);
|
|
310
|
+
}
|
|
311
|
+
if (options.maximumNestingDepth !== void 0) {
|
|
312
|
+
const depth = Math.max(0, ...column.chunks.map(getArrayDepth));
|
|
313
|
+
if (depth > options.maximumNestingDepth) {
|
|
314
|
+
throw new Error(`GeoArrow nesting depth ${depth} exceeds maximumNestingDepth`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (options.maximumOutputBytes !== void 0) {
|
|
318
|
+
const estimatedBytes = coordinates * getGeoArrowDimensionSize(column.dimension) * 8;
|
|
319
|
+
if (estimatedBytes > options.maximumOutputBytes) {
|
|
320
|
+
throw new Error(`GeoArrow estimated output ${estimatedBytes} exceeds maximumOutputBytes`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function getArrayDepth(array) {
|
|
325
|
+
switch (array.kind) {
|
|
326
|
+
case "list":
|
|
327
|
+
case "fixed-size-list":
|
|
328
|
+
return 1 + getArrayDepth(array.child);
|
|
329
|
+
case "struct":
|
|
330
|
+
return 1 + Math.max(0, ...Object.values(array.children).map(getArrayDepth));
|
|
331
|
+
case "dense-union":
|
|
332
|
+
return 1 + Math.max(0, ...array.children.map((child) => getArrayDepth(child.data)));
|
|
333
|
+
default:
|
|
334
|
+
return 1;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// dist/tessellate.js
|
|
339
|
+
function tessellateGeoArrowPolygons(column, options = {}) {
|
|
340
|
+
assertGeoArrowResourceLimits(column, options.limits);
|
|
341
|
+
const rows = materializeGeoArrowRows(column);
|
|
342
|
+
const sourceDimension = getGeoArrowDimensionSize(column.dimension);
|
|
343
|
+
const positionSize = options.positionSize || sourceDimension;
|
|
344
|
+
const sourceRowOffset = options.sourceRowOffset || 0;
|
|
345
|
+
const positions = [];
|
|
346
|
+
const sourceRowIndices = [];
|
|
347
|
+
const indices = [];
|
|
348
|
+
let polygonCount = 0;
|
|
349
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
350
|
+
const row = rows[rowIndex];
|
|
351
|
+
if (row) {
|
|
352
|
+
visitPolygons(row, (polygon) => {
|
|
353
|
+
const vertexOffset = positions.length / positionSize;
|
|
354
|
+
const flatCoordinates = [];
|
|
355
|
+
const holeIndices = [];
|
|
356
|
+
let localVertexCount = 0;
|
|
357
|
+
for (let ringIndex = 0; ringIndex < polygon.length; ringIndex++) {
|
|
358
|
+
const ring = removeClosingCoordinate(polygon[ringIndex]);
|
|
359
|
+
if (ring.length < 3)
|
|
360
|
+
continue;
|
|
361
|
+
if (localVertexCount > 0)
|
|
362
|
+
holeIndices.push(localVertexCount);
|
|
363
|
+
for (const coordinate of ring) {
|
|
364
|
+
for (let component = 0; component < sourceDimension; component++) {
|
|
365
|
+
flatCoordinates.push(coordinate[component] ?? 0);
|
|
366
|
+
}
|
|
367
|
+
for (let component = 0; component < positionSize; component++) {
|
|
368
|
+
positions.push(coordinate[component] ?? 0);
|
|
369
|
+
}
|
|
370
|
+
sourceRowIndices.push(sourceRowOffset + rowIndex);
|
|
371
|
+
localVertexCount++;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (localVertexCount >= 3) {
|
|
375
|
+
const localIndices = (0, import_polygon.earcut)(flatCoordinates, holeIndices, sourceDimension);
|
|
376
|
+
for (const index of localIndices)
|
|
377
|
+
indices.push(vertexOffset + index);
|
|
378
|
+
polygonCount++;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const vertexCount = positions.length / positionSize;
|
|
384
|
+
const IndexArray = vertexCount <= 65535 ? Uint16Array : Uint32Array;
|
|
385
|
+
return {
|
|
386
|
+
positions: Float32Array.from(positions),
|
|
387
|
+
sourceRowIndices: Uint32Array.from(sourceRowIndices),
|
|
388
|
+
indices: IndexArray.from(indices),
|
|
389
|
+
sourceDimension,
|
|
390
|
+
positionSize,
|
|
391
|
+
rowCount: rows.length,
|
|
392
|
+
polygonCount,
|
|
393
|
+
vertexCount,
|
|
394
|
+
triangleCount: indices.length / 3
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function visitPolygons(geometry, visitor) {
|
|
398
|
+
switch (geometry.type) {
|
|
399
|
+
case "Polygon":
|
|
400
|
+
visitor(geometry.coordinates);
|
|
401
|
+
break;
|
|
402
|
+
case "MultiPolygon":
|
|
403
|
+
for (const polygon of geometry.coordinates)
|
|
404
|
+
visitor(polygon);
|
|
405
|
+
break;
|
|
406
|
+
case "GeometryCollection":
|
|
407
|
+
for (const child of geometry.geometries)
|
|
408
|
+
visitPolygons(child, visitor);
|
|
409
|
+
break;
|
|
410
|
+
default:
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function removeClosingCoordinate(ring) {
|
|
415
|
+
if (ring.length < 2)
|
|
416
|
+
return ring;
|
|
417
|
+
const first = ring[0];
|
|
418
|
+
const last = ring[ring.length - 1];
|
|
419
|
+
if (first.length !== last.length)
|
|
420
|
+
return ring;
|
|
421
|
+
for (let index = 0; index < first.length; index++) {
|
|
422
|
+
if (first[index] !== last[index])
|
|
423
|
+
return ring;
|
|
424
|
+
}
|
|
425
|
+
return ring.slice(0, -1);
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=tessellation-entry.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/tessellation-entry.ts", "../src/tessellate.ts", "../src/types.ts", "../src/layout.ts", "../src/kernels.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACIA,qBAAqB;;;AC6Kf,SAAU,yBAAyB,WAA4B;AACnE,UAAQ,WAAW;IACjB,KAAK;AACH,aAAO;IACT,KAAK;IACL,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;EACX;AACF;AAGM,SAAU,wBACd,UAA0B;AAE1B,UAAQ,UAAU;IAChB,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT;AACE,aAAO;EACX;AACF;;;AC5JM,SAAU,qBACd,UACA,OAAa;AAEb,MAAI,CAAC;AAAU,WAAO;AACtB,QAAM,YAAY,SAAS,aAAa,KAAK;AAC7C,SAAO,QAAQ,SAAS,OAAO,YAAY,CAAC,IAAK,MAAM,WAAW,EAAG;AACvE;AAGM,SAAU,oBAAoB,QAAsB;AACxD,SAAO,OAAO,OAAO,OAAO,CAAC,OAAO,UAAU,QAAQ,MAAM,QAAQ,CAAC;AACvE;AAGM,SAAU,yBACd,QACA,SAAiC;AAEjC,MAAI,YAAY;AAChB,aAAW,SAAS,OAAO,QAAQ;AACjC,0BAAsB,OAAO,OAAO,UAAU,WAAW,OAAO;AAChE,iBAAa,MAAM;EACrB;AACF;AA6FM,SAAU,uBAAuB,QAAsB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,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,QAAI,MAAM,KAAK,MAAM,KAAK,KAAK;AAAG,aAAO;EAC3C;AACA,SAAO,KAAK,MAAM,GAAG,EAAE;AACzB;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tessellation-entry.d.ts","sourceRoot":"","sources":["../src/tessellation-entry.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,YAAY,EAAC,oBAAoB,EAAE,iCAAiC,EAAC,wBAAqB;AAC1F,OAAO,EAAC,0BAA0B,EAAC,wBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tessellation-entry.js","sourceRoot":"","sources":["../src/tessellation-entry.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,0BAA0B,EAAC,wBAAqB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import type { SpatialReference } from '@math.gl/crs';
|
|
2
2
|
import type { TypedArray } from '@math.gl/types';
|
|
3
|
-
|
|
3
|
+
/** Minimal tagged geometry shape used only by compatibility builders.
|
|
4
|
+
*
|
|
5
|
+
* The physical GeoArrow APIs never create these values. Keeping the structural type here avoids
|
|
6
|
+
* making the descriptor package depend on the WKB format package.
|
|
7
|
+
*/
|
|
8
|
+
export type GeoArrowGeometryValue = {
|
|
9
|
+
type: 'Point';
|
|
10
|
+
coordinates: readonly number[];
|
|
11
|
+
} | {
|
|
12
|
+
type: 'LineString';
|
|
13
|
+
coordinates: readonly (readonly number[])[];
|
|
14
|
+
} | {
|
|
15
|
+
type: 'Polygon';
|
|
16
|
+
coordinates: readonly (readonly (readonly number[])[])[];
|
|
17
|
+
} | {
|
|
18
|
+
type: 'MultiPoint';
|
|
19
|
+
coordinates: readonly (readonly number[])[];
|
|
20
|
+
} | {
|
|
21
|
+
type: 'MultiLineString';
|
|
22
|
+
coordinates: readonly (readonly (readonly number[])[])[];
|
|
23
|
+
} | {
|
|
24
|
+
type: 'MultiPolygon';
|
|
25
|
+
coordinates: readonly (readonly (readonly (readonly number[])[])[])[];
|
|
26
|
+
} | {
|
|
27
|
+
type: 'GeometryCollection';
|
|
28
|
+
geometries: readonly GeoArrowGeometryValue[];
|
|
29
|
+
};
|
|
4
30
|
/** GeoArrow concrete, mixed, bounding-box, and serialized encodings. */
|
|
5
31
|
export type GeoArrowEncoding = 'geoarrow.point' | 'geoarrow.linestring' | 'geoarrow.polygon' | 'geoarrow.multipoint' | 'geoarrow.multilinestring' | 'geoarrow.multipolygon' | 'geoarrow.geometry' | 'geoarrow.geometrycollection' | 'geoarrow.box' | 'geoarrow.wkb' | 'geoarrow.wkt';
|
|
6
32
|
/** Semantic coordinate dimensions. M is never interpreted as Z. */
|
|
@@ -64,6 +90,12 @@ export type GeoArrowBox = GeoArrowStruct;
|
|
|
64
90
|
export type GeoArrowDenseUnionChild = Readonly<{
|
|
65
91
|
name: string;
|
|
66
92
|
typeId: number;
|
|
93
|
+
/** Child-specific physical encoding (required for mixed-dimensional unions). */
|
|
94
|
+
encoding?: GeoArrowEncoding;
|
|
95
|
+
/** Child-specific semantic dimension. Falls back to the column dimension for legacy data. */
|
|
96
|
+
dimension?: GeoArrowDimension;
|
|
97
|
+
/** Child-specific coordinate layout. Falls back to the column layout for legacy data. */
|
|
98
|
+
coordinateLayout?: GeoArrowCoordinateLayout | null;
|
|
67
99
|
data: GeoArrowArray;
|
|
68
100
|
}>;
|
|
69
101
|
/** Dense-union storage for mixed geometry families. */
|
|
@@ -81,6 +113,10 @@ export type GeoArrowSerialized = GeoArrowArrayBase & Readonly<{
|
|
|
81
113
|
encoding: 'binary' | 'utf8';
|
|
82
114
|
offsets: GeoArrowOffsets;
|
|
83
115
|
values: Uint8Array;
|
|
116
|
+
/** Optional Arrow BinaryView-style records (four uint32 words per row). */
|
|
117
|
+
views?: Uint32Array;
|
|
118
|
+
/** Borrowed out-of-line buffers referenced by BinaryView records. */
|
|
119
|
+
dataBuffers?: readonly Uint8Array[];
|
|
84
120
|
/** Index of logical row zero in `offsets`. */
|
|
85
121
|
offset?: number;
|
|
86
122
|
/** Value subtracted from offsets before indexing `values`. */
|
|
@@ -98,8 +134,6 @@ export type GeoArrowColumn = Readonly<{
|
|
|
98
134
|
edges?: 'planar' | 'spherical';
|
|
99
135
|
metadata?: Readonly<Record<string, unknown>>;
|
|
100
136
|
}>;
|
|
101
|
-
/** Materialized geometry value used at codec and builder boundaries. */
|
|
102
|
-
export type GeoArrowGeometryValue = WellKnownGeometry;
|
|
103
137
|
/** Coordinate callback used by mapping kernels. */
|
|
104
138
|
export type GeoArrowCoordinateMapper = (coordinate: readonly number[], rowIndex: number) => readonly number[];
|
|
105
139
|
/** Four-value XY bounds. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC/C;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;CAAC,GAC/C;IAAC,IAAI,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;CAAC,GACjE;IAAC,IAAI,EAAE,SAAS,CAAC;IAA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"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AA8KpC,4EAA4E;AAC5E,MAAM,UAAU,wBAAwB,CAAC,SAA4B;IACnE,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,IAAI;YACP,OAAO,CAAC,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,OAAO,CAAC,CAAC;QACX,KAAK,MAAM;YACT,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,uBAAuB,CACrC,QAA0B;IAE1B,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,gBAAgB;YACnB,OAAO,OAAO,CAAC;QACjB,KAAK,qBAAqB;YACxB,OAAO,YAAY,CAAC;QACtB,KAAK,kBAAkB;YACrB,OAAO,SAAS,CAAC;QACnB,KAAK,qBAAqB;YACxB,OAAO,YAAY,CAAC;QACtB,KAAK,0BAA0B;YAC7B,OAAO,iBAAiB,CAAC;QAC3B,KAAK,uBAAuB;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,6BAA6B;YAChC,OAAO,oBAAoB,CAAC;QAC9B;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,8BAA8B,CAC5C,IAAmC;IAEnC,OAAO,YAAY,IAAI,CAAC,WAAW,EAAE,EAAsB,CAAC;AAC9D,CAAC"}
|