Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce label clutter on entrances #2932

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions addressing.mss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@

#addresses {
[zoom >= 17] {
text-name: "";
text-placement: interior;
text-face-name: @book-fonts;
text-fill: @address-color;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-size: 10;
text-wrap-width: 30; // 3.0 em
text-line-spacing: -1.5; // -0.15 em
text-margin: 3; // 0.3 em
text-name: "[addr_housename]";
["addr_housenumber" != null] {
["addr_housenumber" != null]["render" = null] {
text-name: [addr_housenumber];
["addr_housename" != null] {
text-name: [addr_housenumber] + "\n" + [addr_housename];
Expand All @@ -25,20 +35,17 @@
}
}
}
text-placement: interior;
text-face-name: @book-fonts;
text-fill: @address-color;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-size: 10;
text-wrap-width: 30; // 3.0 em
text-line-spacing: -1.5; // -0.15 em
text-margin: 3; // 0.3 em
["addr_unit" != null]["addr_housenumber" = null]["render" = null] {
text-name: [addr_unit];
["addr_housename" != null] {
text-name: [addr_unit] + "\n" + [addr_housename];
}
}
["render" = "unit-only"] {
text-name: [addr_unit];
}
[zoom >= 18] {
text-halo-radius: @standard-halo-radius * 1.25;
["addr_unit" != null]["addr_housenumber" = null] {
text-name: [addr_unit];
}
}
[zoom >= 20] {
text-size: 11;
Expand Down
31 changes: 22 additions & 9 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -2213,19 +2213,32 @@ Layer:
"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
CAST(NULL as text) AS render,
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) OR ((tags->'addr:unit') 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) OR ((tags->'addr:unit') IS NOT NULL)
p.way AS way,
p."addr:housenumber" AS addr_housenumber,
p."addr:housename" AS addr_housename,
p.tags->'addr:unit' AS addr_unit,
CASE p."addr:housenumber" = (SELECT poly."addr:housenumber"
FROM planet_osm_polygon AS poly
WHERE ST_Intersects(poly.way, p.way)
AND poly.building IS NOT NULL
AND p.tags ? 'entrance'
LIMIT 1)
WHEN True THEN 'unit-only' ELSE NULL END AS render,
CAST(NULL as real) AS way_pixels
FROM planet_osm_point AS p
WHERE ((p."addr:housenumber" IS NOT NULL)
OR (p."addr:housename" IS NOT NULL)
OR ((p.tags->'addr:unit') IS NOT NULL))
ORDER BY way_pixels DESC NULLS LAST
) AS addresses
properties:
Expand Down