/* $PostgreSQL: pgsql/contrib/earthdistance/earthdistance.sql.in,v 1.11 2007/11/13 04:24:27 momjian Exp $ */

– Adjust this setting to control where the objects get created. SET search_path = public;

– The earth functions rely on contrib/cube having been installed and loaded.

– earth() returns the radius of the earth in meters. This is the only – place you need to change things for the cube base distance functions – in order to use different units (or a better value for the Earth's radius).

CREATE OR REPLACE FUNCTION earth() RETURNS float8 LANGUAGE SQL IMMUTABLE AS 'SELECT ''6378168''::float8';

– Astromers may want to change the earth function so that distances will be – returned in degrees. To do this comment out the above definition and – uncomment the one below. Note that doing this will break the regression – tests.