@loaders.gl/mvt 4.3.1 → 4.4.0-alpha.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 +151 -93
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +74 -78
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/pojo-parser/mvt-constants.d.ts +116 -0
- package/dist/lib/pojo-parser/mvt-constants.d.ts.map +1 -0
- package/dist/lib/pojo-parser/mvt-constants.js +126 -0
- package/dist/lib/pojo-parser/mvt-types.d.ts +17 -0
- package/dist/lib/pojo-parser/mvt-types.d.ts.map +1 -0
- package/dist/lib/pojo-parser/mvt-types.js +4 -0
- package/dist/lib/pojo-parser/parse-geometry-from-pbf.d.ts +77 -0
- package/dist/lib/pojo-parser/parse-geometry-from-pbf.d.ts.map +1 -0
- package/dist/lib/pojo-parser/parse-geometry-from-pbf.js +234 -0
- package/dist/lib/pojo-parser/parse-mvt-from-pbf.d.ts +25 -0
- package/dist/lib/pojo-parser/parse-mvt-from-pbf.d.ts.map +1 -0
- package/dist/lib/pojo-parser/parse-mvt-from-pbf.js +262 -0
- package/dist/lib/vector-tile/vector-tile-feature.d.ts +2 -1
- package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-layer.d.ts +1 -1
- package/dist/lib/vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/mvt-format.d.ts +12 -0
- package/dist/mvt-format.d.ts.map +1 -0
- package/dist/mvt-format.js +20 -0
- package/dist/mvt-loader.d.ts +12 -12
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +3 -13
- package/dist/mvt-source.d.ts +22 -24
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-source.js +14 -23
- package/dist/mvt-worker.js +20 -15
- package/dist/table-tile-source.d.ts +38 -38
- package/dist/table-tile-source.d.ts.map +1 -1
- package/dist/table-tile-source.js +54 -53
- package/dist/tilejson-loader.js +1 -1
- package/package.json +7 -7
- package/src/index.ts +2 -2
- package/src/lib/parse-mvt.ts +2 -8
- package/src/lib/pojo-parser/mvt-constants.ts +135 -0
- package/src/lib/pojo-parser/mvt-types.ts +22 -0
- package/src/lib/pojo-parser/parse-geometry-from-pbf.ts +285 -0
- package/src/lib/pojo-parser/parse-mvt-from-pbf.ts +310 -0
- package/src/lib/vector-tile/vector-tile-feature.ts +2 -6
- package/src/lib/vector-tile/vector-tile-layer.ts +1 -1
- package/src/mvt-format.ts +23 -0
- package/src/mvt-loader.ts +2 -13
- package/src/mvt-source.ts +33 -38
- package/src/table-tile-source.ts +116 -96
package/dist/dist.dev.js
CHANGED
|
@@ -1088,7 +1088,7 @@ var __exports__ = (() => {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
};
|
|
1090
1090
|
|
|
1091
|
-
// ../schema/src/lib/
|
|
1091
|
+
// ../schema-utils/src/lib/schema/data-type.ts
|
|
1092
1092
|
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
1093
1093
|
if (value instanceof Date) {
|
|
1094
1094
|
return "date-millisecond";
|
|
@@ -1139,7 +1139,7 @@ var __exports__ = (() => {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
1141
|
|
|
1142
|
-
// ../schema/src/lib/
|
|
1142
|
+
// ../schema-utils/src/lib/schema/deduce-table-schema.ts
|
|
1143
1143
|
function deduceTableSchema(table) {
|
|
1144
1144
|
switch (table.shape) {
|
|
1145
1145
|
case "array-row-table":
|
|
@@ -1720,8 +1720,8 @@ var __exports__ = (() => {
|
|
|
1720
1720
|
}
|
|
1721
1721
|
};
|
|
1722
1722
|
|
|
1723
|
-
// ../gis/src/lib/
|
|
1724
|
-
function
|
|
1723
|
+
// ../gis/src/lib/feature-collection-converters/convert-flat-geojson-to-binary-features.ts
|
|
1724
|
+
function convertFlatGeojsonToBinaryFeatureCollection(features2, geometryInfo, options) {
|
|
1725
1725
|
const propArrayTypes = extractNumericPropTypes(features2);
|
|
1726
1726
|
const numericPropKeys = Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array);
|
|
1727
1727
|
return fillArrays(
|
|
@@ -2033,14 +2033,14 @@ var __exports__ = (() => {
|
|
|
2033
2033
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
2034
2034
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
2035
2035
|
|
|
2036
|
-
// ../../node_modules/@probe.gl/
|
|
2036
|
+
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
2037
2037
|
var window_2 = globalThis;
|
|
2038
2038
|
var document_2 = globalThis.document || {};
|
|
2039
2039
|
var process_ = globalThis.process || {};
|
|
2040
2040
|
var console_ = globalThis.console;
|
|
2041
2041
|
var navigator_ = globalThis.navigator || {};
|
|
2042
2042
|
|
|
2043
|
-
// ../../node_modules/@probe.gl/
|
|
2043
|
+
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
2044
2044
|
function isElectron(mockUserAgent) {
|
|
2045
2045
|
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
2046
2046
|
return true;
|
|
@@ -2053,7 +2053,7 @@ var __exports__ = (() => {
|
|
|
2053
2053
|
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
2054
2054
|
}
|
|
2055
2055
|
|
|
2056
|
-
// ../../node_modules/@probe.gl/
|
|
2056
|
+
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
2057
2057
|
function isBrowser2() {
|
|
2058
2058
|
const isNode = (
|
|
2059
2059
|
// @ts-expect-error
|
|
@@ -2062,7 +2062,7 @@ var __exports__ = (() => {
|
|
|
2062
2062
|
return !isNode || isElectron();
|
|
2063
2063
|
}
|
|
2064
2064
|
|
|
2065
|
-
// ../../node_modules/@probe.gl/
|
|
2065
|
+
// ../../node_modules/@probe.gl/env/dist/index.js
|
|
2066
2066
|
var VERSION2 = true ? "4.0.7" : "untranspiled source";
|
|
2067
2067
|
|
|
2068
2068
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
@@ -2478,6 +2478,32 @@ var __exports__ = (() => {
|
|
|
2478
2478
|
}
|
|
2479
2479
|
var log = createLog();
|
|
2480
2480
|
|
|
2481
|
+
// ../loader-utils/src/lib/option-utils/merge-options.ts
|
|
2482
|
+
function getRequiredOptions(options) {
|
|
2483
|
+
return options;
|
|
2484
|
+
}
|
|
2485
|
+
function mergeOptions(baseOptions, newOptions) {
|
|
2486
|
+
return mergeOptionsRecursively(baseOptions || {}, newOptions);
|
|
2487
|
+
}
|
|
2488
|
+
function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
2489
|
+
if (level > 3) {
|
|
2490
|
+
return newOptions;
|
|
2491
|
+
}
|
|
2492
|
+
const options = { ...baseOptions };
|
|
2493
|
+
for (const [key, newValue] of Object.entries(newOptions)) {
|
|
2494
|
+
if (newValue && typeof newValue === "object" && !Array.isArray(newValue)) {
|
|
2495
|
+
options[key] = mergeOptionsRecursively(
|
|
2496
|
+
options[key] || {},
|
|
2497
|
+
newOptions[key],
|
|
2498
|
+
level + 1
|
|
2499
|
+
);
|
|
2500
|
+
} else {
|
|
2501
|
+
options[key] = newOptions[key];
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
return options;
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2481
2507
|
// ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
2482
2508
|
function getHiResTimestamp2() {
|
|
2483
2509
|
let timestamp;
|
|
@@ -2688,20 +2714,29 @@ var __exports__ = (() => {
|
|
|
2688
2714
|
}
|
|
2689
2715
|
|
|
2690
2716
|
// ../loader-utils/src/lib/sources/data-source.ts
|
|
2691
|
-
var
|
|
2692
|
-
|
|
2693
|
-
|
|
2717
|
+
var _DataSource = class {
|
|
2718
|
+
optionsType;
|
|
2719
|
+
options;
|
|
2720
|
+
data;
|
|
2721
|
+
url;
|
|
2694
2722
|
/** The actual load options, if calling a loaders.gl loader */
|
|
2695
2723
|
loadOptions;
|
|
2724
|
+
/** A resolved fetch function extracted from loadOptions prop */
|
|
2725
|
+
fetch;
|
|
2696
2726
|
_needsRefresh = true;
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2727
|
+
constructor(data, options, defaultOptions) {
|
|
2728
|
+
if (defaultOptions) {
|
|
2729
|
+
this.options = mergeOptions({ ...defaultOptions, core: _DataSource.defaultOptions }, options);
|
|
2730
|
+
} else {
|
|
2731
|
+
this.options = { ...options };
|
|
2732
|
+
}
|
|
2733
|
+
this.data = data;
|
|
2734
|
+
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
2735
|
+
this.loadOptions = { ...this.options.core?.loadOptions };
|
|
2701
2736
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
2702
2737
|
}
|
|
2703
|
-
setProps(
|
|
2704
|
-
this.
|
|
2738
|
+
setProps(options) {
|
|
2739
|
+
this.options = Object.assign(this.options, options);
|
|
2705
2740
|
this.setNeedsRefresh();
|
|
2706
2741
|
}
|
|
2707
2742
|
/** Mark this data source as needing a refresh (redraw) */
|
|
@@ -2720,6 +2755,15 @@ var __exports__ = (() => {
|
|
|
2720
2755
|
return needsRefresh;
|
|
2721
2756
|
}
|
|
2722
2757
|
};
|
|
2758
|
+
var DataSource = _DataSource;
|
|
2759
|
+
__publicField(DataSource, "defaultOptions", {
|
|
2760
|
+
core: {
|
|
2761
|
+
type: "auto",
|
|
2762
|
+
attributions: [],
|
|
2763
|
+
loadOptions: {},
|
|
2764
|
+
loaders: []
|
|
2765
|
+
}
|
|
2766
|
+
});
|
|
2723
2767
|
function getFetchFunction(options) {
|
|
2724
2768
|
const fetchFunction = options?.fetch;
|
|
2725
2769
|
if (fetchFunction && typeof fetchFunction === "function") {
|
|
@@ -3304,7 +3348,7 @@ var __exports__ = (() => {
|
|
|
3304
3348
|
}
|
|
3305
3349
|
function parseToBinary(arrayBuffer, options) {
|
|
3306
3350
|
const [flatGeoJsonFeatures, geometryInfo] = parseToFlatGeoJson(arrayBuffer, options);
|
|
3307
|
-
const binaryData =
|
|
3351
|
+
const binaryData = convertFlatGeojsonToBinaryFeatureCollection(flatGeoJsonFeatures, geometryInfo);
|
|
3308
3352
|
binaryData.byteLength = arrayBuffer.byteLength;
|
|
3309
3353
|
return binaryData;
|
|
3310
3354
|
}
|
|
@@ -3391,15 +3435,11 @@ var __exports__ = (() => {
|
|
|
3391
3435
|
return decodedFeature;
|
|
3392
3436
|
}
|
|
3393
3437
|
|
|
3394
|
-
// src/mvt-
|
|
3395
|
-
var
|
|
3396
|
-
var MVTWorkerLoader = {
|
|
3397
|
-
dataType: null,
|
|
3398
|
-
batchType: null,
|
|
3438
|
+
// src/mvt-format.ts
|
|
3439
|
+
var MVTFormat = {
|
|
3399
3440
|
name: "Mapbox Vector Tile",
|
|
3400
3441
|
id: "mvt",
|
|
3401
3442
|
module: "mvt",
|
|
3402
|
-
version: VERSION4,
|
|
3403
3443
|
// Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
|
|
3404
3444
|
extensions: ["mvt", "pbf"],
|
|
3405
3445
|
mimeTypes: [
|
|
@@ -3408,8 +3448,17 @@ var __exports__ = (() => {
|
|
|
3408
3448
|
"application/x-protobuf"
|
|
3409
3449
|
// 'application/octet-stream'
|
|
3410
3450
|
],
|
|
3451
|
+
category: "geometry"
|
|
3452
|
+
};
|
|
3453
|
+
|
|
3454
|
+
// src/mvt-loader.ts
|
|
3455
|
+
var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
3456
|
+
var MVTWorkerLoader = {
|
|
3457
|
+
...MVTFormat,
|
|
3458
|
+
dataType: null,
|
|
3459
|
+
batchType: null,
|
|
3460
|
+
version: VERSION4,
|
|
3411
3461
|
worker: true,
|
|
3412
|
-
category: "geometry",
|
|
3413
3462
|
options: {
|
|
3414
3463
|
mvt: {
|
|
3415
3464
|
shape: "geojson",
|
|
@@ -3837,41 +3886,31 @@ var __exports__ = (() => {
|
|
|
3837
3886
|
|
|
3838
3887
|
// src/mvt-source.ts
|
|
3839
3888
|
var MVTSource = {
|
|
3840
|
-
|
|
3841
|
-
id: "mvt",
|
|
3842
|
-
module: "mvt",
|
|
3889
|
+
...MVTFormat,
|
|
3843
3890
|
version: "0.0.0",
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3891
|
+
type: "mvt",
|
|
3892
|
+
fromUrl: true,
|
|
3893
|
+
fromBlob: false,
|
|
3894
|
+
defaultOptions: {
|
|
3847
3895
|
mvt: {
|
|
3848
3896
|
// TODO - add options here
|
|
3849
3897
|
}
|
|
3850
3898
|
},
|
|
3851
|
-
type: "mvt",
|
|
3852
|
-
fromUrl: true,
|
|
3853
|
-
fromBlob: false,
|
|
3854
3899
|
testURL: (url) => true,
|
|
3855
|
-
createDataSource(url,
|
|
3856
|
-
return new MVTTileSource(url,
|
|
3900
|
+
createDataSource(url, options) {
|
|
3901
|
+
return new MVTTileSource(url, options);
|
|
3857
3902
|
}
|
|
3858
3903
|
};
|
|
3859
3904
|
var MVTTileSource = class extends DataSource {
|
|
3860
|
-
props;
|
|
3861
|
-
url;
|
|
3862
3905
|
metadataUrl = null;
|
|
3863
|
-
data;
|
|
3864
3906
|
schema = "tms";
|
|
3865
3907
|
metadata;
|
|
3866
3908
|
extension;
|
|
3867
3909
|
mimeType = null;
|
|
3868
|
-
constructor(url,
|
|
3869
|
-
super(
|
|
3870
|
-
this.
|
|
3871
|
-
this.
|
|
3872
|
-
this.metadataUrl = props.mvt?.metadataUrl || `${this.url}/tilejson.json`;
|
|
3873
|
-
this.extension = props.mvt?.extension || ".png";
|
|
3874
|
-
this.data = this.url;
|
|
3910
|
+
constructor(url, options) {
|
|
3911
|
+
super(url, options, MVTSource.defaultOptions);
|
|
3912
|
+
this.metadataUrl = options.mvt?.metadataUrl || `${this.url}/tilejson.json`;
|
|
3913
|
+
this.extension = options.mvt?.extension || ".png";
|
|
3875
3914
|
this.getTileData = this.getTileData.bind(this);
|
|
3876
3915
|
this.metadata = this.getMetadata();
|
|
3877
3916
|
if (isURLTemplate(this.url)) {
|
|
@@ -4684,10 +4723,14 @@ var __exports__ = (() => {
|
|
|
4684
4723
|
var TableTileSource = {
|
|
4685
4724
|
name: "TableTiler",
|
|
4686
4725
|
id: "table-tiler",
|
|
4726
|
+
module: "mvt",
|
|
4687
4727
|
version: "0.0.0",
|
|
4688
4728
|
extensions: ["mvt"],
|
|
4689
4729
|
mimeTypes: ["application/octet-stream"],
|
|
4690
|
-
|
|
4730
|
+
type: "table",
|
|
4731
|
+
fromUrl: false,
|
|
4732
|
+
fromBlob: false,
|
|
4733
|
+
defaultOptions: {
|
|
4691
4734
|
table: {
|
|
4692
4735
|
coordinates: "local",
|
|
4693
4736
|
promoteId: void 0,
|
|
@@ -4700,27 +4743,16 @@ var __exports__ = (() => {
|
|
|
4700
4743
|
generateId: void 0
|
|
4701
4744
|
}
|
|
4702
4745
|
},
|
|
4703
|
-
type: "table",
|
|
4704
4746
|
testURL: (url) => url.endsWith(".geojson"),
|
|
4705
4747
|
createDataSource(url, options) {
|
|
4706
4748
|
const needsLoading = typeof url === "string" || url instanceof Blob;
|
|
4707
|
-
const loader = options?.
|
|
4749
|
+
const loader = options?.core?.loaders?.[0];
|
|
4708
4750
|
const tablePromise = needsLoading ? loadTable(url, loader) : url;
|
|
4709
|
-
return new
|
|
4751
|
+
return new TableVectorTileSource(tablePromise, options);
|
|
4710
4752
|
}
|
|
4711
|
-
// @ts-expect-error
|
|
4712
4753
|
};
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
const response = await fetch(url);
|
|
4716
|
-
const data2 = await response.arrayBuffer();
|
|
4717
|
-
return await loader.parse(data2);
|
|
4718
|
-
}
|
|
4719
|
-
const data = await url.arrayBuffer();
|
|
4720
|
-
return await loader.parse(data);
|
|
4721
|
-
}
|
|
4722
|
-
var _DynamicVectorTileSource = class {
|
|
4723
|
-
/** Stats for this DynamicVectorTileSource */
|
|
4754
|
+
var _TableVectorTileSource = class extends DataSource {
|
|
4755
|
+
/** Stats for this TableVectorTileSource */
|
|
4724
4756
|
stats = new Stats({
|
|
4725
4757
|
id: "table-tile-source",
|
|
4726
4758
|
stats: [new Stat("tiles", "count"), new Stat("features", "count")]
|
|
@@ -4728,9 +4760,7 @@ var __exports__ = (() => {
|
|
|
4728
4760
|
/** MIME type of the tiles emitted by this tile source */
|
|
4729
4761
|
mimeType = "application/vnd.mapbox-vector-tile";
|
|
4730
4762
|
localCoordinates = true;
|
|
4731
|
-
|
|
4732
|
-
// @ts-expect-error
|
|
4733
|
-
props;
|
|
4763
|
+
tableOptions;
|
|
4734
4764
|
/* Schema of the data */
|
|
4735
4765
|
schema = null;
|
|
4736
4766
|
/** Map of generated tiles, indexed by stringified tile coordinates */
|
|
@@ -4741,8 +4771,9 @@ var __exports__ = (() => {
|
|
|
4741
4771
|
ready;
|
|
4742
4772
|
/** Metadata for the tile source (generated TileJSON/tilestats */
|
|
4743
4773
|
metadata;
|
|
4744
|
-
constructor(table,
|
|
4745
|
-
|
|
4774
|
+
constructor(table, options) {
|
|
4775
|
+
super(table, options, TableTileSource.defaultOptions);
|
|
4776
|
+
this.tableOptions = getRequiredOptions(this.options).table;
|
|
4746
4777
|
this.getTileData = this.getTileData.bind(this);
|
|
4747
4778
|
this.ready = this.initializeTilesAsync(table);
|
|
4748
4779
|
this.metadata = this.getMetadata();
|
|
@@ -4754,7 +4785,7 @@ var __exports__ = (() => {
|
|
|
4754
4785
|
}
|
|
4755
4786
|
async getMetadata() {
|
|
4756
4787
|
await this.ready;
|
|
4757
|
-
return { schema: this.schema, minZoom: 0, maxZoom: this.
|
|
4788
|
+
return { schema: this.schema, minZoom: 0, maxZoom: this.tableOptions.maxZoom };
|
|
4758
4789
|
}
|
|
4759
4790
|
async getSchema() {
|
|
4760
4791
|
await this.ready;
|
|
@@ -4791,9 +4822,9 @@ var __exports__ = (() => {
|
|
|
4791
4822
|
return null;
|
|
4792
4823
|
}
|
|
4793
4824
|
return convertTileToGeoJSON(protoTile, {
|
|
4794
|
-
coordinates: this.
|
|
4825
|
+
coordinates: this.tableOptions.coordinates,
|
|
4795
4826
|
tileIndex,
|
|
4796
|
-
extent: this.
|
|
4827
|
+
extent: this.tableOptions.extent
|
|
4797
4828
|
});
|
|
4798
4829
|
}
|
|
4799
4830
|
/**
|
|
@@ -4801,20 +4832,20 @@ var __exports__ = (() => {
|
|
|
4801
4832
|
* @note the tiles stores all the features together with additional data
|
|
4802
4833
|
*/
|
|
4803
4834
|
createRootTiles(table) {
|
|
4804
|
-
if (this.
|
|
4835
|
+
if (this.tableOptions.maxZoom < 0 || this.tableOptions.maxZoom > 24) {
|
|
4805
4836
|
throw new Error("maxZoom should be in the 0-24 range");
|
|
4806
4837
|
}
|
|
4807
|
-
if (this.
|
|
4838
|
+
if (this.tableOptions.promoteId && this.tableOptions.generateId) {
|
|
4808
4839
|
throw new Error("promoteId and generateId cannot be used together.");
|
|
4809
4840
|
}
|
|
4810
|
-
log.log(1, "
|
|
4841
|
+
log.log(1, "TableVectorTileSource creating root tiles", this.tableOptions)();
|
|
4811
4842
|
log.time(1, "preprocess table")();
|
|
4812
|
-
let features2 = convertFeaturesToProtoFeature(table, this.
|
|
4843
|
+
let features2 = convertFeaturesToProtoFeature(table, this.tableOptions);
|
|
4813
4844
|
log.timeEnd(1, "preprocess table")();
|
|
4814
4845
|
log.time(1, "generate tiles")();
|
|
4815
|
-
features2 = wrapFeatures(features2, this.
|
|
4846
|
+
features2 = wrapFeatures(features2, this.tableOptions);
|
|
4816
4847
|
if (features2.length === 0) {
|
|
4817
|
-
log.log(1, "
|
|
4848
|
+
log.log(1, "TableVectorTileSource: no features generated")();
|
|
4818
4849
|
return;
|
|
4819
4850
|
}
|
|
4820
4851
|
this.splitTile(features2, 0, 0, 0);
|
|
@@ -4823,7 +4854,7 @@ var __exports__ = (() => {
|
|
|
4823
4854
|
log.timeEnd(1, "generate tiles")();
|
|
4824
4855
|
log.log(
|
|
4825
4856
|
1,
|
|
4826
|
-
`
|
|
4857
|
+
`TableVectorTileSource: tiles generated: ${this.stats.get("total").count}`,
|
|
4827
4858
|
this.stats
|
|
4828
4859
|
)();
|
|
4829
4860
|
}
|
|
@@ -4835,7 +4866,7 @@ var __exports__ = (() => {
|
|
|
4835
4866
|
getProtoTile(tileIndex) {
|
|
4836
4867
|
const { z, y } = tileIndex;
|
|
4837
4868
|
let { x } = tileIndex;
|
|
4838
|
-
const { extent } = this.
|
|
4869
|
+
const { extent } = this.tableOptions;
|
|
4839
4870
|
if (z < 0 || z > 24) {
|
|
4840
4871
|
return null;
|
|
4841
4872
|
}
|
|
@@ -4871,7 +4902,7 @@ var __exports__ = (() => {
|
|
|
4871
4902
|
* @param cz, cx, and cy are the coordinates of the target tile
|
|
4872
4903
|
*
|
|
4873
4904
|
* If no target tile is specified, splitting stops when we reach the maximum
|
|
4874
|
-
* zoom or the number of points is low as specified in the
|
|
4905
|
+
* zoom or the number of points is low as specified in the options.
|
|
4875
4906
|
*/
|
|
4876
4907
|
// eslint-disable-next-line max-params, max-statements, complexity
|
|
4877
4908
|
splitTile(features2, z, x, y, cz, cx, cy) {
|
|
@@ -4886,16 +4917,16 @@ var __exports__ = (() => {
|
|
|
4886
4917
|
let tile = this.tiles[id];
|
|
4887
4918
|
if (!tile) {
|
|
4888
4919
|
log.time(2, "tile creation")();
|
|
4889
|
-
tile = this.tiles[id] = createProtoTile(features2, z, x, y, this.
|
|
4920
|
+
tile = this.tiles[id] = createProtoTile(features2, z, x, y, this.tableOptions);
|
|
4890
4921
|
this.tileCoords.push({ z, x, y });
|
|
4891
4922
|
const key = `z${z}`;
|
|
4892
4923
|
let stat = this.stats.get(key, "count");
|
|
4893
4924
|
stat.incrementCount();
|
|
4894
4925
|
stat = this.stats.get("total");
|
|
4895
4926
|
stat.incrementCount();
|
|
4896
|
-
stat =
|
|
4927
|
+
stat = _TableVectorTileSource.stats.get(key, "count");
|
|
4897
4928
|
stat.incrementCount();
|
|
4898
|
-
stat =
|
|
4929
|
+
stat = _TableVectorTileSource.stats.get("total");
|
|
4899
4930
|
stat.incrementCount();
|
|
4900
4931
|
log.log(
|
|
4901
4932
|
2,
|
|
@@ -4911,10 +4942,10 @@ var __exports__ = (() => {
|
|
|
4911
4942
|
}
|
|
4912
4943
|
tile.sourceFeatures = features2;
|
|
4913
4944
|
if (cz === void 0) {
|
|
4914
|
-
if (z === this.
|
|
4945
|
+
if (z === this.tableOptions.indexMaxZoom || tile.numPoints <= this.tableOptions.maxPointsPerTile) {
|
|
4915
4946
|
continue;
|
|
4916
4947
|
}
|
|
4917
|
-
} else if (z === this.
|
|
4948
|
+
} else if (z === this.tableOptions.maxZoom || z === cz) {
|
|
4918
4949
|
continue;
|
|
4919
4950
|
} else if (cz !== void 0) {
|
|
4920
4951
|
const zoomSteps = cz - z;
|
|
@@ -4926,7 +4957,7 @@ var __exports__ = (() => {
|
|
|
4926
4957
|
if (features2.length === 0)
|
|
4927
4958
|
continue;
|
|
4928
4959
|
log.time(2, "clipping tile")();
|
|
4929
|
-
const k1 = 0.5 * this.
|
|
4960
|
+
const k1 = 0.5 * this.tableOptions.buffer / this.tableOptions.extent;
|
|
4930
4961
|
const k2 = 0.5 - k1;
|
|
4931
4962
|
const k3 = 0.5 + k1;
|
|
4932
4963
|
const k4 = 1 + k1;
|
|
@@ -4934,17 +4965,35 @@ var __exports__ = (() => {
|
|
|
4934
4965
|
let bl = null;
|
|
4935
4966
|
let tr = null;
|
|
4936
4967
|
let br = null;
|
|
4937
|
-
let left = clipFeatures(
|
|
4938
|
-
|
|
4968
|
+
let left = clipFeatures(
|
|
4969
|
+
features2,
|
|
4970
|
+
z2,
|
|
4971
|
+
x - k1,
|
|
4972
|
+
x + k3,
|
|
4973
|
+
0,
|
|
4974
|
+
tile.minX,
|
|
4975
|
+
tile.maxX,
|
|
4976
|
+
this.tableOptions
|
|
4977
|
+
);
|
|
4978
|
+
let right = clipFeatures(
|
|
4979
|
+
features2,
|
|
4980
|
+
z2,
|
|
4981
|
+
x + k2,
|
|
4982
|
+
x + k4,
|
|
4983
|
+
0,
|
|
4984
|
+
tile.minX,
|
|
4985
|
+
tile.maxX,
|
|
4986
|
+
this.tableOptions
|
|
4987
|
+
);
|
|
4939
4988
|
features2 = null;
|
|
4940
4989
|
if (left) {
|
|
4941
|
-
tl = clipFeatures(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.
|
|
4942
|
-
bl = clipFeatures(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.
|
|
4990
|
+
tl = clipFeatures(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.tableOptions);
|
|
4991
|
+
bl = clipFeatures(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.tableOptions);
|
|
4943
4992
|
left = null;
|
|
4944
4993
|
}
|
|
4945
4994
|
if (right) {
|
|
4946
|
-
tr = clipFeatures(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.
|
|
4947
|
-
br = clipFeatures(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.
|
|
4995
|
+
tr = clipFeatures(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.tableOptions);
|
|
4996
|
+
br = clipFeatures(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.tableOptions);
|
|
4948
4997
|
right = null;
|
|
4949
4998
|
}
|
|
4950
4999
|
log.timeEnd(2, "clipping tile")();
|
|
@@ -4955,15 +5004,24 @@ var __exports__ = (() => {
|
|
|
4955
5004
|
}
|
|
4956
5005
|
}
|
|
4957
5006
|
};
|
|
4958
|
-
var
|
|
5007
|
+
var TableVectorTileSource = _TableVectorTileSource;
|
|
4959
5008
|
/** Global stats for all DynamicVectorTileSources */
|
|
4960
|
-
__publicField(
|
|
5009
|
+
__publicField(TableVectorTileSource, "stats", new Stats({
|
|
4961
5010
|
id: "table-tile-source-all",
|
|
4962
5011
|
stats: [new Stat("count", "tiles"), new Stat("count", "features")]
|
|
4963
5012
|
}));
|
|
4964
5013
|
function toID(z, x, y) {
|
|
4965
5014
|
return ((1 << z) * y + x) * 32 + z;
|
|
4966
5015
|
}
|
|
5016
|
+
async function loadTable(url, loader) {
|
|
5017
|
+
if (typeof url === "string") {
|
|
5018
|
+
const response = await fetch(url);
|
|
5019
|
+
const data2 = await response.arrayBuffer();
|
|
5020
|
+
return await loader.parse(data2);
|
|
5021
|
+
}
|
|
5022
|
+
const data = await url.arrayBuffer();
|
|
5023
|
+
return await loader.parse(data);
|
|
5024
|
+
}
|
|
4967
5025
|
return __toCommonJS(bundle_exports);
|
|
4968
5026
|
})();
|
|
4969
5027
|
/*! Bundled license information:
|