UNPKG

gis-tools-ts

Version:

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

34 lines 2.73 kB
import type { MValue, 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). Set to 1 if you want the raw area * @returns - the total area of the polygon in square meters */ export declare function polygonsArea<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties>(polygons: VectorMultiPolygon<D> | VectorMultiPolygonGeometry<D> | VectorFeature<M, D, P, VectorMultiPolygonGeometry<D>>, 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<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties>(polygon: VectorPolygon<D> | VectorPolygonGeometry<D> | VectorFeature<M, D, P, VectorPolygonGeometry<D>>, 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<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties>(point: VectorPoint, polygons: VectorMultiPolygon<D> | VectorMultiPolygonGeometry<D> | VectorFeature<M, D, P, VectorMultiPolygonGeometry<D>> | S2Feature<M, D, P, VectorMultiPolygonGeometry<D>>, 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<M = Record<string, unknown>, D extends MValue = Properties, P extends Properties = Properties>(point: VectorPoint, polygon: VectorPolygon<D> | VectorPolygonGeometry<D> | VectorFeature<M, D, P, VectorPolygonGeometry<D>> | S2Feature<M, D, P, VectorPolygonGeometry<D>>, ignoreBoundary?: boolean): boolean; //# sourceMappingURL=polys.d.ts.map