I saw this relevant question : How to convert Geometry type column to degree Minutes Second in SQL Server 2008 R2
But I'm after something else :
How to convert Geography type column to degree Minutes Second ?
The suggested solution for Geometry was:
DECLARE @geom geometry;
SET @geom = geometry::STGeomFromText('POINT(-83.255 32.567477)', 4326);
SELECT CASE WHEN @geom.STX < 0 then '-' ELSE '' END +
CAST(FLOOR(ABS(@geom.STX)) as varchar) + ' ' +
CAST(CAST(FLOOR(ABS(@geom.STX) * 60) AS INT) % 60 as varchar) + ''' ' +
CAST(CAST(FLOOR(ABS(@geom.STX) * 3600) AS INT) % 60 AS VARCHAR) + '"',
CASE WHEN @geom.STY < 0 then '-' ELSE '' END +
CAST(FLOOR(ABS(@geom.STY)) as varchar) + ' ' +
CAST(CAST(FLOOR(ABS(@geom.STY) * 60) AS INT) % 60 as varchar) + ''' ' +
CAST(CAST(FLOOR(ABS(@geom.STY) * 3600) AS INT) % 60 AS VARCHAR) + '"'
NB I'm asking it because I know that geometry is more forgiving than geography
Question
How can I convert geography
to deg/min/sec ? ,
Is it valid to change decimal to => deg/min/sec for geography , as the same way as for Geometry ? (would it be the same calculation?)