Function to convert from latitude and longitude to UTM X and UTM Y coordinate in SQL Server

最后都变了- 提交于 2021-02-11 14:46:55

问题


I need to create a function that converts longitude and latitude to UTM X and UTM Y coordinates in SQL Server. When the user provides longitude and latitude, the function should convert that information to UTM X and UTM Y coordinates.


回答1:


I would recommend using CoordinateSharp which is available as a NuGet package:

https://github.com/Tronald/CoordinateSharp

It has support for UTM




回答2:


I have developed a library in .NET to be called from transact sql Converts WGS84/UTM coordinates to Latitude and Longitude

It does just the opposite, but as it uses CoordinateSharp you can download the code and change it easily to convert from lat/long to wgs84 instead.

You can download it from github:

https://github.com/j-v-garcia/UTM2LATITUDE

usage:

SELECT dbo.UTM2LATITUDE(723399.51,4373328.5,'S',30) AS Latitude, dbo.UTM2LONGITUDE(723399.51,4373328.5,'S',30) AS Longitude

result: 

    39,4805657453054    -0,402592727245112

    <param name="XUTM">pos UTM X</param>
    <param name="YUTM">pos UTM Y</param>
    <param name="LatBand">Latitude band grid zone designation letter (see http://www.dmap.co.uk/utmworld.htm) </param>
    <param name="LongBand">Longitude band grid zone designation number (see http://www.dmap.co.uk/utmworld.htm) </param>


来源:https://stackoverflow.com/questions/57211949/function-to-convert-from-latitude-and-longitude-to-utm-x-and-utm-y-coordinate-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!