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

    Class LayerApi

    Public API facade for layer operations.

    Provides external consumers with a stable entry point for layer management, querying, and event subscription. Internally delegates to controllers and domains, re-emitting domain events so that external code can subscribe without depending on internal architecture.

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Initializes the layer API and subscribes to domain and controller events.

      Parameters

      • controllerRegistry: ControllerRegistry

        The controller registry for accessing controllers

      • layerDomain: LayerDomain

        The layer domain for event subscriptions

      • geometryApi: GeometryApi

        The geometry API for creating and managing geometries

      • featureHighlight: FeatureHighlight

        The feature highlight utility for feature and bounding box highlighting

      Returns LayerApi

    Properties

    allFeatureInfoLayerSet: AllFeatureInfoLayerSet

    All feature info layer set associated to the map

    featureHighlight: FeatureHighlight

    Used to access feature and bounding box highlighting

    featureInfoLayerSet: FeatureInfoLayerSet

    Feature info layer set associated to the map

    geometry: GeometryApi

    Used to access geometry API to create and manage geometries

    hoverFeatureInfoLayerSet: HoverFeatureInfoLayerSet

    Hover feature info layer set associated to the map

    legendsLayerSet: LegendsLayerSet

    Legends layer set associated to the map

    Methods

    • Adds a layer to the map.

      This is the main method to add a GeoView Layer on the map. It handles all the processing, including the validations, and makes sure to inform the layer sets about the layer. The result contains the instanciated GeoViewLayer along with a promise that will resolve when the layer will be officially on the map.

      Parameters

      • geoviewLayerConfig: TypeGeoviewLayerConfig

        The geoview layer configuration to add.

      • OptionalabortSignal: AbortSignal

        Optional AbortSignal used to cancel the layer creation process.

      Returns GeoViewLayerAddedResult

      The result of the addition of the geoview layer.

      When there already is a layer on the map with the provided geoviewLayerId.

    • Adds a Geoview Layer by GeoCore UUID.

      Parameters

      • uuid: string

        The GeoCore UUID to add to the map

      • OptionallayerEntryConfig: string

        The optional layer configuration

      Returns Promise<GeoViewLayerAddedResult | undefined>

      A promise that resolves with the added layer result or undefined when an error occurs

    • Returns the AbstractGVLayer instance associated to the layer path.

      This returns an actual AbstractGVLayer and throws a LayerWrongTypeError if the layerPath points to a GVGroupLayer object. An AbstractGVLayer is essentially a layer that's not a group layer.

      Parameters

      • layerPath: string

        The layer path

      Returns AbstractGVLayer

      The new Geoview Layer

      When the layer couldn't be found at the given layer path.

      When the layer is of wrong type at the given layer path.

    • Returns the GeoView Layer instance associated to the layer path.

      This returns an actual AbstractGVLayer (or undefined) and throws a LayerWrongTypeError if the layerPath points to a GVGroupLayer object. An AbstractGVLayer is essentially a layer that's not a group layer.

      Parameters

      • layerPath: string

        The layer path

      Returns AbstractGVLayer | undefined

      The AbstractGVLayer or undefined when not found

      When the layer is of wrong type at the given layer path.

    • Gets all GeoView layers that are group layers.

      This method filters the list returned by getGeoviewLayers() and returns only the layers that are instances of GVGroupLayer.

      Returns GVGroupLayer[]

      An array containing only the group layers from the current GeoView layer collection.

    • Gets all GeoView layers that are regular layers (not groups).

      This method filters the list returned by getGeoviewLayers() and returns only the layers that are instances of AbstractGVLayer.

      Returns AbstractGVLayer[]

      An array containing only the regular layers from the current GeoView layer collection.

    • Gets the layer configuration of the specified layer path.

      Parameters

      • layerPath: string

        The layer path.

      Returns ConfigBaseClass

      The layer configuration.

      When the layer configuration couldn't be found at the given layer path.

    • Gets the layer configuration of a group layer (not a regular) at the specified layer path.

      Parameters

      • layerPath: string

        The layer path.

      Returns GroupLayerEntryConfig

      The layer configuration.

      When the layer configuration couldn't be found at the given layer path.

      When the layer configuration is of the wrong type at the given layer path.

    • Gets the layer configuration of the specified layer path.

      Parameters

      • layerPath: string

        The layer path.

      Returns ConfigBaseClass | undefined

      The layer configuration or undefined if not found.

    • Gets the layer configuration of a regular layer (not a group) at the specified layer path.

      Parameters

      • layerPath: string

        The layer path.

      Returns AbstractBaseLayerEntryConfig

      The layer configuration.

      When the layer configuration couldn't be found at the given layer path.

      When the layer configuration is of the wrong type at the given layer path.

    • Asynchronously returns the OpenLayer layer associated to a specific layer path.

      This function waits the timeout period before abandonning (or uses the default timeout when not provided). Note this function uses the 'Async' suffix to differentiate it from 'getOLLayer'.

      Parameters

      • layerPath: string

        The layer path to the layer's configuration.

      • Optionaltimeout: number

        Optionally indicate the timeout after which time to abandon the promise

      • OptionalcheckFrequency: number

        Optionally indicate the frequency at which to check for the condition on the layerabstract

      Returns Promise<BaseLayer>

      A promise that resolves to an OpenLayer layer associated to the layer path.

    • Initializes the events on the domain to listen to changes and re-emit the events higher. This is a shortcut to not have the event from the domain have to go through the controller to be caught by the layer api.

      Parameters

      • layerDomain: LayerDomain

        The layer domain to listen on

      Returns void

    • Initializes events on the layer creator controller to relay layer lifecycle events.

      Subscribes to layer config added, config error, config removed, and layer created events from the controller and re-emits them for external consumers.

      Parameters

      • layerCreatorController: LayerCreatorController

        The layer creator controller to listen on

      • layerController: LayerController

        The layer controller to listen on

      Returns void

    • Unregisters a layer all loaded/error event handler.

      Parameters

      • callback: DomainLayerStatusChangedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer config added event handler.

      Parameters

      • callback: LayerBuilderDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer config error event handler.

      Parameters

      • callback: LayerConfigErrorDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer removed event handler.

      Parameters

      • callback: LayerPathDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer created event handler.

      Parameters

      • callback: LayerDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer error event handler.

      Parameters

      • callback: LayerApiLayerErrorDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer first loaded event handler.

      Parameters

      • callback: DomainLayerBaseDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer item visibility toggled event handler.

      Parameters

      • callback: ControllerLayerItemVisibilityChangedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer loaded event handler.

      Parameters

      • callback: DomainLayerBaseDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a layer loading event handler.

      Parameters

      • callback: DomainLayerBaseDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Unregisters a callback from being called whenever the layer status is updated.

      Parameters

      • callback: DomainLayerStatusChangedDelegate

        The callback function to unregister

      Returns void

    • Unregisters a layer visibility toggled event handler.

      Parameters

      • callback: LayerApiLayerVisibleChangedDelegate

        The callback to stop being called whenever the event is emitted

      Returns void

    • Registers a layer all loaded/error event handler.

      Parameters

      • callback: DomainLayerStatusChangedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer config added event handler.

      Parameters

      • callback: LayerBuilderDelegate

        The callback to be executed whenever the event is emitted

      Returns void

      Stop using that hook, it's misleading as it's not a layer config that's added, it's a geoview-layer instance.

    • Registers a layer config error event handler.

      Parameters

      • callback: LayerConfigErrorDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer removed event handler.

      Parameters

      • callback: LayerPathDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer created event handler.

      Parameters

      • callback: LayerDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer error event handler.

      Parameters

      • callback: LayerApiLayerErrorDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer first loaded event handler.

      Parameters

      • callback: DomainLayerBaseDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer item visibility toggled event handler.

      Parameters

      • callback: ControllerLayerItemVisibilityChangedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer loaded event handler.

      Parameters

      • callback: DomainLayerBaseDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a layer loading event handler.

      Parameters

      • callback: DomainLayerBaseDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Registers a callback to be executed whenever the layer status is updated.

      Parameters

      • callback: DomainLayerStatusChangedDelegate

        The callback function

      Returns void

    • Registers a layer visibility toggled event handler.

      Parameters

      • callback: LayerApiLayerVisibleChangedDelegate

        The callback to be executed whenever the event is emitted

      Returns void

    • Redefine feature info fields.

      Parameters

      • layerPath: string

        The path of the layer.

      • fieldNames: string[]

        The new field names to use.

      • fields: "name" | "alias"

        The fields to change.

      Returns void

      When the layer configuration couldn't be found at the given layer path.

      When the layer configuration is of the wrong type at the given layer path.

      When the layer configuration has different field lengths.

      When the layer configuration is not queryable.

    • Loops through all geoview layers and refresh their respective source. Use this function on projection change or other viewer modification who may affect rendering.

      Returns void

    • Removes a layer from the map using its layer path. The path may point to the root geoview layer or a sub layer.

      Parameters

      • layerPath: string

        The path or ID of the layer to be removed

      Returns void

    • Replace outfield names, aliases and types with any number of new values, provided an identical count of each are supplied.

      Parameters

      • layerPath: string

        The path of the layer.

      • types: TypeOutfieldsType[]

        The new field types (TypeOutfieldsType) to use.

      • fieldNames: string[]

        The new field names to use.

      • OptionalfieldAliases: string[]

        Optional, the new field aliases to use.

      Returns void

      When the layer configuration couldn't be found at the given layer path.

      When the layer configuration is of the wrong type at the given layer path.

      When the layer configuration has different field lengths.

      When the layer configuration is not queryable.

    • Changes a GeoJson Source of a GeoJSON layer at the given layer path.

      Parameters

      • layerPath: string

        The path of the layer.

      • geojson: string | GeoJSONObject

        The new geoJSON.

      Returns Promise<void>

      A promise that resolves when the geojson source has been set

      When the layer couldn't be found at the given layer path.

      When the layer is of wrong type at the given layer path.

      When the layer is not a GeoJson layer.

    • Sets the visibility of a single legend item on a regular (non-group) layer.

      This method updates the visibility of the specified item both in the underlying layer's style configuration and optionally in the legend store. It can also trigger the layer filters to be reapplied and optionally wait for the next render cycle before resolving. Finally, it emits an event indicating the visibility change.

      Parameters

      • layerPath: string

        The path identifying the target layer within the map.

      • item: TypeLegendItem

        The legend item whose visibility will be updated.

      • visibility: boolean

        Whether the item should be visible.

      • waitForRender: boolean

        If true, the promise resolves only after the underlying layer has finished its next render cycle.

      Returns Promise<void>

      A promise that resolves once the visibility has been applied, optional legend store updated, filters applied, and render completed if requested

      When the layer couldn't be found at the given layer path.

      When the layer was of wrong type.

    • Sets the date temporal mode for the specific layer.

      This updates the layer-level configuration used to control how date values are interpreted. The value is stored in the application state via the layerController.

      Parameters

      • layerPath: string

        The unique path identifying the layer.

      • temporalMode: TemporalMode

        The date format to apply for displaying date values associated with this layer.

      Returns void

    • Sets the date display format for a specific layer.

      This updates the layer-level configuration used to control how date values are formatted when displayed (e.g., in legends, tooltips, or UI components). The value is stored in the application state via the layerController.

      Parameters

      • layerPath: string

        The unique path identifying the layer.

      • displayDateFormat: string | TypeDisplayDateFormat

        The date format to apply for displaying date values associated with this layer.

      Returns void

    • Sets the date display format (short) for a specific layer.

      Short means the date should be displayed in a more compact format. This updates the layer-level configuration used to control how date values are formatted when displayed (e.g., in legends, tooltips, or UI components). The value is stored in the application state via the layerController.

      Parameters

      • layerPath: string

        The unique path identifying the layer.

      • displayDateFormat: string | TypeDisplayDateFormat

        The date format to apply for displaying date values associated with this layer.

      Returns void

    • Sets hoverable state for a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • hoverable: boolean

        The new hoverable state for the layer.

      Returns void

      When the layer couldn't be found at the given layer path.

      When the layer was of wrong type.

    • Sets the mosaic rule for an ESRI Image layer.

      Parameters

      • layerPath: string

        The layer path

      • mosaicRule: TypeMosaicRule | undefined

        The mosaic rule to apply or undefined to remove it

      Returns void

    • Renames a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • name: string

        The new name to use.

      Returns void

      When the layer couldn't be found at the given layer path.

    • Sets the opacity of a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • opacity: number

        The new opacity value for the layer.

      Returns void

      When the layer couldn't be found at the given layer path.

    • Sets queryable state for a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • queryable: boolean

        The new queryable state for the layer.

      Returns void

      When the layer couldn't be found at the given layer path.

      When the layer was of wrong type.

    • Updates the raster function for an ESRI Image layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • rasterFunctionId: string | undefined

        The raster function ID to apply or undefined to remove it.

      Returns void

      When the layer couldn't be found at the given layer path.

      When the layer is not an ESRI Image layer.

    • Sets the WMS style for a WMS layer.

      Parameters

      • layerPath: string

        The layer path

      • wmsStyle: string

        The WMS style to apply

      Returns void

    • Sets or toggles the visibility of a layer within the current map.

      Retrieves the current visibility of the layer, determines the resulting visibility based on the optional newValue, and applies the change only if the visibility actually differs. If newValue is provided, the visibility is set explicitly; if omitted, the method toggles the current visibility.

      Parameters

      • layerPath: string

        The path of the layer whose visibility is being updated.

      • OptionalnewValue: boolean

        Optional. The new visibility value to apply. If omitted, the current visibility is toggled.

      Returns boolean

      The resulting visibility state of the layer after the update

      When the layer cannot be found at the given path.

    • Zoom to extents of a layer.

      Parameters

      • layerPath: string

        The path of the layer to zoom to.

      • OptionalfitOptions: FitOptions

        Optional fit options for zooming.

      Returns Promise<void>

      A promise that resolves when the zoom operation is complete

      When the layer doesn't have bounds.