Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

allLayers

  • allLayers(map: Map): Layer[]
  • Recurses through all {@link LayerGroup}s in a {@link Map} and returns an array of actual {@link Layer}s found.

    Parameters

    • map: Map

    Returns Layer[]

clamp

  • clamp(x: number, min?: number, max?: number): number
  • Clams a number to a given range, default 0.0 to 1.0.

    Parameters

    • x: number
    • min: number = 0.0
    • max: number = 1.0

    Returns number

clampedInterpolate

  • clampedInterpolate(low: number, high: number, t: number): number
  • Linear interpolation between low and high, at position t, clamping t to 0 <= t <= 1. I.e. the function will return low at minimum and high at maximum, regardless of t.

    Parameters

    • low: number
    • high: number
    • t: number

    Returns number

interpolate

  • interpolate(low: number, high: number, t: number): number
  • Linear interpolation between low and high, at position t.

    Parameters

    • low: number
    • high: number
    • t: number

    Returns number

isCoordinate

  • isCoordinate(o: any): o is Coordinate
  • Tests if the given object represents a valid {@link Coordinate}, i.e. is an array of two or three elements, with element 0 and 1 being numbers.

    Parameters

    • o: any

    Returns o is Coordinate

maxFinite

  • maxFinite(a: number, b: number): number
  • Returns the maximum of the two numbers, ignoring NaN and infinity.

    Parameters

    • a: number
    • b: number

    Returns number

minFinite

  • minFinite(a: number, b: number): number
  • Returns the minimum of the two numbers, ignoring NaN and infinity.

    Parameters

    • a: number
    • b: number

    Returns number

recurseLayers

  • recurseLayers(layersOrMap: Collection<BaseLayer> | Map, visitor: (l: Layer) => void): void
  • Recurses through all {@link LayerGroup}s in a {@link Map} and invokes the given visitor function with every {@link Layer} encountered.

    Parameters

    • layersOrMap: Collection<BaseLayer> | Map
    • visitor: (l: Layer) => void
        • (l: Layer): void
        • Parameters

          • l: Layer

          Returns void

    Returns void

stripZ

  • stripZ(o: Coordinate | Coordinate[] | Coordinate[][] | Coordinate[][][] | Geometry | Geometry[] | Feature | Feature[] | undefined): void
  • Truncates all coordinate arrays to two entries. This is primarily a workaround for the fact that the OpenLayers GML parser reads everything into 3D coordinates, even when the XML specifically states it is 2-dimensional. While this is not usually much of a problem, the WKT Writer respects the number of dimensions in a geometry, resulting in a lot of redundant zero Z-values. This function can be used to truncate coordinates to 2D.

    Parameters

    • o: Coordinate | Coordinate[] | Coordinate[][] | Coordinate[][][] | Geometry | Geometry[] | Feature | Feature[] | undefined

    Returns void

toExtent

  • toExtent(a: Coordinate, b: Coordinate): Extent
  • Creates an {@link Extent} with the corners defined by the coordinates. The given min and max will automatically be swapped if needed.

    Parameters

    • a: Coordinate
    • b: Coordinate

    Returns Extent

toGeometry

  • toGeometry(o: Geometry | Feature | Extent | Coordinate): Geometry
  • Converts the given object to a {@link Geometry}, by either extracting it from a Feature or creating a Geometry representing the same point or box.

    Parameters

    • o: Geometry | Feature | Extent | Coordinate

    Returns Geometry