Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Show circuits number for lines

Russ Garrett582812702f2e
diff --git a/config.toml b/config.toml
index f1840c1..1091de3 100644
--- a/config.toml
+++ b/config.toml
@@ -110,7 +110,7 @@ user = "osm"
[[providers.layers]]
name = "power_line"
geometry_type = "LineString"
-sql = "SELECT gid, ST_AsBinary(geometry) AS geom, tunnel, location, first_semi(frequency) AS frequency, tags -> 'name' AS name, line, tags -> 'ref' AS ref, char_length(tags -> 'ref') AS ref_len, voltages[1] AS voltage, voltages[2] AS voltage_2, voltages[3] AS voltage_3, tags -> 'operator' AS operator, construction != '' AS construction FROM power_lines(!ZOOM!, !BBOX!) ORDER BY convert_voltage(voltage) ASC NULLS FIRST"
+sql = "SELECT gid, ST_AsBinary(geometry) AS geom, tunnel, location, first_semi(frequency) AS frequency, tags -> 'name' AS name, line, tags -> 'ref' AS ref, char_length(tags -> 'ref') AS ref_len, voltages[1] AS voltage, voltages[2] AS voltage_2, voltages[3] AS voltage_3, circuits, tags -> 'operator' AS operator, construction != '' AS construction FROM power_lines(!ZOOM!, !BBOX!) ORDER BY convert_voltage(voltage) ASC NULLS FIRST"
[[providers.layers]]
name = "power_tower"
diff --git a/functions.sql b/functions.sql
index 4632150..4842e65 100644
--- a/functions.sql
+++ b/functions.sql
@@ -70,7 +70,7 @@ BEGIN
FOR I IN array_lower(parts::anyarray, 1)..array_upper(parts::anyarray, 1) LOOP
retval[I] = convert_voltage(parts[I]) / 1000;
END LOOP;
- ELSIF circuits != NULL THEN
+ ELSIF circuits IS NOT NULL THEN
voltage_int = convert_voltage(voltage) / 1000;
FOR I IN 1..circuits LOOP
retval[I] = voltage_int;
@@ -79,7 +79,7 @@ BEGIN
retval[1] = convert_voltage(voltage) / 1000;
END IF;
- return sort_desc(retval);
+ return retval;
END
$$ LANGUAGE plpgsql;