UNPKG

gis-tools-ts

Version:

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

30 lines 2.12 kB
import type { MValue, Properties, VectorFeature, VectorLineString, VectorMultiPolygon, VectorMultiPolygonGeometry, VectorPolygon, VectorPolygonGeometry } from '../../../index.js'; /** * 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; /** * Calculate the approximate area of the polygon ring if were it projected onto the planet. * Note that this area will be positive if ring is oriented counter-clockwise, * otherwise it will be negative. * * Reference: * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for Polygons on a Sphere", * JPL Publication 07-03, Jet Propulsion * Laboratory, Pasadena, CA, June 2007 https://trs.jpl.nasa.gov/handle/2014/40409 * @param coords - ring Coordinates in lon-lat space * @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 polygonRingArea<M extends MValue = Properties>(coords: VectorLineString<M>, planetRadius: number): number; //# sourceMappingURL=area.d.ts.map