From ad7679b53997abd2ad41e36c6b79b5ba6e817f0b Mon Sep 17 00:00:00 2001 From: stirringhalo Date: Fri, 21 Oct 2016 16:11:05 -0400 Subject: [PATCH] Use a fall-back value for building-colour This is to workaround the lack of such support in mapbox-gl-js. Should do data cleaning in import-sql. --- src/import-sql/layers/building.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/import-sql/layers/building.sql b/src/import-sql/layers/building.sql index 21aebee..69b3fea 100644 --- a/src/import-sql/layers/building.sql +++ b/src/import-sql/layers/building.sql @@ -12,6 +12,16 @@ CREATE OR REPLACE VIEW building_layer AS ( SELECT osm_id FROM building_z14 ); +CREATE OR REPLACE FUNCTION default_colour(colour VARCHAR) RETURNS VARCHAR +AS $$ +BEGIN + IF colour = '' THEN + RETURN 'grey'; + ELSE + RETURN colour; + END IF; +END; +$$ LANGUAGE plpgsql IMMUTABLE; CREATE OR REPLACE FUNCTION default_building_height(levels INTEGER) RETURNS INTEGER AS $$