geoview-core - v2.1.2
    Preparing search index...

    Class GVWMS

    Manages a WMS layer.

    GVWMS

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    emitMessage formatFeatureInfoResult getAllFeatureInfo getAttributions getBounds getClassName getExtent getExtentFromFeatures getFeatureInfo getFeatureInfoAtCoordinate getFeatureInfoAtLonLat getFeatureInfoAtPixel getFeatureInfoUsingBBox getFeatureInfoUsingPolygon getFieldType getFilterFromStyle getGeoviewLayerId getGeoviewLayerName getGetFeatureInfoFeatureCount getGetFeatureInfoTolerance getHitTolerance getHoverable getInVisibleRange getIsTimeAware getLayerConfig getLayerFilters getLayerName getLayerPath getLayerStatus getLegend getMaxZoom getMetadataExtent getMetadataProjection getMinZoom getOLLayer getOLSource getOpacity getOverrideCRS getParent getQueryable getStyle getStyleItemVisibility getTimeDimension getVisible getVisibleIncludingParents init inVisibleRange offImageLoadRescue offLayerError offLayerFilterApplied offLayerFirstLoaded offLayerHoverableChanged offLayerLoaded offLayerLoading offLayerMessage offLayerNameChanged offLayerOpacityChanged offLayerQueryableChanged offLayerStyleChanged offLegendQueried offLegendQuerying offVisibleChanged onError onFetchLegend onGetAttributions onGetBounds onGetExtentFromFeatures onGetFieldDomain onGetFieldType onImageLoadError onImageLoadErrorDecipherError onImageLoadRescue onLayerError onLayerFilterApplied onLayerFirstLoaded onLayerHoverableChanged onLayerLoaded onLayerLoading onLayerMessage onLayerNameChanged onLayerOpacityChanged onLayerQueryableChanged onLayerStyleChanged onLegendQueried onLegendQuerying onLoaded onLoading onRefresh onSetLayerFilters onSetStyleAccordingToLegend onSourceChange onVisibleChanged queryLegend refresh setExtent setGetFeatureInfoFeatureCount setGetFeatureInfoTolerance setHoverable setLayerFilters setLayerFiltersDate setLayerName setLegend setMaxZoom setMinZoom setOLLayer setOpacity setOverrideCRS setQueryable setStyle setStyleItemVisibility setVisible setWmsStyle waitForRender waitForSourceReady waitLegendFetched waitLoadedOnce waitLoadedStatus waitStyleApplied applyViewFilterOnSource createLegendFromStyle fetchAndParseFeaturesFromWFSUrl getFeatureIconSource helperFormatFeatureInfoResult helperGetFieldValue initOptionsWithInitialSettings

    Constructors

    Properties

    loadedOnce: boolean = false

    Indicates if the layer has become in loaded status at least once already

    loadingCounter: number = 0

    Counts the number of times the loading happened.

    loadingMarker: number = 0

    Marks the latest loading count for the layer. This useful to know when the put the layer loaded status back correctly with parallel processing happening

    DEFAULT_GET_FEATURE_INFO_TOLERANCE: number = 20

    The default Get Feature Info tolerance to use for QGIS Server services which are more picky by default (really needs to be zoomed in to get results, by default)

    DEFAULT_HIT_TOLERANCE: number = 4

    The default hit tolerance the query should be using

    DEFAULT_LOADING_PERIOD: number = ...

    The default loading period before we show a message to the user about a layer taking a long time to render on map

    DEFAULT_MAX_FEATURE_COUNT: number = 100

    The max feature count returned by the GetFeatureInfo

    Methods

    • 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[]

        Array of parameters to be interpolated into the localized message

      • messageType: SnackbarType = 'info'

        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

    • Formats a list of features into an array of TypeFeatureInfoEntry, including icons, field values, domains, and metadata.

      Parameters

      • features: Feature<Geometry>[]

        Array of features to format.

      • layerConfig: EsriDynamicLayerEntryConfig | VectorLayerEntryConfig | OgcWmsLayerEntryConfig

        Configuration of the associated layer.

      • OptionalserviceDateFormat: string

        The date format used by the service, if applicable.

      • OptionalserviceDateIANA: string

        The IANA time zone identifier used by the service, if applicable.

      • OptionalserviceDateTemporalMode: TemporalMode

        When calendar, treats the input as a calendar-date-only value (no timezones). When 'instant', treats the input as moment in time (timezones aware).

      Returns TypeFeatureInfoEntry[]

      An array of TypeFeatureInfoEntry objects.

    • Protected

      Overrides the get all feature information for all the features stored in the layer. This function performs a WFS 'GetFeature' query operation using the WFS layer configuration embedded in the WMS layer configuration.

      Parameters

      • map: Map

        The Map so that we can grab the resolution/projection we want to get features on.

      • layerFilters: LayerFilters

        The layer filters to apply when querying the features.

      • OptionalabortController: AbortController

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      A promise of a TypeFeatureInfoResult.

      If no WFS layer configuration is defined for this WMS layer.

      When the response is not OK (non-2xx).

      When the JSON response is empty.

      When the request exceeds the timeout duration.

      When the request was aborted by the caller's signal.

      When a network issue happened.

    • Gets the extent of an array of features.

      Parameters

      • objectIds: string[] | number[]

        The IDs of the features to calculate the extent from.

      • outProjection: Projection

        The output projection for the extent.

      • Optionaloutfield: string

        Optional. ID field to return for services that require a value in outfields.

      Returns Promise<Extent>

      The extent of the features, if available

    • Returns feature information for the layer specified.

      Parameters

      • map: Map

        The Map to get feature info from.

      • queryType: QueryType

        The type of query to perform.

      • location: TypeLocation

        An pixel, coordinate or polygon that will be used by the query.

      • queryGeometry: boolean = true

        Whether to include geometry in the query, default is true.

      • OptionalabortController: AbortController = undefined

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      The feature info table.

    • Protected

      Overrides the return of feature information at a given coordinate.

      Parameters

      • map: Map

        The Map where to get Feature Info At Coordinate from.

      • location: Coordinate

        The coordinate that will be used by the query.

      • queryGeometry: boolean = true

        Whether to include geometry in the query, default is true.

      • OptionalabortController: AbortController = undefined

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      A promise of a TypeFeatureInfoResult.

    • Protected

      Overrides the return of feature information at the provided long lat coordinate.

      Parameters

      • map: Map

        The Map where to get Feature Info At LonLat from.

      • lonlat: Coordinate

        The coordinate that will be used by the query.

      • queryGeometry: boolean = true

        Whether to include geometry in the query, default is true.

      • OptionalabortController: AbortController = undefined

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      A promise of a TypeFeatureInfoResult.

      If no WFS layer configuration is defined for this WMS layer.

    • Overridable function to return of feature information at a given pixel location.

      Parameters

      • map: Map

        The Map where to get Feature Info At Pixel from.

      • location: Pixel

        The pixel coordinate that will be used by the query.

      • queryGeometry: boolean = true

        Whether to include geometry in the query, default is true.

      • OptionalabortController: AbortController = undefined

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      A promise of TypeFeatureInfoResult.

    • Overridable function to return of feature information at the provided bounding box.

      Parameters

      • map: Map

        The Map where to get Feature using BBox from.

      • location: Coordinate[]

        The bounding box that will be used by the query.

      • queryGeometry: boolean = true

        Whether to include geometry in the query, default is true.

      • OptionalabortController: AbortController = undefined

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      A promise of a TypeFeatureInfoResult.

      When the function isn't overridden by the children class.

    • Overridable function to return of feature information at the provided polygon.

      Parameters

      • map: Map

        The Map where to get Feature Info using Polygon from.

      • location: Coordinate[]

        The polygon that will be used by the query.

      • queryGeometry: boolean = true

        Whether to include geometry in the query, default is true.

      • OptionalabortController: AbortController = undefined

        The optional abort controller.

      Returns Promise<TypeFeatureInfoResult>

      A promise of a TypeFeatureInfoResult.

      When the function isn't overridden by the children class.

    • Gets the layer style

      Returns
          | Partial<
              Record<
                  | "Point"
                  | "MultiPoint"
                  | "LineString"
                  | "MultiLineString"
                  | "Polygon"
                  | "MultiPolygon",
                  TypeLayerStyleSettings,
              >,
          >
          | undefined

      The layer style

    • Determines whether this layer is visible, taking into account the visibility of all its parent groups. A layer is considered visible only if:

      • the layer itself is visible, and
      • every parent GVGroupLayer up the hierarchy is also visible. This function walks upward through the group layer tree until it reaches the root, returning false immediately if any parent is not visible.

      Parameters

      • groupLayers: GVGroupLayer[]

        The top-level group layers from which the layer hierarchy is searched. This must represent the root collection of the layer tree.

      Returns boolean

      true if this layer and all its parent groups are visible; otherwise false.

    • Sends a query to get feature and calculates an extent from them.

      Parameters

      • objectIds: string[] | number[]

        The IDs of the features to calculate the extent from.

      • outProjection: Projection

        The output projection for the extent.

      • Optionaloutfield: string

        ID field to return for services that require a value in outfields.

      Returns Promise<Extent>

      The extent of the features, if available.

      If no WFS layer configuration is defined for this WMS layer.

      When the no outfields has the type 'oid'.

      When the extent couldn't be computed.

      When the response is not OK (non-2xx).

      When the JSON response is empty.

      When the request exceeds the timeout duration.

      When the request was aborted by the caller's signal.

      When a network issue happened.

    • Protected

      Deciphers an image load error event and returns a corresponding localized error message key. This override inspects the failed image request to detect more specific failure scenarios before falling back to a generic error message. The method currently checks for:

      • Image size exceeding the service-defined MaxWidth or MaxHeight constraints (if available in service metadata).
      • An empty image response (zero width or height). If none of the specific conditions are met, a generic image load error message key is returned.

      Parameters

      • event: Event

        The image load error event triggered by the image source.

      Returns string

      A translation key representing the detected error condition.

    • Updates the visibility of a style item on the layer and triggers a re-render. This method mutates the layer's style configuration for the specified legend item, calls changed() on the underlying OpenLayers layer to schedule a new render, and optionally waits for the next render cycle to complete.

      Parameters

      • item: TypeLegendItem

        The legend/style item whose visibility will be updated.

      • visibility: boolean

        Whether the style item should be visible.

      • waitForRender: boolean

        When true, waits for the next layer render to complete before resolving.

      Returns Promise<void>

      A promise that resolves after the visibility has been updated and, if requested, the layer has finished rendering.

    • Utility function allowing to wait for the layer style to be applied.

      Parameters

      • timeout: number = 30000

        A timeout for the period to wait for. Defaults to 30,000 ms.

      Returns Promise<
          Partial<
              Record<
                  | "Point"
                  | "MultiPoint"
                  | "LineString"
                  | "MultiLineString"
                  | "Polygon"
                  | "MultiPolygon",
                  TypeLayerStyleSettings,
              >,
          >,
      >

      A Promise that resolves when the layer style has been applied.

    • Applies a view filter to a WMS or an Esri Image layer's source by updating the source parameters. This function is responsible for generating the appropriate filter expression based on the layer configuration, optional style, and time-based fragments. It ensures the filter is only applied if it has changed or needs to be reset.

      Parameters

      • layerConfig: EsriImageLayerEntryConfig | OgcWmsLayerEntryConfig

        The configuration object for the WMS or Esri Image layer.

      • source: ImageArcGISRest | ImageWMS

        The OpenLayers ImageWMS or ImageArcGISRest source instance to which the filter will be applied.

      • filter: LayerFilters | undefined

        The raw filter string input (defaults to an empty string if not provided).

      Returns void

      If the filter expression fails to parse or cannot be applied.

    • Creates a legend object based on a given GeoView layer type and style configuration. This method builds a legend representation by combining the provided style settings with the computed legend symbols retrieved from the renderer. It is asynchronous because it waits for GeoviewRenderer.getLegendStyles to generate the legend items.

      Parameters

      • schemaTag: TypeGeoviewLayerType

        The GeoView layer type identifier (e.g., vector, raster, etc.).

      • Optionalstyle: Partial<
            Record<
                | "Point"
                | "MultiPoint"
                | "LineString"
                | "MultiLineString"
                | "Polygon"
                | "MultiPolygon",
                TypeLayerStyleSettings,
            >,
        >

        Optional style configuration mapping geometry types to their style settings.

      Returns Promise<TypeLegend>

      A promise that resolves to a legend object containing:

      • type: the layer type.
      • styleConfig: the provided style configuration.
      • legend: the legend entries generated from the style.
    • Fetches feature data from a WFS GetFeature request URL (expected to return GeoJSON), parses the response into OpenLayers features, and converts them into GeoView Feature Info entries with appropriate attribute formatting. This method:

      • Performs an HTTP request to a WFS GetFeature endpoint.
      • Parses the returned GeoJSON into OL features.
      • Applies WFS/WMS configuration (schema, outfields, styles, filters).
      • Formats fields according to WFS metadata, including date parsing rules.
      • Returns an array of standardized TypeFeatureInfoEntry objects.

      Parameters

      • urlWithOutputJson: string

        The full WFS GetFeature request URL. Must specify an output format compatible with GeoJSON (e.g., outputFormat=application/json).

      • wmsLayerConfig: OgcWmsLayerEntryConfig

        The associated WMS layer configuration. Styling and filter settings from this config are applied when formatting the Feature Info results.

      • wfsLayerConfig: OgcWfsLayerEntryConfig

        The WFS layer configuration used for schema tags, outfields, metadata, and date formatting.

      • OptionalabortController: AbortController = undefined

        Optional AbortController used to cancel the fetch request.

      Returns Promise<TypeFeatureInfoResult>

      A promise of a TypeFeatureInfoResult.

      When the response is not OK (non-2xx).

      When the JSON response is empty.

      When the request exceeds the timeout duration.

      When the request was aborted by the caller's signal.

      When a network issue happened.

    • Retrieves or generates an image source (data URI or path) representing the visual style of a feature. Caches results in the imageSourceDict to avoid redundant processing.

      Parameters

      • feature: Feature

        The feature whose visual representation is to be retrieved.

      • layerStyle: TypeLayerStyleConfig

        Style configuration grouped by geometry type (e.g., Point, LineString, Polygon).

      • domainsLookup: TypeLayerMetadataFields[] | undefined

        Optional domain information for interpreting coded values.

      • aliasLookup: Record<string, string>

        A mapping of original field names to their aliases.

      • imageSourceDict: Record<string, string | undefined>

        A dictionary used to cache and reuse image sources by style key.

      Returns string | undefined

      The image source string representing the feature's style, or undefined if generation fails.

    • Formats a set of OpenLayers features into a structured array of feature info entries. Each feature is enriched with geometry, extent, field information, and optional styling.

      Parameters

      • features: Feature<Geometry>[]

        Array of OpenLayers features to process.

      • layerPath: string

        Path of the layer these features belong to.

      • schemaTag: TypeGeoviewLayerType

        The Geoview layer type for the features.

      • nameField: string | undefined

        Optional field name to use as the display name for features.

      • outFields: TypeOutfields[] | undefined

        Optional array of output fields to include in the feature info.

      • supportZoomTo: boolean

        Whether zoom-to functionality is supported for these features.

      • domainsLookup: TypeLayerMetadataFields[] | undefined

        Optional array of field metadata for domain lookups.

      • layerStyle:
            | Partial<
                Record<
                    | "Point"
                    | "MultiPoint"
                    | "LineString"
                    | "MultiLineString"
                    | "Polygon"
                    | "MultiPolygon",
                    TypeLayerStyleSettings,
                >,
            >
            | undefined

        Optional mapping of geometry type to style settings for icons.

      • OptionalinputFormat: string | string[]

        The format(s) to prioritize for string inputs. Defaults to an ISO-like format.

      • OptionalinputTimezone: string

        The timezone IANA the dates are in.

      • OptionalinputTemporalMode: TemporalMode

        When calendar, treats the input as a calendar-date-only value (no timezones). When 'instant', treats the input as moment in time (timezones aware).

      • callbackGetFieldType: (fieldName: string) => TypeOutfieldsType

        Callback that returns the field type for a given field name.

      • callbackGetFieldDomain: (fieldName: string) => codedValueType | rangeDomainType | null

        Callback that returns the coded value or range domain for a given field name.

      • callbackGetFieldValue: GetFieldValueDelegate

        Callback that returns the value of a field for a feature, in the correct type.

      Returns TypeFeatureInfoEntry[]

      Array of feature info entries representing each feature with enriched metadata.

      Will not throw; errors are caught and logged. Returns an empty array if processing fails.

    • Retrieves and formats the value of a field from an OpenLayers feature. For fields of type date, the value is normalized and formatted using the date management utilities. Date values may be provided as epoch milliseconds or as date strings and are converted to a short ISO-like string.

      Parameters

      • feature: Feature

        The OpenLayers feature containing the field values.

      • fieldName: string

        The name of the field to retrieve.

      • fieldType: TypeOutfieldsType

        The type of the field (e.g. 'string', 'number', 'date').

      • OptionalinputFormat: string | string[]

        The format(s) to prioritize for string inputs. Defaults to an ISO-like format.

      • OptionalinputTimezone: string

        The IANA timezone to assume when interpreting input date values.

      • OptionalinputTemporalMode: TemporalMode

        When calendar, treats the input as a calendar-date-only value (no timezones). When 'instant', treats the input as moment in time (timezones aware).

      Returns unknown

      The formatted field value. For date fields, this is a formatted date string; for other field types, the raw field value is returned.