Project

General

Profile

« Previous | Next » 

Revision 7679

schemas/functions.sql: Added _dms_to_dd(text)

View differences:

schemas/functions.sql
85 85

  
86 86

  
87 87
--
88
-- Name: _dms_to_dd(text); Type: FUNCTION; Schema: functions; Owner: -
89
--
90

  
91
CREATE FUNCTION _dms_to_dd(value text DEFAULT NULL::text) RETURNS double precision
92
    LANGUAGE sql IMMUTABLE STRICT
93
    AS $_$
94
SELECT (g[1]||'1')::integer*functions._dms_to_dd(deg := g[2]::double precision, min := g[3]::double precision, sec := g[4]::double precision, dir := g[5]::functions.compass_dir)
95
FROM regexp_matches($1, '^ *(-?)([\d.]+)(?:(?:deg|[°º])(?: *([\d.]+)(?:min|[''’]))?(?: *([\d.]+)(?:sec|["”]))?)? *([NESW])? *$') matches (g)
96
$_$;
97

  
98

  
99
--
88 100
-- Name: _dms_to_dd(double precision, double precision, double precision, compass_dir); Type: FUNCTION; Schema: functions; Owner: -
89 101
--
90 102

  

Also available in: Unified diff