Add building heights (#56)
* Add better support for 3d buildings Change key from "levels" to "building:levels" as the "levels" key is non-standard and sees much less use than "building:levels" * Fix typo in sql definition and missing render_min_height * Add render_height and min_height to building.yaml * Simplify the render, switch numeric to int. Assume min_height cannot be negative. There are a few examples in overpass, but can't show below ground anyways in mapbox (https://github.com/mapbox/mapbox-gl-js/issues/3456). Also don't attempt to fix min_height>height * Remove colour as it is not currently used
This commit is contained in:
committed by
Lukas Martinelli
parent
c769577c56
commit
373a28e7ad
@@ -5,17 +5,18 @@
|
||||
-- etldoc: label="layer_building | <z13> z13 | <z14_> z14_ " ] ;
|
||||
|
||||
CREATE OR REPLACE FUNCTION layer_building(bbox geometry, zoom_level int)
|
||||
RETURNS TABLE(geom geometry, osm_id bigint, render_height numeric) AS $$
|
||||
RETURNS TABLE(geom geometry, osm_id bigint, render_height int, render_min_height int) AS $$
|
||||
SELECT geometry, osm_id,
|
||||
least(greatest(3, COALESCE(height, levels*3.66,5)),400)^.7::int AS render_height
|
||||
greatest(5, COALESCE(height, levels*3.66,5))::int AS render_height,
|
||||
greatest(0, COALESCE(min_height, min_level*3.66,0))::int AS render_min_height
|
||||
FROM (
|
||||
|
||||
-- etldoc: osm_building_polygon_gen1 -> layer_building:z13
|
||||
SELECT osm_id, geometry, height, levels FROM osm_building_polygon_gen1
|
||||
SELECT osm_id, geometry, height, levels, min_height, min_level FROM osm_building_polygon_gen1
|
||||
WHERE zoom_level = 13 AND geometry && bbox AND area > 1400
|
||||
UNION ALL
|
||||
-- etldoc: osm_building_polygon -> layer_building:z14_
|
||||
SELECT osm_id, geometry, height, levels FROM osm_building_polygon
|
||||
SELECT osm_id, geometry, height, levels, min_height, min_level FROM osm_building_polygon
|
||||
WHERE zoom_level >= 14 AND geometry && bbox
|
||||
) AS zoom_levels
|
||||
ORDER BY render_height ASC, ST_YMin(geometry) DESC;
|
||||
|
||||
Reference in New Issue
Block a user