Add surface field for highways

Keep surface field from OSM on highways, generalize it to two values:
"paved" and "unpaved".

This is a fix for #389 and a partial fix for #422.
This commit is contained in:
Phyks (Lucas Verney)
2019-01-06 12:03:37 +01:00
parent bc63a22db0
commit da00063e0d
4 changed files with 45 additions and 21 deletions

View File

@@ -42,3 +42,13 @@ CREATE OR REPLACE FUNCTION service_value(service TEXT) RETURNS TEXT AS $$
ELSE NULL
END;
$$ LANGUAGE SQL IMMUTABLE STRICT;
-- Limit surface to only the most important values to ensure
-- we always know the values of surface
CREATE OR REPLACE FUNCTION surface_value(surface TEXT) RETURNS TEXT AS $$
SELECT CASE
WHEN surface IN ('paved', 'asphalt', 'concrete', 'paving_stones', 'cobblestone', 'concrete:plates', 'pebblestone') THEN 'paved'
WHEN surface IN ('unpaved', 'ground', 'gravel', 'dirt', 'grass', 'compacted', 'sand', 'fine_gravel', 'sett', 'wood', 'earth') THEN 'unpaved'
ELSE NULL
END;
$$ LANGUAGE SQL IMMUTABLE STRICT;