SwD*_*n81 10 c# gis math coordinates coordinate-systems
有谁知道在哪里可以找到将Lat/Lon位置转换为军事网格参考系统(MGRS)的代码库?如果可能的话,我正在寻找一个C#实现.
我们最终使用GeoTrans并从代码创建一个 DLL,并使用 PInvoke 调用函数。我们从源代码中提取了以下内容,以防有人想知道(最小解决方案):
我们使用的 PInvoke 签名:
[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);
Run Code Online (Sandbox Code Playgroud)
对应mgrs.h中的这个函数:
MGRSDLL_API long __stdcall Convert_Geodetic_To_MGRS(
double Latitude,
double Longitude,
long Precision,
char* MGRS);
Run Code Online (Sandbox Code Playgroud)