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

    Class GVGeoJSON

    Manages a GeoJSON layer.

    GVGeoJSON

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    emitMessage formatFeatureInfoResult getAllFeatureInfo getAttributions getBounds getClassName getExtent getExtentFromFeatures getFeatureInfo getFeatureInfoAtCoordinate getFeatureInfoAtLonLat getFeatureInfoAtPixel getFeatureInfoUsingBBox getFeatureInfoUsingPolygon getFilterFromStyle getGeoviewLayerId getGeoviewLayerName getHitTolerance getHoverable getInVisibleRange getIsTimeAware getLayerConfig getLayerFilters getLayerName getLayerPath getLayerStatus getLegend getMaxZoom getMinZoom getOLLayer getOLSource getOpacity getParent getParentRoot getParents getQueryable getStyle getStyleItemVisibility getTimeDimension getVisible getVisibleIncludingParents init inVisibleRange offLayerError offLayerFilterApplied offLayerFirstLoaded offLayerHoverableChanged offLayerLoaded offLayerLoading offLayerMessage offLayerNameChanged offLayerOpacityChanged offLayerQueryableChanged offLayerStyleChanged offLegendQueried offLegendQuerying offStyleApplied offVisibleChanged onError onErrorDecipherError onFetchLegend onGetAttributions onGetBounds onGetExtentFromFeatures onImageLoadError onImageLoadErrorDecipherError onLayerError onLayerFilterApplied onLayerFirstLoaded onLayerHoverableChanged onLayerLoaded onLayerLoading onLayerMessage onLayerNameChanged onLayerOpacityChanged onLayerQueryableChanged onLayerStyleChanged onLegendQueried onLegendQuerying onLoaded onLoading onRefresh onSetLayerFilters onSetOpacity onSetStyleAccordingToLegend onStyleApplied onVisibleChanged queryLegend refresh setExtent setGeojsonSource setHoverable setLayerFilters setLayerFiltersDate setLayerName setLegend setMaxZoom setMinZoom setOLLayer setOpacity setParent setQueryable setStyle setStyleApplied setStyleItemVisibility setVisible updateGeojsonSource waitForRender waitForSourceReady waitLegendFetched waitLoadedOnce waitLoadedStatus waitStyleApplied calculateStyleForFeature 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

    styleApplied: boolean = false

    Indicates if the style has been applied on the layer yet

    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: unknown[] | undefined

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

      Overrides the 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 a TypeFeatureInfoResult.

    • Gets the bounds for the layer in the given projection. When the layer is a GVLayer, its layer bounds are returned. When the layer is a GVGroup, an Extent union of all layers bounds in the group is returned.

      Parameters

      • projection: Projection

        The projection to get the bounds into.

      • stops: number

        The number of stops to use to generate the extent.

      Returns Promise<Extent | undefined>

      A promise of 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.

    • Protected

      Overrides the 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 a TypeFeatureInfoResult.

    • Protected

      Overrides the 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.

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

    • Retrieves all parent group layers of this layer in hierarchical order.

      The returned array starts with the immediate parent and continues up the hierarchy until the root group layer is reached or a group has already been visited (not supposed to happen).

      Returns GVGroupLayer[]

      An array of parent GVGroupLayer instances, ordered from the immediate parent to the top-most ancestor. Returns an empty array if the layer has no parent.

      This method traverses upward through the parent chain starting from the immediate parent of this layer. A protection mechanism prevents infinite loops in case of circular parent references.

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

      Returns boolean

      true if this layer and all its parent groups are visible; otherwise false.

    • Gets the extent of an array of features.

      Parameters

      • objectIds: string[] | number[]

        The uids 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.

    • Overridable method to set the opacity of the layer.

      If the layer has a parent, the provided opacity is clamped so that it cannot be greater than the parent's opacity. The resulting opacity is applied to the underlying OpenLayers layer.

      If the layer is a GVGroupLayer, the computed opacity is recursively applied to all child layers to maintain consistency within the layer hierarchy.

      Optionally emits a layer opacity change event.

      Parameters

      • opacity: number

        The desired opacity for the layer, typically between 0 (fully transparent) and 1 (fully opaque).

      • emitOpacityChanged: boolean = true

        Optional, whether to emit a layer opacity changed event after updating the opacity. Defaults to true.

      Returns void

    • Loads a Geojson object as the layer source features, overriding the current features if any.

      Parameters

      • geojson: string | GeoJSONObject

        The geoJSON object.

      • projection: Projection

        The output projection.

      Returns Promise<void>

    • Sets the opacity of the layer while ensuring it does not exceed the opacity of its parent layer.

      If the layer has a parent, the provided opacity is clamped so that it cannot be greater than the parent's opacity. The resulting opacity is applied to the underlying OpenLayers layer.

      If the layer is a GVGroupLayer, the computed opacity is recursively applied to all child layers to maintain consistency within the layer hierarchy.

      Optionally emits a layer opacity change event.

      Parameters

      • opacity: number

        The desired opacity for the layer, typically between 0 (fully transparent) and 1 (fully opaque).

      • emitOpacityChanged: boolean = true

        Optional, whether to emit a layer opacity change event after updating the opacity. Defaults to true.

      Returns void

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

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

      • 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 date fields, the raw value (epoch ms or date string) is normalized via the date management utilities.
      • For fields with a codedValue domain, the raw code is resolved to its human-readable name. If no matching code is found, the raw value is returned.
      • For all other fields, the raw value is returned as-is.

      Parameters

      • feature: Feature

        The OpenLayers feature containing the field values.

      • fieldName: string

        The name of the field to retrieve.

      • fieldType: TypeOutfieldsType

        The data type of the field (e.g. 'string', 'number', 'date', 'oid').

      • fieldDomain: codedValueType | rangeDomainType | undefined

        Optional domain metadata. When present and of type codedValue, the raw field value is mapped to the corresponding coded-value name.

      • inputFormat: string | string[] | undefined

        Optional format(s) to prioritize when parsing date string inputs.

      • inputTimezone: string | undefined

        Optional IANA timezone to assume when interpreting date values.

      • inputTemporalMode: TemporalMode | undefined

        Optional temporal mode. 'calendar' treats dates as timezone-agnostic calendar dates; 'instant' treats them as timezone-aware moments.

      Returns unknown

      The processed field value: a formatted date for date fields, the decoded name for coded-value domains, or the raw value otherwise.