|
static void | Forward (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 void | Reverse (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) |
|
static void | Forward (double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) |
|
static void | Reverse (double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) |
|
static void | GridReference (double x, double y, int prec, [System::Runtime::InteropServices::Out] System::String^% gridref) |
|
static void | GridReference (System::String^ gridref, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] int% prec, bool centerp) |
|
|
static double | MajorRadius () |
|
static double | Flattening () |
|
static double | CentralScale () |
|
static double | OriginLatitude () |
|
static double | OriginLongitude () |
|
static double | FalseNorthing () |
|
static double | FalseEasting () |
|
.NET wrapper for GeographicLib::OSGB.
This class allows .NET applications to access GeographicLib::OSGB.
The class implements the coordinate system used by the Ordnance Survey for maps of Great Britain and conversions to the grid reference system.
See
WARNING: the latitudes and longitudes for the Ordnance Survey grid system do not use the WGS84 datum. Do not use the values returned by this class in the UTMUPS, MGRS, or Geoid classes without first converting the datum (and vice versa).
C# Example:
namespace example_OSGB
{
class Program
{
static void Main(string[] args)
{
try {
{
double
lat = DMS.Decode(52,39,27.2531),
lon = DMS.Decode( 1,43, 4.5177);
double x, y;
OSGB.Forward(lat, lon, out x, out y);
string gridref;
OSGB.GridReference(x, y, 2, out gridref);
Console.WriteLine(String.Format("{0} {1} {2}", x, y, gridref));
}
{
string gridref = "TG5113";
double x, y;
int prec;
OSGB.GridReference(gridref, out x, out y, out prec, true);
double lat, lon;
OSGB.Reverse(x, y, out lat, out lon);
Console.WriteLine(String.Format("{0} {1} {2}", prec, lat, lon));
}
}
catch (GeographicErr e) {
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}
Managed C++ Example:
int main(array<System::String ^> ^)
{
try {
{
double
double x, y;
String^ gridref;
Console::WriteLine(String::Format("{0} {1} {2}", x, y, gridref));
}
{
String^ gridref = "TG5113";
double x, y;
int prec;
double lat, lon;
Console::WriteLine(String::Format("{0} {1} {2}", prec, lat, lon));
}
}
Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
return 0;
}
return 0;
}
Visual Basic Example:
Imports NETGeographicLib
Module example_OSGB
Sub Main()
Try
' Sample forward calculation from
' A guide to coordinate systems in Great Britain
Dim lat As Double = DMS.Decode(52, 39, 27.2531)
Dim lon As Double = DMS.Decode(1, 43, 4.5177)
Dim x, y As Double
OSGB.Forward(lat, lon, x, y)
Dim gridref As String = ""
OSGB.GridReference(x, y, 2, gridref)
Console.WriteLine(String.Format("{0} {1} {2}", x, y, gridref))
' Sample reverse calculation
gridref = "TG5113"
Dim prec As Integer
OSGB.GridReference(gridref, x, y, prec, True)
OSGB.Reverse(x, y, lat, lon)
Console.WriteLine(String.Format("{0} {1} {2}", prec, lat, lon))
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module
Definition at line 41 of file OSGB.h.