Files | |
file | locator.c |
locator and bearing conversion interface | |
Functions | |
double | dms2dec (int degrees, int minutes, double seconds, int sw) |
Convert DMS to decimal degrees. | |
double | dmmm2dec (int degrees, double minutes, int sw) |
Convert D M.MMM notation to decimal degrees. | |
int | dec2dms (double dec, int *degrees, int *minutes, double *seconds, int *sw) |
Convert decimal degrees angle into DMS notation. | |
int | dec2dmmm (double dec, int *degrees, double *minutes, int *sw) |
Convert a decimal angle into D M.MMM notation. | |
int | locator2longlat (double *longitude, double *latitude, const char *locator) |
Convert Maidenhead grid locator to Longitude/Latitude. | |
int | longlat2locator (double longitude, double latitude, char *locator, int pair_count) |
Convert longitude/latitude to Maidenhead grid locator. | |
int | qrb (double lon1, double lat1, double lon2, double lat2, double *distance, double *azimuth) |
Calculate the distance and bearing between two points. | |
double | distance_long_path (double distance) |
Calculate the long path distance between two points. | |
double | azimuth_long_path (double azimuth) |
Calculate the long path bearing between two points. |
double azimuth_long_path | ( | double | azimuth | ) |
Calculate the long path bearing between two points.
azimuth | The shortpath bearing |
int dec2dmmm | ( | double | dec, | |
int * | degrees, | |||
double * | minutes, | |||
int * | sw | |||
) |
Convert a decimal angle into D M.MMM notation.
dec | Decimal degrees | |
degrees | Pointer for the calculated whole Degrees | |
minutes | Pointer for the calculated decimal Minutes | |
sw | Pointer for the calculated SW flag |
When passed a value < -180 or > 180, the value will be normalized within these limits and the sign set apropriately.
Upon return dec2dmmm guarantees 0 >= degrees <= 180, 0.0 >= minutes < 60.0.
When dec is < 0.0 sw will be set to 1. When dec is >= 0.0 sw will be set to 0. This flag allows the application to determine whether the D M.MMM angle should be treated as negative (south or west).
-RIG_EINVAL | if any of the pointers are NULL. | |
RIG_OK | if conversion went OK. |
int dec2dms | ( | double | dec, | |
int * | degrees, | |||
int * | minutes, | |||
double * | seconds, | |||
int * | sw | |||
) |
Convert decimal degrees angle into DMS notation.
dec | Decimal degrees | |
degrees | Pointer for the calculated whole Degrees | |
minutes | Pointer for the calculated whole Minutes | |
seconds | Pointer for the calculated decimal Seconds | |
sw | Pointer for the calculated SW flag |
When dec < -180 or dec > 180, the angle will be normalized within these limits and the sign set appropriately.
Upon return dec2dms guarantees 0 >= degrees <= 180, 0 >= minutes < 60, and 0.0 >= seconds < 60.0.
When dec is < 0.0 sw will be set to 1. When dec is >= 0.0 sw will be set to 0. This flag allows the application to determine whether the DMS angle should be treated as negative (south or west).
-RIG_EINVAL | if any of the pointers are NULL. | |
RIG_OK | if conversion went OK. |
double distance_long_path | ( | double | distance | ) |
Calculate the long path distance between two points.
distance | The shortpath distance |
double dmmm2dec | ( | int | degrees, | |
double | minutes, | |||
int | sw | |||
) |
Convert D M.MMM notation to decimal degrees.
degrees | Degrees, whole degrees | |
minutes | Minutes, decimal minutes | |
sw | South or West |
degrees > 360, minutes > 60.0 are allowed, but resulting angle won't be normalized.
When the variable sw is passed a value of 1, the returned decimal degrees value will be negative (south or west). When passed a value of 0 the returned decimal degrees value will be positive (north or east).
double dms2dec | ( | int | degrees, | |
int | minutes, | |||
double | seconds, | |||
int | sw | |||
) |
Convert DMS to decimal degrees.
degrees | Degrees, whole degrees | |
minutes | Minutes, whole minutes | |
seconds | Seconds, decimal seconds | |
sw | South or West |
When the variable sw is passed a value of 1, the returned decimal degrees value will be negative (south or west). When passed a value of 0 the returned decimal degrees value will be positive (north or east).
int locator2longlat | ( | double * | longitude, | |
double * | latitude, | |||
const char * | locator | |||
) |
Convert Maidenhead grid locator to Longitude/Latitude.
longitude | Pointer for the calculated Longitude | |
latitude | Pointer for the calculated Latitude | |
locator | The Maidenhead grid locator--2 through 12 char + nul string |
Decimal long/lat is computed to center of grid square, i.e. given EM19 will return coordinates equivalent to the southwest corner of EM19mm.
-RIG_EINVAL | if locator exceeds RR99xx99xx99 or exceeds length limit--currently 1 to 6 lon/lat pairs. | |
RIG_OK | if conversion went OK. |
int longlat2locator | ( | double | longitude, | |
double | latitude, | |||
char * | locator, | |||
int | pair_count | |||
) |
Convert longitude/latitude to Maidenhead grid locator.
longitude | Longitude, decimal degrees | |
latitude | Latitude, decimal degrees | |
locator | Pointer for the Maidenhead Locator | |
pair_count | Precision expressed as lon/lat pairs in the locator |
-RIG_EINVAL | if locator is NULL or pair_count exceeds length limit. Currently 1 to 6 lon/lat pairs. | |
RIG_OK | if conversion went OK. |
int qrb | ( | double | lon1, | |
double | lat1, | |||
double | lon2, | |||
double | lat2, | |||
double * | distance, | |||
double * | azimuth | |||
) |
Calculate the distance and bearing between two points.
lon1 | The local Longitude, decimal degrees | |
lat1 | The local Latitude, decimal degrees | |
lon2 | The remote Longitude, decimal degrees | |
lat2 | The remote Latitude, decimal degrees | |
distance | Pointer for the distance, km | |
azimuth | Pointer for the bearing, decimal degrees |
This version will calculate the QRB to a precision sufficient for 12 character locators. Antipodal points, which are easily calculated, are considered equidistant and the bearing is simply resolved to be true north (0.0°).
-RIG_EINVAL | if NULL pointer passed or lat and lon values exceed -90 to 90 or -180 to 180. | |
RIG_OK | if calculations are successful. |
Hamlib documentation for version 1.2.8 -- Mon Dec 15 18:03:30 2008
Project page: http://hamlib.org