import { Dispatch } from 'react'; import { Map as Map_2 } from 'maplibre-gl'; import { SetStateAction } from 'react'; /** * State of a single GIBS layer instance added to the map. * * A time-enabled layer can be added multiple times with different dates; * each addition is a separate instance identified by `key`. */ export declare interface AddedLayerState { /** * Unique instance key (e.g. "MODIS_..._TrueColor@2024-06-01"). * Use this with removeLayer/setLayerDate/setLayerOpacity/setLayerVisibility. */ key: string; /** * GIBS layer identifier */ id: string; /** * Selected ISO 8601 date (for time-enabled layers) */ date?: string; /** * Layer opacity (0 to 1) */ opacity: number; /** * Whether the layer is currently visible on the map */ visible: boolean; } /** * Parsed GIBS capabilities document. */ export declare interface GibsCapabilities { /** * All parsed layers, sorted by title. */ layers: GibsLayer[]; /** * Timestamp (ms since epoch) when the document was parsed. */ fetchedAt: number; } /** * A single WMTS layer parsed from the GIBS capabilities document. */ export declare interface GibsLayer { /** * Layer identifier (ows:Identifier), e.g. "MODIS_Terra_CorrectedReflectance_TrueColor". */ id: string; /** * Human-readable layer title (ows:Title). */ title: string; /** * Category the layer belongs to, derived from the platform/instrument * prefix of the identifier (e.g. "MODIS", "VIIRS", "MERRA2"). */ category: string; /** * Image format of the layer tiles. */ format: GibsLayerFormat; /** * File extension used in tile URLs (derived from the resource template). */ fileExtension: string; /** * TileMatrixSet identifier, e.g. "GoogleMapsCompatible_Level9". */ tileMatrixSet: string; /** * Maximum native zoom level (parsed from the TileMatrixSet name). */ maxZoom: number; /** * WGS84 bounding box as [west, south, east, north], if advertised. */ bbox?: [number, number, number, number]; /** * Raw tile ResourceURL template with {Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol} placeholders. */ resourceTemplate: string; /** * Time dimension, if the layer is time-enabled. */ time?: GibsTimeDimension; /** * URL of the first advertised legend image, if any. */ legendUrl?: string; } /** * Image format of a GIBS layer. */ export declare type GibsLayerFormat = "png" | "jpeg" | "mvt"; /** * Time dimension metadata for a GIBS layer. */ export declare interface GibsTimeDimension { /** * Default date (ISO 8601) advertised by the capabilities document. */ default: string; /** * Raw time domain values. Each entry is either a single date or a * "start/end/period" range (e.g. "2002-07-04/2026-06-01/P1D"). */ values: string[]; } /** * Options for configuring the NasaEarthdataControl */ export declare interface NasaEarthdataControlOptions { /** * Whether the control panel should start collapsed (showing only the toggle button) * @default true */ collapsed?: boolean; /** * Position of the control on the map * @default 'top-right' */ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; /** * Title displayed in the control header * @default 'NASA Earthdata' */ title?: string; /** * Initial width of the control panel in pixels. The panel can also be * resized by dragging its outer edge. * @default 320 */ panelWidth?: number; /** * Custom CSS class name for the control container */ className?: string; /** * URL of the WMTS capabilities document * @default DEFAULT_CAPABILITIES_URL */ capabilitiesUrl?: string; /** * Whether to include vector-tile (MVT) layers in search results * @default false */ includeVector?: boolean; /** * Whether to show an opacity slider for added layers * @default true */ showOpacity?: boolean; /** * Attribution string applied to added raster sources * @default 'NASA EOSDIS GIBS' */ attribution?: string; /** * Color theme of the control. 'auto' follows the OS preference. * @default 'auto' */ theme?: "auto" | "light" | "dark"; } /** * React wrapper component for NasaEarthdataControl. * * This component manages the lifecycle of a NasaEarthdataControl instance, * adding it to the map on mount and removing it on unmount. * * @example * ```tsx * import { NasaEarthdataControlReact } from 'maplibre-gl-nasa-earthdata/react'; * * function MyMap() { * const [map, setMap] = useState(null); * * return ( * <> *
* {map && ( * console.log('Added', layer.id)} * /> * )} * * ); * } * ``` * * @param props - Component props including map instance and control options * @returns null - This component renders nothing directly */ export declare function NasaEarthdataControlReact({ map, onStateChange, onLayerAdd, onLayerRemove, ...options }: NasaEarthdataReactProps): null; /** * Event types emitted by the NASA Earthdata control */ export declare type NasaEarthdataEvent = "collapse" | "expand" | "statechange" | "layeradd" | "layerremove" | "capabilitiesload" | "error"; /** * Event handler function type */ export declare type NasaEarthdataEventHandler = (event: NasaEarthdataEventPayload) => void; /** * Payload passed to NASA Earthdata event handlers */ export declare interface NasaEarthdataEventPayload { /** * The event type */ type: NasaEarthdataEvent; /** * Snapshot of the control state at the time of the event */ state: NasaEarthdataState; /** * The GIBS layer involved (for 'layeradd' and 'layerremove') */ layer?: GibsLayer; /** * The error that occurred (for 'error') */ error?: Error; } /** * Props for the React wrapper component */ export declare interface NasaEarthdataReactProps extends NasaEarthdataControlOptions { /** * MapLibre GL map instance */ map: Map_2; /** * Callback fired when the control state changes */ onStateChange?: (state: NasaEarthdataState) => void; /** * Callback fired when a GIBS layer is added to the map */ onLayerAdd?: (layer: GibsLayer) => void; /** * Callback fired when a GIBS layer is removed from the map */ onLayerRemove?: (layerId: string) => void; } /** * Internal state of the NASA Earthdata control */ export declare interface NasaEarthdataState { /** * Whether the control panel is currently collapsed */ collapsed: boolean; /** * Current panel width in pixels */ panelWidth: number; /** * Current search query */ query: string; /** * Layers currently added to the map */ addedLayers: AddedLayerState[]; } /** * Custom hook for managing NASA Earthdata control state in React applications. * * This hook provides a simple way to track and update the state * of a NasaEarthdataControl from React components. * * @example * ```tsx * function MyComponent() { * const { state, setState, setCollapsed, toggle } = useNasaEarthdata(); * * return ( *
* * *
* ); * } * ``` * * @param initialState - Optional initial state values * @returns Object containing state and update functions */ export declare function useNasaEarthdata(initialState?: Partial): { state: NasaEarthdataState; setState: Dispatch>; setCollapsed: (collapsed: boolean) => void; setPanelWidth: (panelWidth: number) => void; setQuery: (query: string) => void; setAddedLayers: (addedLayers: AddedLayerState[]) => void; reset: () => void; toggle: () => void; }; export { }