[Qgis-user] Fw: Qgis-user Digest, Vol 171, Issue 43

Thayer Young thayeray at yahoo.com
Wed May 20 09:00:05 PDT 2020


 You might want to try generating a random diameter for the points in the symbology. For example using a Graduated symbology set the Value to 'rand(2, 20)' and Method to Size. You could then adjust the color for each of the classes to add even more variability.

-Thayer

Date: Mon, 18 May 2020 14:02:18 -0500
From: David Fawcett <david.fawcett at gmail.com>
To: qgis-user <qgis-user at lists.osgeo.org>
Subject: [Qgis-user] Geometry Generator - Generating buffered points
    from    polys
Message-ID:
    <CAF7K3b_q3S4AAR+ZbpfqhEo3-xCRv-MXBFL7bf6PdVVz+RR56g at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

I am working through an exercise to figure out the best way to represent
some wooded areas in a map that I am making.

The current iteration uses geometry generators to create slightly
randomized points to fill the polygons that represent wooded areas. I based
it off of the great examples at
https://impermanent.io/2017/05/05/generative-pseudo-random-polygon-fill-patterns-in-qgis/
And, it works great!

After looking at it a while, I want to introduce some variability in the
size of the point symbols too.

I have two ideas on how to do that:

The first one is to create and populate an attribute for each point
feature, and then apply symbology rules based on that value. The challenge
is that right now, my custom function is returning multi-point features, so
all of the points within a forest poly would have the same attribute.

I am currently pursuing the second one. That strategy is to use the same
altered grid of points, and then buffer each point. I am having a hard time
figuring out how to return a layer with several multi-polygon features
created by buffering the points.

In this example, "buffer" is not defined, so the expression is invalid.

  for xOff in range(countX+1):
    for yOff in range(countY+1):
      ptX = xMin + xOff*(xInterval) + rand * random.uniform(0,xInterval)
      ptY = yMin + yOff*(yInterval) + rand * random.uniform(0,xInterval)

      pt = QgsPointXY(ptX,ptY)
      point = QgsGeometry.fromPointXY(pt)


      if feature.geometry().contains(point):
          sym = buffer(point,200.0,10)
          #points.append(pt)
          bufs.append(sym)

  return collect_geometries(bufs)

    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200520/9fb23bc7/attachment.html>


More information about the Qgis-user mailing list