@loaders.gl/mvt 4.2.0-alpha.5 → 4.2.0-beta.1
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 +70 -18
- package/dist/dist.min.js +1 -1
- package/dist/helpers/binary-util-functions.d.ts +3 -3
- package/dist/helpers/binary-util-functions.d.ts.map +1 -1
- package/dist/helpers/binary-util-functions.js +3 -0
- package/dist/helpers/mapbox-util-functions.d.ts +1 -1
- package/dist/helpers/mapbox-util-functions.d.ts.map +1 -1
- package/dist/helpers/mapbox-util-functions.js +3 -0
- package/dist/index.cjs +64 -18
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -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 +13 -2
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +5 -5
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-layer.js +16 -5
- package/dist/lib/binary-vector-tile/vector-tile.d.ts +3 -3
- package/dist/lib/binary-vector-tile/vector-tile.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile.js +7 -3
- package/dist/lib/geojson-tiler/clip.js +3 -0
- package/dist/lib/geojson-tiler/geojson-tiler.js +6 -5
- package/dist/lib/geojson-tiler/wrap.js +3 -0
- 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 +12 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts +2 -2
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.js +13 -4
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts +2 -2
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile.js +6 -2
- package/dist/lib/parse-mvt.d.ts +2 -2
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/parse-mvt.js +7 -4
- package/dist/lib/types.d.ts +0 -10
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +3 -0
- package/dist/mvt-loader.d.ts +63 -6
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +7 -9
- package/dist/mvt-source.js +8 -3
- package/dist/mvt-worker.js +50 -11
- package/dist/tilejson-loader.d.ts +2 -3
- package/dist/tilejson-loader.d.ts.map +1 -1
- package/dist/tilejson-loader.js +3 -1
- package/dist/workers/mvt-worker.js +3 -0
- package/package.json +6 -6
- package/src/helpers/binary-util-functions.ts +7 -3
- package/src/helpers/mapbox-util-functions.ts +5 -1
- package/src/index.ts +1 -1
- package/src/lib/binary-vector-tile/vector-tile-feature.ts +5 -1
- package/src/lib/binary-vector-tile/vector-tile-layer.ts +11 -7
- package/src/lib/binary-vector-tile/vector-tile.ts +13 -5
- package/src/lib/mapbox-vector-tile/vector-tile-feature.ts +5 -1
- package/src/lib/mapbox-vector-tile/vector-tile-layer.ts +6 -2
- package/src/lib/mapbox-vector-tile/vector-tile.ts +6 -2
- package/src/lib/parse-mvt.ts +13 -8
- package/src/lib/types.ts +3 -11
- package/src/mvt-loader.ts +35 -22
- package/src/tilejson-loader.ts +5 -2
- package/src/workers/mvt-worker.ts +4 -0
package/dist/index.cjs
CHANGED
|
@@ -99,6 +99,14 @@ function readTag(pbf, feature) {
|
|
|
99
99
|
|
|
100
100
|
// dist/lib/mapbox-vector-tile/vector-tile-feature.js
|
|
101
101
|
var VectorTileFeature = class {
|
|
102
|
+
properties;
|
|
103
|
+
extent;
|
|
104
|
+
type;
|
|
105
|
+
id;
|
|
106
|
+
_pbf;
|
|
107
|
+
_geometry;
|
|
108
|
+
_keys;
|
|
109
|
+
_values;
|
|
102
110
|
static get types() {
|
|
103
111
|
return ["Unknown", "Point", "LineString", "Polygon"];
|
|
104
112
|
}
|
|
@@ -258,6 +266,14 @@ var VectorTileFeature = class {
|
|
|
258
266
|
|
|
259
267
|
// dist/lib/mapbox-vector-tile/vector-tile-layer.js
|
|
260
268
|
var VectorTileLayer = class {
|
|
269
|
+
version;
|
|
270
|
+
name;
|
|
271
|
+
extent;
|
|
272
|
+
length;
|
|
273
|
+
_pbf;
|
|
274
|
+
_keys;
|
|
275
|
+
_values;
|
|
276
|
+
_features;
|
|
261
277
|
constructor(pbf, end) {
|
|
262
278
|
this.version = 1;
|
|
263
279
|
this.name = "";
|
|
@@ -312,6 +328,7 @@ function readValueMessage(pbf) {
|
|
|
312
328
|
|
|
313
329
|
// dist/lib/mapbox-vector-tile/vector-tile.js
|
|
314
330
|
var VectorTile = class {
|
|
331
|
+
layers;
|
|
315
332
|
constructor(pbf, end) {
|
|
316
333
|
this.layers = pbf.readFields(readTile, {}, end);
|
|
317
334
|
}
|
|
@@ -414,7 +431,16 @@ var length;
|
|
|
414
431
|
var x;
|
|
415
432
|
var y;
|
|
416
433
|
var i;
|
|
417
|
-
var
|
|
434
|
+
var BinaryVectorTileFeature = class {
|
|
435
|
+
properties;
|
|
436
|
+
extent;
|
|
437
|
+
type;
|
|
438
|
+
id;
|
|
439
|
+
_pbf;
|
|
440
|
+
_geometry;
|
|
441
|
+
_keys;
|
|
442
|
+
_values;
|
|
443
|
+
_geometryInfo;
|
|
418
444
|
// eslint-disable-next-line max-params
|
|
419
445
|
constructor(pbf, end, extent, keys, values, geometryInfo) {
|
|
420
446
|
this.properties = {};
|
|
@@ -520,7 +546,15 @@ var VectorTileFeature2 = class {
|
|
|
520
546
|
};
|
|
521
547
|
|
|
522
548
|
// dist/lib/binary-vector-tile/vector-tile-layer.js
|
|
523
|
-
var
|
|
549
|
+
var BinaryVectorTileLayer = class {
|
|
550
|
+
version;
|
|
551
|
+
name;
|
|
552
|
+
extent;
|
|
553
|
+
length;
|
|
554
|
+
_pbf;
|
|
555
|
+
_keys;
|
|
556
|
+
_values;
|
|
557
|
+
_features;
|
|
524
558
|
constructor(pbf, end) {
|
|
525
559
|
this.version = 1;
|
|
526
560
|
this.name = "";
|
|
@@ -534,11 +568,11 @@ var VectorTileLayer2 = class {
|
|
|
534
568
|
this.length = this._features.length;
|
|
535
569
|
}
|
|
536
570
|
/**
|
|
537
|
-
* return feature `i` from this layer as a `
|
|
571
|
+
* return feature `i` from this layer as a `BinaryVectorTileFeature`
|
|
538
572
|
*
|
|
539
573
|
* @param index
|
|
540
574
|
* @param geometryInfo
|
|
541
|
-
* @returns {
|
|
575
|
+
* @returns {BinaryVectorTileFeature}
|
|
542
576
|
*/
|
|
543
577
|
feature(i2, geometryInfo) {
|
|
544
578
|
if (i2 < 0 || i2 >= this._features.length) {
|
|
@@ -546,7 +580,7 @@ var VectorTileLayer2 = class {
|
|
|
546
580
|
}
|
|
547
581
|
this._pbf.pos = this._features[i2];
|
|
548
582
|
const end = this._pbf.readVarint() + this._pbf.pos;
|
|
549
|
-
return new
|
|
583
|
+
return new BinaryVectorTileFeature(this._pbf, end, this.extent, this._keys, this._values, geometryInfo);
|
|
550
584
|
}
|
|
551
585
|
};
|
|
552
586
|
function readLayer2(tag, layer, pbf) {
|
|
@@ -576,7 +610,8 @@ function readValueMessage2(pbf) {
|
|
|
576
610
|
}
|
|
577
611
|
|
|
578
612
|
// dist/lib/binary-vector-tile/vector-tile.js
|
|
579
|
-
var
|
|
613
|
+
var BinaryVectorTile = class {
|
|
614
|
+
layers;
|
|
580
615
|
constructor(pbf, end) {
|
|
581
616
|
this.layers = pbf.readFields(readTile2, {}, end);
|
|
582
617
|
}
|
|
@@ -584,7 +619,7 @@ var VectorTile2 = class {
|
|
|
584
619
|
function readTile2(tag, layers, pbf) {
|
|
585
620
|
if (tag === 3) {
|
|
586
621
|
if (pbf) {
|
|
587
|
-
const layer = new
|
|
622
|
+
const layer = new BinaryVectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
|
|
588
623
|
if (layer.length && layers) {
|
|
589
624
|
layers[layer.name] = layer;
|
|
590
625
|
}
|
|
@@ -641,7 +676,7 @@ function parseToFlatGeoJson(arrayBuffer, options) {
|
|
|
641
676
|
if (arrayBuffer.byteLength <= 0) {
|
|
642
677
|
return [features, geometryInfo];
|
|
643
678
|
}
|
|
644
|
-
const tile = new
|
|
679
|
+
const tile = new BinaryVectorTile(new import_pbf.default(arrayBuffer));
|
|
645
680
|
const selectedLayers = options && Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);
|
|
646
681
|
selectedLayers.forEach((layerName) => {
|
|
647
682
|
const vectorTileLayer = tile.layers[layerName];
|
|
@@ -701,7 +736,7 @@ function getDecodedFeature(feature, options, layerName) {
|
|
|
701
736
|
}
|
|
702
737
|
function getDecodedFeatureBinary(feature, options, layerName) {
|
|
703
738
|
const decodedFeature = feature.toBinaryCoordinates(
|
|
704
|
-
// @ts-expect-error
|
|
739
|
+
// @ts-expect-error
|
|
705
740
|
options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary
|
|
706
741
|
);
|
|
707
742
|
if (options.layerProperty && decodedFeature.properties) {
|
|
@@ -725,8 +760,10 @@ function transformToLocalCoordinatesBinary(data, feature) {
|
|
|
725
760
|
}
|
|
726
761
|
|
|
727
762
|
// dist/mvt-loader.js
|
|
728
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
763
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
729
764
|
var MVTWorkerLoader = {
|
|
765
|
+
dataType: null,
|
|
766
|
+
batchType: null,
|
|
730
767
|
name: "Mapbox Vector Tile",
|
|
731
768
|
id: "mvt",
|
|
732
769
|
module: "mvt",
|
|
@@ -965,8 +1002,10 @@ function attributeTypeToFieldType(aType) {
|
|
|
965
1002
|
}
|
|
966
1003
|
|
|
967
1004
|
// dist/tilejson-loader.js
|
|
968
|
-
var VERSION2 = true ? "4.2.0-alpha.
|
|
1005
|
+
var VERSION2 = true ? "4.2.0-alpha.6" : "latest";
|
|
969
1006
|
var TileJSONLoader = {
|
|
1007
|
+
dataType: null,
|
|
1008
|
+
batchType: null,
|
|
970
1009
|
name: "TileJSON",
|
|
971
1010
|
id: "tilejson",
|
|
972
1011
|
module: "pmtiles",
|
|
@@ -998,11 +1037,16 @@ var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
|
998
1037
|
var import_images = require("@loaders.gl/images");
|
|
999
1038
|
var import_mvt = require("@loaders.gl/mvt");
|
|
1000
1039
|
var MVTSource = class extends import_loader_utils.DataSource {
|
|
1040
|
+
props;
|
|
1041
|
+
url;
|
|
1042
|
+
metadataUrl = null;
|
|
1043
|
+
data;
|
|
1044
|
+
schema = "tms";
|
|
1045
|
+
metadata;
|
|
1046
|
+
extension;
|
|
1047
|
+
mimeType = null;
|
|
1001
1048
|
constructor(props) {
|
|
1002
1049
|
super(props);
|
|
1003
|
-
this.metadataUrl = null;
|
|
1004
|
-
this.schema = "tms";
|
|
1005
|
-
this.mimeType = null;
|
|
1006
1050
|
this.props = props;
|
|
1007
1051
|
this.url = (0, import_loader_utils.resolvePath)(props.url);
|
|
1008
1052
|
this.metadataUrl = props.metadataUrl === void 0 ? `${this.url}/tilejson.json` : props.metadataUrl;
|
|
@@ -1716,11 +1760,13 @@ var DEFAULT_OPTIONS = {
|
|
|
1716
1760
|
// logging level (0, 1 or 2)
|
|
1717
1761
|
};
|
|
1718
1762
|
var GeoJSONTiler = class {
|
|
1763
|
+
options;
|
|
1764
|
+
// tiles and tileCoords are part of the public API
|
|
1765
|
+
tiles = {};
|
|
1766
|
+
tileCoords = [];
|
|
1767
|
+
stats = {};
|
|
1768
|
+
total = 0;
|
|
1719
1769
|
constructor(data, options) {
|
|
1720
|
-
this.tiles = {};
|
|
1721
|
-
this.tileCoords = [];
|
|
1722
|
-
this.stats = {};
|
|
1723
|
-
this.total = 0;
|
|
1724
1770
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
1725
1771
|
options = this.options;
|
|
1726
1772
|
const debug = options.debug;
|