# All files / components/geo/processing GeoTable.ts

33.33% Statements 4/12
20% Branches 2/10
50% Functions 1/2
36.36% Lines 4/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45

    1x
    1x
    1x

    1x

     export interface Coordinates {
      lon: number
      lat: number
    }

    export enum CoordinateEncoding {
      GEO_HASH,
      FIELDS,
    }

    export interface Track extends Array<number[]> {}

    export interface GeoTable {
      getValue(index: number, field: string): number

      getRowCount(): number

      getLatLon(index: number): Coordinates

      getTimeString(index: number): string

      isTruncated(): boolean

      mapTracks<T, U>(
        mapper: (track: Track, options: U, index: number) => T,
        options: U
      ): T[]
    }

    export interface MinAndMax {
      min?: number
      max?: number
    }

    export const getMinAndMax = (table: GeoTable, field: string): MinAndMax => {
      const rowCount = table.getRowCount()
      const acc: MinAndMax = {}
      for (let i = 0; i < rowCount; i++) {
        const value = table.getValue(i, field)
        acc.min = acc.min === undefined ? value : value < acc.min ? value : acc.min
        acc.max = acc.max === undefined ? value : value > acc.max ? value : acc.max
      }
      return acc
    }