Does anyone know where I could find a library of code for converting Lat/Lon position to Military Grid Reference System (MGRS)? I'm looking for a C# implementation if possible.
We ended up using GeoTrans and create a DLL from the code and using PInvoke to call the functions. We pulled the following from the source incase anyone wanted to know (minimal solution):
The PInvoke Signature we used:
[DllImport("mgrs.dll")]
public static extern int Convert_Geodetic_To_MGRS(
double Latitude,
double Longitude,
int Precision, // 1 to 5, we used 4 (10 square meters)
StringBuilder MGRS);
which corresponds to this function in mgrs.h:
MGRSDLL_API long __stdcall Convert_Geodetic_To_MGRS(
double Latitude,
double Longitude,
long Precision,
char* MGRS);