dotnet/examples/ManagedCPP/example-LambertConformalConic.cpp
Go to the documentation of this file.
1 using namespace System;
2 using namespace NETGeographicLib;
3 
5 {
6  try {
7  // Define the Pennsylvania South state coordinate system EPSG:3364
8  // http://www.spatialreference.org/ref/epsg/3364/
9  const double
10  lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
11  k1 = 1, // scale
12  lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin
13  fe = 600000, fn = 0; // false easting and northing
14  // Set up basic projection
15  LambertConformalConic^ PASouth = gcnew LambertConformalConic( Constants::WGS84::MajorRadius,
16  Constants::WGS84::Flattening,
17  lat1, lat2, k1);
18  double x0, y0;
19  // Transform origin point
20  PASouth->Forward(lon0, lat0, lon0, x0, y0);
21  x0 -= fe; y0 -= fn;
22  {
23  // Sample conversion from geodetic to PASouth grid
24  double lat = 39.95, lon = -75.17; // Philadelphia
25  double x, y;
26  PASouth->Forward(lon0, lat, lon, x, y);
27  x -= x0; y -= y0;
28  Console::WriteLine( String::Format("{0} {1}", x, y) );
29  }
30  {
31  // Sample conversion from PASouth grid to geodetic
32  double x = 820e3, y = 72e3;
33  double lat, lon;
34  x += x0; y += y0;
35  PASouth->Reverse(lon0, x, y, lat, lon);
36  Console::WriteLine( String::Format("{0} {1}", lat, lon) );
37  }
38  }
39  catch (GeographicErr^ e) {
40  Console::WriteLine( String::Format("Caught exception: {0}", e->Message) );
41  return -1;
42  }
43  return 0;
44 }
NETGeographicLib::LambertConformalConic::Reverse
void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)
Definition: dotnet/NETGeographicLib/LambertConformalConic.cpp:133
NETGeographicLib::LambertConformalConic::Forward
void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)
Definition: dotnet/NETGeographicLib/LambertConformalConic.cpp:118
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
fn
static double fn[10]
Definition: fresnl.c:103
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
y0
double y0(double x)
Definition: j0.c:220
example::lat0
const double lat0
Definition: testGPSFactor.cpp:41
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
k1
double k1(double x)
Definition: k1.c:133
x0
static Symbol x0('x', 0)
y
Scalar * y
Definition: level1_cplx_impl.h:124
array
Definition: numpy.h:821
main
int main(array< System::String ^> ^)
Definition: dotnet/examples/ManagedCPP/example-LambertConformalConic.cpp:4
NETGeographicLib::LambertConformalConic
.NET wrapper for GeographicLib::LambertConformalConic.
Definition: LambertConformalConic.h:65
lon
static const double lon
Definition: testGeographicLib.cpp:34
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:20