leaflet-polydraw
Version:
Advanced Leaflet plugin for freehand polygon drawing, with smart merging and powerful editing tools. Compatible with both Leaflet v1.x and v2.x.
41 lines • 1.88 kB
TypeScript
import * as L from 'leaflet';
import type { Feature, Polygon, MultiPolygon } from 'geojson';
/**
* Utility class for polygon calculations.
*/
export declare class PolygonUtil {
private static turfHelper;
/**
* Calculates the center of the polygon.
* @param polygon Array of LatLng points.
* @returns The center LatLng.
*/
static getCenter(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
/**
* Gets the southwest point of the polygon bounds.
* @param polygon Array of LatLng points.
* @returns The southwest LatLng.
*/
static getSouthWest(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
static getNorthEast(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
static getNorthWest(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
static getSouthEast(polygon: L.LatLngLiteral[]): L.LatLngLiteral;
static getNorth(polygon: L.LatLngLiteral[]): number;
static getSouth(polygon: L.LatLngLiteral[]): number;
static getWest(polygon: L.LatLngLiteral[]): number;
static getEast(polygon: L.LatLngLiteral[]): number;
static getSqmArea(polygon: L.LatLngLiteral[]): number;
static getPerimeter(polygon: L.LatLngLiteral[]): number;
static getPolygonChecksum(polygon: L.LatLngLiteral[]): number;
static getMidPoint(point1: L.LatLngLiteral, point2: L.LatLngLiteral): L.LatLngLiteral;
static getBounds(polygon: L.LatLngLiteral[]): L.LatLngBounds;
/**
* Calculates the center of mass of the polygon.
* @param polygon A GeoJSON polygon.
* @returns The center LatLng.
*/
static getCenterOfMass(polygon: Feature<Polygon | MultiPolygon>): L.LatLngLiteral;
static getCenterOfPolygonByIndexWithOffsetFromCenterOfMass(polygon: Feature<Polygon | MultiPolygon>, index: number): L.LatLngLiteral;
private static getPolygonLatLngAtIndex;
}
//# sourceMappingURL=polygon.util.d.ts.map