open-vector-tile
Version:
This library reads/writes Open Vector Tiles
58 lines • 1.69 kB
TypeScript
import { PbfReader } from 'pbf-ts';
import type { Extents } from './index.js';
/** Grid object to read from */
export declare class GridData {
#private;
name: string;
private dataPos;
extent: Extents;
size: number;
min: number;
max: number;
/**
* @param pbf - the pbf protocol we are reading from
* @param end - the position to stop at
*/
constructor(pbf: PbfReader, end: number);
/**
* Get the raw gridded data. Reads much like a raw image.
* @returns - the decomposed gridded data
*/
data(): number[];
}
/**
* Gridded data input. It is assumed data is the actual grid data of each point in the tile
*/
export interface GridInput {
/** The name of the grid data */
name: string;
/** The size of the square tile. The length and width MUST be the same size */
size: number;
/**
* The actual grid data assumed to be floating point (32-bit) precise.
* It is assumed to find data you can use: `index = y * size + x`
*/
data: number[];
/** The extent defines the 0->extent range to remap the data to */
extent: Extents;
}
/**
* @param input - the data to encode
* @returns - the encoded data
*/
export declare function writeGridData(input: GridInput): Uint8Array;
/**
* @param r - red
* @param g - green
* @param b - blue
* @returns - elevation
*/
export declare function convertTerrariumElevationData(r: number, g: number, b: number): number;
/**
* @param r - red
* @param g - green
* @param b - blue
* @returns - elevation
*/
export declare function convertMapboxElevationData(r: number, g: number, b: number): number;
//# sourceMappingURL=gridLayer.d.ts.map