Building Heights, City Rendering

Building Heights!

We have heights!

To improve the realism of the building/city rendering the next step I took was to parse the building heights from the Open Street map objects. The height tag is described on the OSM Wiki here. The main points are as following:  the “height” tag of the way returns the maximum height of the building and you can also get the height of a “building part” by using the same tag. The heights are usually (though not always) in meters and so I began by parsing these heights.

Actually – we have some heights

The issue with using open street map data to provide the heights is that most of the polygons simply do not have a height tag. I have created the table below which shows the number of polygons with a tag. Note: if a polygon had multiple of these tags I just count it as having the tag which appears first from the following list: “building:height” and “height”. Another point worth mentioning is that I did filter out the trees. The code that counts this is running on any object with the “building” or “building:part” type.

Polygons with tag
Building Height 1011
Height 343
Total 1354

This is the statistics for a 30km*30km square block of data entered around Glasgow City Centre.   In total the service returns 65022 polygons of which we only have 1354 heights. For the rest of the heights we have to use some sort of estimation. Another tag which can be extracted from the OSM is the “building:levels” tag. This tag tells us the amount of floors the building has. We can use this to provide a better estimate for some of the buildings. This is done by getting an average/ball park height for a floor and then multiplying this by the number of floors. After this another value is added based on the average height of a building roof. This technique allows us to give a reasonable guess for an additional 6320 buildings which have this tag. For the rest of the buildings I just  generate a random number of floors to a maximum number, and then retrieve the heights as before.

The following image allows us to visualise the buildings which we do have heights for. I exaggerated the heights of the buildings that had any of the tags above, and then coloured them using the following key:

  • Building Height – Red
  • Height – Yellow
  • Building Levels – Blue
Visualising heights
Visualising heights

In the future I hope to do something smarter for the buildings which do not have any heights – i.e estimate based on the shape of the building and the buildings surrounding it. Maybe for some areas there is other data sources we can use to supplement the data. I toyed with the idea of trying to extract the building heights using Lidar data – it seems that a lot of people are already doing this!

Tree heights

For trees which had no “height” tag I simply looked up the average height of a tree in the UK and then applied this plus some random variance. In the future I should be able to look up the type of tree for some forests and then use this to provide a better estimation.

The images below show the difference adding in the polygon heights makes. Also, since the last blog I have also started to add in colours: blue for water, green for forests/grass and a sandy grey colour for buildings.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s