@loaders.gl/mvt
Version:
Loader for Mapbox Vector Tiles
74 lines • 3.35 kB
TypeScript
import type { ImageType, DataSourceOptions, ImageTileSource, VectorTileSource, GetTileParameters, GetTileDataParameters } from '@loaders.gl/loader-utils';
import { DataSource } from '@loaders.gl/loader-utils';
import { ImageLoaderOptions } from '@loaders.gl/images';
import { MVTLoaderOptions, TileJSON, TileJSONLoaderOptions } from '@loaders.gl/mvt';
/** Properties for a Mapbox Vector Tile Source */
export type MVTSourceOptions = DataSourceOptions & {
mvt?: {
/** if not supplied, loads tilejson.json, If null does not load metadata */
metadataUrl?: string | null;
/** Override extension (necessary if no metadata) */
extension?: string;
/** Additional attribution, adds to any attribution loaded from tileset metadata */
attributions?: string[];
/** Specify load options for all sub loaders */
loadOptions?: TileJSONLoaderOptions & MVTLoaderOptions & ImageLoaderOptions;
};
};
/** Creates an MVTTileSource */
export declare const MVTSource: {
readonly version: "0.0.0";
readonly type: "mvt";
readonly fromUrl: true;
readonly fromBlob: false;
readonly defaultOptions: {
readonly mvt: {};
};
readonly testURL: (url: string) => boolean;
readonly createDataSource: (url: string, options: MVTSourceOptions) => MVTTileSource;
readonly name: "Mapbox Vector Tile";
readonly id: "mvt";
readonly module: "mvt";
readonly extensions: ["mvt", "pbf"];
readonly mimeTypes: ["application/vnd.mapbox-vector-tile", "application/x-protobuf"];
readonly category: "geometry";
};
/**
* MVT data source for Mapbox Vector Tiles v1.
*/
/**
* A PMTiles data source
* @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.
*/
export declare class MVTTileSource extends DataSource<string, MVTSourceOptions> implements ImageTileSource, VectorTileSource {
readonly metadataUrl: string | null;
schema: 'tms' | 'xyz' | 'template';
metadata: Promise<TileJSON | null>;
extension: string;
mimeType: string | null;
constructor(url: string, options: MVTSourceOptions);
getMetadata(): Promise<TileJSON | null>;
getTileMIMEType(): string | null;
getTile(parameters: GetTileParameters): Promise<ArrayBuffer | null>;
getTileData(parameters: GetTileDataParameters): Promise<any>;
getImageTile(tileParams: GetTileParameters): Promise<ImageType | null>;
protected _parseImageTile(arrayBuffer: ArrayBuffer): Promise<ImageType>;
getVectorTile(tileParams: GetTileParameters): Promise<unknown | null>;
protected _parseVectorTile(arrayBuffer: ArrayBuffer, tileParams: GetTileParameters): Promise<unknown | null>;
getMetadataUrl(): string | null;
getTileURL(x: number, y: number, z: number): string;
}
export declare function isURLTemplate(s: string): boolean;
export type URLTemplate = string | string[];
/**
* Get a URL from a URL template
* @note copied from deck.gl/modules/geo-layers/src/tileset-2d/utils.ts
* @param template - URL template
* @param x - tile x coordinate
* @param y - tile y coordinate
* @param z - tile z coordinate
* @param id - tile id
* @returns URL
*/
export declare function getURLFromTemplate(template: URLTemplate, x: number, y: number, z: number, id?: string): string;
//# sourceMappingURL=mvt-source.d.ts.map