DROP FUNCTION IF EXISTS `degree2decimal`;
CREATE DEFINER = `root`@`localhost` FUNCTION `degree2decimal`(deg_coord float)
RETURNS float
BEGIN
#converts NMEA/GPS Lat -Long to Decimal Degrees. Code comments are self explanatory.
#The code is not graceful, but it works.
declare degree INT;
declare minutes2 FLOAT;
declare dotdegree FLOAT;
declare decimal2 FLOAT;
set degree= (deg_coord/100);
set minutes2 = deg_coord-(degree*100);
set dotdegree=minutes2/60;
set decimal2=degree+dotdegree;
RETURN decimal2;
END;