.NET wrapper for GeographicLib::Geoid. More...
#include <Geoid.h>
Public Types | |
enum | ConvertFlag { ConvertFlag::ELLIPSOIDTOGEOID = -1, ConvertFlag::NONE = 0, ConvertFlag::GEOIDTOELLIPSOID = 1 } |
Public Member Functions | |
Setting up the geoid | |
Geoid (System::String^name, System::String^path, bool cubic, bool threadsafe) | |
~Geoid () | |
void | CacheArea (double south, double west, double north, double east) |
void | CacheAll () |
void | CacheClear () |
Compute geoid heights | |
double | Height (double lat, double lon) |
double | ConvertHeight (double lat, double lon, double h, ConvertFlag d) |
Static Public Member Functions | |
static System::String | DefaultGeoidName () |
static System::String | DefaultGeoidPath () |
Public Attributes | |
Inspector functions | |
property System::String | Description { System::String^ get() |
property System::String | DateTime { System::String^ get() |
property System::String | GeoidFile { System::String^ get() |
property System::String | GeoidName { System::String^ get() |
property System::String | GeoidDirectory { System::String^ get() |
property System::String | Interpolation { System::String^ get() |
property double | MaxError { double get() |
property double | RMSError { double get() |
property double | Offset { double get() |
property double | Scale { double get() |
property bool | ThreadSafe { bool get() |
property bool | Cache { bool get() |
property double | CacheWest { double get() |
property double | CacheEast { double get() |
property double | CacheNorth { double get() |
property double | CacheSouth { double get() |
property double | MajorRadius { double get() |
property double | Flattening { double get() |
Private Member Functions | |
!Geoid (void) | |
Private Attributes | |
const GeographicLib::Geoid * | m_pGeoid |
.NET wrapper for GeographicLib::Geoid.
This class allows .NET applications to access GeographicLib::Geoid.
This class evaluated the height of one of the standard geoids, EGM84, EGM96, or EGM2008 by bilinear or cubic interpolation into a rectangular grid of data. These geoid models are documented in
The geoids are defined in terms of spherical harmonics. However in order to provide a quick and flexible method of evaluating the geoid heights, this class evaluates the height by interpolation into a grid of precomputed values.
The geoid height, N, can be used to convert a height above the ellipsoid, h, to the corresponding height above the geoid (roughly the height above mean sea level), H, using the relations
h = N + H; H = −N + h.
See geoid for details of how to install the data sets, the data format, estimates of the interpolation errors, and how to use caching.
This class is typically not thread safe in that a single instantiation cannot be safely used by multiple threads because of the way the object reads the data set and because it maintains a single-cell cache. If multiple threads need to calculate geoid heights they should all construct thread-local instantiations. Alternatively, set the optional threadsafe parameter to true in the constructor. This causes the constructor to read all the data into memory and to turn off the single-cell caching which results in a Geoid object which is thread safe.
C# Example:
Managed C++ Example:
Visual Basic Example:
INTERFACE DIFFERENCES:
The () operator has been replaced with Height method.
The following functions are implemented as properties: Description, DateTime, GeoidFile, GeoidName, GeoidDirectory, Interpolation, MaxError, RMSError, Offset, Scale, ThreadSafe, Cache, CacheWest, CacheEast, CacheNorth, CacheSouth, MajorRadius, and Flattening.
|
strong |
Flags indicating conversions between heights above the geoid and heights above the ellipsoid.
|
private |
Definition at line 19 of file dotnet/NETGeographicLib/Geoid.cpp.
Geoid::Geoid | ( | System::String^ | name, |
System::String^ | path, | ||
bool | cubic, | ||
bool | threadsafe | ||
) |
Construct a geoid.
[in] | name | the name of the geoid. |
[in] | path | (optional) directory for data file. |
[in] | cubic | (optional) interpolation method; false means bilinear, true (the default) means cubic. |
[in] | threadsafe | (optional), if true, construct a thread safe object. The default is false |
GeographicErr | if the data file cannot be found, is unreadable, or is corrupt. |
GeographicErr | if threadsafe is true but the memory necessary for caching the data can't be allocated. |
The data file is formed by appending ".pgm" to the name. If path is specified (and is non-empty), then the file is loaded from directory, path. Otherwise the path is given by DefaultGeoidPath(). If the threadsafe parameter is true, the data set is read into memory, the data file is closed, and single-cell caching is turned off; this results in a Geoid object which is thread safe.
Definition at line 29 of file dotnet/NETGeographicLib/Geoid.cpp.
|
inline |
void Geoid::CacheAll | ( | ) |
Cache all the data.
GeographicErr | if the memory necessary for caching the data can't be allocated (in this case, you will have no cache and can try again with a smaller area). |
GeographicErr | if there's a problem reading the data. |
GeographicErr | if this is called on a threadsafe Geoid. |
On most computers, this is fast for data sets with grid resolution of 5' or coarser. For a 1' grid, the required RAM is 450MB; a 2.5' grid needs 72MB; and a 5' grid needs 18MB.
Definition at line 64 of file dotnet/NETGeographicLib/Geoid.cpp.
void Geoid::CacheArea | ( | double | south, |
double | west, | ||
double | north, | ||
double | east | ||
) |
Set up a cache.
[in] | south | latitude (degrees) of the south edge of the cached area. |
[in] | west | longitude (degrees) of the west edge of the cached area. |
[in] | north | latitude (degrees) of the north edge of the cached area. |
[in] | east | longitude (degrees) of the east edge of the cached area. |
GeographicErr | if the memory necessary for caching the data can't be allocated (in this case, you will have no cache and can try again with a smaller area). |
GeographicErr | if there's a problem reading the data. |
GeographicErr | if this is called on a threadsafe Geoid. |
Cache the data for the specified "rectangular" area bounded by the parallels south and north and the meridians west and east. east is always interpreted as being east of west, if necessary by adding 360° to its value. south and north should be in the range [−90°, 90°].
Definition at line 51 of file dotnet/NETGeographicLib/Geoid.cpp.
void Geoid::CacheClear | ( | ) |
Clear the cache. This never throws an error. (This does nothing with a thread safe Geoid.)
Definition at line 77 of file dotnet/NETGeographicLib/Geoid.cpp.
double Geoid::ConvertHeight | ( | double | lat, |
double | lon, | ||
double | h, | ||
ConvertFlag | d | ||
) |
Convert a height above the geoid to a height above the ellipsoid and vice versa.
[in] | lat | latitude of the point (degrees). |
[in] | lon | longitude of the point (degrees). |
[in] | h | height of the point (degrees). |
[in] | d | a Geoid::convertflag specifying the direction of the conversion; Geoid::GEOIDTOELLIPSOID means convert a height above the geoid to a height above the ellipsoid; Geoid::ELLIPSOIDTOGEOID means convert a height above the ellipsoid to a height above the geoid. |
GeographicErr | if there's a problem reading the data; this never happens if (lat, lon) is within a successfully cached area. |
Definition at line 96 of file dotnet/NETGeographicLib/Geoid.cpp.
|
static |
This is the value of the environment variable GEOGRAPHICLIB_GEOID_NAME, if set, otherwise, it is "egm96-5". The Geoid class does not use this function; it is just provided as a convenience for a calling program when constructing a Geoid object.
Definition at line 125 of file dotnet/NETGeographicLib/Geoid.cpp.
|
static |
This is the value of the environment variable GEOGRAPHICLIB_GEOID_PATH, if set; otherwise, it is $GEOGRAPHICLIB_DATA/geoids if the environment variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default (/usr/local/share/GeographicLib/geoids on non-Windows systems and C:/ProgramData/GeographicLib/geoids on Windows systems).
Definition at line 111 of file dotnet/NETGeographicLib/Geoid.cpp.
double Geoid::Height | ( | double | lat, |
double | lon | ||
) |
Compute the geoid height at a point
[in] | lat | latitude of the point (degrees). |
[in] | lon | longitude of the point (degrees). |
GeographicErr | if there's a problem reading the data; this never happens if (lat, lon) is within a successfully cached area. |
The latitude should be in [−90°, 90°].
Definition at line 83 of file dotnet/NETGeographicLib/Geoid.cpp.
property bool NETGeographicLib::Geoid::Cache { bool get() |
property double NETGeographicLib::Geoid::CacheEast { double get() |
property double NETGeographicLib::Geoid::CacheNorth { double get() |
property double NETGeographicLib::Geoid::CacheSouth { double get() |
property double NETGeographicLib::Geoid::CacheWest { double get() |
property System::String NETGeographicLib::Geoid::DateTime { System::String^ get() |
property System::String NETGeographicLib::Geoid::Description { System::String^ get() |
property double NETGeographicLib::Geoid::Flattening { double get() |
property System::String NETGeographicLib::Geoid::GeoidDirectory { System::String^ get() |
property System::String NETGeographicLib::Geoid::GeoidFile { System::String^ get() |
property System::String NETGeographicLib::Geoid::GeoidName { System::String^ get() |
property System::String NETGeographicLib::Geoid::Interpolation { System::String^ get() |
|
private |
property double NETGeographicLib::Geoid::MajorRadius { double get() |
property double NETGeographicLib::Geoid::MaxError { double get() |
property double NETGeographicLib::Geoid::Offset { double get() |
property double NETGeographicLib::Geoid::RMSError { double get() |
property double NETGeographicLib::Geoid::Scale { double get() |
property bool NETGeographicLib::Geoid::ThreadSafe { bool get() |