Convert Australian GDA94 Easting/Northing values to Latitude/Longitude in SQL Server

As I play around with the Cognos Analytics map controls, it appears to me it only understands Latitude/Longitude values, but the sample dataset I have is in UTM format. So, I have to find ways to convert Easting/Northing values to Lat/Long. Since I use SQL Server, attempting to create a column in “Geometry” data type from Easting/Northing value, then convert it to a “Geography” data type (Lat/Long) does not seem to work for me.

After some scrambling on the web, the below SQL Functions seem to work for me to convert Easting/Northing values (on the Australian GDA94, Zone 56 standard). The key to get it to work is setting the correct datum details in the constant section. A quick test of this function does seem to give me the correct Lat/Long coordinates of Sydney Habour Bridge:

Coordinate of the Sydney Harbour bridge for testing

Calling the utm2lat and utm2lon functions to get the result

The two pieces of T-SQL codes below are the same, the only difference is one returns Latitude, the other one returns Longitude value

2 Comments

  1. DSVaucher

    Hi Viet, as I am not a power user of SQL how do i use this?

    I have a table SERVICEADDRESS that contains the fileds SERVICEADDRESS.LATITUDEY and SERVICEADDRESS.LONGITUDEX
    which are in gda94 Easting and Northing

  2. Viet Tran

    It sounds like you have an issue with the Coordinates setting in Maximo Spatial. Have you tried switching between the Latitude/Longitude vs the X/Y options in the “Service Address Options” in the Organization settings?

Leave a Reply