Reputation: 637
I'm trying to do some very basic distance calculations using STDistance from one Geography Point to another. It works, but I am getting slight differences in the results from what google tells me when calculating the straight line distance.
Here's an example:
DECLARE @p1 GEOGRAPHY, @p2 GEOGRAPHY;
SET @P1 = GEOGRAPHY::STGeomFromText('POINT(55.68905174 12.45841931)', 4326);
SET @P2 = GEOGRAPHY::STGeomFromText('POINT(55.67915657 12.58483544)', 4326);
SELECT @P1.STDistance(@P2) AS DISTANCE;
Which returns 14026 meters. If I add those same points on google and add a straight line, it says 8 kilometers:
Now I'd understand the error if long and lat were switched, but they don't seem to be. Any thoughts? This run in Azure SQL if it makes any difference. Any help would be greatly appreciated. Thank you.
Upvotes: 0
Views: 382
Reputation: 637
And in the end, they were actually in the wrong order (Lat Long versus Long Lat).
So point takes it (long, lat), and google takes it lat, long.
Upvotes: 1