go-spatial / tegola-osm

Various scripts for importing and running a mirror of OSM with tegola
https://demo.tegola.io
MIT License
73 stars 26 forks source link

Enhance the as_numeric(text) Postgres helper to support different building height representations #58

Open ARolek opened 4 years ago

ARolek commented 4 years ago

The as_numeric function is really primitive right now. It's mainly used for converting building heights in text format to numeric format so the values can be used for building extrusions when rendered. OSM has various ways to represent heights per: https://wiki.openstreetmap.org/wiki/Key:height. A new function should be put together than handles the various OSM height formats and also allows for conversion between meters / feet.

ARolek commented 4 years ago

Here's an example of of a building that has levels and a height: https://www.openstreetmap.org/way/51185380

jj0hns0n commented 4 years ago

We should also handle for levels=n and use some standard conversion on average height of a building storey/floor etc (https://en.wikipedia.org/wiki/Storey#:~:text=The%20height%20of%20each%20storey,figure%20to%20well%20over%20it).

OSM's guidance is that levels should only be used with height and not instead of, but many buildings only have levels.

buildingheights

An example of where things may be complicated https://www.openstreetmap.org/way/362187535 where the levels = 63 and the height only 10.