T-SQL // 如何将Northing / Easting坐标转换为纬度/经度?

4

可能是重复的问题:
Easting northing to latitude longitude

我有许多数据库中的Northing/Easting数据(例如:n 15217,e 88911),我需要使用T-SQL将其转换为经度/纬度

我该怎么做?


https://dev59.com/1Gsz5IYBdhLWcg3weHuU - twoleggedhorse
1
投票以重新开放,因为它包含有用的信息,除了标记的重复内容。 - Mitch Wheat
2个回答

7
这里有一个开源的dll库(geocoordconversion),可以将东北坐标系转换为经纬度。因此,您可以使用该库进行原始转换。
或者,可能会很有用,我在GitHub上有一个项目,该项目使用此DLL将完整的Ordnance Survey邮政编码数据集导入到SQL Server,并在此过程中将东北坐标系转换为经纬度。这可用作命令行可执行文件。如果这符合您的要求,那么您可能可以使用它。或者至少,有代码突出显示如何使用DLL执行转换。 更新 从我的项目中,以下是使用dll进行转换为经纬度的.NET代码片段:
/// <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。 - twoleggedhorse
谢谢!这对我非常有用。还有一件事:我选择了正确的方法 GridReference.ChangeToPolarGeo(new GridReference(1233, 123)); 吗? - Artem
是的,请查看我回答中的更新。 - AdaTheDev
+1。非常好。我很惊讶它没有更多的赞,因为最终搜索会落在这里! - Mitch Wheat

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接