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 }
Scalar * y
static const double lat
Exception class for NETGeographicLib.
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: numpy.h:543
.NET wrapper for GeographicLib::LambertConformalConic.
const double lat0
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const double lon0
int main(array< System::String^>^)
static Symbol x0('x', 0)
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)
static const double lon
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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02