@loaders.gl/pmtiles 4.2.1 → 4.3.0-alpha.2
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 +1193 -708
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +2 -2
- package/dist/pmtiles-source.d.ts +4 -2
- package/dist/pmtiles-source.d.ts.map +1 -1
- package/dist/pmtiles-source.js +7 -4
- package/package.json +6 -6
- package/src/pmtiles-source.ts +11 -6
package/src/pmtiles-source.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {Schema} from '@loaders.gl/schema';
|
|
6
|
+
import type {GetTileParameters, GetTileDataParameters} from '@loaders.gl/loader-utils';
|
|
6
7
|
import type {ImageType, DataSourceProps} from '@loaders.gl/loader-utils';
|
|
7
8
|
import type {ImageTileSource, VectorTileSource} from '@loaders.gl/loader-utils';
|
|
8
9
|
import {DataSource, resolvePath} from '@loaders.gl/loader-utils';
|
|
@@ -75,6 +76,10 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
75
76
|
this.metadata = this.getMetadata();
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
async getSchema(): Promise<Schema> {
|
|
80
|
+
return {fields: [], metadata: {}};
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
async getMetadata(): Promise<PMTilesMetadata> {
|
|
79
84
|
const pmtilesHeader = await this.pmtiles.getHeader();
|
|
80
85
|
const pmtilesMetadata = await this.pmtiles.getMetadata();
|
|
@@ -96,7 +101,7 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
async getTile(tileParams: GetTileParameters): Promise<ArrayBuffer | null> {
|
|
99
|
-
const {x, y,
|
|
104
|
+
const {x, y, z} = tileParams;
|
|
100
105
|
const rangeResponse = await this.pmtiles.getZxy(z, x, y);
|
|
101
106
|
const arrayBuffer = rangeResponse?.data;
|
|
102
107
|
if (!arrayBuffer) {
|
|
@@ -109,14 +114,14 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
109
114
|
// Tile Source interface implementation: deck.gl compatible API
|
|
110
115
|
// TODO - currently only handles image tiles, not vector tiles
|
|
111
116
|
|
|
112
|
-
async getTileData(tileParams:
|
|
117
|
+
async getTileData(tileParams: GetTileDataParameters): Promise<any> {
|
|
113
118
|
const {x, y, z} = tileParams.index;
|
|
114
119
|
const metadata = await this.metadata;
|
|
115
120
|
switch (metadata.tileMIMEType) {
|
|
116
121
|
case 'application/vnd.mapbox-vector-tile':
|
|
117
|
-
return await this.getVectorTile({x, y,
|
|
122
|
+
return await this.getVectorTile({x, y, z, layers: []});
|
|
118
123
|
default:
|
|
119
|
-
return await this.getImageTile({x, y,
|
|
124
|
+
return await this.getImageTile({x, y, z, layers: []});
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
127
|
|
|
@@ -135,7 +140,7 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
135
140
|
shape: 'geojson-table',
|
|
136
141
|
mvt: {
|
|
137
142
|
coordinates: 'wgs84',
|
|
138
|
-
tileIndex: {x: tileParams.x, y: tileParams.y, z: tileParams.
|
|
143
|
+
tileIndex: {x: tileParams.x, y: tileParams.y, z: tileParams.z},
|
|
139
144
|
...(this.loadOptions as MVTLoaderOptions)?.mvt
|
|
140
145
|
},
|
|
141
146
|
...this.loadOptions
|