Constructor
new Cartesian_Datum(x, y, z, datumopt)
Creates cartesian coordinate representing ECEF (earth-centric earth-fixed) point, on a given
datum. The datum 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 | 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). | |
datum |
LatLon.datums |
<optional> |
Datum this coordinate is defined within. |
- Source:
Throws:
-
Unrecognised datum.
- Type
- TypeError
Example
import { Cartesian } from '/js/geodesy/latlon-ellipsoidal-datum.js';
const coord = new Cartesian(3980581.210, -111.159, 4966824.522);
Extends
- Cartesian
Members
datum
Datum this point is defined within.
- Source:
Methods
convertDatum(toDatum) → {Cartesian}
Converts ‘this’ cartesian coordinate to new datum using Helmert 7-parameter transformation.
Parameters:
Name | Type | Description |
---|---|---|
toDatum |
LatLon.datums | Datum this coordinate is to be converted to. |
- Source:
Throws:
-
Undefined datum.
- Type
- Error
Returns:
This point converted to new datum.
- Type
- Cartesian
Example
const c = new Cartesian(3980574.247, -102.127, 4966830.065, LatLon.datums.OSGB36);
c.convertDatum(LatLon.datums.Irl1975); // [??,??,??]
toLatLon() → {LatLon}
Converts ‘this’ (geocentric) cartesian (x/y/z) coordinate to (geodetic) latitude/longitude
point (based on the same datum, or WGS84 if unset).
Shadow of Cartesian.toLatLon(), returning LatLon augmented with LatLonEllipsoidal_Datum
methods convertDatum, toCartesian, etc.
- Source:
Throws:
-
Unrecognised datum
- Type
- TypeError
Returns:
Latitude/longitude point defined by cartesian coordinates.
- Type
- LatLon
Example
const c = new Cartesian(4027893.924, 307041.993, 4919474.294);
const p = c.toLatLon(); // 50.7978°N, 004.3592°E