geoview-core
    Preparing search index...

    Class WMS

    A class to add wms layer.

    WMS

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    fullSubLayers: boolean = false
    geoviewLayerId: string

    The unique identifier for the GeoView layer. The value of this attribute is extracted from the mapLayerConfig parameter. If its value is undefined, a unique value is generated.

    geoviewLayerName: string

    The GeoView layer name. The value of this attribute is extracted from the mapLayerConfig parameter. If its value is undefined, a default value is generated.

    hitTolerance: number = AbstractGeoViewLayer.DEFAULT_HIT_TOLERANCE

    The default hit tolerance

    layerLoadError: Error[] = []

    List of errors for the layers that did not load.

    listOfLayerEntryConfig: TypeLayerEntryConfig[] = []

    An array of layer settings. In the schema, this attribute is optional. However, we define it as mandatory and if the configuration does not provide a value, we use an empty array instead of an undefined attribute.

    metadataAccessPath: string

    The GeoView layer metadataAccessPath. The name attribute is optional

    olRootLayer?: BaseLayer

    The OpenLayer root layer representing this GeoView Layer.

    serverDateFragmentsOrder?: TypeDateFragments

    Date format object used to translate server to ISO format and ISO to server format

    WMSStyles: string[]
    DEFAULT_HIT_TOLERANCE: number = 4

    The default hit tolerance the query should be using

    DEFAULT_WAIT_PERIOD_METADATA_WARNING: number = ...

    The default waiting time before showing a warning about the metadata taking a long time to get processed

    Methods

    • This method is used to create the layers specified in the listOfLayerEntryConfig attribute inherited from its parent. Normally, it is the second method called in the life cycle of a GeoView layer, the first one being the constructor. Its code is the same for all child classes. It must first validate that the olLayers attribute is null indicating that the method has never been called before for this layer. If this is not the case, an error message must be sent. Then, it calls the abstract method getAdditionalServiceDefinition. For example, when the child is a WFS service, this method executes the GetCapabilities request and saves the result in the metadata attribute of the class. It also process the layer's metadata for each layer in the listOfLayerEntryConfig tree in order to define the missing pieces of the layer's configuration. Layer's configuration can come from the configuration of the GeoView layer or from the information saved by the method #processListOfLayerMetadata, priority being given to the first of the two. When the GeoView layer does not have a service definition, the getAdditionalServiceDefinition method does nothing.

      Finally, the processListOfLayerEntryConfig is called to instantiate each layer identified by the listOfLayerEntryConfig attribute. This method will also register the layers to all layer sets that offer this possibility. For example, if a layer is queryable, it will subscribe to the details-panel and every time the user clicks on the map, the panel will ask the layer to return the descriptive information of all the features in a tolerance radius. This information will be used to populate the details-panel.

      Parameters

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of fetch.

      Returns Promise<ConfigBaseClass[]>

      A promise of the config base classes created.

    • Creates an ImageWMS source from a layer config.

      Parameters

      • layerConfig: OgcWmsLayerEntryConfig

        The configuration for the WMS layer.

      Returns ImageWMS

      A fully configured ImageWMS source.

      If required config fields like dataAccessPath are missing.

    • Protected

      Emits a layer-specific message event with localization support

      Parameters

      • messageKey: string

        The key used to lookup the localized message OR message

      • messageParams: string[] | undefined = []

        Array of parameters to be interpolated into the localized message

      • messageType: SnackbarType = ...

        The message type

      • Optionalnotification: boolean = false

        Whether to show this as a notification. Defaults to false

      Returns void

      this.emitMessage(
      'layers.fetchProgress',
      ['50', '100'],
      messageType: 'error',
      true
      );

      LayerMessageEvent

    • Recursively gets the layer capability for a given layer id.

      Parameters

      • layerId: string

        The layer identifier to get the capabilities for.

      • layer: TypeMetadataWMSCapabilityLayer | undefined = ...

        The current layer entry from the capabilities that will be recursively searched.

      Returns TypeMetadataWMSCapabilityLayer | undefined

      The found layer from the capabilities or undefined if not found.

    • Fetches and processes service metadata for the WMS layer. Depending on whether the metadata URL points to an XML document or a standard WMS endpoint, this method delegates to the appropriate metadata fetching logic.

      • If the URL ends in .xml, a direct XML metadata fetch is performed.
      • Otherwise, the method constructs a WMS GetCapabilities request.
        • If no specific layer configs are provided, a single metadata fetch is made.
        • If layer configs are present (e.g., Geomet use case), individual layer metadata is merged.

      Type Parameters

      • T = TypeMetadataWMS | undefined

      Parameters

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of fetch.

      Returns Promise<T>

      A promise resolving to the parsed metadata object, or undefined if metadata could not be retrieved or no capabilities were found.

      Error thrown when the metadata fetch fails or contains an error.

    • Overrides the way a geoview layer config initializes its layer entries.

      Parameters

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of fetch.

      Returns Promise<TypeGeoviewLayerConfig>

      A promise resolved once the layer entries have been initialized.

      Error thrown when the metadata fetch fails or contains an error.

    • Creates a complete configuration object for a WMS GeoView layer. This function constructs a TypeWMSLayerConfig object that defines a WMS layer and its associated entries. It supports both individual layers and nested group layers through recursive processing.

      Parameters

      • geoviewLayerId: string

        A unique identifier for the GeoView layer.

      • geoviewLayerName: string

        The human-readable name of the GeoView layer.

      • metadataAccessPath: string

        The URL or path used to access the layer's metadata.

      • serverType: TypeOfServer

        The type of WMS server (e.g., 'geoserver', 'mapserver').

      • isTimeAware: boolean

        Indicates whether the layer supports time-based filtering or animation.

      • layerEntries: TypeLayerEntryShell[]

        The root array of parsed layer entries (may include nested groups).

      • fullSubLayers: boolean

        If false, will simulate legacy behavior and skip deeper layers after the first.

      • OptionalcustomGeocoreLayerConfig: unknown = {}

        Optional custom layer configuration to merge into leaf layers.

      Returns TypeWMSLayerConfig

      The fully constructed WMS layer configuration object.

    • Fetches and validates metadata from a given URL for a GeoView raster layer. If the URL does not end with .json, the query string ?f=json is appended to request JSON format. The response is parsed and checked for service-level errors. If an error is found, an exception is thrown.

      Type Parameters

      • T

      Parameters

      • url: string

        The base URL to fetch the metadata from (e.g., ArcGIS REST endpoint).

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of fetch.

      Returns Promise<T>

      A promise resolving to the parsed JSON metadata response.

      Error thrown when the request exceeds the timeout duration.

      Error thrown when the request was aborted by the caller's signal.

      Error thrown when the response is not OK (non-2xx).

      Error thrown when the JSON response is empty.

    • Fetches the metadata for WMS Capabilities.

      Parameters

      • url: string

        The url to query the metadata from.

      • OptionalcallbackNewMetadataUrl: CallbackNewMetadataDelegate

        Callback executed when a proxy had to be used to fetch the metadata. The parameter sent in the callback is the proxy prefix with the '?' at the end.

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of fetch.

      Returns Promise<TypeMetadataWMS>

      Error thrown when the request exceeds the timeout duration.

      Error thrown when the request was aborted by the caller's signal.

      Error thrown when the response is not OK (non-2xx).

      Error thrown when the JSON response is empty.

      Errow thrown when a network issue happened.

    • Fetches the metadata for WMS Capabilities for particular layer(s).

      Parameters

      • url: string

        The url to query the metadata from.

      • layers: string

        The layers to get the capabilities for.

      • OptionalcallbackNewMetadataUrl: CallbackNewMetadataDelegate

        Callback executed when a proxy had to be used to fetch the metadata. The parameter sent in the callback is the proxy prefix with the '?' at the end.

      Returns Promise<TypeMetadataWMS>

      Error thrown when the request exceeds the timeout duration.

      Error thrown when the request was aborted by the caller's signal.

      Error thrown when the response is not OK (non-2xx).

      Error thrown when the JSON response is empty.

      Errow thrown when a network issue happened.

    • Initializes a GeoView layer configuration for a WMS layer. This method creates a basic TypeGeoviewLayerConfig using the provided ID, name, and metadata access path URL. It then initializes the layer entries by calling initGeoViewLayerEntries, which may involve fetching metadata or sublayer info.

      Parameters

      • geoviewLayerId: string

        A unique identifier for the layer.

      • geoviewLayerName: string

        The display name of the layer.

      • metadataAccessPath: string

        The full service URL to the layer endpoint.

      • fullSubLayers: boolean

      Returns Promise<TypeGeoviewLayerConfig>

      A promise that resolves to an initialized GeoView layer configuration with layer entries.

    • Processes a WMS GeoviewLayerConfig and returns a promise that resolves to an array of ConfigBaseClass layer entry configurations.

      This method:

      1. Creates a Geoview layer configuration using the provided parameters.
      2. Instantiates a layer with that configuration.
      3. Processes the layer configuration and returns the result.

      Parameters

      • geoviewLayerId: string

        The unique identifier for the GeoView layer.

      • geoviewLayerName: string

        The display name for the GeoView layer.

      • url: string

        The URL of the service endpoint.

      • layerIds: number[]

        An array of layer IDs to include in the configuration.

      • isTimeAware: boolean

        Indicates if the layer is time aware.

      • typeOfServer: TypeOfServer

        Indicates the type of server.

      • fullSubLayers: boolean

      Returns Promise<ConfigBaseClass[]>

      A promise that resolves to an array of layer configurations.