kopia lustrzana https://github.com/openmaptiles/openmaptiles
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 usedpull/57/merge
rodzic
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;
|
||||
|
|
|
@ -5,10 +5,12 @@ layer:
|
|||
this is welcomed.
|
||||
buffer_size: 4
|
||||
datasource:
|
||||
query: (SELECT geom FROM layer_building(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geom, render_height, render_min_height FROM layer_building(!bbox!, z(!scale_denominator!))) AS t
|
||||
fields:
|
||||
render_height: |
|
||||
An approximated height from levels and height of building after the method of Paul Norman in [OSM Clear](https://github.com/ClearTables/osm-clear). For future 3D rendering of buildings.
|
||||
An approximated height from levels and height of the building or building:part after the method of Paul Norman in [OSM Clear](https://github.com/ClearTables/osm-clear). For future 3D rendering of buildings.
|
||||
render_min_height: |
|
||||
An approximated height from levels and height of the bottom of the building or building:part after the method of Paul Norman in [OSM Clear](https://github.com/ClearTables/osm-clear). For future 3D rendering of buildings.
|
||||
schema:
|
||||
- ./building.sql
|
||||
datasources:
|
||||
|
|
|
@ -20,10 +20,18 @@ tables:
|
|||
- name: height
|
||||
key: height
|
||||
type: integer
|
||||
- name: min_height
|
||||
key: min_height
|
||||
type: integer
|
||||
- name: levels
|
||||
key: levels
|
||||
key: building:levels
|
||||
type: integer
|
||||
- name: min_level
|
||||
key: building:min_level
|
||||
type: integer
|
||||
mapping:
|
||||
building:part:
|
||||
- __any__
|
||||
building:
|
||||
- __any__
|
||||
type: polygon
|
||||
|
|
Ładowanie…
Reference in New Issue