C# 将Lat/Lon转换为MGRS
有人知道我在哪里可以找到一个代码库来将Lat/Lon位置转换为?如果可能的话,我正在寻找一个C#实现。您可以使用的C#包装器将lat/lon转换为UTM。然后,您只需要为MGRS适当地设置值的格式,因为它只是具有不同数字格式的UTM。我们最终使用代码创建了一个DLL,并使用PInvoke调用函数。 我们从源代码中提取了以下内容,以防有人想知道(最小解决方案):C# 将Lat/Lon转换为MGRS,c#,math,gis,coordinates,coordinate-systems,C#,Math,Gis,Coordinates,Coordinate Systems,有人知道我在哪里可以找到一个代码库来将Lat/Lon位置转换为?如果可能的话,我正在寻找一个C#实现。您可以使用的C#包装器将lat/lon转换为UTM。然后,您只需要为MGRS适当地设置值的格式,因为它只是具有不同数字格式的UTM。我们最终使用代码创建了一个DLL,并使用PInvoke调用函数。 我们从源代码中提取了以下内容,以防有人想知道(最小解决方案): 极性 特兰默斯 ups utm 经理 我们使用的PInvoke签名: [DllImport("mgrs.dll")] public
- 极性
- 特兰默斯
- ups
- utm
- 经理
[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);
对应于mgrs.h中的此功能:
MGRSDLL_API long __stdcall Convert_Geodetic_To_MGRS(
double Latitude,
double Longitude,
long Precision,
char* MGRS);
在js上找到,如果有帮助 用法-
var converter = new usngs.Converter();
alert(converter.LLtoMGRS(33.754032, -98.451233, 9));
作为一个Nuget包提供,并且可以做到这一点
Coordinate c = new Coordinate(40.57682, -70.75678);
c.MGRS.ToString(); // Outputs 19T CE 51307 93264
你可能想考虑在HI上问这些问题,你能分享你所创建的PULKEK DLL吗?@以及如何将其添加到我的windows phone项目中