Difference between revisions of "Truxton location get longitude"
Jump to navigation
Jump to search
(Created page with "This retrieves longitude portion of the location. This corresponds to the <code>[Longitude]</code> column of the <code><nowiki>[</nowiki>Location<nowiki>]</...") |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | This retrieves longitude portion of the location. | + | This retrieves [https://en.wikipedia.org/wiki/Longitude longitude] portion of the location. |
This corresponds to the <code>[Longitude]</code> column of the <code><nowiki>[</nowiki>[[Location Table|Location]]<nowiki>]</nowiki></code> table. | This corresponds to the <code>[Longitude]</code> column of the <code><nowiki>[</nowiki>[[Location Table|Location]]<nowiki>]</nowiki></code> table. | ||
| Line 12: | Line 12: | ||
=Return value= | =Return value= | ||
| − | The longitude of the location in [https://en.wikipedia.org/wiki/Decimal_degrees decimal degrees.] | + | The [https://en.wikipedia.org/wiki/Longitude longitude] of the location in [https://en.wikipedia.org/wiki/Decimal_degrees decimal degrees] using the [https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84 WGS84] ellipsoid. |
=Sample= | =Sample= | ||
<source lang="C" highlight="20"> | <source lang="C" highlight="20"> | ||
| − | void dump_location(uint64_t location_handle) | + | void dump_location( uint64_t location_handle ) |
{ | { | ||
double value = 0; | double value = 0; | ||
| Line 23: | Line 23: | ||
char label[ 256 ]; | char label[ 256 ]; | ||
| − | truxton_location_get_label(location_handle, label, sizeof( label )); | + | truxton_location_get_label( location_handle, label, sizeof( label ) ); |
printf( "%s\n", label ); | printf( "%s\n", label ); | ||
| − | truxton_location_get_file_id(location_handle, guid_string, sizeof( guid_string )); | + | truxton_location_get_file_id( location_handle, guid_string, sizeof( guid_string ) ); |
printf( "File ID: %s\n", guid_string ); | printf( "File ID: %s\n", guid_string ); | ||
| − | truxton_location_get_media_id(location_handle, guid_string, sizeof( guid_string )); | + | truxton_location_get_media_id( location_handle, guid_string, sizeof( guid_string ) ); |
printf( "Media ID: %s\n", guid_string ); | printf( "Media ID: %s\n", guid_string ); | ||
| Line 42: | Line 42: | ||
ticks = truxton_location_get_type( location_handle ); | ticks = truxton_location_get_type( location_handle ); | ||
| − | printf( "Type: %" PRIu64 "\n", | + | printf( "Type: %" PRIu64 "\n", ticks ); |
ticks = truxton_location_get_when( location_handle ); | ticks = truxton_location_get_when( location_handle ); | ||
| − | printf( "Ticks: %" PRIu64 "\n", | + | printf( "Ticks: %" PRIu64 "\n", ticks ); |
} | } | ||
</source> | </source> | ||
| + | |||
| + | The <code>PRIu64</code> in the sample code above is a standard way of [https://en.wikipedia.org/wiki/C_data_types#Printf_and_scanf_format_specifiers formatting] a 64-bit unsigned integer in C. | ||
| + | Over the years, different compilers on different operating systems used different format specifiers for things, these <code>PRI</code> macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic. | ||
Latest revision as of 06:58, 10 February 2021
This retrieves longitude portion of the location.
This corresponds to the [Longitude] column of the [Location] table.
Syntax
double truxton_location_get_longitude( uint64_t location_handle );
Parameters
location_handle
This handle comes from calling truxton_location_create() or truxton_child_file_create_location()
Return value
The longitude of the location in decimal degrees using the WGS84 ellipsoid.
Sample
void dump_location( uint64_t location_handle )
{
double value = 0;
uint64_t ticks = 0;
char guid_string[ 40 ];
char label[ 256 ];
truxton_location_get_label( location_handle, label, sizeof( label ) );
printf( "%s\n", label );
truxton_location_get_file_id( location_handle, guid_string, sizeof( guid_string ) );
printf( "File ID: %s\n", guid_string );
truxton_location_get_media_id( location_handle, guid_string, sizeof( guid_string ) );
printf( "Media ID: %s\n", guid_string );
value = truxton_location_get_latitude( location_handle );
printf( "Latitude: %lf\n", value );
value = truxton_location_get_longitude( location_handle );
printf( "Longitude: %lf\n", value );
value = truxton_location_get_altitude( location_handle );
printf( "Altitude: %lf meters\n", value );
ticks = truxton_location_get_type( location_handle );
printf( "Type: %" PRIu64 "\n", ticks );
ticks = truxton_location_get_when( location_handle );
printf( "Ticks: %" PRIu64 "\n", ticks );
}
The PRIu64 in the sample code above is a standard way of formatting a 64-bit unsigned integer in C.
Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.