In QGIS, I want to discern between a number of building types, based on topology. I have data on buildings, parcels and addresses.

I'm having a hard time to discern between row/terrace, end-of-terrace and semi-detached housing. Assume, for the sake of simplicity, that all other dwelling types (detached houses, appartment buildings, non-residential, etc) have already been classified and do not complicate things further. My working definitions are currently:

  • row/terrace: "at least 80% of opposite sides overlap with perimeter of another building; other sides do not overlap with perimeter of other building"
  • end-of-terrace: "at least 80% of one side overlaps with perimeter of a row/terrace building; other sides do not overlap".
  • semi-detached: "at most one side shares overlaps for 80% or more with perimeter of another building; if a second side shares overlap with the perimeter of another building, this overlap can be at most 50% of that side"

The latter ensures that buildings which are semi-detached in terms of living areas but that are attached to other buildings by their garages would count as semi-detached, to fit the local context of this project where such a house would be considered semi-detached.

So far so good. However, I do not know how to implement these rules in QGIS. How should I go about this?

  • How do I calculate perimeter overlap?
  • How do I distinguish between opposite sides of a polygon?
  • How does this work for non-rectangular buildings?

Is there an easier way to achieve what I want that I'm missing?

  • I think this was closed because you had several questions. Try removing the second and third bullet points, and making them a separate question. That should be enough to get the question re-opened. – csk Sep 17 '18 at 21:24
  • I understand that we should ask one single question at a time. However, anyone wanting to use topology to determine dwelling types from building data would run into these issues. Since they are central to the problem, and very related, I believe the three questions at the bulletpoints should be treated as subquestions that clarify my thought process. I think it's clear the main question is "How to implement this rule-set in QGIS?". – M.M. Middeldorp Sep 18 '18 at 8:35

Calculating perimeter overlap between contiguous polygons

  1. Add perimeter length to the building layer as an attribute using the field calculator and the expression $perimeter.
  2. Use the SAGA tool shared polygon edges* (find this tool in the Processing toolbox) to extracts shared edges as a line layer. Choose a field with unique values as the attribute for this tool.
  3. Add $length to the 'shared edge' layer as an attribute.
  4. Each 'shared edge' line has fields called "ID_A" and "ID_B" that link it to its two parent polygons. Add a join to the building polygon layer, using the 'shared edge' layer as the join layer. Use ID_A as the target field. The join field is the field that you used in the tool shared polygon edges above. Add a second join using ID_B as the target field.
  5. Sum the overlapping edge lengths for each polygon. Calculate ratio of overlapping edge length to polygon perimeter.

*NOTE: the shared polygon edges tool only works where an entire segment is shared. If an edge segment overlaps more than one building, it won't be counted. The solution is to split the segment by adding a vertex. (see illustrated example below)

In this example, polygon 1 has a single edge that overlaps the edges of polygons 3 and 4.

enter image description here

Because only part of this edge is shared with each neighboring polygon, the shared polygon edges tool doesn't detect it as a shared edge.

enter image description here

If we add a vertex to polygon 1 at the corner of polygons 3 and 4, like so:

enter image description here

Now the shared polygon edges tool correctly recognizes the shared edges.

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.