Hi, I am attempting to harvest buildings via overpass turbo. I want all buildings excluding buildings with relation type=building role=outline. i.e.: When buildings are composed of parts I only want the parts and not the outline and all other buildings. The first attempt;

[out:json][timeout:25];
area[name='Chapel Street Primary School'];
relation["type"="building"](area) -> .relation;
(way(r.relation)["building"]; -
way(r.relation:!"outline"););
/*added by auto repair*/
(._;>;);
/*end of auto repair*/
out qt;

returns the parts and correctly excludes the building outline but unfortunately all other buildings. The second attempt;

[out:json][timeout:25];
(area[name="Chapel Street Primary School"];
 way["building"!="outline"](area);
 //relation["building"!="outline"](area); 
);
out body;
>;
out skel qt;

includes the normal buildings, the building:parts and only seemingly excludes the building outline ~ I can't select it in the overpass turbo Map ~ its still in the Data though. How can I execute this query successfully?

asked 11 Feb, 16:16

arkriger's gravatar image

arkriger
5526
accept rate: 0%

edited 11 Feb, 19:26

I think building relations are fairly rare compared with simply marking the outline as building=* and the parts as building:part=* and letting the consumer figure out which parts belong to which building. TagInfo lists all building relations as having 194 487 members in total, while building:part alone has 1 698 253 uses (which would exclude outline ways).

(12 Feb, 02:59) InsertUser

Thank you. I understand building relations a bit clearer now.
How do I harvest building:part and normal building while excluding outlines when building:part exists? How would I do this in a single query?

(12 Feb, 11:19) arkriger

Unfortunately, I'm not able to offer much constructive there. My first thought is to try to exclude the amalgamated building:part areas from the search area, but that doesn't actually sound very efficient to me as it involves lots of 'temp' geometry. While I have dabbled in overpass over the years, I have generally stuck to rather simple queries.

(12 Feb, 12:40) InsertUser

Try this one:

[out:json][timeout:25];
area[name='Chapel Street Primary School']->.a;

(
  (
    // I want all buildings
    way[building](area.a);

    // plus every building:part
    way["building:part"](area.a);
  );
-
  // excluding buildings with relation type=building role=outline
  (
    // for every way in the input set select the relations of which it is an "outline" member
    rel(bw:"outline");
    // back to the ways with role "outline"
    way(r:"outline");
  );
);

out body;
>;
out skel qt;

It is probably not much efficient, so I think if it works, it does only for very small areas.

Please notice:

  • 'Chapel Street Primary School' identifies multiple places; you should use '{{bbox}}' or 'area(id:2432441915)' (24e8 + the id of the way which is 32441915) if you, for example, are interested in the particular area in Cape Town;
  • I should have used "rel(bw:"outline")[type=building];" but as Maxerickson pointed out, the building school in Cape Town is a member of a multipolygon relation;
  • "way(r.relation:!"outline")" in your first query seems to be invalid as you can't use the unary operator'!' in front of a role;
  • "way["building"!="outline"](area)" in your second query is wrong ("outline" is a role and not the value of a tag).
permanent link

answered 13 Feb, 15:01

MarcoR's gravatar image

MarcoR
5423717
accept rate: 23%

@InsertUser and @maxerickson I am going to accept @MarcoR 's answer as it does the necessary.

The result is here. The data needs to be cleaned but its a strong foundation.

It would not have been possible without you. Thank you.

(17 Feb, 19:56) arkriger

The item with role 'outline' is a multipolygon relation.

A different way to fetch the parts is to search on the building:part tag:

[out:json][timeout:25];
area[name='Chapel Street Primary School'];
way["building:part"](area);
(._;>;);
out;

That may not work as well when searching a larger area though. My understanding is that objects should not usually have both building:part and building tags; if most of the data follows that it should work okay.

(the building relation is superfluous using that tagging style, there's no overlapping buildings to deal with and sometimes building:parts are available)

permanent link

answered 11 Feb, 22:32

maxerickson's gravatar image

maxerickson
12.5k1079175
accept rate: 31%

outline is not a valid role in multipolygons (should be outer) , but is in relations of type=building.

(12 Feb, 02:51) InsertUser

Thank you. How would I now add the other normal buildings excluding the outline around a number of building:part (in the same query)?

(12 Feb, 10:37) arkriger

@InsertUser, the multipolygon is part of the building relation, with role 'outline'. I guess my other statement is not entirely clear.

I'm not sure how to reliably exclude the parent buildings; it may work well enough to construct a set by recursing up from the building:parts.

If there are no relations, then something like way(around.parts:0)[building] should detect overlapping buildings (where .parts is the building parts).

(12 Feb, 16:18) maxerickson

@maxerickson I think I misread your opening sentence.

(12 Feb, 18:41) InsertUser
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×236
×165
×123

question asked: 11 Feb, 16:16

question was seen: 234 times

last updated: 17 Feb, 19:56

powered by OSQA