GIST index must be applied before simplifying

This commit is contained in:
lukasmartinelli
2016-10-08 21:37:35 +02:00
parent 63985fca1e
commit 850367b6b4
2 changed files with 15 additions and 17 deletions

View File

@@ -12,12 +12,11 @@ RETURNS TABLE(geom geometry, osm_id bigint, render_height float) AS $$
least(greatest(3, COALESCE(height, levels*3.66,5)),400)^.7 AS render_height
FROM (
SELECT osm_id, ST_Simplify(way, 10) AS way, height, levels FROM building_z13
WHERE zoom_level = 13
WHERE zoom_level = 13 AND way && bbox
UNION ALL
SELECT * FROM building_z14
WHERE zoom_level >= 14
WHERE zoom_level >= 14 AND way && bbox
) AS zoom_levels
WHERE way && bbox
ORDER BY render_height, ST_YMin(way) DESC;
$$ LANGUAGE SQL IMMUTABLE;