gtsam
3rdparty
GeographicLib
examples
examples/example-Georef.cpp
Go to the documentation of this file.
1
// Example of using the GeographicLib::GARS class
2
3
#include <iostream>
4
#include <iomanip>
5
#include <exception>
6
#include <string>
7
#include <
GeographicLib/Georef.hpp
>
8
9
using namespace
std
;
10
using namespace
GeographicLib
;
11
12
int
main
() {
13
try
{
14
{
15
// Sample forward calculation
16
double
lat
= 57.64911,
lon
= 10.40744;
// Jutland
17
string
georef;
18
for
(
int
prec = -1; prec <= 11; ++prec) {
19
Georef::Forward
(
lat
,
lon
, prec, georef);
20
cout << prec <<
" "
<< georef <<
"\n"
;
21
}
22
}
23
{
24
// Sample reverse calculation
25
string
georef =
"NKLN2444638946"
;
26
double
lat
,
lon
;
27
int
prec;
28
cout << fixed;
29
Georef::Reverse(georef.substr(0, 2),
lat
,
lon
, prec);
30
cout << prec <<
" "
<<
lat
<<
" "
<<
lon
<<
"\n"
;
31
Georef::Reverse(georef.substr(0, 4),
lat
,
lon
, prec);
32
cout << prec <<
" "
<<
lat
<<
" "
<<
lon
<<
"\n"
;
33
Georef::Reverse(georef,
lat
,
lon
, prec);
34
cout << prec <<
" "
<<
lat
<<
" "
<<
lon
<<
"\n"
;
35
}
36
}
37
catch
(
const
exception&
e
) {
38
cerr <<
"Caught exception: "
<<
e
.what() <<
"\n"
;
39
return
1;
40
}
41
}
Eigen::Forward
@ Forward
Definition:
NumericalDiff.h:19
Georef.hpp
Header for GeographicLib::Georef class.
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition:
JacobiConformal.hpp:15
main
int main()
Definition:
examples/example-Georef.cpp:12
std
Definition:
BFloat16.h:88
lon
static const double lon
Definition:
testGeographicLib.cpp:34
lat
static const double lat
Definition:
testGeographicLib.cpp:34
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:16