import { GeoJSONObject } from "ol/format/GeoJSON"; import Geometry from "ol/geom/Geometry"; import { Feature } from "ol/index"; import Map from "ol/Map"; import { Vector } from "ol/source"; import VectorSource from "ol/source/Vector"; import { ProjectionEnum } from "./projections"; export type AreaUnitEnum = "m2" | "ha"; /** * Calculate & format the area of a polygon * @param polygon * @param unit - defaults to square metres ("m2"), or supports "ha" for hectares * @returns - the total area formatted with unit as a string */ export declare function formatArea(polygon: Geometry, unit: AreaUnitEnum): string | undefined; /** * Fit map view to extent of data features, overriding default zoom & center * @param olMap - an OpenLayers map * @param olSource - an OpenLayers vector source * @param bufferValue - amount to buffer extent by, refer to https://openlayers.org/en/latest/apidoc/module-ol_extent.html#.buffer * @returns - a map view */ export declare function fitToData(olMap: Map, olSource: Vector>, bufferValue: number): void; /** * Translate a hex color to an rgba string with opacity * @param hexColor - a hex color string * @param alpha - a decimal to represent opacity * @returns - a 'rgba(r,g,b,a)' string */ export declare function hexToRgba(hexColor: string, alpha: number): string; /** * Generate a geojson object from a vector source or an array of features * @param source * @param projection * @returns */ export declare function makeGeoJSON(source: VectorSource> | Feature[], projection: ProjectionEnum): GeoJSONObject;