9

I had point data in DXF and generated contours using QGIS. The contours had smaller islands and the contours in itself are too curly. I smoothed the contours too and I could avoid that unwanted island by rejecting contours of a certain length.

enter image description here

but how to avoid unwanted curliness in the single elevation contour. I am very new to QGIS and I don't know Python too. I have attached an image of part of my contour here. I have marked the curly contours with blue while I expect them to be straight as marked in red.

enter image description here

Taras
  • 32,823
  • 4
  • 66
  • 137
Usha
  • 147
  • 5
  • 3
    Looks like you can just use the simplify tool. – Dror Bogin Dec 04 '22 at 05:57
  • 2
    You might look at the Processing GRASS v.generalize tool, which has many different algorithms. Being QGIS its easy to run the tool with one algorithm and different input parameters, look at the result, and try something else, since the results are temp. I was mostly interested in reducing file size and drawing so I used the LANG method and then calculated lengths and deleted everything under a set size. But that still can look rough depending on the scale you look at them. If you are more interested in looks then you might try (before or after) the Vector Geometry smooth tool. – John Dec 04 '22 at 10:08
  • 2
    I'll add that if you still have the DEMs you could smooth them first and then create the contours. Any smoothing (vector or raster) reduces the accuracy of course but that is your choice if it is worth it at the visual scale. See https://gis.stackexchange.com/questions/346049/making-elevation-contours-of-raster-smoother-using-qgis – John Dec 04 '22 at 10:26

1 Answers1

16
  1. Extract by expression lines over a certain length, I use 100 m: $length>100 to remove the small rings
  2. Simplify and smooth output with geometry by expression: smooth(simplify( $geometry, 4), 20). Adjust 4 and 20.

Starting contours: enter image description here

Length over 100: enter image description here

Simplified and smoothed:

enter image description here

enter image description here

To answer your comment: Click the expression E, and search for the function to see the help. The 4 is max deviation and 20 is number of smoothing iterations:

enter image description here

BERA
  • 72,339
  • 13
  • 72
  • 161