Skip to content

Commit

Permalink
changed how name is constructed for parcel lockers
Browse files Browse the repository at this point in the history
  • Loading branch information
ttomasz committed Jan 30, 2022
1 parent 1778a7b commit 2002c7f
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1476,25 +1476,27 @@ Layer:
FROM
(SELECT -- This subselect allows filtering on the feature column
way,
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') 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') END,
CASE
WHEN (amenity = 'parcel_locker' AND ref IS NOT NULL)
THEN ref END
CASE
WHEN amenity = 'parcel_locker'
THEN CONCAT(COALESCE(tags->'brand', tags->'operator', name), E'\n' || ref)
ELSE
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') 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') END
)
)
) AS name,
tags->'parking' as "parking",
END AS name,
tags->'parking' as "parking",
COALESCE(
'aeroway_' || CASE WHEN aeroway IN ('gate', 'apron', 'helipad', 'aerodrome') THEN aeroway END,
'tourism_' || CASE WHEN tourism IN ('alpine_hut', 'apartment', 'artwork', 'camp_site', 'caravan_site', 'chalet', 'gallery', 'guest_house',
Expand Down

0 comments on commit 2002c7f

Please sign in to comment.