From c065d76ba585093b53eda8566cfaa401e3d905d1 Mon Sep 17 00:00:00 2001 From: Robert Marianski Date: Fri, 4 Mar 2016 08:00:49 -0500 Subject: [PATCH 1/6] Show all buildings at z16 --- queries/buildings.jinja2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/queries/buildings.jinja2 b/queries/buildings.jinja2 index 73455dc29..8bf0cfd5a 100644 --- a/queries/buildings.jinja2 +++ b/queries/buildings.jinja2 @@ -50,8 +50,6 @@ WHERE AND mz_building_filter(tags->'building:height', "building:levels", way_area, 200000, 100) {% elif zoom == 15 %} AND mz_building_filter(tags->'building:height', "building:levels", way_area, 100000, 100) -{% elif zoom == 16 %} - AND mz_building_filter(tags->'building:height', "building:levels", way_area, 50000, 25) {% endif %} AND {{ bounds|bbox_filter('way') }} From 9bc94b85d93fb11990524a9f3ee2bc6a9c2880e5 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 4 Mar 2016 13:05:09 +0000 Subject: [PATCH 2/6] Buildings should satisfy this filter if they meet the minimum volume or minimum area limits. --- data/functions.sql | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/data/functions.sql b/data/functions.sql index 809d12ca5..31e9e5bda 100644 --- a/data/functions.sql +++ b/data/functions.sql @@ -741,6 +741,11 @@ CREATE OR REPLACE FUNCTION mz_building_filter( RETURNS BOOLEAN AS $$ BEGIN RETURN CASE + -- if the min area is satisfied, then there's no + -- need to check the area. + WHEN way_area >= min_area + THEN TRUE + -- if height is present, and can be parsed as a -- float, then we can filter right here. WHEN mz_is_numeric(height) @@ -757,9 +762,9 @@ BEGIN WHEN height IS NOT NULL OR levels IS NOT NULL THEN TRUE - -- height isn't present, so just filter on area - -- as we did before. - ELSE way_area >= min_area + -- height isn't present, and area doesn't satisfy + -- the minimum bound, so don't show this building. + ELSE FALSE END; END; $$ LANGUAGE plpgsql IMMUTABLE; From 35f5ffae8d3a029aeced70fb0b4153f5b94097fe Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 4 Mar 2016 13:06:03 +0000 Subject: [PATCH 3/6] Disable area/volume filter at z16. --- queries.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/queries.yaml b/queries.yaml index 07c2414b7..350652e2f 100644 --- a/queries.yaml +++ b/queries.yaml @@ -221,7 +221,6 @@ post_process: 13: { area: 1600, volume: 300000 } 14: { area: 100, volume: 200000 } 15: { area: 100, volume: 100000 } - 16: { area: 25, volume: 50000 } - fn: TileStache.Goodies.VecTiles.transform.intercut params: base_layer: roads From cfd543bd027794b980ea8aecdc3b2d30a89375b9 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 4 Mar 2016 13:06:25 +0000 Subject: [PATCH 4/6] Add min_zoom property to buildings. --- queries/buildings.jinja2 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/queries/buildings.jinja2 b/queries/buildings.jinja2 index 73455dc29..97ce83a3a 100644 --- a/queries/buildings.jinja2 +++ b/queries/buildings.jinja2 @@ -29,6 +29,12 @@ SELECT "roof:orientation" AS roof_orientation, "addr:housenumber" AS addr_housenumber, "addr:street" AS addr_street, +{% if zoom >= 16 %} + CASE WHEN mz_building_filter(tags->'building:height', "building:levels", way_area, 50000, 25) + THEN 16 + ELSE 17 + END AS min_zoom, +{% endif %} %#tags AS tags FROM @@ -50,8 +56,6 @@ WHERE AND mz_building_filter(tags->'building:height', "building:levels", way_area, 200000, 100) {% elif zoom == 15 %} AND mz_building_filter(tags->'building:height', "building:levels", way_area, 100000, 100) -{% elif zoom == 16 %} - AND mz_building_filter(tags->'building:height', "building:levels", way_area, 50000, 25) {% endif %} AND {{ bounds|bbox_filter('way') }} @@ -82,6 +86,9 @@ SELECT NULL AS roof_orientation, "addr:housenumber" AS addr_housenumber, "addr:street" AS addr_street, +{% if zoom >= 16 %} + 16 AS min_zoom, +{% endif %} %#tags AS tags FROM From fddf76dd184d2543db1a7f68239b71ca24154949 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 4 Mar 2016 13:06:34 +0000 Subject: [PATCH 5/6] Add tests. --- test/557-missing-buildings.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/557-missing-buildings.py diff --git a/test/557-missing-buildings.py b/test/557-missing-buildings.py new file mode 100644 index 000000000..b60846f1e --- /dev/null +++ b/test/557-missing-buildings.py @@ -0,0 +1,14 @@ +# Best Tile +assert_has_feature( + 16, 10484, 25339, 'buildings', + {'id': 103383621}) + +# Miraloma School +assert_has_feature( + 16, 10476, 25339, 'buildings', + {'id': 338881092}) + +# Tiny individual building (way_area = 5.4 sq.m.) +assert_has_feature( + 16, 10474, 25343, 'buildings', + {'id': 278410540, 'min_zoom': 17}) From dc503d8f88b50d53ce359d8c968cf4fbd40ce9c6 Mon Sep 17 00:00:00 2001 From: Matt Amos Date: Fri, 4 Mar 2016 13:40:03 +0000 Subject: [PATCH 6/6] Revert min_zoom to previous behaviour. --- queries/buildings.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/buildings.jinja2 b/queries/buildings.jinja2 index 97ce83a3a..eda08afa0 100644 --- a/queries/buildings.jinja2 +++ b/queries/buildings.jinja2 @@ -87,7 +87,7 @@ SELECT "addr:housenumber" AS addr_housenumber, "addr:street" AS addr_street, {% if zoom >= 16 %} - 16 AS min_zoom, + 17 AS min_zoom, {% endif %} %#tags AS tags