dotnet/examples/ManagedCPP/example-MGRS.cpp
Go to the documentation of this file.
1 using namespace System;
2 using namespace NETGeographicLib;
3 
5 {
6  try {
7  // See also example-GeoCoords.cpp
8  {
9  // Sample forward calculation
10  double lat = 33.3, lon = 44.4; // Baghdad
11  int zone;
12  bool northp;
13  double x, y;
14  UTMUPS::Forward(lat, lon, zone, northp, x, y, -1, true);
15  String^ mgrs;
16  MGRS::Forward(zone, northp, x, y, lat, 5, mgrs);
17  Console::WriteLine(mgrs);
18  }
19  {
20  // Sample reverse calculation
21  String^ mgrs = "38SMB4488";
22  int zone, prec;
23  bool northp;
24  double x, y;
25  MGRS::Reverse(mgrs, zone, northp, x, y, prec, true);
26  double lat, lon;
27  UTMUPS::Reverse(zone, northp, x, y, lat, lon, true);
28  Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", lat, lon));
29  }
30  }
31  catch (GeographicErr^ e) {
32  Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
33  return -1;
34  }
35  return 0;
36 }
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
y
Scalar * y
Definition: level1_cplx_impl.h:124
array
Definition: numpy.h:821
lon
static const double lon
Definition: testGeographicLib.cpp:34
main
int main(array< System::String ^> ^)
Definition: dotnet/examples/ManagedCPP/example-MGRS.cpp:4
NETGeographicLib
Definition: Accumulator.h:13
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Thu Jul 4 2024 03:01:21