[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-user
Subject:    Re: [Qgis-user] Qgis-user Digest, Vol 171, Issue 43
From:       Thayer Young <thayeray () yahoo ! com>
Date:       2020-05-20 15:54:41
Message-ID: 2031474496.2169917.1589990081623 () mail ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


 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@gmail.com>
To: qgis-user <qgis-user@lists.osgeo.org>
Subject: [Qgis-user] Geometry Generator - Generating buffered points
       from       polys
Message-ID:
       <CAF7K3b_q3S4AAR+ZbpfqhEo3-xCRv-MXBFL7bf6PdVVz+RR56g@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)

  


[Attachment #5 (text/html)]

<html><head></head><body><div class="ydpd4abf845yahoo-style-wrap" \
style="font-family:Helvetica Neue, Helvetica, Arial, \
sans-serif;font-size:13px;"><div></div>  <div dir="ltr" data-setdir="false">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.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" \
data-setdir="false">-Thayer</div><div dir="ltr" \
data-setdir="false"><br></div><div><br></div></div><div \
id="ydp67cbe5f0yahoo_quoted_0282854523" class="ydp67cbe5f0yahoo_quoted"><div \
style="font-family:'Helvetica Neue', Helvetica, Arial, \
sans-serif;font-size:13px;color:#26282a;"><div><div dir="ltr">Date: Mon, 18 May 2020 \
14:02:18 -0500<br></div><div dir="ltr">From: David Fawcett &lt;<a \
href="mailto:david.fawcett@gmail.com" rel="nofollow" \
target="_blank">david.fawcett@gmail.com</a>&gt;<br></div><div dir="ltr">To: qgis-user \
&lt;<a href="mailto:qgis-user@lists.osgeo.org" rel="nofollow" \
target="_blank">qgis-user@lists.osgeo.org</a>&gt;<br></div><div dir="ltr">Subject: \
[Qgis-user] Geometry Generator - Generating buffered points<br></div><div \
dir="ltr">&nbsp;&nbsp;&nbsp; from&nbsp;&nbsp;&nbsp; polys<br></div><div \
dir="ltr">Message-ID:<br></div><div dir="ltr">&nbsp;&nbsp;&nbsp; \
&lt;CAF7K3b_q3S4AAR+ZbpfqhEo3-xCRv-MXBFL7bf6PdVVz+<a \
href="mailto:RR56g@mail.gmail.com" rel="nofollow" \
target="_blank">RR56g@mail.gmail.com</a>&gt;<br></div><div dir="ltr">Content-Type: \
text/plain; charset="utf-8"<br></div><div dir="ltr"><br></div><div \
dir="ltr">Hi,<br></div><div dir="ltr"><br></div><div dir="ltr">I am working through \
an exercise to figure out the best way to represent<br></div><div dir="ltr">some \
wooded areas in a map that I am making.<br></div><div dir="ltr"><br></div><div \
dir="ltr">The current iteration uses geometry generators to create \
slightly<br></div><div dir="ltr">randomized points to fill the polygons that \
represent wooded areas. I based<br></div><div dir="ltr">it off of the great examples \
at<br></div><div dir="ltr"><a \
href="https://impermanent.io/2017/05/05/generative-pseudo-random-polygon-fill-patterns-in-qgis/" \
rel="nofollow" target="_blank">https://impermanent.io/2017/05/05/generative-pseudo-random-polygon-fill-patterns-in-qgis/</a><br></div><div \
dir="ltr">And, it works great!<br></div><div dir="ltr"><br></div><div dir="ltr">After \
looking at it a while, I want to introduce some variability in the<br></div><div \
dir="ltr">size of the point symbols too.<br></div><div dir="ltr"><br></div><div \
dir="ltr">I have two ideas on how to do that:<br></div><div dir="ltr"><br></div><div \
dir="ltr">The first one is to create and populate an attribute for each \
point<br></div><div dir="ltr">feature, and then apply symbology rules based on that \
value. The challenge<br></div><div dir="ltr">is that right now, my custom function is \
returning multi-point features, so<br></div><div dir="ltr">all of the points within a \
forest poly would have the same attribute.<br></div><div dir="ltr"><br></div><div \
dir="ltr">I am currently pursuing the second one. That strategy is to use the \
same<br></div><div dir="ltr">altered grid of points, and then buffer each point. I am \
having a hard time<br></div><div dir="ltr">figuring out how to return a layer with \
several multi-polygon features<br></div><div dir="ltr">created by buffering the \
points.<br></div><div dir="ltr"><br></div><div dir="ltr">In this example, "buffer" is \
not defined, so the expression is invalid.<br></div><div dir="ltr"><br></div><div \
dir="ltr">&nbsp; for xOff in range(countX+1):<br></div><div dir="ltr">&nbsp; &nbsp; \
for yOff in range(countY+1):<br></div><div dir="ltr">&nbsp; &nbsp; &nbsp; ptX = xMin \
+ xOff*(xInterval) + rand * random.uniform(0,xInterval)<br></div><div \
dir="ltr">&nbsp; &nbsp; &nbsp; ptY = yMin + yOff*(yInterval) + rand * \
random.uniform(0,xInterval)<br></div><div dir="ltr"><br></div><div dir="ltr">&nbsp; \
&nbsp; &nbsp; pt = QgsPointXY(ptX,ptY)<br></div><div dir="ltr">&nbsp; &nbsp; &nbsp; \
point = QgsGeometry.fromPointXY(pt)<br></div><div dir="ltr"><br></div><div \
dir="ltr"><br></div><div dir="ltr">&nbsp; &nbsp; &nbsp; if \
feature.geometry().contains(point):<br></div><div dir="ltr">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; sym = buffer(point,200.0,10)<br></div><div dir="ltr">&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; #points.append(pt)<br></div><div dir="ltr">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; bufs.append(sym)<br></div><div dir="ltr"><br></div><div \
dir="ltr">&nbsp; return collect_geometries(bufs)<br></div><div \
dir="ltr"><br></div></div>  </div>
        </div></body></html>


[Attachment #6 (text/plain)]

_______________________________________________
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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic