SQL function to convert UK OS coordinates from easting/northing to longitude and latitude

前端 未结 6 1228
南方客
南方客 2021-02-10 10:51

Please can someone post a SQL function to convert easting/northing to longitude/latitude. I know it\'s incredibly complicated but I haven\'t found anyone who has documented it i

6条回答
  •  独厮守ぢ
    2021-02-10 11:26

    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
    
            pos UTM X
            pos UTM Y
            Latitude band grid zone designation letter (see http://www.dmap.co.uk/utmworld.htm) 
            Longitude band grid zone designation number (see http://www.dmap.co.uk/utmworld.htm) 
    

提交回复
热议问题