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

    addGeoviewLayer addGeoviewLayerByGeoCoreUUID checkLayerStatus clearVectorFeaturesFromAllFeatureInfoLayerSet clearWMSLayersWithOverrideCRS getExtentOfMultipleLayers getGeoviewLayer getGeoviewLayerIds getGeoviewLayerIfExists getGeoviewLayerPaths getGeoviewLayerRegular getGeoviewLayerRegularIfExists getGeoviewLayers getGeoviewLayersGroups getGeoviewLayersRegulars getLayerEntryConfig getLayerEntryConfigGroup getLayerEntryConfigIfExists getLayerEntryConfigRegular getLayerEntryConfigs getLayerEntryLayerPaths getMapId getOLLayer getOLLayerAsync getOLLayerIfExists highlightLayer isLayerEntryConfigRegistered loadListOfGeoviewLayer offLayerAllLoaded offLayerConfigAdded offLayerConfigError offLayerConfigRemoved offLayerCreated offLayerError offLayerFirstLoaded offLayerItemVisibilityToggled offLayerLoaded offLayerLoading offLayerStatusChanged offLayerVisibilityToggled onLayerAllLoaded onLayerConfigAdded onLayerConfigError onLayerConfigRemoved onLayerCreated onLayerError onLayerFirstLoaded onLayerItemVisibilityToggled onLayerLoaded onLayerLoading onLayerStatusChanged onLayerVisibilityToggled redefineFeatureFields refreshLayers registerLayerConfigInit reloadGeocoreLayers reloadLayer removeAllGeoviewLayers removeAllLayersInError removeHighlightLayer removeLayerHighlights removeLayerUsingPath repeatLastQuery replaceFeatureOutfields setAllLayersVisibility setGeojsonSource setItemVisibility setLayerDateTemporalMode setLayerDisplayDateFormat setLayerDisplayDateFormatShort setLayerHoverable setLayerName setLayerOpacity setLayerQueryable setOrToggleLayerVisibility showLayerError unregisterLayerConfig convertMapConfigsToGeoviewLayerConfig convertMapConfigToGeoviewLayerConfig createLayerConfigFromType generateArrayOfLayerOrderInfo

    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

    MIN_MAX_ZOOM_LEVEL_BUFFER: 0.21

    A zoom level buffer to guarantee that the calculations being done via the resolutions, inches per meter, dpi are more strict than not enough

    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

        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. The result contains the instanciated GeoViewLayer along with a promise that will resolve when the layer will be officially on the map.

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

      Indicates if all layers passed the callback and how many have passed the callback.

    • 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

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

      The new Geoview Layer

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

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

      Parameters

      • layerPath: string

        The layer path

      Returns AbstractBaseGVLayer | undefined

      The AbstractBaseGVLayer or undefined when not found

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

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

      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 a Promise of an 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>

      A Promise resolving when everything is done

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

      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.

      • refresh: boolean

        If true, updates the legend layers store to reflect this change (used to avoid repeated rerenders when updating multiple items).

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

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

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

      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.

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

      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.

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

      If the layer cannot be found at the given 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.

    • 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, GeoTIFF ImageStatic, KML, WFS, WKB, 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.