import { LatLng, type LatLngLike } from "../geo.js"; import { FeatureGroup } from "../layer-group.js"; import { InteractiveLayer } from "../interactive-layer.js"; import { Layer, type LayerOptions } from "../layer.js"; import type { Orihon } from "../map.js"; import type { ReadonlyFeatureSource } from "../source-types.js"; import type { GeoJSONFeature, GeoJSONFeatureCollection, GeoJSONGeometry, GeoJSONPosition } from "../geojson-types.js"; import { type AsyncBatchOptions } from "../services/async-batch.js"; import type { OverlayContent, OverlayContentContext, OverlayRenderable, PopupOptions } from "../overlays/div-overlay.js"; import { type PathOptions } from "./vector.js"; export type { GeoJSONFeature, GeoJSONFeatureCollection, GeoJSONGeometry, GeoJSONGeometryCollection, GeoJSONLineStringGeometry, GeoJSONMultiLineStringGeometry, GeoJSONMultiPointGeometry, GeoJSONMultiPolygonGeometry, GeoJSONPointGeometry, GeoJSONPolygonGeometry, GeoJSONPosition, IdentifiedGeoJSONFeature } from "../geojson-types.js"; /** * Optional GPU path batch for GeoJSON (Advanced tier). * Standard keeps SVG/canvas only — register from `orihon` entry, not `orihon/standard`. */ export type GeoJSONPathBatch = InteractiveLayer & { addPath(rings: LatLngLike[][], closed?: boolean, style?: PathOptions, feature?: GeoJSONFeature): unknown; clearPaths(): unknown; render(): void; }; export type GeoJSONWebGLBatchFactory = (options: LayerOptions & PathOptions & { interactive?: boolean; className?: string; }) => GeoJSONPathBatch; /** Advanced entry calls this so `renderer: "webgl" | "auto"` can use GPU lines. */ export declare function registerGeoJSONWebGLBatch(factory: GeoJSONWebGLBatchFactory | null): void; export type GeoJSONData = GeoJSONGeometry | GeoJSONFeature | GeoJSONFeatureCollection | GeoJSONData[]; export type GeoJSONInput = GeoJSONData | ReadonlyFeatureSource; export type GeoJSONAsyncInput = GeoJSONData | string | Blob | AsyncIterable; export type GeoJSONStyleFunction = (feature: GeoJSONFeature) => PathOptions; export type GeoJSONPointToLayer = (feature: GeoJSONFeature, latlng: LatLng) => InteractiveLayer; export type GeoJSONPopupFactory = (feature: GeoJSONFeature, layer: InteractiveLayer, context: OverlayContentContext) => OverlayRenderable | Promise; export type GeoJSONPopupContent = OverlayContent | GeoJSONPopupFactory; /** svg = DOM per feature; canvas = CPU batch; webgl = GPU lines (Advanced, after register). */ export type GeoJSONRendererMode = "svg" | "canvas" | "webgl" | "auto"; export interface GeoJSONAsyncOptions extends AsyncBatchOptions { /** Parse string/Blob input in a dedicated worker when available. Default true. */ useWorker?: boolean; /** Maximum UTF-8 bytes accepted from string/Blob input. Default 256 MiB. */ maxBytes?: number; } export interface GeoJSONOptions extends PathOptions { style?: PathOptions | GeoJSONStyleFunction; pointToLayer?: GeoJSONPointToLayer; filter?: (feature: GeoJSONFeature) => boolean; onEachFeature?: (feature: GeoJSONFeature, layer: Layer) => void; coordsToLatLng?: (coordinates: GeoJSONPosition) => LatLngLike; popup?: GeoJSONPopupContent; popupOptions?: PopupOptions; /** * Vector backend. * - `auto` — SVG for small sets; canvas (Standard) or WebGL (Advanced, if registered) when ≥ `canvasThreshold` * - `webgl` — GPU batch when Advanced backend is registered; otherwise canvas */ renderer?: GeoJSONRendererMode; /** Path-feature count that triggers canvas/webgl in `auto` mode. Default 250. */ canvasThreshold?: number; /** Stop adding features once this many are stored. Unset = unlimited. */ maxFeatures?: number; /** * Keep source features for `toGeoJSON()`, later feature-style updates and * inspection. Set `false` for write-once canvas/WebGL path batches when the * source collection is very large. Point layers are always retained. * Default `true`. */ retainFeatures?: boolean; } interface FeatureEntry { feature: GeoJSONFeature; layer: InteractiveLayer; } declare function geoJSONCoordsToLatLng(coordinates: GeoJSONPosition): LatLng; declare function latLngToGeoJSONCoords(value: LatLngLike, precision?: number): GeoJSONPosition; declare function geoJSONAsFeature(value: GeoJSONFeature | GeoJSONGeometry): GeoJSONFeature; export declare class GeoJSONLayer extends FeatureGroup { #private; static coordsToLatLng: typeof geoJSONCoordsToLatLng; static latLngToCoords: typeof latLngToGeoJSONCoords; static asFeature: typeof geoJSONAsFeature; readonly geoJSONOptions: GeoJSONOptions; readonly featureEntries: FeatureEntry[]; readonly defaultStyles: Map, PathOptions>; readonly rendererMode: "svg" | "canvas" | "webgl"; private _pathBatch; private _featureCount; private _pathBatchFeatureCount; private readonly _source; private _sourceUnsubscribe; private readonly _layersByFeatureId; private readonly _sourceChanged; constructor(data?: GeoJSONInput | null, options?: GeoJSONOptions); onAdd(map: Orihon): void; onRemove(): void; get data(): GeoJSONFeatureCollection; get paths(): Array<{ path: SVGPathElement; geometry: GeoJSONGeometry; }>; addData(data: GeoJSONData): this; /** * Responsively ingest parsed GeoJSON, an async stream of GeoJSON chunks, or * raw JSON text/Blob. Raw input is parsed in a worker when available; parsed * object graphs stay on the main thread and yield cooperatively to avoid a * second full structured clone. */ addDataAsync(input: GeoJSONAsyncInput, options?: GeoJSONAsyncOptions): Promise; removeLayer(layer: Layer): this; clearLayers(): this; setStyle(style: PathOptions | GeoJSONStyleFunction): this; resetStyle(layer?: Layer): this; toGeoJSON(precision?: number): GeoJSONFeatureCollection; } export declare function geoJSON(data?: GeoJSONInput | null, options?: GeoJSONOptions): GeoJSONLayer; //# sourceMappingURL=geojson.d.ts.map