[Qgis-user] geometry generator - unexpected results

David Fawcett david.fawcett at gmail.com
Fri Apr 17 09:53:18 PDT 2020


Michel,

Thank you for your response, and for putting some good geometry generator
examples out for others to learn from. (If others on the list haven't seen
them, they are at:
https://gitlab.com/GIS-projects/qgis-geometry-generator-examples)

Your suggestion worked for me. I am mapping in EPSG 26915 (UTM Z15N), and
since both SRS are in meters, I thought that similar values would work. I
had tried to change the params in the functions by an order of magnitude,
but obviously needed to go farther.

Thank you again for your help.

David.

On Fri, Apr 17, 2020 at 5:05 AM Michel Stuyts <michel.stuyts at edegem.be>
wrote:

> 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-bounces at lists.osgeo.org> *Namens *David
> Fawcett
> *Verzonden:* donderdag 16 april 2020 20:01
> *Aan:* qgis-user <qgis-user at 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 at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200417/75e0d06d/attachment.html>


More information about the Qgis-user mailing list