3

Spent hours on a search. No luck. I need to create a border around selected adjacent polygons. Concave Hull and Convex Hull don't give the desired results. It seems to be a simple request. The problem is when you deal with thousands of them. Please see before and after image attached.enter image description here

3
  • 2
    What about dissolve? – Zoltan Apr 23 at 19:40
  • 2
    Followed by "Boundary" if the aim is to get a line, not polygon. – user30184 Apr 23 at 20:05
  • 1
    Here is a solution using a virtual layer – JGH Apr 23 at 20:12
5

If you need it only for visualization purposes, you can use the first soution. Below you find a second solution that works for visualization purpose as well as in the case you want to create actual geometries (polygon or line):

Solution 1:

  1. Duplicate the layer

  2. Set the layer style to Inverted polygons > Simple line

  3. Check the box next to Merge polygons before rendering (slow)

Screenshot: yellow - original polygon layer; blue: duplicated layer: enter image description here

Solution 2:

You can use QGIS expressions to create a buffer around the outer boundary of the polygons. You can use either Geometry generator or Geometry by Expression (see here for details) with the following expression (replace 'my_layer' with the name of your layer and adapt the size of the buffer - 800 in my example). You get a polygon - if you want to get a line instead, look to version B below:

difference( 
    buffer ( 
        aggregate( 
            'my_layer', 
            'collect', 
            $geometry
        ), 
    800),
    aggregate( 
            'my_layer', 
            'collect', 
            $geometry
        )
)

Screenshot: demonstrating the solution using Geometry generator: enter image description here

Version B

To get a line instead of a polygon, simply add a boundary () function and set the buffer value to something close to 0 (in my case: 1):

enter image description here

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.