Constructor
new LatLonEllipsoidal_ReferenceFrame(lat, lon, heightopt, referenceFrameopt, epochopt)
Creates geodetic latitude/longitude point on an ellipsoidal model earth using using a
specified reference frame.
Note that while the epoch defaults to the frame reference epoch, the accuracy of ITRF
realisations is meaningless without knowing the observation epoch.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat |
number | Geodetic latitude in degrees. | ||
lon |
number | Geodetic longitude in degrees. | ||
height |
number |
<optional> |
0 | Height above ellipsoid in metres. |
referenceFrame |
LatLon.referenceFrames |
<optional> |
ITRF2014 | Reference frame this point is defined within. |
epoch |
number |
<optional> |
referenceFrame.epoch | date of observation of coordinate (decimal year). defaults to reference epoch t₀ of reference frame. |
Throws:
-
Unrecognised reference frame.
- Type
- TypeError
Example
import LatLon from '/js/geodesy/latlon-ellipsoidal-referenceframe.js';
const p = new LatLon(51.47788, -0.00147, 0, LatLon.referenceFrames.ITRF2000);
Extends
- LatLonEllipsoidal
Members
(static) ellipsoids
Ellipsoid parameters; semi-major axis (a), semi-minor axis (b), and flattening (f).
The only ellipsoids used in modern geodesy are WGS-84 and GRS-80 (while based on differing
defining parameters, the only effective difference is a 0.1mm variation in the minor axis b).
Example
const availableEllipsoids = Object.keys(LatLon.ellipsoids).join(); // WGS84,GRS80
const a = LatLon.ellipsoids.Airy1830.a; // 6377563.396
(static) referenceFrames
Reference frames, with their base ellipsoids and reference epochs.
Example
const availableReferenceFrames = Object.keys(LatLon.referenceFrames).join(); // ITRF2014,ITRF2008, ...
(static) transformParameters
14-parameter Helmert transformation parameters between (dynamic) ITRS frames, and from ITRS
frames to (static) regional TRFs NAD83, ETRF2000, and GDA94.
This is a limited set of transformations; e.g. ITRF frames prior to ITRF2000 are not included.
More transformations could be added on request.
Many conversions are direct; for NAD83, successive ITRF transformations are chained back to
ITRF2000.
epoch
Point’s observed epoch.
referenceFrame
Reference frame this point is defined within.
Methods
(static) parse(lat|latlon, lonopt, height, referenceFrame, epochopt) → {LatLon}
Parses a latitude/longitude point from a variety of formats.
Latitude & longitude (in degrees) can be supplied as two separate parameters, as a single
comma-separated lat/lon string, or as a single object with { lat, lon } or GeoJSON properties.
The latitude/longitude values may be numeric or strings; they may be signed decimal or
deg-min-sec (hexagesimal) suffixed by compass direction (NSEW); a variety of separators are
accepted. Examples -3.62, '3 37 12W', '3°37′12″W'.
Thousands/decimal separators must be comma/dot; use Dms.fromLocale to convert locale-specific
thousands/decimal separators.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lat|latlon |
number | string | Object | Geodetic Latitude (in degrees) or comma-separated lat/lon or lat/lon object. | ||
lon |
number |
<optional> |
Longitude in degrees. | |
height |
number | Height above ellipsoid in metres. | ||
referenceFrame |
LatLon.referenceFrames | Reference frame this point is defined within. | ||
epoch |
number |
<optional> |
referenceFrame.epoch | date of observation of coordinate (decimal year). |
Throws:
-
Unrecognised reference frame.
- Type
- TypeError
Returns:
Latitude/longitude point on ellipsoidal model earth using given reference frame.
- Type
- LatLon
Example
const p1 = LatLon.parse(51.47788, -0.00147, 17, LatLon.referenceFrames.ETRF2000); // numeric pair
const p2 = LatLon.parse('51°28′40″N, 000°00′05″W', 17, LatLon.referenceFrames.ETRF2000); // dms string + height
const p3 = LatLon.parse({ lat: 52.205, lon: 0.119 }, 17, LatLon.referenceFrames.ETRF2000); // { lat, lon } object numeric
convertReferenceFrame(toReferenceFrame) → {LatLon}
Converts ‘this’ lat/lon coordinate to new coordinate system.
Parameters:
Name | Type | Description |
---|---|---|
toReferenceFrame |
LatLon.referenceFrames | Reference frame this coordinate is to be converted to. |
Throws:
-
Undefined reference frame, Transformation not available.
- Type
- Error
Returns:
This point converted to new reference frame.
- Type
- LatLon
Example
const pEtrf = new LatLon(51.47788000, -0.00147000, 0, LatLon.referenceFrames.ITRF2000);
const pItrf = pEtrf.convertReferenceFrame(LatLon.referenceFrames.ETRF2000); // 51.47787826°N, 000.00147125°W
toCartesian() → {Cartesian}
Converts ‘this’ point from (geodetic) latitude/longitude coordinates to (geocentric) cartesian
(x/y/z) coordinates, based on same reference frame.
Shadow of LatLonEllipsoidal.toCartesian(), returning Cartesian augmented with
LatLonEllipsoidal_ReferenceFrame methods/properties.
Returns:
Cartesian point equivalent to lat/lon point, with x, y, z in metres from
earth centre, augmented with reference frame conversion methods and properties.
- Type
- Cartesian
toString(formatopt, dpopt, dpHeightopt, referenceFrameopt) → {string}
Returns a string representation of ‘this’ point, formatted as degrees, degrees+minutes, or
degrees+minutes+seconds.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
format |
string |
<optional> |
d | Format point as 'd', 'dm', 'dms'. |
dp |
number |
<optional> |
4|2|0 | Number of decimal places to use: default 4 for d, 2 for dm, 0 for dms. |
dpHeight |
number |
<optional> |
null | Number of decimal places to use for height; default (null) is no height display. |
referenceFrame |
boolean |
<optional> |
false | Whether to show reference frame point is defined on. |
Returns:
Comma-separated formatted latitude/longitude.
- Type
- string
Example
new LatLon(51.47788, -0.00147, 0, LatLon.referenceFrames.ITRF2014).toString(); // 51.4778°N, 000.0015°W
new LatLon(51.47788, -0.00147, 0, LatLon.referenceFrames.ITRF2014).toString('dms'); // 51°28′40″N, 000°00′05″W
new LatLon(51.47788, -0.00147, 42, LatLon.referenceFrames.ITRF2014).toString('dms', 0, 0); // 51°28′40″N, 000°00′05″W +42m