Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Make power parsing more resilient

Russ Garrett2950102c41be
diff --git a/functions.sql b/functions.sql
index 3dc76a3..c828ef6 100644
--- a/functions.sql
+++ b/functions.sql
@@ -10,7 +10,7 @@ DECLARE
parts TEXT[];
val NUMERIC;
BEGIN
- parts := regexp_matches(upper(value), '([0-9][0-9\.,]*)[ ]?([KMG]?W)?', '');
+ parts := regexp_matches(upper(value), '([0-9]+[\.,]?[0-9]+)[ ]?([KMG]?W)?', '');
val := replace(parts[1], ',', '.');
IF parts[2] = 'KW' THEN
val := val * 1e3;