Class CogSource

Provides data from a Cloud Optimized GeoTIFF (COG).

Hierarchy

Constructors

Properties

_bps: number
_cache: Cache = GlobalCache
_cacheId: string = ...
_cacheOptions: CogCacheOptions
_channels: number[]
_dimensions: Vector2
_extent: Extent
_format: any
_imageCount: number
_initializePromise: Promise<void>
_initialized: boolean
_levels: Level[]
_nodata: number
_origin: number[]
_pool: Pool
_sampleCount: number
_tiffImage: GeoTIFF
containsFn: CustomContainsFn
crs: string
datatype: TextureDataType

Gets the datatype of images generated by this source.

flipY: boolean

Gets whether images generated from this source should be flipped vertically.

isCogSource: boolean = true
isImageSource: boolean = true
type: string
url: string
version: number

Accessors

  • get channels(): number[]
  • Gets the channel mapping.

    Returns number[]

  • set channels(value): void
  • Parameters

    • value: number[]

    Returns void

Methods

  • Adds a listener to an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<ImageSourceEvents[T], T, CogSource>

      The function that gets called when the event is fired.

    Returns void

  • Type Parameters

    • T extends string

    Parameters

    • type: T
    • listener: EventListener<{}, T, CogSource>

    Returns void

  • Parameters

    • requestExtent: Extent

      The request extent.

    • requestWidth: number

      The width, in pixels, of the request extent.

    • requestHeight: number

      The height, in pixels, of the request extent.

    • margin: number = 0

      The margin, in pixels.

    Returns {
        extent: Extent;
        height: number;
        width: number;
    }

    The adjusted parameters.

    • extent: Extent
    • height: number
    • width: number
  • Gets whether this source contains the specified extent. If a custom contains function is provided, it will be used. Otherwise, intersects() is used.

    This method is mainly used to discard non-relevant requests (i.e don't process regions that are not relevant to this source).

    Parameters

    • extent: Extent

      The extent to test.

    Returns boolean

  • Creates a texture from the pixel buffer(s).

    Parameters

    • buffers: SizedArray<NumberArray>

      The buffers (one buffer per band)

    Returns DataTexture

    The generated texture.

  • Fire an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    Returns void

  • Disposes unmanaged resources of this source.

    Returns void

  • Parameters

    • image: GeoTIFFImage

      The image to read.

    • window: number[]

      The image region to read.

    • Optional signal: AbortSignal

      The abort signal.

    Returns Promise<TypedArray | TypedArray[]>

    The buffers.

  • Returns the CRS of this source.

    Returns string

    The CRS.

  • Returns the extent of this source expressed in the CRS of the source.

    Returns Extent

    The extent of the source.

  • Gets the images for the specified extent and pixel size.

    Parameters

    • options: {
          extent: Extent;
          height: number;
          id: string;
          signal?: AbortSignal;
          width: number;
      }

      The options.

      • extent: Extent
      • height: number
      • id: string
      • Optional signal?: AbortSignal
      • width: number

    Returns {
        id: string;
        request: (() => Promise<ImageResult>);
    }[]

    An array containing the functions to generate the images asynchronously.

  • Extract a region from the specified image.

    Parameters

    • extent: Extent

      The request extent.

    • level: Level

      The level to sample.

    • signal: AbortSignal

      The abort signal.

    • id: string

      The request id.

    Returns Promise<unknown>

    The buffer(s).

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<ImageSourceEvents[T], T, CogSource>

      The function that gets called when the event is fired.

    Returns boolean

  • Type Parameters

    • T extends string

    Parameters

    • type: T
    • listener: EventListener<{}, T, CogSource>

    Returns boolean

  • Initializes the source.

    Returns Promise<void>

    A promise that resolves when the source is initialized.

  • Returns Promise<void>

  • Test the intersection between the specified extent and this source's extent. This method may be overriden to perform special logic.

    Parameters

    • extent: Extent

      The extent to test.

    Returns boolean

    true if the extent and this source extent intersects, false otherwise.

  • Parameters

    • opts: {
          extent: Extent;
          height: number;
          id: string;
          signal?: AbortSignal;
          width: number;
      }
      • extent: Extent
      • height: number
      • id: string
      • Optional signal?: AbortSignal
      • width: number

    Returns Promise<ImageResult>

  • Returns a window in the image's coordinates that matches the requested extent.

    Parameters

    • extent: Extent

      The window extent.

    • resolution: number[]

      The spatial resolution of the window.

    Returns number[]

    The window.

  • Removes a listener from an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: EventListener<ImageSourceEvents[T], T, CogSource>

      The listener function that gets removed.

    Returns void

  • Type Parameters

    • T extends string

    Parameters

    • type: T
    • listener: EventListener<{}, T, CogSource>

    Returns void

  • Select the best overview level (or the final image) to match the requested extent and pixel width and height.

    Parameters

    • requestExtent: Extent

      The window extent.

    • requestWidth: number

      The pixel width of the window.

    • requestHeight: number

      The pixel height of the window.

    Returns Level

    The selected zoom level.

  • Raises an event to reload the source.

    Returns void

  • Attemps to compute the exact extent of the TIFF image.

    Parameters

    • crs: string

      The CRS.

    • tiffImage: GeoTIFFImage

      The TIFF image.

    Returns Extent

Generated using TypeDoc