Constructor
new Cartesian_ReferenceFrame(x, y, z, referenceFrameopt, epochopt)
Creates cartesian coordinate representing ECEF (earth-centric earth-fixed) point, on a given
reference frame. The reference frame will identify the primary meridian (for the x-coordinate),
and is also useful in transforming to/from geodetic (lat/lon) coordinates.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
number | X coordinate in metres (=> 0°N,0°E). | ||
y |
number | Y coordinate in metres (=> 0°N,90°E). | ||
z |
number | Z coordinate in metres (=> 90°N). | ||
referenceFrame |
LatLon.referenceFrames |
<optional> |
Reference frame this coordinate is defined within. | |
epoch |
number |
<optional> |
referenceFrame.epoch | date of observation of coordinate (decimal year). |
Throws:
-
Unrecognised reference frame, Invalid epoch.
- Type
- TypeError
Example
import { Cartesian } from '/js/geodesy/latlon-ellipsoidal-referenceframe.js';
const coord = new Cartesian(3980581.210, -111.159, 4966824.522);
Extends
- Cartesian
Members
epoch
Point’s observed epoch.
referenceFrame
Reference frame this point is defined within.
Methods
convertReferenceFrame(toReferenceFrame) → {Cartesian}
Converts ‘this’ cartesian coordinate to new reference frame using Helmert 14-parameter
transformation. The observation epoch is unchanged.
Note that different conversions have different tolerences; refer to the literature if
tolerances are significant.
Parameters:
Name | Type | Description |
---|---|---|
toReferenceFrame |
LatLon.referenceFrames | Reference frame this coordinate is to be converted to. |
Throws:
-
Undefined reference frame.
- Type
- Error
Returns:
This point converted to new reference frame.
- Type
- Cartesian
Example
const c = new Cartesian(3980574.247, -102.127, 4966830.065, LatLon.referenceFrames.ITRF2000);
c.convertReferenceFrame(LatLon.referenceFrames.ETRF2000); // [3980574.395,-102.214,4966829.941](ETRF2000@1997.0)
toLatLon() → {LatLon}
Converts ‘this’ (geocentric) cartesian (x/y/z) coordinate to (geodetic) latitude/longitude
point (based on the same reference frame).
Shadow of Cartesian.toLatLon(), returning LatLon augmented with LatLonEllipsoidal_ReferenceFrame
methods convertReferenceFrame, toCartesian, etc.
Throws:
-
No reference frame defined.
- Type
- Error
Returns:
Latitude/longitude point defined by cartesian coordinates, in given reference frame.
- Type
- LatLon
Example
const c = new Cartesian(4027893.924, 307041.993, 4919474.294, LatLon.referenceFrames.ITRF2000);
const p = c.toLatLon(); // 50.7978°N, 004.3592°E
toString(dpopt) → {string}
Returns a string representation of ‘this’ cartesian point. TRF is shown if set, and
observation epoch if different from reference epoch.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
dp |
number |
<optional> |
0 | Number of decimal places to use. |
Returns:
Comma-separated latitude/longitude.
- Type
- string