5.1.11. nvector.objects.GeoPoint¶
- class GeoPoint(latitude, longitude, z=0, frame=None, degrees=False)[source]¶
Geographical position given as latitude, longitude, depth in frame E.
- Parameters
- latitude, longitude: real scalars or vectors of length n.
Geodetic latitude and longitude given in [rad or deg]
- z: real scalar or vector of length n.
Depth(s) [m] relative to the ellipsoid (depth = -height)
- frame: FrameE object
reference ellipsoid. The default ellipsoid model used is WGS84, but other ellipsoids/spheres might be specified.
- degrees: bool
True if input are given in degrees otherwise radians are assumed.
Examples
Solve geodesic problems.
The following illustrates its use
>>> import nvector as nv >>> wgs84 = nv.FrameE(name='WGS84') >>> point_a = wgs84.GeoPoint(-41.32, 174.81, degrees=True) >>> point_b = wgs84.GeoPoint(40.96, -5.50, degrees=True)
>>> print(point_a) GeoPoint(latitude=-0.721170046924057, longitude=3.0510100654112877, z=0, frame=FrameE(a=6378137.0, f=0.0033528106647474805, name='WGS84', axes='e'))
The geodesic inverse problem
>>> s12, az1, az2 = point_a.distance_and_azimuth(point_b, degrees=True) >>> 's12 = {:5.2f}, az1 = {:5.2f}, az2 = {:5.2f}'.format(s12, az1, az2) 's12 = 19959679.27, az1 = 161.07, az2 = 18.83'
The geodesic direct problem
>>> point_a = wgs84.GeoPoint(40.6, -73.8, degrees=True) >>> az1, distance = 45, 10000e3 >>> point_b, az2 = point_a.displace(distance, az1, degrees=True) >>> lat2, lon2 = point_b.latitude_deg, point_b.longitude_deg >>> msg = 'lat2 = {:5.2f}, lon2 = {:5.2f}, az2 = {:5.2f}' >>> msg.format(lat2, lon2, az2) 'lat2 = 32.64, lon2 = 49.01, az2 = 140.37'
- __init__(latitude, longitude, z=0, frame=None, degrees=False)[source]¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(latitude, longitude[, z, frame, …])Initialize self.
delta_to
(other)Returns cartesian delta vector from positions a to b decomposed in N.
displace
(distance, azimuth[, long_unroll, …])Returns position b computed from current position, distance and azimuth.
distance_and_azimuth
(point[, long_unroll, …])Returns ellipsoidal distance between positions as well as the direction.
to_ecef_vector
()Returns position as ECEFvector object.
to_geo_point
()Returns position as GeoPoint object.
to_nvector
()Returns position as Nvector object.
Attributes
latitude_deg
latitude in degrees.
latlon
(latitude, longitude, z) tuple, angles are in radian.
latlon_deg
(latitude_deg, longitude_deg, z) tuple, angles are in degree.
longitude_deg
longitude in degrees.
scalar
True if the position is a scalar point