nautical.location package
Submodules
nautical.location.point module
- class nautical.location.point.Point(lat: float = 0.0, lon: float = 0.0, alt: float = 0.0)[source]
Bases:
object
A 3D point containing latitude, longitude and altitude coordinates.
- __init__(lat: float = 0.0, lon: float = 0.0, alt: float = 0.0) None [source]
The latitude, longitude, and altitude are supplied to the base class as the x, y, z parameters respectively.
- __str__()[source]
Python version of the to string function. Turn this object into a string
- Returns
string representation of this object
- property altitude
Altitude Property (meters) :return: altitude (meters)
- as_tuple()[source]
Get the values of the object as a simple tuple. The lat and lon are used but not the altitude. The altitude is omitted for use with haverine.
- Returns
Tuple of lat, lon
- distance(other, units=DistanceUnits.METERS)[source]
Get the distance using the Haversine function. The function will determine the distance between this instance and another Point.
- Parameters
other – The other Point
units – Units used for measurement
- Returns
Distance between the points in units specified
- in_range(other, distance, units=DistanceUnits.METERS)[source]
Deteremine if the points are within a specific distance of eachother.
- Parameters
other – The other Point
distance – Max distance between the points
units – Units used for measurement
- Returns
True when points are within the specified distance
- property latitude
Latitude Property (degrees) :return: latitude (degrees)
- property longitude
Longitude Property (degrees) :return: longitude (degrees)
- static parse(data)[source]
Parse the string containing lon, lat, alt [optional] values respectively.
- Parameters
data – A string containing lon, lat, altitude.
- Returns
instance of Point on success, None on failure
nautical.location.util module
- nautical.location.util._create_square(geometry)[source]
When there are only two points in a geometry, instead of using a line, create a square/rectangle out of the max/mins
- Parameters
geometry – Ordered list of Point objects
- Returns
4 point geometry
- nautical.location.util._find_intersections(geometry, point)[source]
Find the number of times that the point intesects with the edges of the geometry when extending a ray towards the edges of the geometry.
- Parameters
geometry – Ordered list of Point objects
point – Point to calculate the intersections
- Returns
Number of times the ray instersects with the geometry
- nautical.location.util.haversine(point_one, point_two, units=DistanceUnits.METERS) float [source]
Wrapper for the Haversine for the Point class in this module
- Parameters
p1 – Point 1
point_two – Point 2
units – nautical.units.DistanceUnits
- Returns
Distance between the points, in units
- nautical.location.util.in_area(geometry, point)[source]
Determine if a point exists within a geometry of points. The algorithm can be found here: https://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html
- Parameters
geometry – Ordered list of Point objects
point – Point that should be checked if exists in the geometry
- Returns
True when the value lies in the geometry, false otherwise
- nautical.location.util.in_range(point_one, point_two, distance, units=DistanceUnits.METERS)[source]
Determine if the points are within a distance of each other.
- Parameters
point_one – Point 1
point_two – Point 2
distance – Max allowed distance between points to return true.
units – Units of measurement [default=METERS]
- Returns
True when the distance between P1 and P2 is less than (or equal to) distance_m
- nautical.location.util.in_range_ll(lat1_deg, lon1_deg, lat2_deg, lon2_deg, distance, units=DistanceUnits.METERS)[source]
Determine if points are within a distance of each other provided with the latitude, longitude of each point
- Parameters
lat1_deg – Latitude of point 1 in degrees
lon1_deg – Longitude of point 1 in degrees
lat2_deg – Latitude of point 2 in degrees
lon2_deg – Longitude of point 2 in degrees
distance_m – Max allowed distance between points to return true (meters).
- Returns
True when the distance between P1 and P2 is less than (or equal to) distance_m
Module contents
The module contains data to create and manage 3D points. The points can be generated from the data contained inside of NOAA’s kml and html data.
- class nautical.location.Point(lat: float = 0.0, lon: float = 0.0, alt: float = 0.0)[source]
Bases:
object
A 3D point containing latitude, longitude and altitude coordinates.
- __init__(lat: float = 0.0, lon: float = 0.0, alt: float = 0.0) None [source]
The latitude, longitude, and altitude are supplied to the base class as the x, y, z parameters respectively.
- __str__()[source]
Python version of the to string function. Turn this object into a string
- Returns
string representation of this object
- property altitude
Altitude Property (meters) :return: altitude (meters)
- as_tuple()[source]
Get the values of the object as a simple tuple. The lat and lon are used but not the altitude. The altitude is omitted for use with haverine.
- Returns
Tuple of lat, lon
- distance(other, units=DistanceUnits.METERS)[source]
Get the distance using the Haversine function. The function will determine the distance between this instance and another Point.
- Parameters
other – The other Point
units – Units used for measurement
- Returns
Distance between the points in units specified
- in_range(other, distance, units=DistanceUnits.METERS)[source]
Deteremine if the points are within a specific distance of eachother.
- Parameters
other – The other Point
distance – Max distance between the points
units – Units used for measurement
- Returns
True when points are within the specified distance
- property latitude
Latitude Property (degrees) :return: latitude (degrees)
- property longitude
Longitude Property (degrees) :return: longitude (degrees)
- static parse(data)[source]
Parse the string containing lon, lat, alt [optional] values respectively.
- Parameters
data – A string containing lon, lat, altitude.
- Returns
instance of Point on success, None on failure