首页 > 代码库 > sql 计算两经纬度间的距离

sql 计算两经纬度间的距离

DECLARE @g geography;
SET @g = geography::STPointFromText(‘POINT(113.216273 23.236333)‘, 4326);
SELECT @g.ToString();
DECLARE @gg geography;
SET @gg = geography::STPointFromText(‘POINT(115.567368 37.341209)‘, 4326);
SELECT @gg.ToString();

 

SELECT @g.STDistance(@gg)