sql根据坐标算距离
CREATE FUNCTION ConvertXYToDistance(@la1 DECIMAL,@lo1 DECIMAL,@la2 DECIMAL,@lo2 DECIMAL)
RETURNS FLOAT
AS
BEGIN
BEGIN
RETURN (Round(6378.137*2*Asin(
Sqrt(
power(Sin((@la1*PI()/180)-(@la2*PI()/180))/2,2)+
Cos(@la1*PI()/180)*COS(@la2*PI()/180)*power(SIN((@lo1*PI()/180)-(@lo2*PI()/180))/2,2)
))*10000,0)/10000)
END
END