Package pygeodesy :: Module ellipsoidalNvector :: Class Nvector
[frames] | no frames]

Class Nvector

  object --+                
           |                
named._Named --+            
               |            
named._NamedBase --+        
                   |        
   vector3d.Vector3d --+    
                       |    
 nvectorBase.NvectorBase --+
                           |
                          Nvector

An n-vector is a position representation using a (unit) vector normal to the earth ellipsoid. Unlike lat-/longitude points, n-vectors have no singularities or discontinuities.

For many applications, n-vectors are more convenient to work with than other position representations like lat-/longitude, earth-centred earth-fixed (ECEF) vectors, UTM coordinates, etc.

Note commonality with sphericalNvector.Nvector.

Instance Methods
 
__init__(self, x, y, z, h=0, datum=None, ll=None, name='')
New n-vector normal to the earth's surface.
 
copy(self)
Copy this vector.
 
toCartesian(self, **kwds)
Convert this n-vector to Nvector-based cartesian (ECEF) coordinates.
 
toLatLon(self, **kwds)
Convert this n-vector to an Nvector-based geodetic point.
 
unit(self, ll=None)
Normalize this vector to unit length.

Inherited from nvectorBase.NvectorBase: to3abh, to3llh, to4xyzh, toStr, toVector3d

Inherited from vector3d.Vector3d: __abs__, __add__, __cmp__, __div__, __eq__, __ge__, __gt__, __le__, __lt__, __matmul__, __mul__, __ne__, __neg__, __pos__, __radd__, __rmatmul__, __rsub__, __sub__, __truediv__, angleTo, cross, dividedBy, dot, equals, isequalTo, minus, negate, others, parse, plus, rotate, rotateAround, sum, times, to2ab, to2ll, to3xyz

Inherited from named._NamedBase: __repr__, __str__, toStr2

Inherited from named._Named: __copy__, classof

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties
  datum
Get this n-vector's datum (Datum).

Inherited from nvectorBase.NvectorBase: Ecef, H, h

Inherited from vector3d.Vector3d: crosserrors, length, x, y, z

Inherited from named._Named: classname, classnaming, name, named, named2

Inherited from object: __class__

Method Details

__init__(self, x, y, z, h=0, datum=None, ll=None, name='')
(Constructor)

 

New n-vector normal to the earth's surface.

Parameters:
  • x - X component (meter).
  • y - Y component (meter).
  • z - Z component (meter).
  • h - Optional height above model surface (meter).
  • datum - Optional datum this n-vector is defined within (Datum).
  • ll - Optional, original latlon (LatLon).
  • name - Optional name (str).
Raises:
  • TypeError - If datum is not a Datum.
Overrides: object.__init__

Example:

>>> from ellipsoidalNvector import Nvector
>>> v = Nvector(0.5, 0.5, 0.7071, 1)
>>> v.toLatLon()  # 45.0°N, 045.0°E, +1.00m

copy(self)

 

Copy this vector.

Returns:
Copy (Nvector).
Overrides: named._Named.copy

toCartesian(self, **kwds)

 

Convert this n-vector to Nvector-based cartesian (ECEF) coordinates.

Parameters:
  • kwds - Optional, additional Cartesian keyword arguments, ignored if Cartesian=None. Specify Cartesian=... to override this Cartesian class or set Cartesian=None.
Returns:
The Cartesian point (Cartesian) or if Cartesian=None, an Ecef9Tuple(x, y, z, lat, lon, height, C, M, datum) with C and M if available.
Raises:
  • TypeError - Invalid Cartesian, datum or kwds.
Overrides: nvectorBase.NvectorBase.toCartesian

Example:

>>> v = Nvector(0.5, 0.5, 0.7071)
>>> c = v.toCartesian()  # [3194434, 3194434, 4487327]
>>> p = c.toLatLon()  # 45.0°N, 45.0°E

toLatLon(self, **kwds)

 

Convert this n-vector to an Nvector-based geodetic point.

Parameters:
  • kwds - Optional, additional LatLon keyword arguments, ignored if LatLon=None. Specify LatLon=... to override this LatLon class or set LatLon=None.
Returns:
The LatLon point (LatLon) or a LatLon3Tuple(lat, lon, height) if LatLon=None.
Raises:
  • TypeError - Invalid LatLon or kwds.
Overrides: nvectorBase.NvectorBase.toLatLon

Example:

>>> v = Nvector(0.5, 0.5, 0.7071)
>>> p = v.toLatLon()  # 45.0°N, 45.0°E

unit(self, ll=None)

 

Normalize this vector to unit length.

Parameters:
  • ll - Optional, original latlon (LatLon).
Returns:
Normalised vector (Nvector).
Overrides: vector3d.Vector3d.unit

Property Details

datum

Get this n-vector's datum (Datum).

Get Method:
datum(self) - Get this n-vector's datum (Datum).
Set Method:
Read_Only(self, ignored) - Throws an AttributeError, always.