Skip to content

Commit

Permalink
Merge pull request #2494 from tpikonen/addr_unit
Browse files Browse the repository at this point in the history
Render addr:unit
  • Loading branch information
kocio-pl authored Sep 22, 2017
2 parents b3338b3 + 60784d5 commit 16444a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion addressing.mss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
["addr_housename" != null] {
text-name: [addr_housenumber] + "\n" + [addr_housename];
}
["addr_unit" != null] {
text-name: [addr_housenumber] + " " + [addr_unit];
["addr_housename" != null] {
text-name: [addr_housenumber] + " " + [addr_unit] + "\n" + [addr_housename];
}
}
}
text-placement: interior;
text-min-distance: 1;
Expand All @@ -26,8 +32,11 @@
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-size: 10;
text-wrap-width: 20; // 2.0 em
text-wrap-width: 30; // 3.0 em
text-line-spacing: -1.5; // -0.15 em
[zoom >= 18]["addr_unit" != null]["addr_housenumber" = null] {
text-name: [addr_unit];
}
[zoom >= 20] {
text-size: 11;
text-wrap-width: 22; // 2.0 em
Expand Down
6 changes: 4 additions & 2 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -2176,18 +2176,20 @@ Layer:
way,
"addr:housenumber" AS addr_housenumber,
"addr:housename" AS addr_housename,
tags->'addr:unit' AS addr_unit,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE (("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL))
WHERE (("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR (tags->'addr:unit' IS NOT NULL))
AND building IS NOT NULL
UNION ALL
SELECT
way,
"addr:housenumber" AS addr_housenumber,
"addr:housename" AS addr_housename,
tags->'addr:unit' AS addr_unit,
NULL AS way_pixels
FROM planet_osm_point
WHERE ("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL)
WHERE ("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR (tags->'addr:unit' IS NOT NULL)
ORDER BY way_pixels DESC NULLS LAST
) AS addresses
properties:
Expand Down

0 comments on commit 16444a9

Please sign in to comment.