I am testing SQL Server STDistance function in the following way:
DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::STGeomFromText('POINT(53.553813 9.99158)', 4326);
SET @h = geography::STGeomFromText('POINT(52.5234051 13.4113)', 4326);
SELECT @g.STDistance(@h);
These points represent, respectively, Hamburg and Berlin.
The STDistance
call above returns 394612.166639773
(aprox. 394km). However, on Google Earth/Maps, when I calculate the straight line between the two points above, I get aprox. 254km.
If I understood correctly, both SQL Server SRID 4326
and Google Earth represent/use the WGS84
reference system, so I don't know what else could be causing this difference.
Any ideas?