8

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

3
  • 3
    Looks like you can just use the simplify tool.
    – Dror Bogin
    Dec 4, 2022 at 5: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 4, 2022 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 gis.stackexchange.com/questions/346049/…
    – John
    Dec 4, 2022 at 10:26

1 Answer 1

15
  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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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