/** Current GeoLibre iframe protocol version. Version 1 requests remain supported by the app. */ export declare const EMBED_API_VERSION: 2; export declare const EMBED_API_SOURCE: "geolibre"; export type MapRenderer = "maplibre" | "cesium" | "mapbox" | "arcgis"; export interface Viewport { bbox?: [number, number, number, number] | null; center: [number, number]; zoom: number; bearing: number; pitch: number; } export type ViewTarget = { bbox: [number, number, number, number]; } | { center?: [number, number]; zoom?: number; bearing?: number; pitch?: number; duration?: number; }; /** A GeoJSON feature as returned by `getLayerFeatures` and `getDrawnFeatures`; `id` is exactly as stored. */ export interface EmbedFeature { type: "Feature"; id?: string | number; geometry: { type: string; coordinates?: unknown; geometries?: unknown[]; } | null; properties: Record | null; } export interface LayerSummary { id: string; name: string; type: string; visible: boolean; opacity: number; } export interface AddLayerSpec { id: string; name: string; type: string; source: Record; visible?: boolean; opacity?: number; style?: Record; metadata?: Record; geojson?: unknown; beforeId?: string; } export interface AddDataOptions { styleUrl?: string; /** Fit the map to the newly added data. Defaults to true. */ fit?: boolean; } export type EmbedEventMap = { ready: { version: string; }; /** * Every command already returns a promise the client settles from this ack, * so subscribing is only worth it to observe the traffic (logging, or an ack * that arrives with no request waiting for it). */ ack: { requestId: string; ok: boolean; error?: string; result?: unknown; }; projectLoaded: { url: string | null; name: string; layerIds: string[]; }; selectionChanged: { layerId: string | null; featureIds: string[]; }; rendererchange: { renderer: MapRenderer; }; viewChanged: Viewport; toolCompleted: Record; serverFileWritten: { path: string; toolId: string; }; /** * A layer's in-memory feature collection was replaced: drawings, edits, * attribute edits, refreshes, late-loaded data. It may fire without a content * change. Debounced per layer (about 250 ms). A layer appearing with features * counts; a layer's removal is sent at once with `removed: true`. Not sent for * whole project loads (use `projectLoaded`), and only when the deployment * grants `export:data`. Read the features with `getLayerFeatures(layerId)`. */ featuresChanged: { layerId: string; featureCount: number; removed?: boolean; }; }; type EventName = keyof EmbedEventMap; type Listener = (payload: EmbedEventMap[K]) => void; export interface ConnectOptions { /** Exact origin hosting the GeoLibre iframe. */ origin: string; /** Time allowed for the initial ready event. Defaults to 15 seconds. */ timeoutMs?: number; /** Time allowed for each command acknowledgement. Defaults to 15 seconds. */ requestTimeoutMs?: number; } export interface GeoLibreEmbedClient { loadProject(url: string): Promise; setView(target: ViewTarget): Promise; highlightFeature(payload: { layerId: string; featureId?: string | number; featureIds?: Array; filter?: Record; fit?: boolean; }): Promise; openTool(id: string, params?: Record): Promise; setLayerVisibility(layerId: string, visible: boolean): Promise; listLayers(): Promise; setFilter(layerId: string, expression: unknown[] | null): Promise; setRenderer(renderer: MapRenderer): Promise; getRenderer(): Promise; getViewport(): Promise; addLayer(spec: AddLayerSpec): Promise; addData(url: string, options?: AddDataOptions): Promise; exportImage(): Promise; /** * Read a layer's features (WGS84, ids exactly as stored), the same as the * plugin API's `getLayerFeatures`. Rejects for an unknown layer. A layer * that holds no in-memory features (raster, tiles, remote vector sources) * resolves to an empty array. An empty array therefore means "no in-memory * features" (an empty layer, or a raster, tile or remote source); the layer * `type` from `listLayers` cannot tell these apart. Removed layers reject. */ getLayerFeatures(layerId: string): Promise; /** * Read the user's free drawings (all Sketches layers, combined), the same as * the plugin API's `getDrawnFeatures`. Resolves to an empty array when * nothing is drawn yet. */ getDrawnFeatures(): Promise; on(type: K, listener: Listener): () => void; disconnect(): void; } /** Connect to a framed GeoLibre app and wait until its embed API is ready. */ export declare function connect(iframe: HTMLIFrameElement, options: ConnectOptions): Promise; export {}; //# sourceMappingURL=index.d.ts.map