A simple newbie question. How can I use this library to calculate the distance
between 2 coordinates if the cordinates are in format 60,12345 22,54321 ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can look into using the current locale to regulate this. However, I
regard this as a side issue for the library -- so don't hold your
breath. The "recommended" way to do distance calculations is with C++
code:
Welcome to Open Discussion
A simple newbie question. How can I use this library to calculate the distance
between 2 coordinates if the cordinates are in format 60,12345 22,54321 ?
The degree and DMS decoding in the DMS class uses a period for the
decimal separator. On a Unix platform you can convert commas to periods
with:
echo 60,12345 22,54321 61,12345 23,54321 | tr , . | Geod -i | tr . ,
=>
25,73198351 26,60343672 124142,645 124134,834
I can look into using the current locale to regulate this. However, I
regard this as a side issue for the library -- so don't hold your
breath. The "recommended" way to do distance calculations is with C++
code:
double lat1, lon1, lat2, lon2;
double s12, azi1, azi2, m12;
std::cin >> lat1 >> lon1 >> lat2 >> lon2;
GeographicLib::Geodesic::WGS84.Inverse(lat1, lon1, lat2, lon2,
s12, azi1, azi2, m12);
std::cout << "Distance = " << s12 << "\n";
In this case, you, the programmer, deal with the reading and writing of
the numbers.
Thanks for the answer. Now I know more how to deal with it.
Regards