Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

SQL updates

Russ Garrettd3fb79c304a6
diff --git a/config.toml b/config.toml
index f3f36b0..cd0f5fd 100644
--- a/config.toml
+++ b/config.toml
@@ -104,7 +104,7 @@ user = "osm"
[[providers.layers]]
name = "power_line"
dont_simplify = true
-sql = "SELECT osm_id AS gid, ST_AsBinary(ST_Simplify(geometry, ZRes(!ZOOM!) / 6)) AS geom, tunnel, location, frequency, type, name, line, ref, char_length(ref) AS ref_len, convert_voltage(voltage) / 1000 AS voltage, convert_voltage(nth_semi(voltage, 2)) / 1000 AS voltage_2, convert_voltage(nth_semi(voltage, 3)) / 1000 AS voltage_3, operator FROM osm_power_lines WHERE geometry && !BBOX! AND ST_Length(geometry) > ZRes(!ZOOM!) AND (line NOT IN ('bay', 'busbar') OR !ZOOM! > 10) ORDER BY convert_voltage(voltage) DESC NULLS LAST"
+sql = "SELECT osm_id AS gid, ST_AsBinary(ST_Simplify(geometry, ZRes(!ZOOM!) / 6)) AS geom, tunnel, location, first_semi(frequency) AS frequency, type, name, line, ref, char_length(ref) AS ref_len, convert_voltage(voltage) / 1000 AS voltage, convert_voltage(nth_semi(voltage, 2)) / 1000 AS voltage_2, convert_voltage(nth_semi(voltage, 3)) / 1000 AS voltage_3, operator FROM osm_power_lines WHERE geometry && !BBOX! AND ST_Length(geometry) > ZRes(!ZOOM!) AND (line NOT IN ('bay', 'busbar') OR !ZOOM! > 10) ORDER BY convert_voltage(voltage) DESC NULLS LAST"
[[providers.layers]]
name = "power_tower"
@@ -114,12 +114,12 @@ sql = "SELECT osm_id AS gid, ST_AsBinary(geometry) AS geom, type, name, ref, ope
[[providers.layers]]
name = "power_substation"
min_zoom = 8
-sql = "SELECT osm_id AS gid, ST_AsBinary(geometry) AS geom, name, convert_voltage(voltage) / 1000 AS voltage, substation, operator FROM substation WHERE geometry && !BBOX! AND 7 < !ZOOM! ORDER BY convert_voltage(voltage) DESC NULLS LAST"
+sql = "SELECT osm_id AS gid, ST_AsBinary(geometry) AS geom, name, first_semi(frequency) AS frequency, convert_voltage(voltage) / 1000 AS voltage, convert_voltage(nth_semi(voltage, 2)) / 1000 AS voltage_2, convert_voltage(nth_semi(voltage, 3)) / 1000 AS voltage_3, substation, operator FROM substation WHERE geometry && !BBOX! AND 7 < !ZOOM! ORDER BY convert_voltage(voltage) DESC NULLS LAST"
[[providers.layers]]
name = "power_substation_point"
min_zoom = 5
-sql = "SELECT osm_id AS gid, ST_AsBinary(ST_Centroid(geometry)) AS geom, (ST_GeometryType(geometry) = 'ST_Point') AS is_node, name, convert_voltage(voltage) / 1000 AS voltage, substation FROM substation WHERE geometry && !BBOX! AND 4 < !ZOOM! ORDER BY convert_voltage(voltage) DESC NULLS LAST"
+sql = "SELECT osm_id AS gid, ST_AsBinary(ST_Centroid(geometry)) AS geom, (ST_GeometryType(geometry) = 'ST_Point') AS is_node, name, first_semi(frequency) AS frequency, convert_voltage(voltage) / 1000 AS voltage, convert_voltage(nth_semi(voltage, 2)) / 1000 AS voltage_2, convert_voltage(nth_semi(voltage, 3)) / 1000 AS voltage_3, substation FROM substation WHERE geometry && !BBOX! AND 4 < !ZOOM! ORDER BY convert_voltage(voltage) DESC NULLS LAST"
[[providers.layers]]
name = "power_plant"