This C# library can be used to convert from one mapping coordinate system to another, for instance converting latitude/longitude to UK OS coordinates. It is based on the JCoord class library and is therefore licensed under the GPL. It also should have all the features available in that library.
Download the source code (requires Visual Studio 2017).
Download the Windows assembly (requires .NET Framework 2.0).
Download the Windows Phone 8 assembly (no longer updated).
Read the documentation.
And here's a simple example of usage. Other than changing the datum, the classes are immutable i.e Their state does not change after instantiation. They have methods to convert to other coordinate systems which return an instance of the required type.
static void Main(string args)
// create an OS grid reference object
OSRef osRef = new OSRef(535598, 182120);
Console.WriteLine("OS reference is " + osRef.ToString());
Console.WriteLine("Grid reference is " + osRef.ToSixFigureString());
LatLng latLng = osRef.ToLatLng();
Console.WriteLine("Lat/long using OSGB36 datum is " + latLng.ToString());
Console.WriteLine("Lat/long using WGS84 datum is " + latLng.ToString());
MGRSRef mgrsRef = latLng.ToMGRSRef();
Console.WriteLine("MGRS reference is " + mgrsRef.ToString());
UTMRef utmRef = mgrsRef.ToUTMRef();
Console.WriteLine("UTM reference is " + utmRef.ToString());
Added LatLng.Bearing that returns the bearing between two LatLng objects 18.104.22.168
Added a new overload of LatLng.ToUtmRef to force the longitude zone used 22.214.171.124
Fixed a bug in the IrishRef constructor and more clean up.
Removed some property setters to improve API consistency 126.96.36.199
Cleaned up the code with ReSharper 188.8.131.52
Added OSRef.ToTenFigureString() method to generate 10 figure OS grid references. 184.108.40.206
OSRef constructor now accepts 6, 8 and 10 figure OS grid references. 220.127.116.11
Better OSRef and IrishRef constructors that take a LatLng, so the LatLng does not have to be using the WGS84 datum. 18.104.22.168
Added support for ED50 datum. 22.214.171.124
Fixed ToDatum() so it works in more cases (not just when converting from WGS84)
New LatLng copy constructor 126.96.36.199
Added a better performing MGRSRef constructor (thanks to Vincent de Lagabbe) 188.8.131.52
Added helper methods to check validity of latitude/longitudes
Improved the formatting of UTMRef.ToString() method184.108.40.206
Fixed the UTMRef.ToString() method (thanks to Bryan McCauley for providing the fix)220.127.116.11
Added Windows Phone class library (thanks to Timothy Green for the suggestion)18.104.22.168
Fixed LatLng constructor which takes degrees. minutes and seconds to handle the correct range.
Fixed OSRef constructor taking a grid reference so it doesn't throw an exception22.214.171.124
MGRSRef constructor taking a single string now works.
MGRSRef constructor with parameters for each part of the MGRS reference no longer throws an exception
MGRSRef conversion to UTM reference now works for more cases
126.96.36.199 - MGRSRef.ToUTMRef() should now work
188.8.131.52 - Fixed a bug in MGRSRef.ToString()
184.108.40.206 - Added generic versions of Datum and Ellipsoid classes to reduce code size
220.127.116.11 - Initial release