Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LatLng

Hierarchy

  • LatLng

Index

Constructors

constructor

  • new LatLng(latitude: number, longitude: number): LatLng
  • new LatLng(coords: number[]): LatLng
  • Creates an object representing a geographical point with the given latitude and longitude.

    Parameters

    • latitude: number
    • longitude: number

    Returns LatLng

  • Creates an object representing a geographical point with the given latitude and longitude.

    Parameters

    • coords: number[]

    Returns LatLng

Properties

lat

lat: number

Latitude in degrees.

lng

lng: number

Longitude in degrees.

Static DEG_TO_RAD

DEG_TO_RAD: number

A multiplier for converting degrees into radians.

Value: Math.PI / 180.

Static MAX_MARGIN

MAX_MARGIN: number

Max margin of error for the equality check.

Value: 1.0E-9.

Static RAD_TO_DEG

RAD_TO_DEG: number

A multiplier for converting radians into degrees.

Value: 180 / Math.PI.

Methods

distanceTo

  • distanceTo(otherLatlng: LatLng): number
  • Returns the distance (in meters) to the given LatLng calculated using the Haversine formula. See description on wikipedia

    Parameters

    Returns number

equals

  • equals(otherLatlng: LatLng): boolean
  • Returns true if the given LatLng point is at the same position (within a small margin of error).

    Parameters

    Returns boolean

toString

  • toString(): string
  • Returns a string representation of the point (for debugging purposes).

    Returns string

wrap

  • wrap(left: number, right: number): LatLng
  • Returns a new LatLng object with the longitude wrapped around left and right boundaries (-180 to 180 by default).

    Parameters

    • left: number
    • right: number

    Returns LatLng