1

Is there a way to keep the outline of a building?

I am using a shp with lines showing the walls of a building (originally CAD file). I would like to keep only the outline of the building either as a line showing the perimeter of the building or as polygon showing the area of the building.

Any ideas?

enter image description here

EDIT

  • By outline I mean the boundary of the building
  • The example is just one floor of one building. I have multiple buildings per site and each has multiple floors. Each building_floor is a different map so there are hundreds per site.
  • The gaps is not a problem. Each gap is a door from a different layer. I can merge these two to close the gaps (basically close the doors).
  • I know I can manually draw a line or a polygon around each map but as I said it's a lot of work and I thought to ask first for a quicker way.
  • I already tried Concave Hull and Convex Hull but the results are not great - it needs fixing. Probably is better to start fixing this rather than start drawing each one from scratch.
  • Can you define what your outline would be? Perhaps mark it in your screenshot. Maybe a convex hull would do? – MrXsquared Jun 17 at 12:37
  • 1
    A fast result can be obtained by create a Concave Hull. Just play with the threshold, but for complex building forms, it may be difficult and not perfect. – J. Monticolo Jun 17 at 12:58
  • 2
    The problem is all the "openings" on the plan. Should the resulting building outline follow them in, or close them off? How do you design an algorithm that goes round the little crinkly bits of the building outline but doesn't go into the openings and round the rooms? – Spacedman Jun 17 at 13:09
  • 1
    The treshold in a concave hull can eliminate these "openings" but can avoid small outline modifications (for example on the left). I think it's depend on the quality attempted on the final result and the data quantity. If it's just one big building, you can close these "openings" for a greater Concave Hull result. – J. Monticolo Jun 17 at 13:16
  • 1
    Why not just manually draw a polygon around the outside of the building? – GreyHippo Jun 17 at 15:12
3

If you only have one building, the fastest and most accurate method is to manually draw a polygon, using snapping. The outline of that building will only have about 21 vertices, so it really won't take very long to digitize.

  1. Turn on snapping to vertices on the snapping toolbar. Set a fairly small snapping radius, such as 5 pixels.
  2. Create a new polygon layer, and begin digitizing a new polygon.
  3. Place a vertex at one corner of the building, and proceed around the outside of the building. The snapping feature will automatically move your mouse to the nearest vertex when you get close to it.
  4. Right click to finish creating the new polygon. Save your edits to the layer.

If you have a layer with many building diagrams, it would take a while to digitize them all manually. You can create building outlines all in one step with one of the concave hull tools. The outcome from this method will not be as perfect as doing it manually. It will require some trial and error to find the settings that give you the best possible output, and you may need to manually correct some of the output polygons.

  • The concave hull (k-nearest neighbor) tool accepts line and polygon inputs. Run this tool with the default setting of "number of points" = 3. If you're not happy with the outcome, increase the number of points for a smoother polygon, or decrease the number of points for a more concave polygon.

  • The concave hull (alpha shapes) tool requires points as its input. Run extract vertices to convert your building layer to points. As for the other tool, try it with the default setting (threshold = 3). If you're not happy with the outcome, increase the threshold for a smoother polygon, or decrease the threshold for a more concave polygon.

1

If these are all line features, then:

  1. Merge with the doors.
  2. Dissolve all lines.
  3. Convert lines to polygons.
  4. Dissolve all polygons.

If there are any lines not actually touching, thus the won't create a closed polygon, you can first buffer all the line features by said tolerance, a few mm, and then:

  1. Convert buffer result to line,
  2. Steps 1-4 above.
  3. Negative buffer by same value, shape will obviously be slightly different, but very close
0

The procedure below assumes that each line has some unique attribute that corresponds to a certain building.

  1. Convert lines to points using Extract vertices
  2. Convert Points to Polygons using Veroni Polygons
  3. Dissolve Polygons

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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