@loaders.gl/mvt 4.2.0-alpha.4 → 4.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +274 -252
- package/dist/dist.min.js +14 -0
- package/dist/helpers/binary-util-functions.d.ts +1 -1
- package/dist/helpers/binary-util-functions.d.ts.map +1 -1
- package/dist/helpers/binary-util-functions.js +99 -61
- package/dist/helpers/mapbox-util-functions.d.ts +2 -2
- package/dist/helpers/mapbox-util-functions.d.ts.map +1 -1
- package/dist/helpers/mapbox-util-functions.js +67 -33
- package/dist/index.cjs +37 -61
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.js +135 -118
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-layer.js +77 -38
- package/dist/lib/binary-vector-tile/vector-tile.d.ts +1 -1
- package/dist/lib/binary-vector-tile/vector-tile.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile.js +17 -12
- package/dist/lib/geojson-tiler/clip.d.ts +1 -1
- package/dist/lib/geojson-tiler/clip.d.ts.map +1 -1
- package/dist/lib/geojson-tiler/clip.js +177 -142
- package/dist/lib/geojson-tiler/convert.d.ts +1 -1
- package/dist/lib/geojson-tiler/convert.d.ts.map +1 -1
- package/dist/lib/geojson-tiler/convert.js +116 -100
- package/dist/lib/geojson-tiler/feature.d.ts +1 -1
- package/dist/lib/geojson-tiler/feature.d.ts.map +1 -1
- package/dist/lib/geojson-tiler/feature.js +38 -29
- package/dist/lib/geojson-tiler/geojson-tiler.d.ts +1 -1
- package/dist/lib/geojson-tiler/geojson-tiler.d.ts.map +1 -1
- package/dist/lib/geojson-tiler/geojson-tiler.js +197 -159
- package/dist/lib/geojson-tiler/simplify.js +60 -40
- package/dist/lib/geojson-tiler/tile.js +108 -88
- package/dist/lib/geojson-tiler/transform.d.ts +1 -1
- package/dist/lib/geojson-tiler/transform.d.ts.map +1 -1
- package/dist/lib/geojson-tiler/transform.js +35 -26
- package/dist/lib/geojson-tiler/wrap.d.ts +1 -1
- package/dist/lib/geojson-tiler/wrap.d.ts.map +1 -1
- package/dist/lib/geojson-tiler/wrap.js +71 -53
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.js +156 -151
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.js +75 -38
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile.js +17 -12
- package/dist/lib/parse-mvt.d.ts +1 -1
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/parse-mvt.js +142 -115
- package/dist/lib/parse-tilejson.js +234 -176
- package/dist/lib/types.js +0 -1
- package/dist/mvt-loader.d.ts +1 -1
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +41 -21
- package/dist/mvt-source.js +148 -139
- package/dist/tilejson-loader.d.ts +1 -1
- package/dist/tilejson-loader.d.ts.map +1 -1
- package/dist/tilejson-loader.js +31 -30
- package/dist/workers/mvt-worker.js +0 -1
- package/package.json +12 -8
- package/dist/helpers/binary-util-functions.js.map +0 -1
- package/dist/helpers/mapbox-util-functions.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/binary-vector-tile/LICENSE.txt +0 -31
- package/dist/lib/binary-vector-tile/vector-tile-feature.js.map +0 -1
- package/dist/lib/binary-vector-tile/vector-tile-layer.js.map +0 -1
- package/dist/lib/binary-vector-tile/vector-tile.js.map +0 -1
- package/dist/lib/geojson-tiler/LICENSE +0 -19
- package/dist/lib/geojson-tiler/clip.js.map +0 -1
- package/dist/lib/geojson-tiler/convert.js.map +0 -1
- package/dist/lib/geojson-tiler/feature.js.map +0 -1
- package/dist/lib/geojson-tiler/geojson-tiler.js.map +0 -1
- package/dist/lib/geojson-tiler/simplify.js.map +0 -1
- package/dist/lib/geojson-tiler/tile.js.map +0 -1
- package/dist/lib/geojson-tiler/transform.js.map +0 -1
- package/dist/lib/geojson-tiler/wrap.js.map +0 -1
- package/dist/lib/mapbox-vector-tile/LICENSE.txt +0 -31
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.js.map +0 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.js.map +0 -1
- package/dist/lib/mapbox-vector-tile/vector-tile.js.map +0 -1
- package/dist/lib/parse-mvt.js.map +0 -1
- package/dist/lib/parse-tilejson.js.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/mvt-loader.js.map +0 -1
- package/dist/mvt-source.js.map +0 -1
- package/dist/tilejson-loader.js.map +0 -1
- package/dist/workers/mvt-worker.js.map +0 -1
package/dist/dist.dev.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
if (typeof exports === 'object' && typeof module === 'object')
|
|
3
3
|
module.exports = factory();
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
|
-
else if (typeof exports === 'object') exports['
|
|
6
|
-
else root['
|
|
5
|
+
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
|
+
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
7
|
"use strict";
|
|
8
8
|
var __exports__ = (() => {
|
|
9
9
|
var __create = Object.create;
|
|
@@ -27,6 +27,7 @@ var __exports__ = (() => {
|
|
|
27
27
|
}
|
|
28
28
|
return to;
|
|
29
29
|
};
|
|
30
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
30
31
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
32
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
33
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -37,6 +38,13 @@ var __exports__ = (() => {
|
|
|
37
38
|
));
|
|
38
39
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
40
|
|
|
41
|
+
// external-global-plugin:@loaders.gl/core
|
|
42
|
+
var require_core = __commonJS({
|
|
43
|
+
"external-global-plugin:@loaders.gl/core"(exports, module) {
|
|
44
|
+
module.exports = globalThis.loaders;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
40
48
|
// ../../node_modules/ieee754/index.js
|
|
41
49
|
var require_ieee754 = __commonJS({
|
|
42
50
|
"../../node_modules/ieee754/index.js"(exports) {
|
|
@@ -777,15 +785,16 @@ var __exports__ = (() => {
|
|
|
777
785
|
}
|
|
778
786
|
});
|
|
779
787
|
|
|
780
|
-
//
|
|
781
|
-
var
|
|
782
|
-
__export(
|
|
788
|
+
// bundle.ts
|
|
789
|
+
var bundle_exports = {};
|
|
790
|
+
__export(bundle_exports, {
|
|
783
791
|
GeoJSONTiler: () => GeoJSONTiler,
|
|
784
792
|
MVTLoader: () => MVTLoader,
|
|
785
793
|
MVTSource: () => MVTSource,
|
|
786
794
|
MVTWorkerLoader: () => MVTWorkerLoader,
|
|
787
795
|
TileJSONLoader: () => TileJSONLoader
|
|
788
796
|
});
|
|
797
|
+
__reExport(bundle_exports, __toESM(require_core(), 1));
|
|
789
798
|
|
|
790
799
|
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
791
800
|
function _typeof(obj) {
|
|
@@ -1350,14 +1359,18 @@ var __exports__ = (() => {
|
|
|
1350
1359
|
function flatGeojsonToBinary(features, geometryInfo, options) {
|
|
1351
1360
|
const propArrayTypes = extractNumericPropTypes(features);
|
|
1352
1361
|
const numericPropKeys = Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array);
|
|
1353
|
-
return fillArrays(
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1362
|
+
return fillArrays(
|
|
1363
|
+
features,
|
|
1364
|
+
{
|
|
1365
|
+
propArrayTypes,
|
|
1366
|
+
...geometryInfo
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
numericPropKeys: options && options.numericPropKeys || numericPropKeys,
|
|
1370
|
+
PositionDataType: options ? options.PositionDataType : Float32Array,
|
|
1371
|
+
triangulate: options ? options.triangulate : true
|
|
1372
|
+
}
|
|
1373
|
+
);
|
|
1361
1374
|
}
|
|
1362
1375
|
function extractNumericPropTypes(features) {
|
|
1363
1376
|
const propArrayTypes = {};
|
|
@@ -1385,11 +1398,7 @@ var __exports__ = (() => {
|
|
|
1385
1398
|
propArrayTypes,
|
|
1386
1399
|
coordLength
|
|
1387
1400
|
} = geometryInfo;
|
|
1388
|
-
const {
|
|
1389
|
-
numericPropKeys = [],
|
|
1390
|
-
PositionDataType = Float32Array,
|
|
1391
|
-
triangulate = true
|
|
1392
|
-
} = options;
|
|
1401
|
+
const { numericPropKeys = [], PositionDataType = Float32Array, triangulate = true } = options;
|
|
1393
1402
|
const hasGlobalId = features[0] && "id" in features[0];
|
|
1394
1403
|
const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
|
|
1395
1404
|
const points = {
|
|
@@ -1454,9 +1463,7 @@ var __exports__ = (() => {
|
|
|
1454
1463
|
handlePoint(geometry, points, indexMap, coordLength, properties);
|
|
1455
1464
|
points.properties.push(keepStringProperties(properties, numericPropKeys));
|
|
1456
1465
|
if (hasGlobalId) {
|
|
1457
|
-
points.fields.push({
|
|
1458
|
-
id: feature.id
|
|
1459
|
-
});
|
|
1466
|
+
points.fields.push({ id: feature.id });
|
|
1460
1467
|
}
|
|
1461
1468
|
indexMap.pointFeature++;
|
|
1462
1469
|
break;
|
|
@@ -1464,9 +1471,7 @@ var __exports__ = (() => {
|
|
|
1464
1471
|
handleLineString(geometry, lines, indexMap, coordLength, properties);
|
|
1465
1472
|
lines.properties.push(keepStringProperties(properties, numericPropKeys));
|
|
1466
1473
|
if (hasGlobalId) {
|
|
1467
|
-
lines.fields.push({
|
|
1468
|
-
id: feature.id
|
|
1469
|
-
});
|
|
1474
|
+
lines.fields.push({ id: feature.id });
|
|
1470
1475
|
}
|
|
1471
1476
|
indexMap.lineFeature++;
|
|
1472
1477
|
break;
|
|
@@ -1474,9 +1479,7 @@ var __exports__ = (() => {
|
|
|
1474
1479
|
handlePolygon(geometry, polygons, indexMap, coordLength, properties);
|
|
1475
1480
|
polygons.properties.push(keepStringProperties(properties, numericPropKeys));
|
|
1476
1481
|
if (hasGlobalId) {
|
|
1477
|
-
polygons.fields.push({
|
|
1478
|
-
id: feature.id
|
|
1479
|
-
});
|
|
1482
|
+
polygons.fields.push({ id: feature.id });
|
|
1480
1483
|
}
|
|
1481
1484
|
indexMap.polygonFeature++;
|
|
1482
1485
|
break;
|
|
@@ -1491,16 +1494,32 @@ var __exports__ = (() => {
|
|
|
1491
1494
|
points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
|
|
1492
1495
|
const nPositions = geometry.data.length / coordLength;
|
|
1493
1496
|
fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);
|
|
1494
|
-
points.globalFeatureIds.fill(
|
|
1495
|
-
|
|
1497
|
+
points.globalFeatureIds.fill(
|
|
1498
|
+
indexMap.feature,
|
|
1499
|
+
indexMap.pointPosition,
|
|
1500
|
+
indexMap.pointPosition + nPositions
|
|
1501
|
+
);
|
|
1502
|
+
points.featureIds.fill(
|
|
1503
|
+
indexMap.pointFeature,
|
|
1504
|
+
indexMap.pointPosition,
|
|
1505
|
+
indexMap.pointPosition + nPositions
|
|
1506
|
+
);
|
|
1496
1507
|
indexMap.pointPosition += nPositions;
|
|
1497
1508
|
}
|
|
1498
1509
|
function handleLineString(geometry, lines, indexMap, coordLength, properties) {
|
|
1499
1510
|
lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
|
|
1500
1511
|
const nPositions = geometry.data.length / coordLength;
|
|
1501
1512
|
fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
|
|
1502
|
-
lines.globalFeatureIds.fill(
|
|
1503
|
-
|
|
1513
|
+
lines.globalFeatureIds.fill(
|
|
1514
|
+
indexMap.feature,
|
|
1515
|
+
indexMap.linePosition,
|
|
1516
|
+
indexMap.linePosition + nPositions
|
|
1517
|
+
);
|
|
1518
|
+
lines.featureIds.fill(
|
|
1519
|
+
indexMap.lineFeature,
|
|
1520
|
+
indexMap.linePosition,
|
|
1521
|
+
indexMap.linePosition + nPositions
|
|
1522
|
+
);
|
|
1504
1523
|
for (let i2 = 0, il = geometry.indices.length; i2 < il; ++i2) {
|
|
1505
1524
|
const start = geometry.indices[i2];
|
|
1506
1525
|
const end = i2 === il - 1 ? geometry.data.length : geometry.indices[i2 + 1];
|
|
@@ -1512,8 +1531,16 @@ var __exports__ = (() => {
|
|
|
1512
1531
|
polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
|
|
1513
1532
|
const nPositions = geometry.data.length / coordLength;
|
|
1514
1533
|
fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
|
|
1515
|
-
polygons.globalFeatureIds.fill(
|
|
1516
|
-
|
|
1534
|
+
polygons.globalFeatureIds.fill(
|
|
1535
|
+
indexMap.feature,
|
|
1536
|
+
indexMap.polygonPosition,
|
|
1537
|
+
indexMap.polygonPosition + nPositions
|
|
1538
|
+
);
|
|
1539
|
+
polygons.featureIds.fill(
|
|
1540
|
+
indexMap.polygonFeature,
|
|
1541
|
+
indexMap.polygonPosition,
|
|
1542
|
+
indexMap.polygonPosition + nPositions
|
|
1543
|
+
);
|
|
1517
1544
|
for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {
|
|
1518
1545
|
const startPosition = indexMap.polygonPosition;
|
|
1519
1546
|
polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
|
|
@@ -1522,16 +1549,15 @@ var __exports__ = (() => {
|
|
|
1522
1549
|
const nextIndices = geometry.indices[l + 1];
|
|
1523
1550
|
for (let i2 = 0, il = indices.length; i2 < il; ++i2) {
|
|
1524
1551
|
const start = indices[i2];
|
|
1525
|
-
const end = i2 === il - 1 ?
|
|
1552
|
+
const end = i2 === il - 1 ? (
|
|
1553
|
+
// last line, so either read to:
|
|
1554
|
+
nextIndices === void 0 ? geometry.data.length : nextIndices[0]
|
|
1555
|
+
) : indices[i2 + 1];
|
|
1526
1556
|
polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
|
|
1527
1557
|
indexMap.polygonPosition += (end - start) / coordLength;
|
|
1528
1558
|
}
|
|
1529
1559
|
const endPosition = indexMap.polygonPosition;
|
|
1530
|
-
triangulatePolygon(polygons, areas, indices, {
|
|
1531
|
-
startPosition,
|
|
1532
|
-
endPosition,
|
|
1533
|
-
coordLength
|
|
1534
|
-
});
|
|
1560
|
+
triangulatePolygon(polygons, areas, indices, { startPosition, endPosition, coordLength });
|
|
1535
1561
|
}
|
|
1536
1562
|
}
|
|
1537
1563
|
function triangulatePolygon(polygons, areas, indices, {
|
|
@@ -1555,10 +1581,7 @@ var __exports__ = (() => {
|
|
|
1555
1581
|
function wrapProps(obj, size) {
|
|
1556
1582
|
const returnObj = {};
|
|
1557
1583
|
for (const key in obj) {
|
|
1558
|
-
returnObj[key] = {
|
|
1559
|
-
value: obj[key],
|
|
1560
|
-
size
|
|
1561
|
-
};
|
|
1584
|
+
returnObj[key] = { value: obj[key], size };
|
|
1562
1585
|
}
|
|
1563
1586
|
return returnObj;
|
|
1564
1587
|
}
|
|
@@ -1567,70 +1590,32 @@ var __exports__ = (() => {
|
|
|
1567
1590
|
shape: "binary-feature-collection",
|
|
1568
1591
|
points: {
|
|
1569
1592
|
...points,
|
|
1570
|
-
positions: {
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
},
|
|
1574
|
-
globalFeatureIds: {
|
|
1575
|
-
value: points.globalFeatureIds,
|
|
1576
|
-
size: 1
|
|
1577
|
-
},
|
|
1578
|
-
featureIds: {
|
|
1579
|
-
value: points.featureIds,
|
|
1580
|
-
size: 1
|
|
1581
|
-
},
|
|
1593
|
+
positions: { value: points.positions, size: coordLength },
|
|
1594
|
+
globalFeatureIds: { value: points.globalFeatureIds, size: 1 },
|
|
1595
|
+
featureIds: { value: points.featureIds, size: 1 },
|
|
1582
1596
|
numericProps: wrapProps(points.numericProps, 1)
|
|
1583
1597
|
},
|
|
1584
1598
|
lines: {
|
|
1585
1599
|
...lines,
|
|
1586
|
-
positions: {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
},
|
|
1590
|
-
pathIndices: {
|
|
1591
|
-
value: lines.pathIndices,
|
|
1592
|
-
size: 1
|
|
1593
|
-
},
|
|
1594
|
-
globalFeatureIds: {
|
|
1595
|
-
value: lines.globalFeatureIds,
|
|
1596
|
-
size: 1
|
|
1597
|
-
},
|
|
1598
|
-
featureIds: {
|
|
1599
|
-
value: lines.featureIds,
|
|
1600
|
-
size: 1
|
|
1601
|
-
},
|
|
1600
|
+
positions: { value: lines.positions, size: coordLength },
|
|
1601
|
+
pathIndices: { value: lines.pathIndices, size: 1 },
|
|
1602
|
+
globalFeatureIds: { value: lines.globalFeatureIds, size: 1 },
|
|
1603
|
+
featureIds: { value: lines.featureIds, size: 1 },
|
|
1602
1604
|
numericProps: wrapProps(lines.numericProps, 1)
|
|
1603
1605
|
},
|
|
1604
1606
|
polygons: {
|
|
1605
1607
|
...polygons,
|
|
1606
|
-
positions: {
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
},
|
|
1610
|
-
|
|
1611
|
-
value: polygons.polygonIndices,
|
|
1612
|
-
size: 1
|
|
1613
|
-
},
|
|
1614
|
-
primitivePolygonIndices: {
|
|
1615
|
-
value: polygons.primitivePolygonIndices,
|
|
1616
|
-
size: 1
|
|
1617
|
-
},
|
|
1618
|
-
globalFeatureIds: {
|
|
1619
|
-
value: polygons.globalFeatureIds,
|
|
1620
|
-
size: 1
|
|
1621
|
-
},
|
|
1622
|
-
featureIds: {
|
|
1623
|
-
value: polygons.featureIds,
|
|
1624
|
-
size: 1
|
|
1625
|
-
},
|
|
1608
|
+
positions: { value: polygons.positions, size: coordLength },
|
|
1609
|
+
polygonIndices: { value: polygons.polygonIndices, size: 1 },
|
|
1610
|
+
primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
|
|
1611
|
+
globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
|
|
1612
|
+
featureIds: { value: polygons.featureIds, size: 1 },
|
|
1626
1613
|
numericProps: wrapProps(polygons.numericProps, 1)
|
|
1627
1614
|
}
|
|
1615
|
+
// triangles not expected
|
|
1628
1616
|
};
|
|
1629
1617
|
if (binaryFeatures.polygons && polygons.triangles) {
|
|
1630
|
-
binaryFeatures.polygons.triangles = {
|
|
1631
|
-
value: new Uint32Array(polygons.triangles),
|
|
1632
|
-
size: 1
|
|
1633
|
-
};
|
|
1618
|
+
binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
|
|
1634
1619
|
}
|
|
1635
1620
|
return binaryFeatures;
|
|
1636
1621
|
}
|
|
@@ -1732,6 +1717,7 @@ var __exports__ = (() => {
|
|
|
1732
1717
|
this._values = values;
|
|
1733
1718
|
pbf.readFields(readFeature, this, end);
|
|
1734
1719
|
}
|
|
1720
|
+
// eslint-disable-next-line complexity, max-statements
|
|
1735
1721
|
loadGeometry() {
|
|
1736
1722
|
const pbf = this._pbf;
|
|
1737
1723
|
pbf.pos = this._geometry;
|
|
@@ -1771,6 +1757,7 @@ var __exports__ = (() => {
|
|
|
1771
1757
|
lines.push(line);
|
|
1772
1758
|
return lines;
|
|
1773
1759
|
}
|
|
1760
|
+
// eslint-disable-next-line max-statements
|
|
1774
1761
|
bbox() {
|
|
1775
1762
|
const pbf = this._pbf;
|
|
1776
1763
|
pbf.pos = this._geometry;
|
|
@@ -1857,11 +1844,7 @@ var __exports__ = (() => {
|
|
|
1857
1844
|
if (typeof options === "function") {
|
|
1858
1845
|
return this._toGeoJSON(options);
|
|
1859
1846
|
}
|
|
1860
|
-
const {
|
|
1861
|
-
x: x2,
|
|
1862
|
-
y: y2,
|
|
1863
|
-
z
|
|
1864
|
-
} = options;
|
|
1847
|
+
const { x: x2, y: y2, z } = options;
|
|
1865
1848
|
const size = this.extent * Math.pow(2, z);
|
|
1866
1849
|
const x0 = this.extent * x2;
|
|
1867
1850
|
const y0 = this.extent * y2;
|
|
@@ -1891,6 +1874,11 @@ var __exports__ = (() => {
|
|
|
1891
1874
|
pbf.readFields(readLayer, this, end);
|
|
1892
1875
|
this.length = this._features.length;
|
|
1893
1876
|
}
|
|
1877
|
+
/**
|
|
1878
|
+
* return feature `i` from this layer as a `VectorTileFeature`
|
|
1879
|
+
* @param index
|
|
1880
|
+
* @returns feature
|
|
1881
|
+
*/
|
|
1894
1882
|
feature(i2) {
|
|
1895
1883
|
if (i2 < 0 || i2 >= this._features.length) {
|
|
1896
1884
|
throw new Error("feature index out of bounds");
|
|
@@ -1991,12 +1979,7 @@ var __exports__ = (() => {
|
|
|
1991
1979
|
areas.push(ringAreas);
|
|
1992
1980
|
if (polygon.length)
|
|
1993
1981
|
polygons.push(polygon);
|
|
1994
|
-
return {
|
|
1995
|
-
type,
|
|
1996
|
-
areas,
|
|
1997
|
-
indices: polygons,
|
|
1998
|
-
data: geom.data
|
|
1999
|
-
};
|
|
1982
|
+
return { type, areas, indices: polygons, data: geom.data };
|
|
2000
1983
|
}
|
|
2001
1984
|
function project(data, x0, y0, size) {
|
|
2002
1985
|
for (let j = 0, jl = data.length; j < jl; j += 2) {
|
|
@@ -2035,6 +2018,7 @@ var __exports__ = (() => {
|
|
|
2035
2018
|
var y;
|
|
2036
2019
|
var i;
|
|
2037
2020
|
var VectorTileFeature2 = class {
|
|
2021
|
+
// eslint-disable-next-line max-params
|
|
2038
2022
|
constructor(pbf, end, extent, keys, values, geometryInfo) {
|
|
2039
2023
|
this.properties = {};
|
|
2040
2024
|
this.extent = extent;
|
|
@@ -2047,6 +2031,7 @@ var __exports__ = (() => {
|
|
|
2047
2031
|
this._geometryInfo = geometryInfo;
|
|
2048
2032
|
pbf.readFields(readFeature2, this, end);
|
|
2049
2033
|
}
|
|
2034
|
+
// eslint-disable-next-line complexity, max-statements
|
|
2050
2035
|
loadGeometry() {
|
|
2051
2036
|
const pbf = this._pbf;
|
|
2052
2037
|
pbf.pos = this._geometry;
|
|
@@ -2083,11 +2068,13 @@ var __exports__ = (() => {
|
|
|
2083
2068
|
throw new Error(`unknown command ${cmd}`);
|
|
2084
2069
|
}
|
|
2085
2070
|
}
|
|
2086
|
-
return {
|
|
2087
|
-
data,
|
|
2088
|
-
indices
|
|
2089
|
-
};
|
|
2071
|
+
return { data, indices };
|
|
2090
2072
|
}
|
|
2073
|
+
/**
|
|
2074
|
+
*
|
|
2075
|
+
* @param transform
|
|
2076
|
+
* @returns result
|
|
2077
|
+
*/
|
|
2091
2078
|
_toBinaryCoordinates(transform) {
|
|
2092
2079
|
const geom = this.loadGeometry();
|
|
2093
2080
|
let geometry;
|
|
@@ -2097,19 +2084,13 @@ var __exports__ = (() => {
|
|
|
2097
2084
|
case 1:
|
|
2098
2085
|
this._geometryInfo.pointFeaturesCount++;
|
|
2099
2086
|
this._geometryInfo.pointPositionsCount += geom.indices.length;
|
|
2100
|
-
geometry = {
|
|
2101
|
-
type: "Point",
|
|
2102
|
-
...geom
|
|
2103
|
-
};
|
|
2087
|
+
geometry = { type: "Point", ...geom };
|
|
2104
2088
|
break;
|
|
2105
2089
|
case 2:
|
|
2106
2090
|
this._geometryInfo.lineFeaturesCount++;
|
|
2107
2091
|
this._geometryInfo.linePathsCount += geom.indices.length;
|
|
2108
2092
|
this._geometryInfo.linePositionsCount += geom.data.length / coordLength;
|
|
2109
|
-
geometry = {
|
|
2110
|
-
type: "LineString",
|
|
2111
|
-
...geom
|
|
2112
|
-
};
|
|
2093
|
+
geometry = { type: "LineString", ...geom };
|
|
2113
2094
|
break;
|
|
2114
2095
|
case 3:
|
|
2115
2096
|
geometry = classifyRings2(geom);
|
|
@@ -2123,11 +2104,7 @@ var __exports__ = (() => {
|
|
|
2123
2104
|
default:
|
|
2124
2105
|
throw new Error(`Invalid geometry type: ${this.type}`);
|
|
2125
2106
|
}
|
|
2126
|
-
const result = {
|
|
2127
|
-
type: "Feature",
|
|
2128
|
-
geometry,
|
|
2129
|
-
properties: this.properties
|
|
2130
|
-
};
|
|
2107
|
+
const result = { type: "Feature", geometry, properties: this.properties };
|
|
2131
2108
|
if (this.id !== null) {
|
|
2132
2109
|
result.id = this.id;
|
|
2133
2110
|
}
|
|
@@ -2137,11 +2114,7 @@ var __exports__ = (() => {
|
|
|
2137
2114
|
if (typeof options === "function") {
|
|
2138
2115
|
return this._toBinaryCoordinates(options);
|
|
2139
2116
|
}
|
|
2140
|
-
const {
|
|
2141
|
-
x: x2,
|
|
2142
|
-
y: y2,
|
|
2143
|
-
z
|
|
2144
|
-
} = options;
|
|
2117
|
+
const { x: x2, y: y2, z } = options;
|
|
2145
2118
|
const size = this.extent * Math.pow(2, z);
|
|
2146
2119
|
const x0 = this.extent * x2;
|
|
2147
2120
|
const y0 = this.extent * y2;
|
|
@@ -2163,13 +2136,27 @@ var __exports__ = (() => {
|
|
|
2163
2136
|
pbf.readFields(readLayer2, this, end);
|
|
2164
2137
|
this.length = this._features.length;
|
|
2165
2138
|
}
|
|
2139
|
+
/**
|
|
2140
|
+
* return feature `i` from this layer as a `VectorTileFeature`
|
|
2141
|
+
*
|
|
2142
|
+
* @param index
|
|
2143
|
+
* @param geometryInfo
|
|
2144
|
+
* @returns {VectorTileFeature}
|
|
2145
|
+
*/
|
|
2166
2146
|
feature(i2, geometryInfo) {
|
|
2167
2147
|
if (i2 < 0 || i2 >= this._features.length) {
|
|
2168
2148
|
throw new Error("feature index out of bounds");
|
|
2169
2149
|
}
|
|
2170
2150
|
this._pbf.pos = this._features[i2];
|
|
2171
2151
|
const end = this._pbf.readVarint() + this._pbf.pos;
|
|
2172
|
-
return new VectorTileFeature2(
|
|
2152
|
+
return new VectorTileFeature2(
|
|
2153
|
+
this._pbf,
|
|
2154
|
+
end,
|
|
2155
|
+
this.extent,
|
|
2156
|
+
this._keys,
|
|
2157
|
+
this._values,
|
|
2158
|
+
geometryInfo
|
|
2159
|
+
);
|
|
2173
2160
|
}
|
|
2174
2161
|
};
|
|
2175
2162
|
function readLayer2(tag, layer, pbf) {
|
|
@@ -2221,10 +2208,7 @@ var __exports__ = (() => {
|
|
|
2221
2208
|
const shape = options?.gis?.format || options?.mvt?.shape || options?.shape;
|
|
2222
2209
|
switch (shape) {
|
|
2223
2210
|
case "columnar-table":
|
|
2224
|
-
return {
|
|
2225
|
-
shape: "columnar-table",
|
|
2226
|
-
data: parseToBinary(arrayBuffer, mvtOptions)
|
|
2227
|
-
};
|
|
2211
|
+
return { shape: "columnar-table", data: parseToBinary(arrayBuffer, mvtOptions) };
|
|
2228
2212
|
case "geojson-table": {
|
|
2229
2213
|
const table = {
|
|
2230
2214
|
shape: "geojson-table",
|
|
@@ -2306,9 +2290,7 @@ var __exports__ = (() => {
|
|
|
2306
2290
|
throw new Error("mvt options required");
|
|
2307
2291
|
}
|
|
2308
2292
|
const wgs84Coordinates = options.mvt?.coordinates === "wgs84";
|
|
2309
|
-
const {
|
|
2310
|
-
tileIndex
|
|
2311
|
-
} = options.mvt;
|
|
2293
|
+
const { tileIndex } = options.mvt;
|
|
2312
2294
|
const hasTileIndex = tileIndex && Number.isFinite(tileIndex.x) && Number.isFinite(tileIndex.y) && Number.isFinite(tileIndex.z);
|
|
2313
2295
|
if (wgs84Coordinates && !hasTileIndex) {
|
|
2314
2296
|
throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");
|
|
@@ -2316,23 +2298,27 @@ var __exports__ = (() => {
|
|
|
2316
2298
|
return options.mvt;
|
|
2317
2299
|
}
|
|
2318
2300
|
function getDecodedFeature(feature, options, layerName) {
|
|
2319
|
-
const decodedFeature = feature.toGeoJSON(
|
|
2301
|
+
const decodedFeature = feature.toGeoJSON(
|
|
2302
|
+
// @ts-expect-error What is going on here?
|
|
2303
|
+
options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates
|
|
2304
|
+
);
|
|
2320
2305
|
if (options.layerProperty) {
|
|
2321
2306
|
decodedFeature.properties[options.layerProperty] = layerName;
|
|
2322
2307
|
}
|
|
2323
2308
|
return decodedFeature;
|
|
2324
2309
|
}
|
|
2325
2310
|
function getDecodedFeatureBinary(feature, options, layerName) {
|
|
2326
|
-
const decodedFeature = feature.toBinaryCoordinates(
|
|
2311
|
+
const decodedFeature = feature.toBinaryCoordinates(
|
|
2312
|
+
// @ts-expect-error What is going on here?
|
|
2313
|
+
options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary
|
|
2314
|
+
);
|
|
2327
2315
|
if (options.layerProperty && decodedFeature.properties) {
|
|
2328
2316
|
decodedFeature.properties[options.layerProperty] = layerName;
|
|
2329
2317
|
}
|
|
2330
2318
|
return decodedFeature;
|
|
2331
2319
|
}
|
|
2332
2320
|
function transformToLocalCoordinates(line, feature) {
|
|
2333
|
-
const {
|
|
2334
|
-
extent
|
|
2335
|
-
} = feature;
|
|
2321
|
+
const { extent } = feature;
|
|
2336
2322
|
for (let i2 = 0; i2 < line.length; i2++) {
|
|
2337
2323
|
const p = line[i2];
|
|
2338
2324
|
p[0] /= extent;
|
|
@@ -2340,23 +2326,27 @@ var __exports__ = (() => {
|
|
|
2340
2326
|
}
|
|
2341
2327
|
}
|
|
2342
2328
|
function transformToLocalCoordinatesBinary(data, feature) {
|
|
2343
|
-
const {
|
|
2344
|
-
extent
|
|
2345
|
-
} = feature;
|
|
2329
|
+
const { extent } = feature;
|
|
2346
2330
|
for (let i2 = 0, il = data.length; i2 < il; ++i2) {
|
|
2347
2331
|
data[i2] /= extent;
|
|
2348
2332
|
}
|
|
2349
2333
|
}
|
|
2350
2334
|
|
|
2351
2335
|
// src/mvt-loader.ts
|
|
2352
|
-
var VERSION =
|
|
2336
|
+
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
2353
2337
|
var MVTWorkerLoader = {
|
|
2354
2338
|
name: "Mapbox Vector Tile",
|
|
2355
2339
|
id: "mvt",
|
|
2356
2340
|
module: "mvt",
|
|
2357
2341
|
version: VERSION,
|
|
2342
|
+
// Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
|
|
2358
2343
|
extensions: ["mvt", "pbf"],
|
|
2359
|
-
mimeTypes: [
|
|
2344
|
+
mimeTypes: [
|
|
2345
|
+
// https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile
|
|
2346
|
+
"application/vnd.mapbox-vector-tile",
|
|
2347
|
+
"application/x-protobuf"
|
|
2348
|
+
// 'application/octet-stream'
|
|
2349
|
+
],
|
|
2360
2350
|
worker: true,
|
|
2361
2351
|
category: "geometry",
|
|
2362
2352
|
options: {
|
|
@@ -2430,9 +2420,7 @@ var __exports__ = (() => {
|
|
|
2430
2420
|
name: key,
|
|
2431
2421
|
...attributeTypeToFieldType(String(datatype))
|
|
2432
2422
|
}));
|
|
2433
|
-
const layer2 = {
|
|
2434
|
-
...layer
|
|
2435
|
-
};
|
|
2423
|
+
const layer2 = { ...layer };
|
|
2436
2424
|
delete layer2.fields;
|
|
2437
2425
|
return {
|
|
2438
2426
|
name: layer.id || "",
|
|
@@ -2474,9 +2462,7 @@ var __exports__ = (() => {
|
|
|
2474
2462
|
return layers.map((layer) => {
|
|
2475
2463
|
const tilestatsLayer = tilestatsLayers.find((tsLayer) => tsLayer.name === layer.name);
|
|
2476
2464
|
const fields = tilestatsLayer?.fields || [];
|
|
2477
|
-
const layer2 = {
|
|
2478
|
-
...layer
|
|
2479
|
-
};
|
|
2465
|
+
const layer2 = { ...layer };
|
|
2480
2466
|
delete layer2.fields;
|
|
2481
2467
|
return {
|
|
2482
2468
|
...layer2,
|
|
@@ -2488,7 +2474,10 @@ var __exports__ = (() => {
|
|
|
2488
2474
|
function parseBounds(bounds) {
|
|
2489
2475
|
const result = fromArrayOrString(bounds);
|
|
2490
2476
|
if (Array.isArray(result) && result.length === 4 && [result[0], result[2]].every(isLng) && [result[1], result[3]].every(isLat)) {
|
|
2491
|
-
return [
|
|
2477
|
+
return [
|
|
2478
|
+
[result[0], result[1]],
|
|
2479
|
+
[result[2], result[3]]
|
|
2480
|
+
];
|
|
2492
2481
|
}
|
|
2493
2482
|
return void 0;
|
|
2494
2483
|
}
|
|
@@ -2553,6 +2542,8 @@ var __exports__ = (() => {
|
|
|
2553
2542
|
const fieldTypes = attributeTypeToFieldType(attribute.type);
|
|
2554
2543
|
const field = {
|
|
2555
2544
|
name: attribute.attribute,
|
|
2545
|
+
// what happens if attribute type is string...
|
|
2546
|
+
// filterProps: getFilterProps(fieldTypes.type, attribute),
|
|
2556
2547
|
...fieldTypes
|
|
2557
2548
|
};
|
|
2558
2549
|
if (typeof attribute.min === "number") {
|
|
@@ -2576,13 +2567,11 @@ var __exports__ = (() => {
|
|
|
2576
2567
|
const type = aType.toLowerCase();
|
|
2577
2568
|
if (!type || !attrTypeMap[type]) {
|
|
2578
2569
|
}
|
|
2579
|
-
return attrTypeMap[type] || {
|
|
2580
|
-
type: "string"
|
|
2581
|
-
};
|
|
2570
|
+
return attrTypeMap[type] || { type: "string" };
|
|
2582
2571
|
}
|
|
2583
2572
|
|
|
2584
2573
|
// src/tilejson-loader.ts
|
|
2585
|
-
var VERSION2 =
|
|
2574
|
+
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
2586
2575
|
var TileJSONLoader = {
|
|
2587
2576
|
name: "TileJSON",
|
|
2588
2577
|
id: "tilejson",
|
|
@@ -2600,18 +2589,12 @@ var __exports__ = (() => {
|
|
|
2600
2589
|
parse: async (arrayBuffer, options) => {
|
|
2601
2590
|
const jsonString = new TextDecoder().decode(arrayBuffer);
|
|
2602
2591
|
const json = JSON.parse(jsonString);
|
|
2603
|
-
const tilejsonOptions = {
|
|
2604
|
-
...TileJSONLoader.options.tilejson,
|
|
2605
|
-
...options?.tilejson
|
|
2606
|
-
};
|
|
2592
|
+
const tilejsonOptions = { ...TileJSONLoader.options.tilejson, ...options?.tilejson };
|
|
2607
2593
|
return parseTileJSON(json, tilejsonOptions);
|
|
2608
2594
|
},
|
|
2609
2595
|
parseTextSync: (text, options) => {
|
|
2610
2596
|
const json = JSON.parse(text);
|
|
2611
|
-
const tilejsonOptions = {
|
|
2612
|
-
...TileJSONLoader.options.tilejson,
|
|
2613
|
-
...options?.tilejson
|
|
2614
|
-
};
|
|
2597
|
+
const tilejsonOptions = { ...TileJSONLoader.options.tilejson, ...options?.tilejson };
|
|
2615
2598
|
return parseTileJSON(json, tilejsonOptions);
|
|
2616
2599
|
}
|
|
2617
2600
|
};
|
|
@@ -2634,7 +2617,10 @@ var __exports__ = (() => {
|
|
|
2634
2617
|
var window_ = globals.window || globals.self || globals.global || {};
|
|
2635
2618
|
var global_ = globals.global || globals.self || globals.window || {};
|
|
2636
2619
|
var document_ = globals.document || {};
|
|
2637
|
-
var isBrowser =
|
|
2620
|
+
var isBrowser = (
|
|
2621
|
+
// @ts-ignore process does not exist on browser
|
|
2622
|
+
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
2623
|
+
);
|
|
2638
2624
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
2639
2625
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
2640
2626
|
|
|
@@ -2656,23 +2642,24 @@ var __exports__ = (() => {
|
|
|
2656
2642
|
|
|
2657
2643
|
// ../loader-utils/src/lib/sources/data-source.ts
|
|
2658
2644
|
var DataSource = class {
|
|
2659
|
-
_needsRefresh = true;
|
|
2660
2645
|
constructor(props) {
|
|
2661
|
-
this.
|
|
2662
|
-
|
|
2663
|
-
};
|
|
2664
|
-
this.loadOptions = {
|
|
2665
|
-
...props.loadOptions
|
|
2666
|
-
};
|
|
2646
|
+
this._needsRefresh = true;
|
|
2647
|
+
this.props = { ...props };
|
|
2648
|
+
this.loadOptions = { ...props.loadOptions };
|
|
2667
2649
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
2668
2650
|
}
|
|
2669
2651
|
setProps(props) {
|
|
2670
2652
|
this.props = Object.assign(this.props, props);
|
|
2671
2653
|
this.setNeedsRefresh();
|
|
2672
2654
|
}
|
|
2655
|
+
/** Mark this data source as needing a refresh (redraw) */
|
|
2673
2656
|
setNeedsRefresh() {
|
|
2674
2657
|
this._needsRefresh = true;
|
|
2675
2658
|
}
|
|
2659
|
+
/**
|
|
2660
|
+
* Does this data source need refreshing?
|
|
2661
|
+
* @note The specifics of the refresh mechanism depends on type of data source
|
|
2662
|
+
*/
|
|
2676
2663
|
getNeedsRefresh(clear = true) {
|
|
2677
2664
|
const needsRefresh = this._needsRefresh;
|
|
2678
2665
|
if (clear) {
|
|
@@ -2694,7 +2681,7 @@ var __exports__ = (() => {
|
|
|
2694
2681
|
}
|
|
2695
2682
|
|
|
2696
2683
|
// ../images/src/lib/utils/version.ts
|
|
2697
|
-
var VERSION3 =
|
|
2684
|
+
var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
2698
2685
|
|
|
2699
2686
|
// ../images/src/lib/category-api/image-type.ts
|
|
2700
2687
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -2881,10 +2868,7 @@ var __exports__ = (() => {
|
|
|
2881
2868
|
switch (brandMajor) {
|
|
2882
2869
|
case "avif":
|
|
2883
2870
|
case "avis":
|
|
2884
|
-
return {
|
|
2885
|
-
extension: "avif",
|
|
2886
|
-
mimeType: "image/avif"
|
|
2887
|
-
};
|
|
2871
|
+
return { extension: "avif", mimeType: "image/avif" };
|
|
2888
2872
|
default:
|
|
2889
2873
|
return null;
|
|
2890
2874
|
}
|
|
@@ -2920,6 +2904,7 @@ var __exports__ = (() => {
|
|
|
2920
2904
|
}
|
|
2921
2905
|
return {
|
|
2922
2906
|
mimeType: mediaType.mimeType,
|
|
2907
|
+
// TODO - decode width and height
|
|
2923
2908
|
width: 0,
|
|
2924
2909
|
height: 0
|
|
2925
2910
|
};
|
|
@@ -2966,10 +2951,7 @@ var __exports__ = (() => {
|
|
|
2966
2951
|
if (!isJpeg) {
|
|
2967
2952
|
return null;
|
|
2968
2953
|
}
|
|
2969
|
-
const {
|
|
2970
|
-
tableMarkers,
|
|
2971
|
-
sofMarkers
|
|
2972
|
-
} = getJpegMarkers();
|
|
2954
|
+
const { tableMarkers, sofMarkers } = getJpegMarkers();
|
|
2973
2955
|
let i2 = 2;
|
|
2974
2956
|
while (i2 + 9 < dataView.byteLength) {
|
|
2975
2957
|
const marker = dataView.getUint16(i2, BIG_ENDIAN);
|
|
@@ -2977,7 +2959,9 @@ var __exports__ = (() => {
|
|
|
2977
2959
|
return {
|
|
2978
2960
|
mimeType: "image/jpeg",
|
|
2979
2961
|
height: dataView.getUint16(i2 + 5, BIG_ENDIAN),
|
|
2962
|
+
// Number of lines
|
|
2980
2963
|
width: dataView.getUint16(i2 + 7, BIG_ENDIAN)
|
|
2964
|
+
// Number of pixels per line
|
|
2981
2965
|
};
|
|
2982
2966
|
}
|
|
2983
2967
|
if (!tableMarkers.has(marker)) {
|
|
@@ -2993,11 +2977,23 @@ var __exports__ = (() => {
|
|
|
2993
2977
|
for (let i2 = 65504; i2 < 65520; ++i2) {
|
|
2994
2978
|
tableMarkers.add(i2);
|
|
2995
2979
|
}
|
|
2996
|
-
const sofMarkers = /* @__PURE__ */ new Set([
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
2980
|
+
const sofMarkers = /* @__PURE__ */ new Set([
|
|
2981
|
+
65472,
|
|
2982
|
+
65473,
|
|
2983
|
+
65474,
|
|
2984
|
+
65475,
|
|
2985
|
+
65477,
|
|
2986
|
+
65478,
|
|
2987
|
+
65479,
|
|
2988
|
+
65481,
|
|
2989
|
+
65482,
|
|
2990
|
+
65483,
|
|
2991
|
+
65485,
|
|
2992
|
+
65486,
|
|
2993
|
+
65487,
|
|
2994
|
+
65502
|
|
2995
|
+
]);
|
|
2996
|
+
return { tableMarkers, sofMarkers };
|
|
3001
2997
|
}
|
|
3002
2998
|
function toDataView(data) {
|
|
3003
2999
|
if (data instanceof DataView) {
|
|
@@ -3014,9 +3010,7 @@ var __exports__ = (() => {
|
|
|
3014
3010
|
|
|
3015
3011
|
// ../images/src/lib/parsers/parse-to-node-image.ts
|
|
3016
3012
|
async function parseToNodeImage(arrayBuffer, options) {
|
|
3017
|
-
const {
|
|
3018
|
-
mimeType
|
|
3019
|
-
} = getBinaryImageMetadata(arrayBuffer) || {};
|
|
3013
|
+
const { mimeType } = getBinaryImageMetadata(arrayBuffer) || {};
|
|
3020
3014
|
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
3021
3015
|
assert(parseImageNode2);
|
|
3022
3016
|
return await parseImageNode2(arrayBuffer, mimeType);
|
|
@@ -3027,9 +3021,7 @@ var __exports__ = (() => {
|
|
|
3027
3021
|
options = options || {};
|
|
3028
3022
|
const imageOptions = options.image || {};
|
|
3029
3023
|
const imageType = imageOptions.type || "auto";
|
|
3030
|
-
const {
|
|
3031
|
-
url
|
|
3032
|
-
} = context || {};
|
|
3024
|
+
const { url } = context || {};
|
|
3033
3025
|
const loadType = getLoadableImageType(imageType);
|
|
3034
3026
|
let image;
|
|
3035
3027
|
switch (loadType) {
|
|
@@ -3063,12 +3055,23 @@ var __exports__ = (() => {
|
|
|
3063
3055
|
|
|
3064
3056
|
// ../images/src/image-loader.ts
|
|
3065
3057
|
var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
|
|
3066
|
-
var MIME_TYPES = [
|
|
3058
|
+
var MIME_TYPES = [
|
|
3059
|
+
"image/png",
|
|
3060
|
+
"image/jpeg",
|
|
3061
|
+
"image/gif",
|
|
3062
|
+
"image/webp",
|
|
3063
|
+
"image/avif",
|
|
3064
|
+
"image/bmp",
|
|
3065
|
+
"image/vnd.microsoft.icon",
|
|
3066
|
+
"image/svg+xml"
|
|
3067
|
+
];
|
|
3067
3068
|
var DEFAULT_IMAGE_LOADER_OPTIONS = {
|
|
3068
3069
|
image: {
|
|
3069
3070
|
type: "auto",
|
|
3070
3071
|
decode: true
|
|
3072
|
+
// if format is HTML
|
|
3071
3073
|
}
|
|
3074
|
+
// imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
|
|
3072
3075
|
};
|
|
3073
3076
|
var ImageLoader = {
|
|
3074
3077
|
id: "image",
|
|
@@ -3078,17 +3081,18 @@ var __exports__ = (() => {
|
|
|
3078
3081
|
mimeTypes: MIME_TYPES,
|
|
3079
3082
|
extensions: EXTENSIONS,
|
|
3080
3083
|
parse: parseImage,
|
|
3084
|
+
// TODO: byteOffset, byteLength;
|
|
3081
3085
|
tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
|
|
3082
3086
|
options: DEFAULT_IMAGE_LOADER_OPTIONS
|
|
3083
3087
|
};
|
|
3084
3088
|
|
|
3085
3089
|
// src/mvt-source.ts
|
|
3086
3090
|
var MVTSource = class extends DataSource {
|
|
3087
|
-
metadataUrl = null;
|
|
3088
|
-
schema = "tms";
|
|
3089
|
-
mimeType = null;
|
|
3090
3091
|
constructor(props) {
|
|
3091
3092
|
super(props);
|
|
3093
|
+
this.metadataUrl = null;
|
|
3094
|
+
this.schema = "tms";
|
|
3095
|
+
this.mimeType = null;
|
|
3092
3096
|
this.props = props;
|
|
3093
3097
|
this.url = resolvePath(props.url);
|
|
3094
3098
|
this.metadataUrl = props.metadataUrl === void 0 ? `${this.url}/tilejson.json` : props.metadataUrl;
|
|
@@ -3100,6 +3104,7 @@ var __exports__ = (() => {
|
|
|
3100
3104
|
this.schema = "template";
|
|
3101
3105
|
}
|
|
3102
3106
|
}
|
|
3107
|
+
// @ts-ignore - Metadata type misalignment
|
|
3103
3108
|
async getMetadata() {
|
|
3104
3109
|
if (!this.metadataUrl) {
|
|
3105
3110
|
return null;
|
|
@@ -3123,11 +3128,7 @@ var __exports__ = (() => {
|
|
|
3123
3128
|
return this.mimeType;
|
|
3124
3129
|
}
|
|
3125
3130
|
async getTile(tileParams) {
|
|
3126
|
-
const {
|
|
3127
|
-
x: x2,
|
|
3128
|
-
y: y2,
|
|
3129
|
-
zoom: z
|
|
3130
|
-
} = tileParams;
|
|
3131
|
+
const { x: x2, y: y2, zoom: z } = tileParams;
|
|
3131
3132
|
const tileUrl = this.getTileURL(x2, y2, z);
|
|
3132
3133
|
const response = await this.fetch(tileUrl);
|
|
3133
3134
|
if (!response.ok) {
|
|
@@ -3136,18 +3137,11 @@ var __exports__ = (() => {
|
|
|
3136
3137
|
const arrayBuffer = await response.arrayBuffer();
|
|
3137
3138
|
return arrayBuffer;
|
|
3138
3139
|
}
|
|
3140
|
+
// Tile Source interface implementation: deck.gl compatible API
|
|
3141
|
+
// TODO - currently only handles image tiles, not vector tiles
|
|
3139
3142
|
async getTileData(tileParams) {
|
|
3140
|
-
const {
|
|
3141
|
-
|
|
3142
|
-
y: y2,
|
|
3143
|
-
z
|
|
3144
|
-
} = tileParams.index;
|
|
3145
|
-
const arrayBuffer = await this.getTile({
|
|
3146
|
-
x: x2,
|
|
3147
|
-
y: y2,
|
|
3148
|
-
zoom: z,
|
|
3149
|
-
layers: []
|
|
3150
|
-
});
|
|
3143
|
+
const { x: x2, y: y2, z } = tileParams.index;
|
|
3144
|
+
const arrayBuffer = await this.getTile({ x: x2, y: y2, zoom: z, layers: [] });
|
|
3151
3145
|
if (arrayBuffer === null) {
|
|
3152
3146
|
return null;
|
|
3153
3147
|
}
|
|
@@ -3155,16 +3149,12 @@ var __exports__ = (() => {
|
|
|
3155
3149
|
this.mimeType = this.mimeType || imageMetadata?.mimeType || "application/vnd.mapbox-vector-tile";
|
|
3156
3150
|
switch (this.mimeType) {
|
|
3157
3151
|
case "application/vnd.mapbox-vector-tile":
|
|
3158
|
-
return await this._parseVectorTile(arrayBuffer, {
|
|
3159
|
-
x: x2,
|
|
3160
|
-
y: y2,
|
|
3161
|
-
zoom: z,
|
|
3162
|
-
layers: []
|
|
3163
|
-
});
|
|
3152
|
+
return await this._parseVectorTile(arrayBuffer, { x: x2, y: y2, zoom: z, layers: [] });
|
|
3164
3153
|
default:
|
|
3165
3154
|
return await this._parseImageTile(arrayBuffer);
|
|
3166
3155
|
}
|
|
3167
3156
|
}
|
|
3157
|
+
// ImageTileSource interface implementation
|
|
3168
3158
|
async getImageTile(tileParams) {
|
|
3169
3159
|
const arrayBuffer = await this.getTile(tileParams);
|
|
3170
3160
|
return arrayBuffer ? this._parseImageTile(arrayBuffer) : null;
|
|
@@ -3172,6 +3162,7 @@ var __exports__ = (() => {
|
|
|
3172
3162
|
async _parseImageTile(arrayBuffer) {
|
|
3173
3163
|
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
3174
3164
|
}
|
|
3165
|
+
// VectorTileSource interface implementation
|
|
3175
3166
|
async getVectorTile(tileParams) {
|
|
3176
3167
|
const arrayBuffer = await this.getTile(tileParams);
|
|
3177
3168
|
return arrayBuffer ? this._parseVectorTile(arrayBuffer, tileParams) : null;
|
|
@@ -3181,11 +3172,7 @@ var __exports__ = (() => {
|
|
|
3181
3172
|
shape: "geojson-table",
|
|
3182
3173
|
mvt: {
|
|
3183
3174
|
coordinates: "wgs84",
|
|
3184
|
-
tileIndex: {
|
|
3185
|
-
x: tileParams.x,
|
|
3186
|
-
y: tileParams.y,
|
|
3187
|
-
z: tileParams.zoom
|
|
3188
|
-
},
|
|
3175
|
+
tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.zoom },
|
|
3189
3176
|
...this.loadOptions?.mvt
|
|
3190
3177
|
},
|
|
3191
3178
|
...this.loadOptions
|
|
@@ -3284,6 +3271,7 @@ var __exports__ = (() => {
|
|
|
3284
3271
|
// src/lib/geojson-tiler/feature.ts
|
|
3285
3272
|
function createFeature(id, type, geom, tags) {
|
|
3286
3273
|
const feature = {
|
|
3274
|
+
// eslint-disable-next-line
|
|
3287
3275
|
id: id == null ? null : id,
|
|
3288
3276
|
type,
|
|
3289
3277
|
geometry: geom,
|
|
@@ -3327,9 +3315,7 @@ var __exports__ = (() => {
|
|
|
3327
3315
|
} else if (data.type === "Feature") {
|
|
3328
3316
|
convertFeature(features, data, options);
|
|
3329
3317
|
} else {
|
|
3330
|
-
convertFeature(features, {
|
|
3331
|
-
geometry: data
|
|
3332
|
-
}, options);
|
|
3318
|
+
convertFeature(features, { geometry: data }, options);
|
|
3333
3319
|
}
|
|
3334
3320
|
return features;
|
|
3335
3321
|
}
|
|
@@ -3376,11 +3362,16 @@ var __exports__ = (() => {
|
|
|
3376
3362
|
}
|
|
3377
3363
|
} else if (type === "GeometryCollection") {
|
|
3378
3364
|
for (const singleGeometry of geojson.geometry.geometries) {
|
|
3379
|
-
convertFeature(
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3365
|
+
convertFeature(
|
|
3366
|
+
features,
|
|
3367
|
+
{
|
|
3368
|
+
id,
|
|
3369
|
+
geometry: singleGeometry,
|
|
3370
|
+
properties: geojson.properties
|
|
3371
|
+
},
|
|
3372
|
+
options,
|
|
3373
|
+
index
|
|
3374
|
+
);
|
|
3384
3375
|
}
|
|
3385
3376
|
return;
|
|
3386
3377
|
} else {
|
|
@@ -3796,26 +3787,35 @@ var __exports__ = (() => {
|
|
|
3796
3787
|
// src/lib/geojson-tiler/geojson-tiler.ts
|
|
3797
3788
|
var DEFAULT_OPTIONS = {
|
|
3798
3789
|
maxZoom: 14,
|
|
3790
|
+
// max zoom to preserve detail on
|
|
3799
3791
|
indexMaxZoom: 5,
|
|
3792
|
+
// max zoom in the tile index
|
|
3800
3793
|
indexMaxPoints: 1e5,
|
|
3794
|
+
// max number of points per tile in the tile index
|
|
3801
3795
|
tolerance: 3,
|
|
3796
|
+
// simplification tolerance (higher means simpler)
|
|
3802
3797
|
extent: 4096,
|
|
3798
|
+
// tile extent
|
|
3803
3799
|
buffer: 64,
|
|
3800
|
+
// tile buffer on each side
|
|
3804
3801
|
lineMetrics: false,
|
|
3802
|
+
// whether to calculate line metrics
|
|
3803
|
+
// @ts-expect-error Ensures all these required params have defaults
|
|
3805
3804
|
promoteId: void 0,
|
|
3805
|
+
// name of a feature property to be promoted to feature.id
|
|
3806
3806
|
generateId: false,
|
|
3807
|
+
// whether to generate feature ids. Cannot be used with promoteId
|
|
3807
3808
|
debug: 0
|
|
3809
|
+
// logging level (0, 1 or 2)
|
|
3808
3810
|
};
|
|
3809
3811
|
var GeoJSONTiler = class {
|
|
3810
|
-
tiles = {};
|
|
3811
|
-
tileCoords = [];
|
|
3812
|
-
stats = {};
|
|
3813
|
-
total = 0;
|
|
3814
3812
|
constructor(data, options) {
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
};
|
|
3813
|
+
// tiles and tileCoords are part of the public API
|
|
3814
|
+
this.tiles = {};
|
|
3815
|
+
this.tileCoords = [];
|
|
3816
|
+
this.stats = {};
|
|
3817
|
+
this.total = 0;
|
|
3818
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
3819
3819
|
options = this.options;
|
|
3820
3820
|
const debug = options.debug;
|
|
3821
3821
|
if (debug)
|
|
@@ -3829,7 +3829,11 @@ var __exports__ = (() => {
|
|
|
3829
3829
|
let features = convert(data, options);
|
|
3830
3830
|
if (debug) {
|
|
3831
3831
|
console.timeEnd("preprocess data");
|
|
3832
|
-
console.log(
|
|
3832
|
+
console.log(
|
|
3833
|
+
"index: maxZoom: %d, maxPoints: %d",
|
|
3834
|
+
options.indexMaxZoom,
|
|
3835
|
+
options.indexMaxPoints
|
|
3836
|
+
);
|
|
3833
3837
|
console.time("generate tiles");
|
|
3834
3838
|
}
|
|
3835
3839
|
features = wrap(features, this.options);
|
|
@@ -3844,11 +3848,16 @@ var __exports__ = (() => {
|
|
|
3844
3848
|
console.log("tiles generated:", this.total, JSON.stringify(this.stats));
|
|
3845
3849
|
}
|
|
3846
3850
|
}
|
|
3851
|
+
/**
|
|
3852
|
+
* Get a tile at the specified index
|
|
3853
|
+
* @param z
|
|
3854
|
+
* @param x
|
|
3855
|
+
* @param y
|
|
3856
|
+
* @returns
|
|
3857
|
+
*/
|
|
3858
|
+
// eslint-disable-next-line complexity, max-statements
|
|
3847
3859
|
getTile(z, x2, y2) {
|
|
3848
|
-
const {
|
|
3849
|
-
extent,
|
|
3850
|
-
debug
|
|
3851
|
-
} = this.options;
|
|
3860
|
+
const { extent, debug } = this.options;
|
|
3852
3861
|
if (z < 0 || z > 24) {
|
|
3853
3862
|
return null;
|
|
3854
3863
|
}
|
|
@@ -3883,6 +3892,15 @@ var __exports__ = (() => {
|
|
|
3883
3892
|
}
|
|
3884
3893
|
return this.tiles[id] ? transformTile(this.tiles[id], extent) : null;
|
|
3885
3894
|
}
|
|
3895
|
+
/**
|
|
3896
|
+
* splits features from a parent tile to sub-tiles.
|
|
3897
|
+
* @param z, x, and y are the coordinates of the parent tile
|
|
3898
|
+
* @param cz, cx, and cy are the coordinates of the target tile
|
|
3899
|
+
*
|
|
3900
|
+
* If no target tile is specified, splitting stops when we reach the maximum
|
|
3901
|
+
* zoom or the number of points is low as specified in the options.
|
|
3902
|
+
*/
|
|
3903
|
+
// eslint-disable-next-line max-params, max-statements, complexity
|
|
3886
3904
|
splitTile(features, z, x2, y2, cz, cx, cy) {
|
|
3887
3905
|
const stack = [features, z, x2, y2];
|
|
3888
3906
|
const options = this.options;
|
|
@@ -3900,14 +3918,18 @@ var __exports__ = (() => {
|
|
|
3900
3918
|
console.time("creation");
|
|
3901
3919
|
}
|
|
3902
3920
|
tile = this.tiles[id] = createTile(features, z, x2, y2, options);
|
|
3903
|
-
this.tileCoords.push({
|
|
3904
|
-
z,
|
|
3905
|
-
x: x2,
|
|
3906
|
-
y: y2
|
|
3907
|
-
});
|
|
3921
|
+
this.tileCoords.push({ z, x: x2, y: y2 });
|
|
3908
3922
|
if (debug) {
|
|
3909
3923
|
if (debug > 1) {
|
|
3910
|
-
console.log(
|
|
3924
|
+
console.log(
|
|
3925
|
+
"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",
|
|
3926
|
+
z,
|
|
3927
|
+
x2,
|
|
3928
|
+
y2,
|
|
3929
|
+
tile.numFeatures,
|
|
3930
|
+
tile.numPoints,
|
|
3931
|
+
tile.numSimplified
|
|
3932
|
+
);
|
|
3911
3933
|
console.timeEnd("creation");
|
|
3912
3934
|
}
|
|
3913
3935
|
const key = `z${z}`;
|
|
@@ -3964,7 +3986,7 @@ var __exports__ = (() => {
|
|
|
3964
3986
|
function toID(z, x2, y2) {
|
|
3965
3987
|
return ((1 << z) * y2 + x2) * 32 + z;
|
|
3966
3988
|
}
|
|
3967
|
-
return __toCommonJS(
|
|
3989
|
+
return __toCommonJS(bundle_exports);
|
|
3968
3990
|
})();
|
|
3969
3991
|
/*! Bundled license information:
|
|
3970
3992
|
|