The numbers you need to use in “rand(-10, 10), rand(-10, 10)” depend on the CRS 
of your layer. I tested it with some demo data in EPSG:31370 and I got a 
similar result as you.  When I changed those numbers I got a better result.  
After you changed those, you can play around with that 100 inside the 
generate_series, to get the result you want. For me the following gave a good 
result:

make_line(
    array_foreach(
        generate_series(
            0, length($geometry), 300
        ),
        translate(
            line_interpolate_point($geometry, @element),
            rand(-0.5, 0.5),
            rand(-0.5, 0.5)
        )
    )
)


Michel

Van: Qgis-user <qgis-user-boun...@lists.osgeo.org> Namens David Fawcett
Verzonden: donderdag 16 april 2020 20:01
Aan: qgis-user <qgis-user@lists.osgeo.org>
Onderwerp: [Qgis-user] geometry generator - unexpected results

I am trying to use a geometry generator to accomplish the "hand-drawn" line 
style.

Some great recent examples by:

Klas Karlsson
https://twitter.com/klaskarlsson/status/1249333750451879937

Hamish:
https://polemic.nz/2019/11/18/foss4g-qgis-geometry-generators/

I am using the code below from the blog post by Hamish in QGIS 3.12:


make_line(

    array_foreach(

        generate_series(

            0, length($geometry), 100

        ),

        translate(

            line_interpolate_point($geometry, @element),

            rand(-10, 10),

            rand(-10, 10)

        )

    )

)

Here is an image of what the results look like: 
https://github.com/fawcett/examples/blob/master/lines.png

The line geometries are in blue, and the geometry generator output is in black.

Can anyone suggest what is going wrong?

Thank you,

David.


_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to