CREATE OR REPLACE TYPE BODY GeoCoord
AS
MEMBER FUNCTION Distance (other IN GeoCoord)
  RETURN NUMBER
  IS
  BEGIN
   RETURN 6370 * ACOS(COS(SELF.latitude/180*3.14)
               * COS(other.latitude/180*3.14)
               * COS((SELF.longitude -
                      other.longitude)/180*3.14)
               + SIN(SELF.latitude/180*3.14)
               * SIN(other.latitude/180*3.14));
  END;
MAP MEMBER FUNCTION Distance_Greenwich
  RETURN NUMBER
  IS
  BEGIN
   RETURN SELF.Distance(GeoCoord(0, 51));
  END;
END;
/
