import type { GeohashBounds } from './core.js'; import type { PolygonInput } from './geojson.js'; export type { GeohashBounds } from './core.js'; export type { PolygonInput, GeoJSONPolygon, GeoJSONMultiPolygon } from './geojson.js'; /** * Ray-casting algorithm: test whether a point [x, y] lies inside a polygon. * Polygon is an array of [x, y] vertices (closed automatically). */ export declare function pointInPolygon(point: [number, number], polygon: [number, number][]): boolean; /** * Test whether all four corners of bounds lie inside the polygon. */ export declare function boundsFullyInsidePolygon(bounds: GeohashBounds, polygon: [number, number][]): boolean; /** * Test whether a bounds rectangle overlaps a polygon at all. * Checks: (1) any bounds corner inside polygon, (2) any polygon vertex inside bounds, * (3) any edge intersection. */ export declare function boundsOverlapsPolygon(bounds: GeohashBounds, polygon: [number, number][]): boolean; export interface CoverageOptions { minPrecision?: number; maxPrecision?: number; maxCells?: number; mergeThreshold?: number; } /** * Convert a polygon (array of [lon, lat] vertices) to an efficient set of * multi-precision geohash strings using recursive subdivision. * * Edges always subdivide to maxPrecision for a tight boundary. Interior * cells use the coarsest precision allowed by mergeThreshold. If the result * exceeds maxCells, maxPrecision is stepped down until it fits. * * Throws RangeError if the polygon cannot be covered within maxCells at * the given minPrecision. * * **Antimeridian:** polygons crossing ±180° longitude are not supported. * Split at the antimeridian and cover each half separately. */ export declare function polygonToGeohashes(input: PolygonInput, options?: CoverageOptions): string[]; /** * Compute the convex hull of a set of `[x, y]` points using Andrew's * monotone chain algorithm. O(n log n). * * Returns the hull vertices in counter-clockwise winding order. * Handles edge cases: empty input, single point, two points, collinear * points, and duplicates (automatically deduplicated). */ export declare function convexHull(input: [number, number][]): [number, number][]; /** * Compute a convex hull polygon from an array of geohash strings. * Collects all unique cell corners, then builds the hull using * Andrew's monotone chain algorithm. * Returns `[lon, lat][]`. * * **Antimeridian:** throws if the input hashes straddle ±180° longitude. * Dateline-crossing hulls cannot be consumed by planar geometry functions * (`pointInPolygon`, `polygonToGeohashes`). Split hash sets at the * antimeridian and compute separate hulls for each side. */ export declare function geohashesToConvexHull(hashes: string[]): [number, number][]; export interface DeduplicateOptions { /** * Allow near-complete sibling merges (30/32) for a smaller result array. * Trades a tiny boundary overshoot for fewer cells. Default: `false` (exact). */ lossy?: boolean; } /** * Remove redundant geohashes and merge sibling groups. * 1. Remove any geohash whose ancestor (shorter prefix) is already in the set. * 2. Merge sibling sets bottom-up — exact (all 32) by default, or * near-complete (≥30/32) when `lossy: true`. */ export declare function deduplicateGeohashes(hashes: string[], options?: DeduplicateOptions): string[]; export interface GeohashGeoJSON { type: 'FeatureCollection'; features: { type: 'Feature'; geometry: { type: 'Polygon'; coordinates: [number, number][][]; }; properties: { geohash: string; precision: number; }; }[]; } /** * Convert an array of geohash strings to a GeoJSON FeatureCollection * of polygon rectangles, suitable for rendering on a MapLibre map. */ export declare function geohashesToGeoJSON(hashes: string[]): GeohashGeoJSON; //# sourceMappingURL=coverage.d.ts.map