4

I would like to create zones inside a boundary from lines. Hard to explain but you can see my goal in the screenshots below:

enter image description here

Each line should have its own zone. Delimited by the zone of the neighboring lines zones.

I would like to use QGIS or SQL for this task.

2
  • 3
    Red on green and red on blue are among the hardest contrasts to see, even before taking color blindness into account. Please choose one environment for the focus of your Question.
    – Vince
    Jan 12 at 11:50
  • 1
    If I understand your drawings correctly - how about using this function or CTE? :-)...gis.stackexchange.com/a/348154/120129 Jan 12 at 18:28
7

Make sure your lines layer has a unique identifier (I used a field called Label with 'A', 'B', 'C' etc. A unique number will also work but the label field is a bit easier to spot later).

Densify your lines by a given interval and Extract Vertices

enter image description here

Use Voronoi Polygons (with a sufficient buffer region)

enter image description here

enter image description here

Dissolve the Voronoi output using the unique identifier field that you gave your lines layer.

enter image description here

Clip to your original boundary

enter image description here

5

Another possibility:

  1. Create a polygon grid (rectangles, hexagons) with the extent of the polygon.

  2. Create a new field to get the $id of the nearest line to each grid cell with this expression:

    if(overlay_intersects('polygon'), overlay_nearest('line', $id)[0], '')
    
  3. Aggregate the grid layer based on the attribute created in step 2.

enter image description here

2
  • 2
    Of course it depends on the size of original polygon, but the first step can be a bit heavy in terms of computation.
    – Taras
    Jan 13 at 6:10
  • Of course. But adapting the cell size should resolve that. Even more sophisticated: large cell size and in a 2nd step create a new grid with smaller cells inside the cells at the border of the zones.
    – Babel
    Jan 13 at 7:04

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.