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

.NET Wrapper for GeographicLib::AlbersEqualArea. More...

#include <AlbersEqualArea.h>

Public Types

enum  StandardTypes { StandardTypes::CylindricalEqualArea, StandardTypes::AzimuthalEqualAreaNorth, StandardTypes::AzimuthalEqualAreaSouth }
 

Public Member Functions

 AlbersEqualArea (StandardTypes type)
 
 AlbersEqualArea (double a, double f, double stdlat, double k0)
 
 AlbersEqualArea (double a, double f, double stdlat1, double stdlat2, double k1)
 
 AlbersEqualArea (double a, double f, double sinlat1, double coslat1, double sinlat2, double coslat2, double k1)
 
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)
 
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)
 
 ~AlbersEqualArea ()
 Destructor. More...
 

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

 !AlbersEqualArea ()
 

Private Attributes

GeographicLib::AlbersEqualAream_pAlbersEqualArea
 

Detailed Description

.NET Wrapper for GeographicLib::AlbersEqualArea.

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

Implementation taken from the report,

This is a implementation of the equations in Snyder except that divided differences will be [have been] used to transform the expressions into ones which may be evaluated accurately. [In this implementation, the projection correctly becomes the cylindrical equal area or the azimuthal equal area projection when the standard latitude is the equator or a pole.]

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 minimum azimuthal scale, with an azimuthal scale specified on this parallel. This latitude is also used as the latitude of origin which is returned by AlbersEqualArea::OriginLatitude. The azimuthal scale on the latitude of origin is given by AlbersEqualArea::CentralScale. The case with two standard parallels at opposite poles is singular and is disallowed. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions. AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the meridian convergence, γ, and azimuthal scale, k. A small square aligned with the cardinal directions is projected to a rectangle with dimensions k (in the E-W direction) and 1/k (in the N-S direction). The E-W sides of the rectangle are oriented γ degrees counter-clockwise from the x axis. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin.

C# Example:

using System;
namespace example_AlbersEqualArea
{
class Program
{
static void Main(string[] args)
{
try {
const double
lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
k1 = 1, // scale
lon0 = -77 - 45/60.0; // Central meridian
// Set up basic projection
AlbersEqualArea albers = new AlbersEqualArea( Constants.WGS84.MajorRadius,
Constants.WGS84.Flattening,
lat1, lat2, k1);
{
// Sample conversion from geodetic to Albers Equal Area
double lat = 39.95, lon = -75.17; // Philadelphia
double x, y;
albers.Forward(lon0, lat, lon, out x, out y);
Console.WriteLine( String.Format("X: {0} Y: {1}", x, y ) );
}
{
// Sample conversion from Albers Equal Area grid to geodetic
double x = 220e3, y = -53e3;
double lat, lon;
albers.Reverse(lon0, x, y, out lat, out lon);
Console.WriteLine( String.Format("Latitude: {0} Longitude: {1}", lat, lon ) );
}
}
catch (GeographicErr e) {
Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) );
}
}
}
}

Managed C++ Example:

// Example of using the GeographicLib::AlbersEqualArea class
#include <iostream>
#include <exception>
using namespace std;
using namespace GeographicLib;
int main() {
try {
const double
a = Constants::WGS84_a(),
f = Constants::WGS84_f(),
lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
k1 = 1, // scale
lon0 = -77 - 45/60.0; // Central meridian
// Set up basic projection
const AlbersEqualArea albers(a, f, lat1, lat2, k1);
{
// Sample conversion from geodetic to Albers Equal Area
double lat = 39.95, lon = -75.17; // Philadelphia
double x, y;
albers.Forward(lon0, lat, lon, x, y);
cout << x << " " << y << "\n";
}
{
// Sample conversion from Albers Equal Area grid to geodetic
double x = 220e3, y = -53e3;
double lat, lon;
albers.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_AlbersEqualArea
Sub Main()
Try
Dim lat1 As Double = 40 + 58 / 60.0 : Dim lat2 As Double = 39 + 56 / 60.0 ' standard parallels
Dim k1 As Double = 1 ' scale
Dim lon0 As Double = -77 - 45 / 60.0 ' Central meridian
' Set up basic projection
Dim albers As AlbersEqualArea = New AlbersEqualArea(Constants.WGS84.MajorRadius,
Constants.WGS84.Flattening,
lat1, lat2, k1)
' Sample conversion from geodetic to Albers Equal Area
Dim lat As Double = 39.95 : Dim lon As Double = -75.17 ' Philadelphia
Dim x, y As Double
albers.Forward(lon0, lat, lon, x, y)
Console.WriteLine(String.Format("X: {0} Y: {1}", x, y))
' Sample conversion from Albers Equal Area grid to geodetic
x = 220000.0 : y = -53000.0
albers.Reverse(lon0, x, y, lat, lon)
Console.WriteLine(String.Format("Latitude: {0} Longitude: {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 constructor has been provided that creates the standard projections.

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

Definition at line 67 of file AlbersEqualArea.h.

Member Enumeration Documentation

Standard AlbersEqualAreaProjections that assume the WGS84 ellipsoid.

Enumerator
CylindricalEqualArea 

cylindrical equal area projection (stdlat = 0, and k0 = 1)

AzimuthalEqualAreaNorth 

Lambert azimuthal equal area projection (stdlat = 90°, and k0 = 1)

AzimuthalEqualAreaSouth 

Lambert azimuthal equal area projection (stdlat = −90°, and k0 = 1)

Definition at line 79 of file AlbersEqualArea.h.

Constructor & Destructor Documentation

AlbersEqualArea::!AlbersEqualArea ( )
private

Definition at line 19 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

NETGeographicLib::AlbersEqualArea::~AlbersEqualArea ( )
inline

Destructor.

Definition at line 87 of file AlbersEqualArea.h.

AlbersEqualArea::AlbersEqualArea ( StandardTypes  type)

! Constructor for one of the standard types.

Parameters
[in]typeThe desired standard type.

Definition at line 29 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

AlbersEqualArea::AlbersEqualArea ( 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]k0azimuthal scale 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 70 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

AlbersEqualArea::AlbersEqualArea ( 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]k1azimuthal scale 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 stdlat1 and stdlat2 are opposite poles.

Definition at line 53 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

AlbersEqualArea::AlbersEqualArea ( 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]k1azimuthal scale 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 stdlat1 and stdlat2 are opposite poles.

This allows parallels close to the poles to be specified accurately. This routine computes the latitude of origin and the azimuthal scale at this latitude. If dlat = abs(lat2lat1) ≤ 160°, then the error in the latitude of origin is less than 4.5 × 10−14d;.

Definition at line 87 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

Member Function Documentation

void AlbersEqualArea::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]kazimuthal scale of projection at point; the radial scale is the 1/k.

The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No false easting or northing is added and lat should be in the range [−90°, 90°]. 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 121 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

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

AlbersEqualArea::Forward without returning the convergence and scale.

Definition at line 151 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

void AlbersEqualArea::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]kazimuthal scale of projection at point; the radial scale is the 1/k.

The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No false easting or northing is added. The value of lon returned is in the range [−180°, 180°). The value of lat returned is in the range [−90°, 90°]. If the input point is outside the legal projected space the nearest pole is returned.

Definition at line 136 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

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

AlbersEqualArea::Reverse without returning the convergence and scale.

Definition at line 162 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

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

Set the azimuthal scale for the projection.

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

This allows a "latitude of conformality" to be specified.

Definition at line 108 of file dotnet/NETGeographicLib/AlbersEqualArea.cpp.

Member Data Documentation

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

Definition at line 261 of file AlbersEqualArea.h.

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

Definition at line 246 of file AlbersEqualArea.h.

GeographicLib::AlbersEqualArea* NETGeographicLib::AlbersEqualArea::m_pAlbersEqualArea
private

Definition at line 71 of file AlbersEqualArea.h.

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

Definition at line 240 of file AlbersEqualArea.h.

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

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

Definition at line 255 of file AlbersEqualArea.h.


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


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