Project

General

Profile

« Previous | Next » 

Revision 7674

schemas/functions.sql: _dms_to_dd(): Added dir param to specify compass dir suffix, in order to calculate the sign correctly

View differences:

schemas/functions.sql
85 85

  
86 86

  
87 87
--
88
-- Name: _dms_to_dd(double precision, double precision, double precision); Type: FUNCTION; Schema: functions; Owner: -
88
-- Name: _dms_to_dd(double precision, double precision, double precision, compass_dir); Type: FUNCTION; Schema: functions; Owner: -
89 89
--
90 90

  
91
CREATE FUNCTION _dms_to_dd(deg double precision DEFAULT NULL::double precision, min double precision DEFAULT NULL::double precision, sec double precision DEFAULT NULL::double precision) RETURNS double precision
91
CREATE FUNCTION _dms_to_dd(deg double precision DEFAULT NULL::double precision, min double precision DEFAULT NULL::double precision, sec double precision DEFAULT NULL::double precision, dir compass_dir DEFAULT NULL::compass_dir) RETURNS double precision
92 92
    LANGUAGE sql IMMUTABLE
93 93
    AS $_$
94 94
SELECT sum(value)
95 95
FROM
96 96
(VALUES
97
      ($1)
97
      ($1*functions._map('N=>1,E=>1,S=>-1,W=>-1', $4::text)::integer)
98 98
    , ($2/60)
99 99
    , ($3/60/60)
100 100
)

Also available in: Unified diff