Project

General

Profile

« Previous | Next » 

Revision 7698

schemas/functions.sql: functions._dms_to_dd(): Added support for DMS values without separators

View differences:

functions.sql
92 92
    LANGUAGE sql IMMUTABLE STRICT
93 93
    AS $_$
94 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)
95
FROM 
96
(
97
    SELECT regexp_matches($1, '^ *(-?)(\d{1,3}(?:\.\d*)?)(?:(?:deg|[°º])(?: *([\d.]+)(?:min|[''’]))?(?: *([\d.]+)(?:sec|["”]))?)? *([NESW])? *$')
98
    UNION ALL
99
    SELECT regexp_matches($1, '^ *(-?)(\d{2,3})(\d{2})(\d{3}) *([NESW])? *$')
100
)
101
matches (g)
96 102
$_$;
97 103

  
98 104

  

Also available in: Unified diff