geoview-core
    Preparing search index...

    Class LayerApi

    A class to get the layer from layer type. Layer type can be esriFeature, esriDynamic and ogcWMS

    LayerApi

    Index

    Constructors

    Properties

    Methods

    Constructors

    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

    initialLayerOrder: TypeOrderedLayerInfo[] = []

    Order to load layers

    legendsLayerSet: LegendsLayerSet

    Legends layer set associated to the map

    mapViewer: MapViewer

    Reference on the map viewer

    DEBUG_WMS_LAYER_GROUP_FULL_SUB_LAYERS: false

    Temporary debugging flag indicating if we want the WMS group layers to have their sub layers fully blown up

    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.

      Parameters

      • geoviewLayerConfig: TypeGeoviewLayerConfig

        The geoview layer configuration to add.

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of fetch.

      Returns GeoViewLayerAddedResult

      The result of the addition of the geoview layer. The result contains the instanciated GeoViewLayer along with a promise that will resolve when the layer will be officially on the map.

    • Calculates an union of all the layer extents based on the given layerPath and its possible children.

      Parameters

      • layerPath: string

        The layer path

      Returns Extent | undefined

      An extent representing an union of all layer extents associated with the layer path

    • Checks if the layer results sets are all greater than or equal to the provided status

      Parameters

      • status: TypeLayerStatus
      • OptionalcallbackNotGood: (layerConfig: ConfigBaseClass) => void

      Returns [boolean, number]

    • Clears any overridden CRS settings on all WMS layers in the map. Iterates through all GeoView layers, identifies those that are instances of GVWMS, and resets their override CRS to undefined, allowing them to use the default projection behavior.

      Returns void

    • Creates an instance of a specific AbstractGeoViewLayer subclass based on the given GeoView layer configuration. This function determines the correct layer type from the configuration and instantiates it accordingly.

      Parameters

      • geoviewLayerConfig: TypeGeoviewLayerConfig

        The configuration object for the GeoView layer.

      Returns AbstractGeoViewLayer

      An instance of the corresponding AbstractGeoViewLayer subclass.

      • This method currently supports GeoJSON, CSV, WMS, Esri Dynamic, Esri Feature, Esri Image, ImageStatic, WFS, OGC Feature, XYZ Tiles, and Vector Tiles.
      • If the layer type is not supported, an error is thrown.
      • TODO: Refactor to use the validated configuration with metadata already fetched.

      If the configuration does not match any supported layer type.

    • Gets the max extent of all layers on the map, or of a provided subset of layers.

      Parameters

      • layerIds: string[] = ...

        IDs or layerPaths of layers to get max extents from.

      Returns Extent

      The overall extent.

    • Returns the GeoView instance associated to the layer path.

      Parameters

      • layerPath: string

        The layer path

      Returns AbstractBaseLayer

      The new Geoview Layer

      Error thrown when the layer couldn't be found at the given layer path.

    • Returns the GeoView instance associated to the layer path.

      Parameters

      • layerPath: string

        The layer path

      Returns AbstractBaseLayer | undefined

      The new Geoview Layer or undefined when not found

    • 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 the specified layer path.

      Parameters

      • layerPath: string

        The layer path.

      Returns ConfigBaseClass | undefined

      The layer configuration or undefined if not found.

    • Returns the OpenLayer instance associated with the layer path.

      Parameters

      • layerPath: string

        The layer path to the layer's configuration.

      Returns BaseLayer

      Returns the geoview instance associated to the layer path.

      Error thrown when the layer couldn't be found 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>

      Returns the OpenLayer layer associated to the layer path.

    • Returns the OpenLayer instance associated with the layer path.

      Parameters

      • layerPath: string

        The layer path to the layer's configuration.

      Returns BaseLayer | undefined

      Returns the geoview instance associated to the layer path.

    • Verifies if a layer is registered. Returns true if registered.

      Parameters

      • layerPath: string

        The layer path to check.

      Returns boolean

      Returns true if the layer configuration is registered.

    • Load layers that was passed in with the map config

      Parameters

      • mapConfigLayerEntries: MapConfigLayerEntry[]

        An optional array containing layers passed within the map config

      Returns Promise<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

    • 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

    • Registers the layer in the LayerApi layer-sets to start managing it. This function may be used to start managing a layer in the UI when said layer has been created outside of the regular config->layer flow.

      Parameters

      • layer: AbstractGVLayer

        The layer to register

      Returns void

    • Removes layer and feature highlights for a given layer.

      Parameters

      • layerPath: string

        The path of the layer to remove highlights from.

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

        The new field aliases to use.

      Returns void

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

      Error thrown when the layer couldn't be found at the given layer path.

      Error thrown when the layer is not a GeoJson layer.

    • Toggle visibility of an item.

      Parameters

      • layerPath: string

        The layer path of the layer to change.

      • item: TypeLegendItem

        The item to change.

      • visibility: boolean

        The visibility to set.

      • updateLegendLayers: boolean = true

        Should legend layers be updated (here to avoid repeated rerendering when setting all items in layer).

      Returns void

    • Renames a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • name: string

        The new name to use.

      Returns void

      Error thrown when the layer couldn't be found at the given layer path.

    • Sets opacity for a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • opacity: number

        The new opacity to use.

      • OptionalemitOpacityChange: boolean

        Whether to emit the event or not (false to avoid updating the legend layers)

      Returns void

      Error thrown when the layer couldn't be found at the given layer path

    • Sets or toggles the visibility of a layer.

      Parameters

      • layerPath: string

        The path of the layer.

      • OptionalnewValue: boolean

        The new value of visibility.

      Returns boolean

      Error thrown when the layer couldn't be found at the given layer path.

    • Show the errors that happened during layers loading. If it's an aggregate error, log and show all of them. If it's a regular error, log and show only that error.

      Parameters

      • error: unknown

        The error to log and show.

      • geoviewLayerId: string

        The Geoview layer id for which the error happened.

      Returns void

    • Unregisters the layer in the LayerApi to stop managing it.

      Parameters

      • layerConfig: ConfigBaseClass

        The layer entry config to unregister

      • unregisterOrderedLayerInfo: boolean = true

        Should it be unregistered from orderedLayerInfo

      Returns void

    • Converts a list of map configuration layer entries into an array of promises, each resolving to one or more GeoView layer configuration objects.

      Parameters

      • mapId: string

        The unique identifier of the map instance this configuration applies to.

      • language: TypeDisplayLanguage

        The language setting used for layer labels and metadata.

      • mapConfigLayerEntries: MapConfigLayerEntry[]

        The array of layer entries to convert.

      • errorCallback: (mapConfigLayerEntry: MapConfigLayerEntry, error: unknown) => void

        Callback invoked when an error occurs during layer processing.

      Returns Promise<TypeGeoviewLayerConfig>[]

      An array of promises, each resolving to an array of TypeGeoviewLayerConfig objects.

    • Converts a map configuration layer entry into a promise of a GeoView layer configuration. Depending on the type of the layer entry (e.g., GeoCore, GeoPackage, Shapefile, RCS, or standard GeoView), this function processes each entry accordingly and wraps the result in a Promise. Errors encountered during asynchronous operations are handled via a provided callback.

      Parameters

      • mapId: string

        The unique identifier of the map instance this configuration applies to.

      • language: TypeDisplayLanguage

        The language setting used for layer labels and metadata.

      • entry: MapConfigLayerEntry

        The array of layer entry to convert.

      • errorCallback: (mapConfigLayerEntry: MapConfigLayerEntry, error: unknown) => void

        Callback invoked when an error occurs during layer processing.

      Returns Promise<TypeGeoviewLayerConfig>

      The promise resolving to a TypeGeoviewLayerConfig object.