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 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
constructor(lat: number, lng: number, ellipsoid: Ellipsoid = null)
Build a Coordinate object with latitude lat and longitude lng according to the Ellipsoid.
getLat()
Return the latitude (number)
getLng()
Return the longitude (number)
getPoints()
Return an array with this Coordinate object (Array
getEllipsoid()
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)
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.
Add a comment