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

.NET wrapper for GeographicLib::LambertConformalConic. More...

#include <LambertConformalConic.h>

Public Member Functions

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)
 
void Forward (double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double%x, [System::Runtime::InteropServices::Out] double%y)
 
 LambertConformalConic (double a, double f, double stdlat, double k0)
 
 LambertConformalConic (double a, double f, double stdlat1, double stdlat2, double k1)
 
 LambertConformalConic (double a, double f, double sinlat1, double coslat1, double sinlat2, double coslat2, double k1)
 
 LambertConformalConic ()
 
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)
 
void Reverse (double lon0, double x, double y, [System::Runtime::InteropServices::Out] double%lat, [System::Runtime::InteropServices::Out] double%lon)
 
void SetScale (double lat, double k)
 
 ~LambertConformalConic ()
 

Public Attributes

Inspector functions
property double MajorRadius { double get()
 
property double Flattening { double get()
 
property double OriginLatitude { double get()
 
property double CentralScale { double get()
 

Private Member Functions

 !LambertConformalConic (void)
 

Private Attributes

GeographicLib::LambertConformalConicm_pLambertConformalConic
 

Detailed Description

.NET wrapper for GeographicLib::LambertConformalConic.

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

Implementation taken from the report,

This is a implementation of the equations in Snyder except that divided differences have been used to transform the expressions into ones which may be evaluated accurately and that Newton's method is used to invert the projection. In this implementation, the projection correctly becomes the Mercator projection or the polar stereographic projection when the standard latitude is the equator or a pole. The accuracy of the projections is about 10 nm (10 nanometers).

The ellipsoid parameters, the standard parallels, and the scale on the standard parallels are set in the constructor. Internally, the case with two standard parallels is converted into a single standard parallel, the latitude of tangency (also the latitude of minimum scale), with a scale specified on this parallel. This latitude is also used as the latitude of origin which is returned by LambertConformalConic::OriginLatitude. The scale on the latitude of origin is given by LambertConformalConic::CentralScale. The case with two distinct standard parallels where one is a pole is singular and is disallowed. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the LambertConformalConic::Forward and LambertConformalConic::Reverse functions. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin. However these are can be simply included by the calling function. For example the Pennsylvania South state coordinate system (EPSG:3364) is obtained by: C# Example:

using System;
namespace example_LambertConformalConic
{
class Program
{
static void Main(string[] args)
{
try {
// Define the Pennsylvania South state coordinate system EPSG:3364
// http://www.spatialreference.org/ref/epsg/3364/
const double
lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
k1 = 1, // scale
lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin
fe = 600000, fn = 0; // false easting and northing
// Set up basic projection
LambertConformalConic PASouth = new LambertConformalConic( Constants.WGS84.MajorRadius,
Constants.WGS84.Flattening,
lat1, lat2, k1);
double x0, y0;
// Transform origin point
PASouth.Forward(lon0, lat0, lon0, out x0, out y0);
x0 -= fe; y0 -= fn;
{
// Sample conversion from geodetic to PASouth grid
double lat = 39.95, lon = -75.17; // Philadelphia
double x, y;
PASouth.Forward(lon0, lat, lon, out x, out y);
x -= x0; y -= y0;
Console.WriteLine( String.Format("{0} {1}", x, y) );
}
{
// Sample conversion from PASouth grid to geodetic
double x = 820e3, y = 72e3;
double lat, lon;
x += x0; y += y0;
PASouth.Reverse(lon0, x, y, out lat, out lon);
Console.WriteLine( String.Format("{0} {1}", lat, lon) );
}
}
catch (GeographicErr e) {
Console.WriteLine( String.Format("Caught exception: {0}", e.Message) );
}
}
}
}

Managed C++ Example:

// Example of using the GeographicLib::LambertConformalConic class
#include <iostream>
#include <exception>
using namespace std;
using namespace GeographicLib;
int main() {
try {
// Define the Pennsylvania South state coordinate system EPSG:3364
// http://www.spatialreference.org/ref/epsg/3364/
const double
a = Constants::WGS84_a(),
f = 1/298.257222101, // GRS80
lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
k1 = 1, // scale
lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin
fe = 600000, fn = 0; // false easting and northing
// Set up basic projection
const LambertConformalConic PASouth(a, f, lat1, lat2, k1);
double x0, y0;
// Transform origin point
PASouth.Forward(lon0, lat0, lon0, x0, y0);
x0 -= fe; y0 -= fn;
{
// Sample conversion from geodetic to PASouth grid
double lat = 39.95, lon = -75.17; // Philadelphia
double x, y;
PASouth.Forward(lon0, lat, lon, x, y);
x -= x0; y -= y0;
cout << x << " " << y << "\n";
}
{
// Sample conversion from PASouth grid to geodetic
double x = 820e3, y = 72e3;
double lat, lon;
x += x0; y += y0;
PASouth.Reverse(lon0, x, y, lat, lon);
cout << lat << " " << lon << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

Visual Basic Example:

Imports NETGeographicLib
Module example_LambertConformalConic
Sub Main()
Try
' Define the Pennsylvania South state coordinate system EPSG:3364
' http://www.spatialreference.org/ref/epsg/3364/
Dim lat1 As Double = 40 + 58 / 60.0, lat2 = 39 + 56 / 60.0 ' standard parallels
Dim k1 As Double = 1 ' scale
Dim lat0 As Double = 39 + 20 / 60.0, lon0 = -77 - 45 / 60.0 ' origin
Dim fe As Double = 600000, fn = 0 ' false easting and northing
' Set up basic projection
Dim PASouth As LambertConformalConic = New LambertConformalConic(Constants.WGS84.MajorRadius,
Constants.WGS84.Flattening,
lat1, lat2, k1)
Dim x0, y0 As Double
' Transform origin point
PASouth.Forward(lon0, lat0, lon0, x0, y0)
x0 -= fe : y0 -= fn
' Sample conversion from geodetic to PASouth grid
Dim lat As Double = 39.95, lon = -75.17 ' Philadelphia
Dim x, y As Double
PASouth.Forward(lon0, lat, lon, x, y)
x -= x0 : y -= y0
Console.WriteLine(String.Format("{0} {1}", x, y))
' Sample conversion from PASouth grid to geodetic
x = 820000.0 : y = 72000.0
x += x0 : y += y0
PASouth.Reverse(lon0, x, y, lat, lon)
Console.WriteLine(String.Format("{0} {1}", lat, lon))
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module

INTERFACE DIFFERENCES:
A default constructor has been provided that assumes a Mercator projection.

The MajorRadius, Flattening, OriginLatitude, and CentralScale functions are implemented as properties.

Definition at line 65 of file LambertConformalConic.h.

Constructor & Destructor Documentation

LambertConformalConic::!LambertConformalConic ( void  )
private
LambertConformalConic::LambertConformalConic ( double  a,
double  f,
double  stdlat,
double  k0 
)

Constructor with a single standard parallel.

Parameters
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in]stdlatstandard parallel (degrees), the circle of tangency.
[in]k0scale on the standard parallel.
Exceptions
GeographicErrif a, (1 − f ) a, or k0 is not positive.
GeographicErrif stdlat is not in [−90°, 90°].

Definition at line 31 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

LambertConformalConic::LambertConformalConic ( double  a,
double  f,
double  stdlat1,
double  stdlat2,
double  k1 
)

Constructor with two standard parallels.

Parameters
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in]stdlat1first standard parallel (degrees).
[in]stdlat2second standard parallel (degrees).
[in]k1scale on the standard parallels.
Exceptions
GeographicErrif a, (1 − f ) a, or k1 is not positive.
GeographicErrif stdlat1 or stdlat2 is not in [−90°, 90°], or if either stdlat1 or stdlat2 is a pole and stdlat1 is not equal stdlat2.

Definition at line 50 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

LambertConformalConic::LambertConformalConic ( double  a,
double  f,
double  sinlat1,
double  coslat1,
double  sinlat2,
double  coslat2,
double  k1 
)

Constructor with two standard parallels specified by sines and cosines.

Parameters
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in]sinlat1sine of first standard parallel.
[in]coslat1cosine of first standard parallel.
[in]sinlat2sine of second standard parallel.
[in]coslat2cosine of second standard parallel.
[in]k1scale on the standard parallels.
Exceptions
GeographicErrif a, (1 − f ) a, or k1 is not positive.
GeographicErrif stdlat1 or stdlat2 is not in [−90°, 90°], or if either stdlat1 or stdlat2 is a pole and stdlat1 is not equal stdlat2.

This allows parallels close to the poles to be specified accurately. This routine computes the latitude of origin and the scale at this latitude. In the case where lat1 and lat2 are different, the errors in this routines are as follows: if dlat = abs(lat2lat1) ≤ 160° and max(abs(lat1), abs(lat2)) ≤ 90 − min(0.0002, 2.2 × 10−6(180 − dlat), 6 &times 10−8 dlat2) (in degrees), then the error in the latitude of origin is less than 4.5 × 10−14d and the relative error in the scale is less than 7 × 10−15.

Definition at line 69 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

LambertConformalConic::LambertConformalConic ( )

The default constructor assumes a Mercator projection.

Definition at line 91 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

NETGeographicLib::LambertConformalConic::~LambertConformalConic ( )
inline

The destructor calls the finalizer.

Definition at line 148 of file LambertConformalConic.h.

Member Function Documentation

void LambertConformalConic::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 
)

Forward projection, from geographic to Lambert conformal conic.

Parameters
[in]lon0central meridian longitude (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

The latitude origin is given by LambertConformalConic::LatitudeOrigin(). No false easting or northing is added and lat should be in the range [−90°, 90°]. The error in the projection is less than about 10 nm (10 nanometers), true distance, and the errors in the meridian convergence and scale are consistent with this. The values of x and y returned for points which project to infinity (i.e., one or both of the poles) will be large but finite.

Definition at line 118 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

void LambertConformalConic::Forward ( double  lon0,
double  lat,
double  lon,
[System::Runtime::InteropServices::Out] double%  x,
[System::Runtime::InteropServices::Out] double%  y 
)

LambertConformalConic::Forward without returning the convergence and scale.

Definition at line 148 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

void LambertConformalConic::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 
)

Reverse projection, from Lambert conformal conic to geographic.

Parameters
[in]lon0central meridian longitude (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

The latitude origin is given by LambertConformalConic::LatitudeOrigin(). No false easting or northing is added. The value of lon returned is in the range [−180°, 180°). The error in the projection is less than about 10 nm (10 nanometers), true distance, and the errors in the meridian convergence and scale are consistent with this.

Definition at line 133 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

void LambertConformalConic::Reverse ( double  lon0,
double  x,
double  y,
[System::Runtime::InteropServices::Out] double%  lat,
[System::Runtime::InteropServices::Out] double%  lon 
)

LambertConformalConic::Reverse without returning the convergence and scale.

Definition at line 159 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

void LambertConformalConic::SetScale ( double  lat,
double  k 
)

Set the scale for the projection.

Parameters
[in]lat(degrees).
[in]kscale at latitude lat (default 1).
Exceptions
GeographicErrk is not positive.
GeographicErrif lat is not in [−90°, 90°].

Definition at line 105 of file dotnet/NETGeographicLib/LambertConformalConic.cpp.

Member Data Documentation

property double NETGeographicLib::LambertConformalConic::CentralScale { double get()
Returns
central scale for the projection. This is the scale on the latitude of origin.

Definition at line 256 of file LambertConformalConic.h.

property double NETGeographicLib::LambertConformalConic::Flattening { double get()
Returns
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 241 of file LambertConformalConic.h.

GeographicLib::LambertConformalConic* NETGeographicLib::LambertConformalConic::m_pLambertConformalConic
private

Definition at line 69 of file LambertConformalConic.h.

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

Definition at line 235 of file LambertConformalConic.h.

property double NETGeographicLib::LambertConformalConic::OriginLatitude { double get()
Returns
latitude of the origin for the projection (degrees).

This is the latitude of minimum scale and equals the stdlat in the 1-parallel constructor and lies between stdlat1 and stdlat2 in the 2-parallel constructors.

Definition at line 250 of file LambertConformalConic.h.


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


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