5

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.

Taras
  • 32,823
  • 4
  • 66
  • 137
MartinMap
  • 8,262
  • 7
  • 50
  • 114
  • 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 '22 at 11:50
  • 1
    If I understand your drawings correctly - how about using this function or CTE? :-)...https://gis.stackexchange.com/a/348154/120129 – Cyril Mikhalchenko Jan 12 '22 at 18:28

2 Answers2

8

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

Taras
  • 32,823
  • 4
  • 66
  • 137
Matt
  • 16,843
  • 3
  • 21
  • 52
7

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

Taras
  • 32,823
  • 4
  • 66
  • 137
Babel
  • 71,072
  • 14
  • 78
  • 208
  • 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 '22 at 06: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 '22 at 07:04