Project

General

Profile

« Previous | Next » 

Revision 7677

schemas/functions.sql: _dms_to_dd(): Fixed bug where need to apply the sign multiplier after the components are added, because it applies to the DMS as a whole rather than just to the degree component

View differences:

schemas/functions.sql
91 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
SELECT sum(value)
94
SELECT sum(value)*functions._map('N=>1,E=>1,S=>-1,W=>-1', $4::text)::integer
95 95
FROM
96 96
(VALUES
97
      ($1*functions._map('N=>1,E=>1,S=>-1,W=>-1', $4::text)::integer)
97
      ($1)
98 98
    , ($2/60)
99 99
    , ($3/60/60)
100 100
)

Also available in: Unified diff