Coordinate¶
Represents a geographic coordinate with latitude, longitude, and altitude.
- class MAVez.coordinate.Coordinate(latitude_deg, longitude_deg, altitude_m=0, heading_deg=0, timestamp_ms=0)¶
Bases:
object- property altitude_mm: int¶
- azimuth_to(other)¶
Compute the azimuth to another coordinate clockwise from north
- Parameters:
other (
Coordinate) – The other coordinate to calculate the azimuth to.- Returns:
The azimuth relative to north in degrees
- Return type:
float
- bearing_to(other)¶
Compute the bearing to another coordinate clockwise from self.heading_deg
- Parameters:
other (
Coordinate) – The other coordinate to calculate the bearing to.- Returns:
The bearing relative to heading in degrees
- Return type:
float
- distance_to(other, include_alt=False)¶
Calculate the distance between two coordinates in meters.
- Parameters:
other (
Coordinate) – The other coordinate to calculate the distance to.include_alt (
bool) – Flag to consider difference in altitude in distance. Defaults to false.
- Returns:
The distance in meters between the two coordinates.
- Return type:
float
- classmethod from_int(latitude_degE7, longitude_degE7, altitude_mm=0, heading_cdeg=0, timestamp_ms=0)¶
Create a coordinate object from using integer representation of position
- Parameters:
latitude_degE7 (
int) – Latitude of position in degrees * 10^7.longitude_degE7 (
int) – Longitude of position in degrees * 10^7.altitude_mm (
int) – Altitude of position in millimeters. Defaults to 0.heading_cdeg (
int) – Heading of position in centidegrees clockwise from north. Defaults to 0.timestamp_ms (
int|float) – Timestamp for the position in milliseconds. Defaults to 0.
- Returns:
The created Coordinate object
- Return type:
- classmethod from_rad(latitude_rad, longitude_rad, altitude_m=0, heading_rad=0, timestamp_ms=0)¶
Create a coordinate object from using radian representation of position
- Parameters:
latitude_rad (
float) – Latitude of position in radians.longitude_rad (
float) – Longitude of position in radians.altitude_m (
float) – Altitude of position in meters. Defaults to 0.heading_rad (
float) – Heading of position in radians clockwise from north. Defaults to 0.timestamp_ms (
int|float) – Timestamp for the position in milliseconds. Defaults to 0.
- Returns:
The created Coordinate object
- Return type:
- property heading_cdeg: int¶
- property heading_rad: float¶
- property latitude_degE7: int¶
- property latitude_rad: float¶
- property longitude_degE7: int¶
- property longitude_rad: float¶
- offset_coordinate(distance_m, azimuth_deg)¶
Offset the coordinate by a given distance and heading.
- Parameters:
distance_m (
float) – The distance to offset in meters.azimuth_deg (
float) – The bearing from the first coordinate in degrees.
- Returns:
A new Coordinate object with the offset applied.
- Return type:
- path_to(other)¶
Calculate the azimuth, bearing, and distance between two coordinates in degrees.
- Parameters:
other (
Coordinate) – The other coordinate to calculate the path to.- Returns:
A dict with keys for calculated “distance” in meters, “azimuth” in degrees, and “bearing” in degrees
- Return type:
dict[str,float]
- MAVez.coordinate.main()¶