s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
57 lines • 2.05 kB
TypeScript
import { Tile } from '../../dataStructures';
import type { BBOX, BBox, VectorLineString, VectorPointGeometry } from '..';
/** The child of a tile */
export interface TileChild {
/** The id of the child tile */
id: bigint;
/** The child tile */
tile: Tile;
}
/** Split features into the 4 children of a tile */
export type TileChildren = [
TileChild,
TileChild,
TileChild,
TileChild
];
/**
* @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(tile: Tile, buffer?: number): TileChildren;
/**
* @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(geometry: VectorPointGeometry, axis: 0 | 1, k1: number, k2: number): VectorPointGeometry | 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 {
line: VectorLineString;
offset: number;
vecBBox?: BBOX;
}
/** Ensuring `vecBBox` exists */
export interface ClipLineResultWithBBox {
line: VectorLineString;
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(geom: VectorLineString, bbox: BBox, isPolygon: boolean, offset?: number, buffer?: number): ClipLineResultWithBBox[];
//# sourceMappingURL=clip.d.ts.map