gtsam
3rdparty
GeographicLib
examples
examples/example-MGRS.cpp
Go to the documentation of this file.
1
// Example of using the GeographicLib::MGRS class
2
3
#include <iostream>
4
#include <exception>
5
#include <string>
6
#include <
GeographicLib/UTMUPS.hpp
>
7
#include <
GeographicLib/MGRS.hpp
>
8
9
using namespace
std
;
10
using namespace
GeographicLib
;
11
12
int
main
() {
13
try
{
14
// See also example-GeoCoords.cpp
15
{
16
// Sample forward calculation
17
double
lat
= 33.3,
lon
= 44.4;
// Baghdad
18
int
zone;
19
bool
northp;
20
double
x
,
y
;
21
UTMUPS::Forward
(
lat
,
lon
, zone, northp,
x
,
y
);
22
string
mgrs;
23
MGRS::Forward
(zone, northp,
x
,
y
,
lat
, 5, mgrs);
24
cout << mgrs <<
"\n"
;
25
}
26
{
27
// Sample reverse calculation
28
string
mgrs =
"38SMB4488"
;
29
int
zone, prec;
30
bool
northp;
31
double
x
,
y
;
32
MGRS::Reverse(mgrs, zone, northp,
x
,
y
, prec);
33
double
lat
,
lon
;
34
UTMUPS::Reverse(zone, northp,
x
,
y
,
lat
,
lon
);
35
cout << prec <<
" "
<<
lat
<<
" "
<<
lon
<<
"\n"
;
36
}
37
}
38
catch
(
const
exception&
e
) {
39
cerr <<
"Caught exception: "
<<
e
.what() <<
"\n"
;
40
return
1;
41
}
42
}
Eigen::Forward
@ Forward
Definition:
NumericalDiff.h:19
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition:
JacobiConformal.hpp:15
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition:
gnuplot_common_settings.hh:12
UTMUPS.hpp
Header for GeographicLib::UTMUPS class.
main
int main()
Definition:
examples/example-MGRS.cpp:12
MGRS.hpp
Header for GeographicLib::MGRS class.
y
Scalar * y
Definition:
level1_cplx_impl.h:124
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 Sun Dec 22 2024 04:11:31