Public Member Functions | Private Member Functions | Private Attributes | List of all members
NETGeographicLib::LocalCartesian Class Reference

.NET wrapper for GeographicLib::LocalCartesian. More...

#include <LocalCartesian.h>

Public Member Functions

void Forward (double lat, double lon, double h, [System::Runtime::InteropServices::Out] double%x, [System::Runtime::InteropServices::Out] double%y, [System::Runtime::InteropServices::Out] double%z)
 
void Forward (double lat, double lon, double h, [System::Runtime::InteropServices::Out] double%x, [System::Runtime::InteropServices::Out] double%y, [System::Runtime::InteropServices::Out] double%z, [System::Runtime::InteropServices::Out] array< double, 2 >^%M)
 
 LocalCartesian (double lat0, double lon0, double h0, Geocentric^earth)
 
 LocalCartesian (double lat0, double lon0, double h0)
 
 LocalCartesian (Geocentric^earth)
 
 LocalCartesian ()
 
void Reset (double lat0, double lon0, double h0)
 
void Reverse (double x, double y, double z, [System::Runtime::InteropServices::Out] double%lat, [System::Runtime::InteropServices::Out] double%lon, [System::Runtime::InteropServices::Out] double%h)
 
void Reverse (double x, double y, double z, [System::Runtime::InteropServices::Out] double%lat, [System::Runtime::InteropServices::Out] double%lon, [System::Runtime::InteropServices::Out] double%h, [System::Runtime::InteropServices::Out] array< double, 2 >^%M)
 
 ~LocalCartesian ()
 

Public Attributes

Inspector functions
property double LatitudeOrigin { double get()
 
property double LongitudeOrigin { double get()
 
property double HeightOrigin { double get()
 
property double MajorRadius { double get()
 
property double Flattening { double get()
 

Private Member Functions

 !LocalCartesian (void)
 

Private Attributes

GeographicLib::LocalCartesianm_pLocalCartesian
 

Detailed Description

.NET wrapper for GeographicLib::LocalCartesian.

This class allows .NET applications to access GeographicLib::LocalCartesian.

Convert between geodetic coordinates latitude = lat, longitude = lon, height = h (measured vertically from the surface of the ellipsoid) to local cartesian coordinates (x, y, z). The origin of local cartesian coordinate system is at lat = lat0, lon = lon0, h = h0. The z axis is normal to the ellipsoid; the y axis points due north. The plane z = - h0 is tangent to the ellipsoid.

The conversions all take place via geocentric coordinates using a Geocentric object.

C# Example:

using System;
namespace example_LocalCartesian
{
class Program
{
static void Main(string[] args)
{
try {
Geocentric earth = new Geocentric();
const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
LocalCartesian proj = new LocalCartesian(lat0, lon0, 0, earth);
{
// Sample forward calculation
double lat = 50.9, lon = 1.8, h = 0; // Calais
double x, y, z;
proj.Forward(lat, lon, h, out x, out y, out z);
Console.WriteLine(String.Format("{0} {1} {2}", x, y, z));
}
{
// Sample reverse calculation
double x = -38e3, y = 230e3, z = -4e3;
double lat, lon, h;
proj.Reverse(x, y, z, out lat, out lon, out h);
Console.WriteLine(String.Format("{0} {1} {2}", lat, lon, h));
}
}
catch (GeographicErr e) {
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}

Managed C++ Example:

// Example of using the GeographicLib::LocalCartesian class
#include <iostream>
#include <exception>
#include <cmath>
using namespace std;
using namespace GeographicLib;
int main() {
try {
Geocentric earth(Constants::WGS84_a(), Constants::WGS84_f());
// Alternatively: const Geocentric& earth = Geocentric::WGS84();
const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
LocalCartesian proj(lat0, lon0, 0, earth);
{
// Sample forward calculation
double lat = 50.9, lon = 1.8, h = 0; // Calais
double x, y, z;
proj.Forward(lat, lon, h, x, y, z);
cout << x << " " << y << " " << z << "\n";
}
{
// Sample reverse calculation
double x = -38e3, y = 230e3, z = -4e3;
double lat, lon, h;
proj.Reverse(x, y, z, lat, lon, h);
cout << lat << " " << lon << " " << h << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

Visual Basic Example:

Imports NETGeographicLib
Module example_LocalCartesian
Sub Main()
Try
Dim earth As Geocentric = New Geocentric()
Dim lat0 As Double = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0 ' Paris
Dim proj As LocalCartesian = New LocalCartesian(lat0, lon0, 0, earth)
' Sample forward calculation
Dim lat As Double = 50.9, lon = 1.8, h = 0 ' Calais
Dim x, y, z As Double
proj.Forward(lat, lon, h, x, y, z)
Console.WriteLine(String.Format("{0} {1} {2}", x, y, z))
' Sample reverse calculation
x = -38000.0 : y = 230000.0 : z = -4000.0
proj.Reverse(x, y, z, lat, lon, h)
Console.WriteLine(String.Format("{0} {1} {2}", lat, lon, h))
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module

INTERFACE DIFFERENCES:
Constructors have been provided that assume WGS84 parameters.

The following functions are implemented as properties: LatitudeOrigin, LongitudeOrigin, HeightOrigin, MajorRadius, and Flattening.

The rotation matrices returned by the Forward and Reverse functions are 2D, 3 × 3 arrays rather than vectors.

Definition at line 48 of file LocalCartesian.h.

Constructor & Destructor Documentation

LocalCartesian::!LocalCartesian ( void  )
private

Definition at line 22 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

LocalCartesian::LocalCartesian ( double  lat0,
double  lon0,
double  h0,
Geocentric earth 
)

Constructor setting the origin.

Parameters
[in]lat0latitude at origin (degrees).
[in]lon0longitude at origin (degrees).
[in]h0height above ellipsoid at origin (meters); default 0.
[in]earthGeocentric object for the transformation; default Geocentric::WGS84.

lat0 should be in the range [−90°, 90°].

Definition at line 32 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

LocalCartesian::LocalCartesian ( double  lat0,
double  lon0,
double  h0 
)

Constructor setting the origin and assuming a WGS84 ellipsoid.

Parameters
[in]lat0latitude at origin (degrees).
[in]lon0longitude at origin (degrees).
[in]h0height above ellipsoid at origin (meters); default 0.

lat0 should be in the range [−90°, 90°].

Definition at line 49 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

LocalCartesian::LocalCartesian ( Geocentric earth)

Constructor that uses the provided ellipsoid.

Parameters
[in]earthGeocentric object for the transformation; default Geocentric::WGS84.

Sets lat0 = 0, lon0 = 0, h0 = 0.

Definition at line 63 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

LocalCartesian::LocalCartesian ( )

The default constructor assumes the WGS84 ellipsoid.

Sets lat0 = 0, lon0 = 0, h0 = 0.

Definition at line 79 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

NETGeographicLib::LocalCartesian::~LocalCartesian ( )
inline

The destructor calls the finalizer.

Definition at line 103 of file LocalCartesian.h.

Member Function Documentation

void LocalCartesian::Forward ( double  lat,
double  lon,
double  h,
[System::Runtime::InteropServices::Out] double%  x,
[System::Runtime::InteropServices::Out] double%  y,
[System::Runtime::InteropServices::Out] double%  z 
)

Convert from geodetic to local cartesian coordinates.

Parameters
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[in]hheight of point above the ellipsoid (meters).
[out]xlocal cartesian coordinate (meters).
[out]ylocal cartesian coordinate (meters).
[out]zlocal cartesian coordinate (meters).

lat should be in the range [−90°, 90°].

Definition at line 99 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

void LocalCartesian::Forward ( double  lat,
double  lon,
double  h,
[System::Runtime::InteropServices::Out] double%  x,
[System::Runtime::InteropServices::Out] double%  y,
[System::Runtime::InteropServices::Out] double%  z,
[System::Runtime::InteropServices::Out] array< double, 2 >^%  M 
)

Convert from geodetic to local cartesian coordinates and return rotation matrix.

Parameters
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[in]hheight of point above the ellipsoid (meters).
[out]xlocal cartesian coordinate (meters).
[out]ylocal cartesian coordinate (meters).
[out]zlocal cartesian coordinate (meters).
[out]Ma 3 × 3 rotation matrix.

lat should be in the range [−90°, 90°].

Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways

  • in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
  • in x, y, z coordinates (where the components are relative to the local coordinate system at (lat0, lon0, h0)); call this representation v0.

Then we have v0 = Mv1.

Definition at line 112 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

void LocalCartesian::Reset ( double  lat0,
double  lon0,
double  h0 
)

Reset the origin.

Parameters
[in]lat0latitude at origin (degrees).
[in]lon0longitude at origin (degrees).
[in]h0height above ellipsoid at origin (meters); default 0.

lat0 should be in the range [−90°, 90°].

Definition at line 93 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

void LocalCartesian::Reverse ( double  x,
double  y,
double  z,
[System::Runtime::InteropServices::Out] double%  lat,
[System::Runtime::InteropServices::Out] double%  lon,
[System::Runtime::InteropServices::Out] double%  h 
)

Convert from local cartesian to geodetic coordinates.

Parameters
[in]xlocal cartesian coordinate (meters).
[in]ylocal cartesian coordinate (meters).
[in]zlocal cartesian coordinate (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]hheight of point above the ellipsoid (meters).

The value of lon returned is in the range [−180°, 180°).

Definition at line 131 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

void LocalCartesian::Reverse ( double  x,
double  y,
double  z,
[System::Runtime::InteropServices::Out] double%  lat,
[System::Runtime::InteropServices::Out] double%  lon,
[System::Runtime::InteropServices::Out] double%  h,
[System::Runtime::InteropServices::Out] array< double, 2 >^%  M 
)

Convert from local cartesian to geodetic coordinates and return rotation matrix.

Parameters
[in]xlocal cartesian coordinate (meters).
[in]ylocal cartesian coordinate (meters).
[in]zlocal cartesian coordinate (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]hheight of point above the ellipsoid (meters).
[out]Ma 3 × 3 rotation matrix.

Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways

  • in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
  • in x, y, z coordinates (where the components are relative to the local coordinate system at (lat0, lon0, h0)); call this representation v0.

Then we have v1 = MTv0, where MT is the transpose of M.

Definition at line 144 of file dotnet/NETGeographicLib/LocalCartesian.cpp.

Member Data Documentation

property double NETGeographicLib::LocalCartesian::Flattening { double get()
Returns
f the flattening of the ellipsoid. This is the value inherited from the Geocentric object used in the constructor.

Definition at line 242 of file LocalCartesian.h.

property double NETGeographicLib::LocalCartesian::HeightOrigin { double get()
Returns
height of the origin (meters).

Definition at line 229 of file LocalCartesian.h.

property double NETGeographicLib::LocalCartesian::LatitudeOrigin { double get()
Returns
latitude of the origin (degrees).

Definition at line 219 of file LocalCartesian.h.

property double NETGeographicLib::LocalCartesian::LongitudeOrigin { double get()
Returns
longitude of the origin (degrees).

Definition at line 224 of file LocalCartesian.h.

GeographicLib::LocalCartesian* NETGeographicLib::LocalCartesian::m_pLocalCartesian
private

Definition at line 52 of file LocalCartesian.h.

property double NETGeographicLib::LocalCartesian::MajorRadius { double get()
Returns
a the equatorial radius of the ellipsoid (meters). This is the value of a inherited from the Geocentric object used in the constructor.

Definition at line 236 of file LocalCartesian.h.


The documentation for this class was generated from the following files:


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