Skip to content

@deltares/fews-web-oc-composables


@deltares/fews-web-oc-composables / fetchWmsLegend

Function: fetchWmsLegend() ​

fetchWmsLegend(options): Promise<GetLegendGraphicResponse>

Defined in: useWms/fetchWmsLegend.ts:54

Alpha

This API is not yet stable and may change in future versions.

Fetches a WMS legend graphic once, as a plain Promise.

Use this instead of useWmsLegend when a reactive, auto-reloading result is not needed (e.g. for generating a one-off image for a report).

Parameters ​

options ​

FetchWmsLegendOptions

Request configuration. See FetchWmsLegendOptions.

Returns ​

Promise<GetLegendGraphicResponse>

A promise resolving to the legend graphic response.

Example ​

ts
import { fetchWmsLegend } from '@deltares/fews-web-oc-composables'

const legendGraphic = await fetchWmsLegend({
  layerName: 'waterlevel',
  useDisplayUnits: true,
  webservice: { baseUrl: 'https://example.localhost/fewswebservices' },
})