@loaders.gl/pmtiles 4.0.0-beta.3 → 4.0.0-beta.4
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 +10 -75
- package/package.json +6 -6
package/dist/dist.dev.js
CHANGED
|
@@ -801,10 +801,7 @@ var __exports__ = (() => {
|
|
|
801
801
|
var window_ = globals.window || globals.self || globals.global || {};
|
|
802
802
|
var global_ = globals.global || globals.self || globals.window || {};
|
|
803
803
|
var document_ = globals.document || {};
|
|
804
|
-
var isBrowser = (
|
|
805
|
-
// @ts-ignore process does not exist on browser
|
|
806
|
-
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
807
|
-
);
|
|
804
|
+
var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
|
|
808
805
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
809
806
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
810
807
|
|
|
@@ -872,8 +869,6 @@ var __exports__ = (() => {
|
|
|
872
869
|
|
|
873
870
|
// ../loader-utils/src/lib/sources/data-source.ts
|
|
874
871
|
var DataSource = class {
|
|
875
|
-
/** A resolved fetch function extracted from loadOptions prop */
|
|
876
|
-
/** The actual load options, if calling a loaders.gl loader */
|
|
877
872
|
_needsRefresh = true;
|
|
878
873
|
constructor(props) {
|
|
879
874
|
this.props = {
|
|
@@ -888,14 +883,9 @@ var __exports__ = (() => {
|
|
|
888
883
|
this.props = Object.assign(this.props, props);
|
|
889
884
|
this.setNeedsRefresh();
|
|
890
885
|
}
|
|
891
|
-
/** Mark this data source as needing a refresh (redraw) */
|
|
892
886
|
setNeedsRefresh() {
|
|
893
887
|
this._needsRefresh = true;
|
|
894
888
|
}
|
|
895
|
-
/**
|
|
896
|
-
* Does this data source need refreshing?
|
|
897
|
-
* @note The specifics of the refresh mechanism depends on type of data source
|
|
898
|
-
*/
|
|
899
889
|
getNeedsRefresh(clear = true) {
|
|
900
890
|
const needsRefresh = this._needsRefresh;
|
|
901
891
|
if (clear) {
|
|
@@ -920,12 +910,10 @@ var __exports__ = (() => {
|
|
|
920
910
|
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
921
911
|
|
|
922
912
|
// ../images/src/lib/category-api/image-type.ts
|
|
923
|
-
var
|
|
924
|
-
_parseImageNode
|
|
925
|
-
} = globalThis;
|
|
913
|
+
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
926
914
|
var IMAGE_SUPPORTED = typeof Image !== "undefined";
|
|
927
915
|
var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
|
|
928
|
-
var NODE_IMAGE_SUPPORTED = Boolean(
|
|
916
|
+
var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
|
|
929
917
|
var DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;
|
|
930
918
|
function isImageTypeSupported(type) {
|
|
931
919
|
switch (type) {
|
|
@@ -1142,7 +1130,6 @@ var __exports__ = (() => {
|
|
|
1142
1130
|
}
|
|
1143
1131
|
return {
|
|
1144
1132
|
mimeType: mediaType.mimeType,
|
|
1145
|
-
// TODO - decode width and height
|
|
1146
1133
|
width: 0,
|
|
1147
1134
|
height: 0
|
|
1148
1135
|
};
|
|
@@ -1200,9 +1187,7 @@ var __exports__ = (() => {
|
|
|
1200
1187
|
return {
|
|
1201
1188
|
mimeType: "image/jpeg",
|
|
1202
1189
|
height: dataView.getUint16(i3 + 5, BIG_ENDIAN),
|
|
1203
|
-
// Number of lines
|
|
1204
1190
|
width: dataView.getUint16(i3 + 7, BIG_ENDIAN)
|
|
1205
|
-
// Number of pixels per line
|
|
1206
1191
|
};
|
|
1207
1192
|
}
|
|
1208
1193
|
if (!tableMarkers.has(marker)) {
|
|
@@ -1242,9 +1227,9 @@ var __exports__ = (() => {
|
|
|
1242
1227
|
const {
|
|
1243
1228
|
mimeType
|
|
1244
1229
|
} = getBinaryImageMetadata(arrayBuffer) || {};
|
|
1245
|
-
const
|
|
1246
|
-
assert(
|
|
1247
|
-
return await
|
|
1230
|
+
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
1231
|
+
assert(parseImageNode2);
|
|
1232
|
+
return await parseImageNode2(arrayBuffer, mimeType);
|
|
1248
1233
|
}
|
|
1249
1234
|
|
|
1250
1235
|
// ../images/src/lib/parsers/parse-image.ts
|
|
@@ -1293,9 +1278,7 @@ var __exports__ = (() => {
|
|
|
1293
1278
|
image: {
|
|
1294
1279
|
type: "auto",
|
|
1295
1280
|
decode: true
|
|
1296
|
-
// if format is HTML
|
|
1297
1281
|
}
|
|
1298
|
-
// imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
|
|
1299
1282
|
};
|
|
1300
1283
|
var ImageLoader = {
|
|
1301
1284
|
id: "image",
|
|
@@ -1305,7 +1288,6 @@ var __exports__ = (() => {
|
|
|
1305
1288
|
mimeTypes: MIME_TYPES,
|
|
1306
1289
|
extensions: EXTENSIONS,
|
|
1307
1290
|
parse: parseImage,
|
|
1308
|
-
// TODO: byteOffset, byteLength;
|
|
1309
1291
|
tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
|
|
1310
1292
|
options: DEFAULT_IMAGE_LOADER_OPTIONS
|
|
1311
1293
|
};
|
|
@@ -1999,10 +1981,7 @@ var __exports__ = (() => {
|
|
|
1999
1981
|
const nextIndices = geometry.indices[l + 1];
|
|
2000
1982
|
for (let i3 = 0, il = indices.length; i3 < il; ++i3) {
|
|
2001
1983
|
const start = indices[i3];
|
|
2002
|
-
const end = i3 === il - 1 ?
|
|
2003
|
-
// last line, so either read to:
|
|
2004
|
-
nextIndices === void 0 ? geometry.data.length : nextIndices[0]
|
|
2005
|
-
) : indices[i3 + 1];
|
|
1984
|
+
const end = i3 === il - 1 ? nextIndices === void 0 ? geometry.data.length : nextIndices[0] : indices[i3 + 1];
|
|
2006
1985
|
polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
|
|
2007
1986
|
indexMap.polygonPosition += (end - start) / coordLength;
|
|
2008
1987
|
}
|
|
@@ -2104,7 +2083,6 @@ var __exports__ = (() => {
|
|
|
2104
2083
|
},
|
|
2105
2084
|
numericProps: wrapProps(polygons.numericProps, 1)
|
|
2106
2085
|
}
|
|
2107
|
-
// triangles not expected
|
|
2108
2086
|
};
|
|
2109
2087
|
if (binaryFeatures.polygons && polygons.triangles) {
|
|
2110
2088
|
binaryFeatures.polygons.triangles = {
|
|
@@ -2212,7 +2190,6 @@ var __exports__ = (() => {
|
|
|
2212
2190
|
this._values = values;
|
|
2213
2191
|
pbf.readFields(readFeature, this, end);
|
|
2214
2192
|
}
|
|
2215
|
-
// eslint-disable-next-line complexity, max-statements
|
|
2216
2193
|
loadGeometry() {
|
|
2217
2194
|
const pbf = this._pbf;
|
|
2218
2195
|
pbf.pos = this._geometry;
|
|
@@ -2252,7 +2229,6 @@ var __exports__ = (() => {
|
|
|
2252
2229
|
lines.push(line);
|
|
2253
2230
|
return lines;
|
|
2254
2231
|
}
|
|
2255
|
-
// eslint-disable-next-line max-statements
|
|
2256
2232
|
bbox() {
|
|
2257
2233
|
const pbf = this._pbf;
|
|
2258
2234
|
pbf.pos = this._geometry;
|
|
@@ -2373,11 +2349,6 @@ var __exports__ = (() => {
|
|
|
2373
2349
|
pbf.readFields(readLayer, this, end);
|
|
2374
2350
|
this.length = this._features.length;
|
|
2375
2351
|
}
|
|
2376
|
-
/**
|
|
2377
|
-
* return feature `i` from this layer as a `VectorTileFeature`
|
|
2378
|
-
* @param index
|
|
2379
|
-
* @returns feature
|
|
2380
|
-
*/
|
|
2381
2352
|
feature(i3) {
|
|
2382
2353
|
if (i3 < 0 || i3 >= this._features.length) {
|
|
2383
2354
|
throw new Error("feature index out of bounds");
|
|
@@ -2522,7 +2493,6 @@ var __exports__ = (() => {
|
|
|
2522
2493
|
var y;
|
|
2523
2494
|
var i;
|
|
2524
2495
|
var VectorTileFeature2 = class {
|
|
2525
|
-
// eslint-disable-next-line max-params
|
|
2526
2496
|
constructor(pbf, end, extent, keys, values, geometryInfo) {
|
|
2527
2497
|
this.properties = {};
|
|
2528
2498
|
this.extent = extent;
|
|
@@ -2535,7 +2505,6 @@ var __exports__ = (() => {
|
|
|
2535
2505
|
this._geometryInfo = geometryInfo;
|
|
2536
2506
|
pbf.readFields(readFeature2, this, end);
|
|
2537
2507
|
}
|
|
2538
|
-
// eslint-disable-next-line complexity, max-statements
|
|
2539
2508
|
loadGeometry() {
|
|
2540
2509
|
const pbf = this._pbf;
|
|
2541
2510
|
pbf.pos = this._geometry;
|
|
@@ -2577,11 +2546,6 @@ var __exports__ = (() => {
|
|
|
2577
2546
|
indices
|
|
2578
2547
|
};
|
|
2579
2548
|
}
|
|
2580
|
-
/**
|
|
2581
|
-
*
|
|
2582
|
-
* @param transform
|
|
2583
|
-
* @returns result
|
|
2584
|
-
*/
|
|
2585
2549
|
_toBinaryCoordinates(transform) {
|
|
2586
2550
|
const geom = this.loadGeometry();
|
|
2587
2551
|
let geometry;
|
|
@@ -2657,13 +2621,6 @@ var __exports__ = (() => {
|
|
|
2657
2621
|
pbf.readFields(readLayer2, this, end);
|
|
2658
2622
|
this.length = this._features.length;
|
|
2659
2623
|
}
|
|
2660
|
-
/**
|
|
2661
|
-
* return feature `i` from this layer as a `VectorTileFeature`
|
|
2662
|
-
*
|
|
2663
|
-
* @param index
|
|
2664
|
-
* @param geometryInfo
|
|
2665
|
-
* @returns {VectorTileFeature}
|
|
2666
|
-
*/
|
|
2667
2624
|
feature(i3, geometryInfo) {
|
|
2668
2625
|
if (i3 < 0 || i3 >= this._features.length) {
|
|
2669
2626
|
throw new Error("feature index out of bounds");
|
|
@@ -2817,20 +2774,14 @@ var __exports__ = (() => {
|
|
|
2817
2774
|
return options.mvt;
|
|
2818
2775
|
}
|
|
2819
2776
|
function getDecodedFeature(feature, options, layerName) {
|
|
2820
|
-
const decodedFeature = feature.toGeoJSON(
|
|
2821
|
-
// @ts-expect-error What is going on here?
|
|
2822
|
-
options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates
|
|
2823
|
-
);
|
|
2777
|
+
const decodedFeature = feature.toGeoJSON(options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates);
|
|
2824
2778
|
if (options.layerProperty) {
|
|
2825
2779
|
decodedFeature.properties[options.layerProperty] = layerName;
|
|
2826
2780
|
}
|
|
2827
2781
|
return decodedFeature;
|
|
2828
2782
|
}
|
|
2829
2783
|
function getDecodedFeatureBinary(feature, options, layerName) {
|
|
2830
|
-
const decodedFeature = feature.toBinaryCoordinates(
|
|
2831
|
-
// @ts-expect-error What is going on here?
|
|
2832
|
-
options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary
|
|
2833
|
-
);
|
|
2784
|
+
const decodedFeature = feature.toBinaryCoordinates(options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary);
|
|
2834
2785
|
if (options.layerProperty && decodedFeature.properties) {
|
|
2835
2786
|
decodedFeature.properties[options.layerProperty] = layerName;
|
|
2836
2787
|
}
|
|
@@ -2862,14 +2813,8 @@ var __exports__ = (() => {
|
|
|
2862
2813
|
id: "mvt",
|
|
2863
2814
|
module: "mvt",
|
|
2864
2815
|
version: VERSION2,
|
|
2865
|
-
// Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
|
|
2866
2816
|
extensions: ["mvt", "pbf"],
|
|
2867
|
-
mimeTypes: [
|
|
2868
|
-
// https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile
|
|
2869
|
-
"application/vnd.mapbox-vector-tile",
|
|
2870
|
-
"application/x-protobuf"
|
|
2871
|
-
// 'application/octet-stream'
|
|
2872
|
-
],
|
|
2817
|
+
mimeTypes: ["application/vnd.mapbox-vector-tile", "application/x-protobuf"],
|
|
2873
2818
|
worker: true,
|
|
2874
2819
|
category: "geometry",
|
|
2875
2820
|
options: {
|
|
@@ -3033,8 +2978,6 @@ var __exports__ = (() => {
|
|
|
3033
2978
|
const fieldTypes = attributeTypeToFieldType(attribute.type);
|
|
3034
2979
|
return {
|
|
3035
2980
|
name: attribute.attribute,
|
|
3036
|
-
// what happens if attribute type is string...
|
|
3037
|
-
// filterProps: getFilterProps(fieldTypes.type, attribute),
|
|
3038
2981
|
...fieldTypes
|
|
3039
2982
|
};
|
|
3040
2983
|
}
|
|
@@ -4669,7 +4612,6 @@ var __exports__ = (() => {
|
|
|
4669
4612
|
this.blob = blob;
|
|
4670
4613
|
this.key = key;
|
|
4671
4614
|
}
|
|
4672
|
-
// TODO - how is this used?
|
|
4673
4615
|
getKey() {
|
|
4674
4616
|
return this.blob.url || "";
|
|
4675
4617
|
}
|
|
@@ -4678,9 +4620,6 @@ var __exports__ = (() => {
|
|
|
4678
4620
|
const data = await slice.arrayBuffer();
|
|
4679
4621
|
return {
|
|
4680
4622
|
data
|
|
4681
|
-
// etag: response.headers.get('ETag') || undefined,
|
|
4682
|
-
// cacheControl: response.headers.get('Cache-Control') || undefined,
|
|
4683
|
-
// expires: response.headers.get('Expires') || undefined
|
|
4684
4623
|
};
|
|
4685
4624
|
}
|
|
4686
4625
|
};
|
|
@@ -4715,8 +4654,6 @@ var __exports__ = (() => {
|
|
|
4715
4654
|
}
|
|
4716
4655
|
return arrayBuffer;
|
|
4717
4656
|
}
|
|
4718
|
-
// Tile Source interface implementation: deck.gl compatible API
|
|
4719
|
-
// TODO - currently only handles image tiles, not vector tiles
|
|
4720
4657
|
async getTileData(tileParams) {
|
|
4721
4658
|
const {
|
|
4722
4659
|
x: x3,
|
|
@@ -4741,12 +4678,10 @@ var __exports__ = (() => {
|
|
|
4741
4678
|
});
|
|
4742
4679
|
}
|
|
4743
4680
|
}
|
|
4744
|
-
// ImageTileSource interface implementation
|
|
4745
4681
|
async getImageTile(tileParams) {
|
|
4746
4682
|
const arrayBuffer = await this.getTile(tileParams);
|
|
4747
4683
|
return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;
|
|
4748
4684
|
}
|
|
4749
|
-
// VectorTileSource interface implementation
|
|
4750
4685
|
async getVectorTile(tileParams) {
|
|
4751
4686
|
const arrayBuffer = await this.getTile(tileParams);
|
|
4752
4687
|
const loadOptions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/pmtiles",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "Framework-independent loader for the pmtiles format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"build-bundle": "ocular-bundle ./src/index.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@loaders.gl/images": "4.0.0-beta.
|
|
44
|
-
"@loaders.gl/loader-utils": "4.0.0-beta.
|
|
45
|
-
"@loaders.gl/mvt": "4.0.0-beta.
|
|
46
|
-
"@loaders.gl/schema": "4.0.0-beta.
|
|
43
|
+
"@loaders.gl/images": "4.0.0-beta.4",
|
|
44
|
+
"@loaders.gl/loader-utils": "4.0.0-beta.4",
|
|
45
|
+
"@loaders.gl/mvt": "4.0.0-beta.4",
|
|
46
|
+
"@loaders.gl/schema": "4.0.0-beta.4",
|
|
47
47
|
"pmtiles": "^2.7.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "848c20b474532d301f2c3f8d4e1fb9bf262b86d4"
|
|
50
50
|
}
|