UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

57 lines 2.56 kB
import { Tile } from '../../dataStructures'; import type { BBOX, BBox, MValue, Properties, VectorLineString, VectorPointGeometry } from '..'; /** The child of a tile */ export interface TileChild<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties> { /** The id of the child tile */ id: bigint; /** The child tile */ tile: Tile<M, D, P>; } /** Split features into the 4 children of a tile */ export type TileChildren<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties> = [ TileChild<M, D, P>, TileChild<M, D, P>, TileChild<M, D, P>, TileChild<M, D, P> ]; /** * @param tile - the tile to split * @param buffer - the buffer around the tile for lines and polygons * @returns - the tile's children split into 4 sub-tiles */ export declare function splitTile<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties>(tile: Tile<M, D, P>, buffer?: number): TileChildren<M, D, P>; /** * @param geometry - input vector geometry * @param axis - 0 for x, 1 for y * @param k1 - minimum accepted value of the axis * @param k2 - maximum accepted value of the axis * @returns - the clipped geometry or undefined if the geometry was not inside the range */ export declare function clipPoint<M extends MValue = Properties>(geometry: VectorPointGeometry<M>, axis: 0 | 1, k1: number, k2: number): VectorPointGeometry<M> | undefined; /** * After clipping a line, return the altered line, * the offset the new line starts at, * and if the line is ccw */ export interface ClipLineResult<M extends MValue = Properties> { line: VectorLineString<M>; offset: number; vecBBox?: BBOX; } /** Ensuring `vecBBox` exists */ export interface ClipLineResultWithBBox<M extends MValue = Properties> { line: VectorLineString<M>; offset: number; vecBBox: BBOX; } /** * Data should always be in a 0->1 coordinate system to use this clip function * @param geom - the original geometry line * @param bbox - the bounding box to clip the line to * @param isPolygon - true if the line comes from a polygon * @param offset - the starting offset the line starts at * @param buffer - the buffer to apply to the line (spacing outside the bounding box) * @returns - the clipped geometry */ export declare function clipLine<M extends MValue = Properties>(geom: VectorLineString<M>, bbox: BBox, isPolygon: boolean, offset?: number, buffer?: number): ClipLineResultWithBBox<M>[]; //# sourceMappingURL=clip.d.ts.map