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

    Class AbstractGVLayerAbstract

    Abstract Geoview Layer managing an OpenLayer layer.

    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 getHitTolerance getHoverable getInVisibleRange getIsTimeAware getLayerConfig getLayerFilters getLayerName getLayerPath getLayerStatus getLegend getMaxZoom getMinZoom getOLLayer getOLSource getOpacity getParent getQueryable getStyle getStyleItemVisibility getTimeDimension getVisible getVisibleIncludingParents init inVisibleRange offLayerError offLayerFilterApplied offLayerFirstLoaded offLayerHoverableChanged offLayerLoaded offLayerLoading offLayerMessage offLayerNameChanged offLayerOpacityChanged offLayerQueryableChanged offLayerStyleChanged offLegendQueried offLegendQuerying offVisibleChanged onError onFetchLegend onGetAttributions onGetBounds onGetExtentFromFeatures onGetFieldDomain onGetFieldType onImageLoadError onImageLoadErrorDecipherError onLayerError onLayerFilterApplied onLayerFirstLoaded onLayerHoverableChanged onLayerLoaded onLayerLoading onLayerMessage onLayerNameChanged onLayerOpacityChanged onLayerQueryableChanged onLayerStyleChanged onLegendQueried onLegendQuerying onLoaded onLoading onRefresh onSetLayerFilters onSetStyleAccordingToLegend onSourceChange onVisibleChanged queryLegend refresh setExtent setHoverable setLayerFilters setLayerFiltersDate setLayerName setLegend setMaxZoom setMinZoom setOLLayer setOpacity setQueryable setStyle setStyleItemVisibility setVisible waitForRender waitForSourceReady waitLegendFetched waitLoadedOnce waitLoadedStatus waitStyleApplied createLegendFromStyle 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_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

    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

      Overridable function to get all feature information for all the features stored in the layer.

      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 TypeFeatureInfoResult.

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

    • Gets the bounds for the layer in the given projection.

      Parameters

      • projection: Projection

        The projection to get the bounds into.

      • stops: number

        The number of stops to use to generate the extent.

      Returns Extent | undefined

      The layer bounding box.

    • 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.

    • Overridable function to 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 TypeFeatureInfoResult.

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

    • Overridable function to 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.

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

    • 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 flag if layer use its time dimension, this can be use to exclude layers from time function like time slider

      Returns boolean

      The flag indicating if the layer should be included in time awareness functions such as the Time Slider. True by default.

    • 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.

    • Initializes the GVLayer. This function checks if the source is ready and if so it calls onLoaded() to pursue initialization of the layer. If the source isn't ready, it registers to the source ready event to pursue initialization of the layer once its source is ready.

      Returns void

    • Must override method to return the bounds of a layer in the given projection.

      Parameters

      • projection: Projection

        The projection to get the bounds into.

      • stops: number

        The number of stops to use to generate the extent.

      Returns Extent | undefined

      The layer bounding box.

    • Overridable function that 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

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

      Returns Promise<Extent>

      The extent of the features, if available

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

    • Overridable function to return the domain of the specified field or null if the field has no domain.

      Parameters

      • fieldName: string

        The field name for which we want to get the domain.

      Returns codedValueType | rangeDomainType | null

      The domain of the field.

    • Overridable function to return the type of the specified field from the metadata. If the type can not be found, return 'string'.

      Parameters

      • fieldName: string

        The field name for which we want to get the type.

      Returns TypeOutfieldsType

      The type of the field.

    • Overridable method called to get a more specific error code for image load errors.

      Parameters

      • event: Event

        The event which is being triggered.

      Returns string

      The error code to use for the error message to the user, default is 'layers.errorImageLoad'.

    • 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.

    • Waits for the next render cycle of the underlying OpenLayers layer to complete. Resolves the returned promise after the layer emits a postrender event, indicating that it has finished rendering for a frame.

      Returns Promise<void>

      A promise that resolves after the layer has rendered at least once.

    • Waits until the underlying OpenLayers source reaches the ready state. If the source is already ready, the returned promise resolves immediately. If the source enters the error state, the promise is rejected.

      Returns Promise<void>

      A promise that resolves when the source state becomes ready, or rejects if the source enters the error state.

    • Utility function allowing to wait for the layer to be loaded at least once.

      Parameters

      • timeout: number = 30000

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

      Returns Promise<boolean>

      A Promise that resolves when the layer has been loaded at least once.

    • Utility function allowing to wait for the layer to be loaded at least once.

      Parameters

      • timeout: number = 30000

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

      Returns Promise<boolean>

      A Promise that resolves when the layer has been loaded at least once.

    • 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.

    • 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.
    • 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.

    • Initializes common properties on a layer options.

      Parameters

      • layerOptions: Options

        The layer options to initialize

      • layerConfig: AbstractBaseLayerEntryConfig

        The config to read the initial settings from

      Returns void