Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将Lat/Lon转换为MGRS_C#_Math_Gis_Coordinates_Coordinate Systems - Fatal编程技术网

C# 将Lat/Lon转换为MGRS

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

有人知道我在哪里可以找到一个代码库来将Lat/Lon位置转换为?如果可能的话,我正在寻找一个C#实现。

您可以使用的C#包装器将lat/lon转换为UTM。然后,您只需要为MGRS适当地设置值的格式,因为它只是具有不同数字格式的UTM。

我们最终使用代码创建了一个DLL,并使用PInvoke调用函数。 我们从源代码中提取了以下内容,以防有人想知道(最小解决方案):

  • 极性
  • 特兰默斯
  • ups
  • utm
  • 经理
我们使用的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);
对应于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项目中