【问题标题】:T-SQL // How I can convert Northing / Easting coordinates to lat / long? [duplicate]T-SQL //如何将北/东坐标转换为纬度/经度? [复制]
【发布时间】:2012-12-13 10:27:05
【问题描述】:

可能重复:
Easting northing to latitude longitude

我的数据库中有许多北距/东距数据(例如:n 15217, e 88911),我需要使用 T-SQL 将其转换为 Lat/long

我该怎么做?

【问题讨论】:

标签: sql sql-server sql-server-2008 tsql


【解决方案1】:

有一个开源 dll 库here (geocoordconversion) 可以将东/北转换为纬度/经度。因此,您可以敲出一些东西以将其用于原始转换。

另外,可能有用的是,我有一个 project on GitHub,它使用此 DLL 将完整的军械调查邮政编码数据集导入 SQL Server,将东/北转换为纬度/经度。这可作为命令行可执行文件使用。如果这与您想要的完全一致,那么您也许可以使用它。或者至少,有代码强调如何使用 DLL 来执行转换。

更新 在我的项目中,.NET sn-p 使用 dll 转换为纬度/经度:

/// <summary>
/// Converts northing and easting coordinates into Longitude/Latitude coordinates in the WGS84 coordinate system.
/// </summary>
/// <param name="northing">northing coordinate</param>
/// <param name="easting">easting coordinate</param>
/// <returns>converted coordinates</returns>
protected PolarGeoCoordinate ConvertToLonLat(double northing, double easting)
{
    // Use GeoCoordConversion DLL to convert the Eastings & Northings to Lon/Lat
    // coordinates in the WGS84 system. The DLL was pulled from: http://code.google.com/p/geocoordconversion/
    // and is available under the GNU General Public License v3: http://www.gnu.org/licenses/gpl.html
    GridReference gridRef = new GridReference((long)easting, (long)northing);
    PolarGeoCoordinate polarCoord = GridReference.ChangeToPolarGeo(gridRef);
    return PolarGeoCoordinate.ChangeCoordinateSystem(polarCoord, CoordinateSystems.WGS84);
}

【讨论】:

  • +1 因为您的帖子去年帮助我完成了这件事。使用上面提到的dll构建了一个小应用程序
  • 谢谢!这对我来说非常有用。一件事:我选择了正确的方法GridReference.ChangeToPolarGeo(new GridReference(1233, 123));
  • 是的,请参阅我的回答中的更新
  • +1。非常好。我很惊讶它没有得到更多的支持,因为搜索最终登陆这里!
【解决方案2】:

如果您看到 this page 显示您可以应用更改此 UTM 格式的算法,请更改它们。您下载的页面上有一个示例电子表格,并查看计算结果。我怀疑应该很容易抓住查找表并使用它们加入您的数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-09
    • 1970-01-01
    • 1970-01-01
    • 2012-12-30
    • 1970-01-01
    • 2019-01-23
    • 2010-10-11
    • 2017-07-02
    相关资源
    最近更新 更多