s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
34 lines • 2.49 kB
TypeScript
import type { Properties, S2Feature, VectorFeature, VectorMultiPolygon, VectorMultiPolygonGeometry, VectorPoint, VectorPolygon, VectorPolygonGeometry } from '../..';
/**
* Find the area of a collection of polygons. Assumes geometry is in lon-lat space
* @param polygons - the collection of polygons
* @param planetRadius - the radius of the planet (Earth by default)
* @returns - the total area of the polygon
*/
export declare function polygonsArea(polygons: VectorMultiPolygon | VectorMultiPolygonGeometry | VectorFeature<Record<string, unknown>, Properties, Properties, VectorMultiPolygonGeometry>, planetRadius?: number): number;
/**
* Find the area of a polygon. Assumes geometry is in Lon-Lat space
* @param polygon - the polygon
* @param planetRadius - the radius of the planet (Earth by default)
* @returns - The approximate signed geodesic area of the polygon in square meters.
*/
export declare function polygonArea(polygon: VectorPolygon | VectorPolygonGeometry | VectorFeature<Record<string, unknown>, Properties, Properties, VectorPolygonGeometry>, planetRadius?: number): number;
/**
* A robust method to see if a point is in a collection of polygons or not.
* Be sure the point and polygon are in the same projection space.
* @param point - the point to check
* @param polygons - the collection of polygons
* @param ignoreBoundary - if true, ignore when the point is on the boundary
* @returns - true if the point is in the polygon
*/
export declare function pointInPolygons(point: VectorPoint, polygons: VectorMultiPolygon | VectorMultiPolygonGeometry | VectorFeature<Record<string, unknown>, Properties, Properties, VectorMultiPolygonGeometry> | S2Feature<Record<string, unknown>, Properties, Properties, VectorMultiPolygonGeometry>, ignoreBoundary?: boolean): boolean;
/**
* A robust method to see if a point is in a polygon or not.
* Be sure the point and polygon are in the same projection space.
* @param point - the point to check
* @param polygon - the polygon
* @param ignoreBoundary - if true, ignore when the point is on the boundary
* @returns - true if the point is in the polygon
*/
export declare function pointInPolygon(point: VectorPoint, polygon: VectorPolygon | VectorPolygonGeometry | VectorFeature<Record<string, unknown>, Properties, Properties, VectorPolygonGeometry> | S2Feature<Record<string, unknown>, Properties, Properties, VectorPolygonGeometry>, ignoreBoundary?: boolean): boolean;
//# sourceMappingURL=polys.d.ts.map