Skip to content

@deltares/fews-web-oc-composables


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

Function: useWmsLayerCapabilities() ​

useWmsLayerCapabilities(options): UseWmsReturn

Defined in: useWms/useWmsLayerCapabilities.ts:104

Alpha

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

Loads WMS GetCapabilities for a layer, and derives the layer's capabilities and available time values from the response.

By default, refreshes on system-time ticks and when visibility resumes.

Reactively reloads when the layer or filter changes, and supports automatic refreshing through refresh. On request failure, the last successful result is retained when the request inputs are unchanged. Changing the layer or filter clears the previous result; errors are exposed through error and rejected from an explicit fetch() call.

Parameters ​

options ​

UseWmsLayerCapabilitiesOptions

MemberTypeDescription
enabled?Ref<boolean, boolean>Controls whether requests and automatic refreshes are enabled.
filter?MaybeRefOrGetter<Partial<GetCapabilitiesFilter>>Optional overrides for the GetCapabilities request.
layerNameMaybeRefOrGetter<string | undefined>Name of the WMS layer to load.
refresh?UseWmsRefreshOptionsConfiguration for automatic request refreshing.
webservice?PiWebserviceOptionsOptional webservice configuration for standalone usage. When omitted, the host-provided webservice context is used.

Request configuration. See UseWmsLayerCapabilitiesOptions.

Defaults applied when not overridden:

  • importFromExternalDataSource: false
  • onlyHeaders: false
  • forecastCount: 1

Returns ​

UseWmsReturn

MemberTypeDescription
cancel() => voidCancels the currently running request, if any.
capabilitiesReadonly<Ref<GetCapabilitiesResponse | undefined>>The full WMS GetCapabilities response, or undefined when no layer is selected, or the request has not resolved yet.
errorReadonly<Ref<Error | null>>Error from the most recent request, or null when there is no error.
fetch() => Promise<void>Fetches the requested WMS data immediately.
hasAttemptedReadonly<Ref<boolean>>Whether a request has completed for the current inputs, successfully or not.
hasLoadedReadonly<Ref<boolean>>Whether a successful response is available for the current inputs.
lastRefreshAtReadonly<Ref<Date | undefined>>Time at which the most recent refresh completed successfully.
lastTriggerPolicyReadonly<Ref<RefreshPolicy | undefined>>Policy that caused the most recent refresh.
layerCapabilitiesReadonly<Ref<Layer | undefined>>The WMS capabilities of the requested layer, or undefined when no layer is selected, or the request has not resolved yet.
loadCapabilities() => Promise<void>Reloads the capabilities and times. Called automatically when request options change or a refresh is triggered.
loadingReadonly<Ref<boolean>>Whether the initial request is in progress.
pauseRefresh() => voidPauses automatic refreshes.
refreshingReadonly<Ref<boolean>>Whether a subsequent request is in progress.
requestRefresh() => voidRequests a refresh through the refresh coordinator.
resumeRefresh() => voidResumes automatic refreshes.
timesReadonly<Ref<Date[] | undefined>>The available time values for the layer, restricted to the layer's firstValueTime/lastValueTime range (if present), or undefined when no layer is selected.

See UseWmsReturn.

Example ​

ts
import { ref } from 'vue'
import { useWmsLayerCapabilities } from '@deltares/fews-web-oc-composables'

const options = {
  layerName: ref('waterlevel'),
  webservice: { baseUrl: 'https://example.localhost/fewswebservices' },
  refresh: { policies: ['onInterval'], intervalMs: 30_000 },
}

const { capabilities, layerCapabilities, times } =
  useWmsLayerCapabilities(options)