# Class: Cartesian

## latlon-ellipsoidal~Cartesian(x, y, z)

ECEF (earth-centered earth-fixed) geocentric cartesian coordinates.

## Constructor

#### new Cartesian(x, y, z)

Creates cartesian coordinate representing ECEF (earth-centric earth-fixed) point.
##### Parameters:
Name Type 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).
Source:
##### Example
``````import { Cartesian } from '/js/geodesy/latlon-ellipsoidal.js';
const coord = new Cartesian(3980581.210, -111.159, 4966824.522);``````

• Vector3d

### Methods

#### toLatLon(ellipsoidopt) → {LatLon}

Converts ‘this’ (geocentric) cartesian (x/y/z) coordinate to (geodetic) latitude/longitude point on specified ellipsoid. Uses Bowring’s (1985) formulation for μm precision in concise form; ‘The accuracy of geodetic latitude and height equations’, B R Bowring, Survey Review vol 28, 218, Oct 1985.
##### Parameters:
Name Type Attributes Default Description
`ellipsoid` LatLon.ellipsoids <optional>
WGS84 Ellipsoid to use when converting point.
Source:
##### Throws:
Invalid ellipsoid.
Type
TypeError
##### Returns:
Latitude/longitude point defined by cartesian coordinates, on given ellipsoid.
Type
LatLon
##### Example
``````const c = new Cartesian(4027893.924, 307041.993, 4919474.294);
const p = c.toLatLon(); // 50.7978°N, 004.3592°E``````

#### toString(dpopt) → {string}

Returns a string representation of ‘this’ cartesian point.
##### Parameters:
Name Type Attributes Default Description
`dp` number <optional>
0 Number of decimal places to use.
Source:
##### Returns:
Comma-separated latitude/longitude.
Type
string