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

    Class EsriFeature

    A class to add an EsriFeature layer.

    EsriFeature

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    hitTolerance: number = AbstractGeoViewLayer.DEFAULT_HIT_TOLERANCE

    The default hit tolerance

    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.

    olRootLayer?: BaseLayer

    The OpenLayer root layer representing this GeoView Layer.

    DEFAULT_DISPLAY_DATE_MODE_TO_GENERATE_CONFIGS: DisplayDateMode = 'long'

    The default display date mode used when generating default configurations

    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

    DEFAULT_WAIT_PERIOD_METADATA_WARNING_RECALL: number = ...
    DEFAULT_WAIT_SLOW_FETCH_WARNING: number = ...

    The maximum delay to wait before we warn about the features fetch taking a long time

    EXCLUDED_HEADERS: string[] = ...
    EXCLUDED_HEADERS_GEN: string[] = ...
    EXCLUDED_HEADERS_LAT: string[] = ...
    EXCLUDED_HEADERS_LNG: string[] = ...
    EXCLUDED_HEADERS_STYLE: string[] = ...
    MAX_ESRI_FEATURES: 200000
    NAME_FIELD_KEYWORDS: string[] = ...

    Methods

    • Adds a GeoViewLayerLoadedFailedError in the internal list of errors for a layer being loaded. It also sets the layer status to error.

      Parameters

      • error: Error

        The error

      • layerConfig: ConfigBaseClass | undefined

        Optional layer config

      Returns void

    • Recursively processes the list of layer entries to see if all of them are greater than or equal to the provided layer status.

      Parameters

      • layerStatus: TypeLayerStatus

        The layer status to compare with the internal value of the config.

      Returns boolean

      true when all layers are greater than or equal to the layerStatus parameter.

    • 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

      • displayDateMode: DisplayDateMode

        The display date mode to use for processing time dimensions in the metadata.

      • OptionalmapProjection: Projection

        The map projection.

      • OptionalabortSignal: AbortSignal

        Optional AbortSignal used to cancel the layer creation process.

      Returns Promise<ConfigBaseClass[]>

      A promise of the config base classes created.

    • Creates a GV Layer from a layer configuration.

      Parameters

      • layerConfig: AbstractBaseLayerEntryConfig

        Information needed to create the GeoView layer.

      Returns AbstractGVLayer

      The GV Layer that has been created.

    • Creates a VectorSource from a layer config.

      Parameters

      • layerConfig: VectorLayerEntryConfig

        Configuration object for the vector tile layer.

      Returns GVVectorSource

      An initialized VectorSource ready for use in a layer.

    • 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

    • Fetches the metadata by calling onFetchServiceMetadata.

      Type Parameters

      • T

      Parameters

      • OptionalabortSignal: AbortSignal

        Optional AbortSignal used to cancel the layer creation process.

      Returns Promise<T>

      Returns a Promise of a metadata

      When the metadata fetch fails or contains an error.

      When the metadata is empty (no Capabilities) (WMS/WFS layers).

    • Recursively gets all layer entry configs in the GeoView Layer.

      Returns ConfigBaseClass[]

      The list of layer entry configs

    • A quick getter to help identify which layer class the current instance is coming from.

      Returns string

    • Gets the Geoview layer id.

      Returns string

      The geoview layer id

    • Returns the display name of the GeoView layer, if defined.

      Returns string

      The GeoView layer name.

    • Gets the first layer entry name if any sub-layers exist or else gets the geoviewLayerName or even the geoviewLayerId.

      Returns string

      The layer entry name if any sub-layers exist or the geoviewLayerName or even the geoviewLayerId.

    • Overrides the parent class's getter to provide a more specific return type (covariant return).

      Returns TypeMetadataEsriDynamic | TypeMetadataEsriFeature | undefined

      The strongly-typed layer metadata specific to this layer.

      Sometimes, the layer processing uses metadata coming from MapServer/?f=json (TypeMetadataEsriDynamic) and sometimes from FeatureServer/?f=json (TypeMetadataEsriFeature) which is the reason for the double types.

    • Retrieves the metadata access path used by this GeoView layer.

      Returns string

      The metadata access path.

      When the metadataAccessPath is undefined.

    • Gets the metadata access path if it exists.

      Returns string | undefined

      The trimmed metadata access path, or undefined if not defined.

    • Indicates if the metadata access path is defined in the config.

      Returns boolean

      True if the configuration has a metadata access path.

    • Initializes the layer entries based on the GeoviewLayerConfig that was initially provided in the constructor.

      Returns Promise<TypeGeoviewLayerConfig>

      A promise resolved once the layer entries have been initialized.

    • Unregisters a config created event handler.

      Parameters

      • callback: LayerConfigCreatedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer entry config processed event handler.

      Parameters

      • callback: LayerEntryProcessedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer entry config processed event handler.

      Parameters

      • callback: LayerEntryRegisterInitDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer creation event handler.

      Parameters

      • callback: LayerGroupCreatedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a config created event handler.

      Parameters

      • callback: LayerGVCreatedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer message event handler.

      Parameters

      • callback: LayerMessageDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Protected

      Overrides the creation of the GV Layer

      Parameters

      • layerConfig: EsriFeatureLayerEntryConfig

        The layer entry configuration.

      Returns GVEsriFeature

      The GV Layer

    • Overridable function to create a source configuration for the vector layer.

      Parameters

      • layerConfig: VectorLayerEntryConfig

        The layer entry configuration.

      • sourceOptions: Options<Feature<Geometry>>

        The source options (default: { strategy: all }).

      Returns GVVectorSource

      The source configuration that will be used to create the vector layer.

    • Protected

      Overrides the loading of the vector features for the layer by fetching EsriFeature data and converting it into OpenLayers Feature feature instances.

      Parameters

      • layerConfig: VectorLayerEntryConfig

        The configuration object for the vector layer, containing source and data access information.

      • sourceOptions: Options<Feature<Geometry>>

        The OpenLayers vector source options associated with the layer. This may be used by implementations to customize loading behavior or source configuration.

      • readOptions: ReadOptions

        Options controlling how features are read, including the target featureProjection.

      Returns Promise<Feature<Geometry>[]>

      A promise that resolves to an array of OpenLayers features.

    • Protected

      Overrides the way the metadata is fetched. Resolves with the Json object or undefined when no metadata is to be expected for a particular layer type.

      Type Parameters

      • T =
            | TypeMetadataEsriDynamic
            | TypeMetadataEsriDynamicLayer
            | TypeMetadataEsriFeature
            | undefined

      Parameters

      • OptionalabortSignal: AbortSignal

        Optional AbortSignal used to cancel the layer creation process.

      Returns Promise<T>

      A promise with the metadata or undefined when no metadata for the particular layer type.

      This function returns TypeMetadataEsriDynamic | TypeMetadataEsriDynamicLayer | TypeMetadataEsriFeature because sometimes the url is MapServer/?f=json, sometimes MapServer/{layerId}?f=json and sometimes FeatureServer/?f=json which all return different payloads.

      When the metadata fetch fails or contains an error.

    • Overridable function to perform additional initialization on the created GV Layer.

      Parameters

      Returns void

    • Protected

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

      Parameters

      • OptionalabortSignal: AbortSignal

        Optional AbortSignal used to cancel the layer creation process.

      Returns Promise<TypeGeoviewLayerConfig>

      A promise resolved once the layer entries have been initialized.

      When the metadata fetch fails or contains an error.

    • Registers a config created event handler.

      Parameters

      • callback: LayerConfigCreatedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer entry config processed event handler.

      Parameters

      • callback: LayerEntryProcessedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer entry config processed event handler.

      Parameters

      • callback: LayerEntryRegisterInitDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer creation event handler.

      Parameters

      • callback: LayerGroupCreatedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a config created event handler.

      Parameters

      • callback: LayerGVCreatedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer message event handler.

      Parameters

      • callback: LayerMessageDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Protected

      Overrides the way the layer metadata is processed.

      Parameters

      • layerConfig: EsriFeatureLayerEntryConfig

        The layer entry configuration to process.

      • displayDateMode: DisplayDateMode

        The display date mode to use for processing time dimensions in the metadata.

      • OptionalmapProjection: Projection

        The map projection.

      • OptionalabortSignal: AbortSignal

        Optional AbortSignal used to cancel the layer creation process.

      Returns Promise<EsriFeatureLayerEntryConfig>

      A promise that the layer entry configuration has gotten its metadata processed.

      When the layer has too many Esri features.

    • Overridable method to process a layer entry and return a Promise of an Open Layer Base Layer object.

      Parameters

      • layerConfig: AbstractBaseLayerEntryConfig

        Information needed to create the GeoView layer.

      Returns Promise<AbstractGVLayer>

      The Geoview Layer that has been created.

    • Overridable method to validate the configuration of the layer entries to ensure that each layer is correctly defined.

      Parameters

      • layerConfig: ConfigBaseClass

      Returns void

    • Protected

      This method validates recursively the configuration of the layer entries to ensure that it is a feature layer identified with a numeric layerId and creates a group entry when a layer is a group.

      Parameters

      • listOfLayerEntryConfig: ConfigBaseClass[]

        The list of layer entries configuration to validate.

      Returns void

    • Sets the metadata access path used by this GeoView layer.

      Parameters

      • metadataAccessPath: string

        The metadata access path to set.

      Returns void

    • Validates the configuration of the layer entries to ensure that each layer is correctly defined.

      Parameters

      • layerConfig: ConfigBaseClass

        The layer entry config to validate

      Returns void

    • Recursively validates the configuration of the layer entries to ensure that each layer is correctly defined.

      Parameters

      • listOfLayerEntryConfig: ConfigBaseClass[]

        The list of layer entries configuration to validate.

      Returns void

    • Creates a configuration object for an Esri Feature layer. This function constructs a TypeEsriFeatureLayerConfig object that describes an Esri Feature layer and its associated entry configurations based on the provided parameters.

      Parameters

      • geoviewLayerId: string

        A unique identifier for the GeoView layer.

      • geoviewLayerName: string

        The display name of the GeoView layer.

      • metadataAccessPath: string

        The full service URL to the layer endpoint.

      • isTimeAware: boolean | undefined

        Indicates whether the layer supports time-based filtering.

      • layerEntries: TypeLayerEntryShell[]

        An array of layer entries objects to be included in the configuration.

      Returns TypeEsriFeatureLayerConfig

      The constructed configuration object for the Esri Feature layer.

    • Fetches json data from the given URL using settings defined in the vector source configuration. Supports both GET and POST requests depending on the presence of postSettings.

      Parameters

      • url: string

        The URL to fetch data from.

      • OptionalpostSettings: TypePostSettings

        The possible POST settings from the layer config.

      Returns Promise<unknown>

      A promise that resolves to the fetched text response.

    • Fetches text data from the given URL using settings defined in the vector source configuration. Supports both GET and POST requests depending on the presence of postSettings.

      Parameters

      • url: string

        The URL to fetch data from.

      • OptionalpostSettings: TypePostSettings

        The possible POST settings from the layer config.

      Returns Promise<string>

      A promise that resolves to the fetched text response.

    • Initializes a GeoView layer configuration for a Esri Feature 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.

      • OptionalisTimeAware: boolean

        Indicates whether the layer supports time-based filtering.

      Returns Promise<TypeGeoviewLayerConfig>

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

    • Protected

      Processes a Layer Config by calling 'createGeoViewLayers' on the provided layer.

      Parameters

      Returns Promise<ConfigBaseClass[]>

      The promise of a generated ConfigBaseClass.

    • Processes an Esri Feature 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.

      Returns Promise<ConfigBaseClass[]>

      A promise that resolves to an array of layer configurations.