import type { ElevationConverter, MValue, Properties, VectorFeatureCollection, VectorMultiLineString, VectorMultiPolygon, VectorMultiPolygonFeature, VectorMultiPolygonGeometry } from '../../index.js'; export interface ElevationProperties extends Properties { elev: number; elevFt: number; } export type ContourFeature = VectorMultiPolygonFeature, MValue, ElevationProperties>; export type ContourFeatureCollection = VectorFeatureCollection, MValue, ElevationProperties, VectorMultiPolygonGeometry>; /** * Generate isoline thresholds given a min, max, and step. * @param min - minimum value * @param max - maximum value * @param step - step size * @returns a collection of thresholds within the range provided all inclusive and sorted */ export declare function isolineThresholds(min: number, max: number, step: number): number[]; /** * # Create Isolines * * ## Description * Creates isolines from an image. * * NOTE: Defaults to the Mapbox elevation data converter `convertMapboxElevationData`. However, * to use the Terrarium elevation data converter, use `convertTerrariumElevationData`. * * NOTE: Using a buffer with a small padding works, but it only extends the line ends of the isolines. * A better method would be to pull in grid data with large padding (second example). * If you have a large padding like 16px then you don't need a buffer, so you should set it to 0. * * ## Examples * * ### Create Isolines * ```ts * import 'gis-tools-ts/polyfills/local'; // You may need this to handle image data if you are using the file system. * import { buildContours } from 'gis-tools-ts'; * * // Pull in the image data. We are using a local image file that is 514x514 with prebuilt padding * const elevationImage = await Bun.file( * './tests/tools/isobands/fixtures/13_1556_3084.webp', * ).arrayBuffer(); * * // Create the isolines. * const isolines = await buildContours(elevationImage); * ``` * * ### High quality with large padding * ```ts * import { RasterTilesFileReader } from 'gis-tools-ts/file'; // because we use file.js local polyfills already added * import { buildContours } from 'gis-tools-ts'; * * // Setup a tile reader * const reader = new RasterTilesFileReader( * `${__dirname}/../../readers/tile/fixtures/wm/terrain-v2`, * ); * const metadata = await reader.getMetadata(); * const isTMS = metadata.scheme === 'tms'; * // read in the elevation data with a big bigger padding * // we are pulling in Canada/Greenland area at zoom 3. Padding of 16 so a resulting 544x544 image. * const padding = 16; * const tile = await reader.getTileWithPaddingWM(3, 3, 1, padding, 512, 512); * if (tile === undefined) throw new Error('Tile not found'); * // build the isolines * const isolines = await buildContours(tile!.image, undefined, 1_000, isTMS, padding, 0); * ``` * * @param imageData - the raw RGB(A) image data * @param elevationConverter - the conversion function to convert the pixels to elevation * @param step - the step size for the heightmap. Defaults to 100 meters for the Mapbox elevation data. * @param tmsStyle - if true, the y position will be inverted * @param padding - The number of pixels that extend around the main data * @param tolerance - The Douglas-Peucker tolerance. Defaults to `1 / 2_096` * @returns The isolines stored in a FeatureCollection */ export declare function buildContours(imageData: ArrayBufferLike | Uint8Array | Uint8ClampedArray | Buffer | ImageData, elevationConverter?: ElevationConverter, step?: number, tmsStyle?: boolean, padding?: number, tolerance?: number): Promise; export declare function buildIsoBands(values: number[], threshold: number, width: number, height: number, padding: number, tolerance?: number): VectorMultiPolygon; export declare function buildIsorings(values: number[], threshold: number, width: number, height: number, padding: number, tolerance?: number): VectorMultiLineString; //# sourceMappingURL=contours.d.ts.map