s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
64 lines • 2.57 kB
TypeScript
import type { BBOX, VectorLineString, VectorMultiLineString, VectorMultiPolygon, VectorPoint } from './';
/**
* Creates a bounding box from a point
* @param point - input vector point
* @returns - BBox of the point
*/
export declare function fromPoint(point: VectorPoint): BBOX;
/**
* Creates a bounding box from a linestring
* @param line - input vector line
* @returns - BBox of the line
*/
export declare function fromLineString(line: VectorLineString): BBOX;
/**
* Creates a bounding box from a multilinestring
* @param multiLines - input vector multilinestring
* @returns - BBox of the multilinestring
*/
export declare function fromMultiLineString(multiLines: VectorMultiLineString): BBOX;
/**
* Creates a bounding box from a multipolygon
* @param multiPolygon - input vector multipolygon
* @returns - BBox of the multipolygon
*/
export declare function fromMultiPolygon(multiPolygon: VectorMultiPolygon): BBOX;
/**
* Checks if a point is within a bounding box
* @param bbox - the bounding box to test
* @param point - point to test if it exists within the bbox
* @returns - true if the point is within the bbox, false otherwise
*/
export declare function pointOverlap(bbox: BBOX, point: VectorPoint): boolean;
/**
* Checks if two bounding boxes overlap. If they don't overlap, returns undefined.
* If they do, return the overlap
* @param b1 - first bounding box
* @param b2 - second bounding box
* @returns - undefined if no overlap, or a bbox of the overlap
*/
export declare function bboxOverlap(b1: BBOX, b2: BBOX): undefined | BBOX;
/**
* Extends a bounding box to include a point
* @param bbox - the bounding box to extend, if it doesn't exist it will be created otherwise just modified
* @param point - the point to add to the bbox
* @returns - the extended bbox
*/
export declare function extendBBox(bbox: BBOX | undefined, point: VectorPoint): BBOX;
/**
* Merges two bounding boxes into the first and returns the result
* @param b1 - the first bounding box
* @param b2 - the second bounding box
* @returns - the merged bounding box
*/
export declare function mergeBBoxes(b1: BBOX | undefined, b2: BBOX): BBOX;
/**
* Create a new bounding box clipped by the axis and min-max
* @param bb - the original bounding box
* @param axis - 0 for x, 1 for y
* @param k1 - the lower bound
* @param k2 - the upper bound
* @returns the new bounding box clipped by the axis and min-max
*/
export declare function clipBBox(bb: BBOX | undefined, axis: 0 | 1, k1: number, k2: number): BBOX;
//# sourceMappingURL=bbox.d.ts.map