Q: how to extract building parts?

Hi Guys,

How to extract building parts?

I have extracted buildings (churches) from the planet.osm file using osmosis, it’s quite easy even with relations (something like --tf accept-relations building=church --used-way --used-node will do), but those are merely multipolygons, e.g. https://www.openstreetmap.org/relation/6637079 is just building outline, no any relation with parts.

So my question is how to fetch building parts of the certain building? is there any standard way to do that?


You need to find in which outline a building part is located.

BTW, Haven’t heard from you for a while

vvoovv, thank you!

Since I still have a little more post on this forum than you, I guess not so much time has passed.
I hope you are doing well too, nice to see you again)

OK, i see. Is there any standard tool for that? Or I need to code it myself? :slight_smile:
this should be actually very precise check…

I’ve been checking if an outline and a building part share some common nodes. If there are no common nodes I’ve been using a BVH-tree to find which outline a ray originating from a node of the building part hits.

Ok, it seems reasonable.

But there are building parts that are outside outlines!
for example this one: http://www.openstreetmap.org/way/447556578

Is it considered to be acceptable or not? I guess the author of this way tried to render cornice (https://en.wikipedia.org/wiki/Cornice), but from my point of view it is completly illogical, because outline is actually a ** projection of all parts ** a building to the ground.

And also a question, which I tried to raise 5 years ago: how to tag actuall building heights?
In other words, what should be height value on buildning outline: total height or heigh of the lowest building part?

Outline of this bilding (https://www.openstreetmap.org/way/36866037#map=19/56.31051/38.12957, it’a a bell tower) should be actually 86, but currently it is set to 19, to get currect rendering of the lowest part.

Can I change it to 86? (height=86), or should I use (or invent) some other tagging scheme, e.g. building:total_height=86?

My first task is to obtain the list of the highest buildings in Russia.

An outline can be defined by the building=* tag or if building parts are outside of the building with an building:part=yes.
So the given example is a possible tagging scheme.

See https://demo.f4map.com/#lat=56.3106177&lon=38.1297648&zoom=19

All your questions are answered on this wiki page: https://wiki.openstreetmap.org/wiki/Simple_3D_buildings
If there are multiple height in an outline use inner building parts or maybe levels. If you don’t want to, you’re free to choose, I would then prefer the average height :wink:

As height defines the height to the top of the roof according to wiki, I think the current value of the example is acceptable.

Ok, but what is writtent there, is that actually true?
My intention is to figure out how communitiy sees this topic now :slight_smile:

e.g., it is stated:
When a building has any building:part= areas, the building outline is not considered for 3D rendering.*
Is it really so?

OK, great. I will change the height of this bell tower to 86. Let’s see how F4, osm2world and Kendzi3d will react to that.
This way has full height once: https://www.openstreetmap.org/way/36866037/history, version 6, and then was changed to height of the first “tier” --version 7.

And you have not answered my question, what is a proper way to obtain the list of the tallest buildings from OSM data. Do I need to analyze building parts for that?

Yes, if you use building:part it has to cover the whole building outline, outline is ignored for 3D but still relevant for 2D rendering.

Yes, you have.

R0bst3r, thank you for your answers.

I do not see that it is ignored, and do not understand, how it could be.

Consider the following example:

in F4: http://demo.f4map.com/#lat=56.3087989&lon=38.1295133&zoom=20&camera.theta=61.616&camera.phi=-27.215

the building structure is the following: cillinder, then dome, then another cillinder, and then pyramidal roof. There is no building part for the lowest tier other than way/35546654, which is also outline. F4, osm2world and kendzi3d does consider it for 3d.

Read it related to the example on the wiki page given:

You have a building outline. Fill it completely with building:parts. No 3D building properties on outline, all on building:parts, otherwise the outline will ‘cover’ the building:part. If it’s getting complex, add a building relation, it’s also a good idea to use this as documentation of your building:parts.

BUT: You are free to use tags on building outline. You are free to use only single building:parts and do no cover the whole outline. Your are also free to don’t use a relation. And the 3D renderers will anyway try to interpret your tags. You can also resign height tags and your building will still get a default height.

OSM is not perfect nor your tagging has to be. The result is the important thing and that’s the task of the 3D renderers.

I’m afraid some of R0bst3r’s statements contradict the documentation. Unlike some parts of OSM that suffer from poorly-defined tags, Simple 3D Buildings is actually quite clear about these things. So in particular:

  • All building:part areas must be entirely inside a building area. The cornice example you linked to is incorrect.

  • The building outline must be entirely covered with building parts. What happens if this rule is not followed varies widely between renderers, and cannot be relied on.

  • You do not need to analyze building parts to find the highest buildings. The height on the building=* area must be the height of the entire building.

Note that the last item means that you ought to never use the same element (e.g. a way) to represent both the building as a whole and one of its parts. The height would inevitably be incorrect for either one or the other.

A minor correction:
All building:part areas must be entirely inside a building area, if a relation type=building isn’t present for the building.

If the relation type=building is present, all building parts must be listed as the relation members with the role=part. The building outline must be listed with the role=outline. The building parts can be located in any possible way relative to the building outline in the presence of the relation type=building.

It makes sense to use the relation type=building only for buildings with parts hanging over the building outline.

I added clarifications for the type=building relation in the Simple 3D Buildings specification:

I’m not sure I agree with that change. The building outline section states: “The building outline represents the area of land covered by the union of all parts of the building.” A statement like that (with slightly different phrasing) has been part of the page since its first version, and there’s zero indication that this would only apply to relation-free buildings.

Tordanik, thank you, that makes perfect sense for me.

I do not have statistics, but it seems that it’s quite common practice for towers with several tiers. But Ok, original intention is clear.

By the way, is osm2world still in development? Do you accept feature requests/bug reports?

Sure! :slight_smile: The best place for bug reports and feature requests is on Github, but you can also contact me directly if you prefer.

Tordanik, that definition is valid for 99% of cases.
However note, that a building outline is also used as the building footprint by 2d renderers.

So we have a problem if the building outline doesn’t correspond to a footprint (in the manner how a mapper perceives the footprint in his head).

Example: Villa Mediterranee in Marseille. I (as an ordinary mapper) would use the building part that touches the ground as the building footprint:

Image Source: https://commons.wikimedia.org/wiki/File:Marseille_-panoramio(9).jpg by Ainars Brūvelis, license: CC BY-SA 3.0

why? :slight_smile:
I, personally, as another ordinary mappper, will use projection.
And it is 100% correct for 2d renders.

that’s how I perceive what a building footprint for that building is.

also note there is one more tiny building beneath the overhanging part as shown on the photo in the website of the Villa Mediterranee.

I’d treat that tiny building as separate and independant from the volume of the Villa Mediterranee. So it can’t be inside the outline of the Villa Mediterranee.

Image from http://www.villa-mediterranee.org