Skip to content

Commit

Permalink
Restore height and ele text
Browse files Browse the repository at this point in the history
This used to be done by processing in the subselects
and the outer selects, now it's done in just the outer.
  • Loading branch information
pnorman committed May 6, 2019
1 parent c6f2cd4 commit d2c261d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,21 @@ Layer:
FROM
(SELECT -- This subselect allows filtering on the feature column
way,
name,
CONCAT(
name,
E'\n' || CONCAT( -- by doing this with a || if both the ele and height branches are null, this entire expression is null and only name is used
CASE
WHEN (tags ? 'ele') AND tags->'ele' ~ '^-?\d{1,4}(\.\d+)?$'
AND ("natural" IN ('peak', 'volcano', 'saddle')
OR tourism = 'alpine_hut' OR (tourism = 'information' AND tags->'information' = 'guidepost')
OR amenity = 'shelter')
THEN CONCAT(REPLACE(ROUND((tags->'ele')::NUMERIC)::TEXT, '-', U&'\2212'), U&'\00A0', 'm') ELSE NULL END,
CASE
WHEN (tags ? 'height') AND tags->'height' ~ '^\d{1,3}(\.\d+)?$'
AND waterway = 'waterfall'
THEN CONCAT(ROUND((tags->'height')::NUMERIC)::TEXT, U&'\00A0', 'm') ELSE NULL END
)
) AS name,
COALESCE(
'aeroway_' || CASE WHEN aeroway IN ('gate', 'apron', 'helipad', 'aerodrome') THEN aeroway ELSE NULL END,
'tourism_' || CASE WHEN tourism IN ('alpine_hut', 'apartment', 'artwork', 'camp_site', 'caravan_site', 'chalet', 'gallery', 'guest_house',
Expand Down

0 comments on commit d2c261d

Please sign in to comment.