TsGeo - Resources - Coordinate

The Coordinate class is the most important class of TsGeo and provides the base for all features.

It’s a representation of a geographic location and consists of three parts:

  • Geographic Latitude
  • Geographic Longitude
  • Ellipsoid

Geographic latitude and longitude values are float numbers between -90.0 and 90.0 (degrees latitude) and -180.0 and 180.0 (degrees longitude).

The Ellipsoid is a representation of an approximated shape of the earth and is abstracted in its own Ellipsoid class

Public Methods

constructor(lat: number, lng: number, ellipsoid: Ellipsoid = null)

Build a Coordinate object with latitude lat and longitude lng according to the Ellipsoid.


Return the latitude (number)


Return the longitude (number)


Return an array with this Coordinate object (Array)


Return the ellipsoid (Ellipsoid)

getDistance(coordinate: Coordinate, calculator: DistanceInterface)

Return the distance between this object and coordinate using the calculator (number)

format(formatter: FormatterInterface)

Return a string of this Coordinate object using the formatter (string)

Static Methods

isValidLatitude(latitude: number)

Return true if latitude is between -90° and 90°, otherwise false.

isValidLongitude(longitude: number)

Return true if longitude is between -180° and 180°, otherwise false.

isNumericInBounds(value: number, lower: number, upper: number)

Return true if value is between lower and upper, otherwise false.

Retour Line

Ajouter un commentaire