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:
objectA 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.
- as_tuple() tuple[float, float][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
- __str__() str[source]
Python version of the to string function. Turn this object into a string
- Returns:
string representation of this object
- static from_json(json_dict: dict[str, float]) Point[source]
Fill the instance from a json dictionary
- distance(other: Point, units: DistanceUnits = DistanceUnits.METERS) float[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: Point, distance: float, units: DistanceUnits = DistanceUnits.METERS) bool[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
nautical.location.util module
- 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_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
- 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_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
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:
objectA 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.
- as_tuple() tuple[float, float][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
- __str__() str[source]
Python version of the to string function. Turn this object into a string
- Returns:
string representation of this object
- static from_json(json_dict: dict[str, float]) Point[source]
Fill the instance from a json dictionary
- distance(other: Point, units: DistanceUnits = DistanceUnits.METERS) float[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: Point, distance: float, units: DistanceUnits = DistanceUnits.METERS) bool[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