39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
/**
|
|
* Spatial utility functions for geographic calculations.
|
|
*/
|
|
/**
|
|
* Ray-casting algorithm to determine if a point is inside a polygon.
|
|
* @param lat Point latitude
|
|
* @param lng Point longitude
|
|
* @param polygonCoords Array of [lng, lat] coordinate pairs (GeoJSON order)
|
|
*/
|
|
export declare function isPointInPolygon(lat: number, lng: number, polygonCoords: number[][]): boolean;
|
|
/**
|
|
* Parse GeoJSON string and extract coordinate arrays for all polygons.
|
|
* Supports Polygon and MultiPolygon types.
|
|
* Returns array of coordinate rings (outer rings only).
|
|
*/
|
|
export declare function parseGeoJsonPolygon(geojsonString: string): number[][][];
|
|
/**
|
|
* Calculate bounding box from an array of [lng, lat] coordinate pairs.
|
|
* Returns { minLat, maxLat, minLng, maxLng }.
|
|
*/
|
|
export declare function calculateBounds(coordinates: number[][]): {
|
|
minLat: number;
|
|
maxLat: number;
|
|
minLng: number;
|
|
maxLng: number;
|
|
};
|
|
/**
|
|
* Haversine distance between two lat/lng points in meters.
|
|
*/
|
|
export declare function haversineDistance(lat1: number, lng1: number, lat2: number, lng2: number): number;
|
|
/**
|
|
* Calculate the centroid of an array of [lng, lat] coordinate pairs.
|
|
* Returns { lat, lng }.
|
|
*/
|
|
export declare function calculateCentroid(coordinates: number[][]): {
|
|
lat: number;
|
|
lng: number;
|
|
};
|
|
//# sourceMappingURL=spatial.d.ts.map
|