Mysql GPS Distance Calculate / Mysql’de GPS Mesafe Hesaplama
PLAIN TEXT
MySQL:
CREATE FUNCTION `distance`(mylon DOUBLE, mylat DOUBLE,destlon DOUBLE,destlat DOUBLE) RETURNS FLOAT
DETERMINISTIC
COMMENT 'distance function'
BEGIN
DECLARE distance FLOAT;
SET distance = 3956 * 2 * ASIN(SQRT( POWER(SIN((mylat - destlat) * PI()/180 / 2), 2) + COS(mylat * PI()/180) * COS(destlat * PI()/180) * POWER(SIN((mylon -destlon) * PI()/180 / 2), 2) ));
return distance * 1.609344;
END;
çıktı [...]