Re: [Qgis-user] Placing random points

2023-03-25 Thread Thomas Sebastien via QGIS-User
Hi Chris,

Thanks for your help. I used all your suggestions and a combination of them and 
what works best for me seems to be the layer bounds approach even though my 
polygons are very irregular in shape. Luckily number of points I need to create 
is not so big, so I can check that they all fall inside polygons.

Have a good day,

Sébastien

> Le 25 mars 2023 à 04:16, chris hermansen via QGIS-User 
>  a écrit :
> 
> Andrea and list,
> 
> On Fri, Mar 24, 2023 at 5:00 PM Andrea Giudiceandrea via QGIS-User 
> mailto:qgis-user@lists.osgeo.org>> wrote:
>> > Thomas Sebastien sebasapp at hotmail.com 
>> > Fri Mar 24 03:32:25 PDT 2023
>> 
>> > what works best for what I’m trying to achieve is dissolving the polygons 
>> > and placing random points in layer bounds
>> 
>> Hi Sebastien,
>> AFAIK, you don't need to dissolve the polygons before using them as 
>> input of the "Random points in layer bounds" algorithm: such algorithm 
>> correctly places the total chosen number n of random points even if the 
>> input N features/polygons are not dissolved.
>> 
> I believe I was the one who suggested the layer bounds approach.
> 
> Thomas Sebastian, you do not need to dissolve the polygons if you are only 
> interested in placing the random points within the layer bounds as Andrea 
> says.  If you have a non-rectangular dataset then your layer bounds could 
> result in points being placed outside the polygons in your dataset; you 
> should do the dissolve and place the points within the dissolved polygon.  If 
> like me you live in a rectangular / map-sheet-ish world then by all means 
> work in the layer bounds.
> 
> 
> -- 
> Chris Hermansen · clhermansen "at" gmail "dot" com
> 
> C'est ma façon de parler.
> ___
> 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

___
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


Re: [Qgis-user] Placing random points

2023-03-25 Thread Andrea Giudiceandrea via QGIS-User

chris hermansen clhermansen at gmail.com
Fri Mar 24 20:16:59 PDT 2023



I believe I was the one who suggested the layer bounds approach.


Hi Chris, probably there was a misunderstanding.

IIRC, you suggested to use the "Random points in extent" algorithm. 
AFAIK this algorithm places the random points inside a rectangular (in 
the CRS Cartesian plane) extent, e.g. the rectangular extent of the 
layer containing the polygons, so it is not guaranteed that such random 
points will actually fall inside the polygons as the can fall inside the 
rectangular extent but outside the polygons. Using this algorithm it is 
not guaranteed that such random points will actually fall inside the 
polygons even if the polygons are dissolved.


Instead, using the "Random points in layer bounds" algorithm, the 
resulting layer will contain the specified number of points and such 
random points will always fall inside the polygons even if the polygons 
are not dissolved.


Best regards.

Andrea
___
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


Re: [Qgis-user] Placing random points

2023-03-24 Thread chris hermansen via QGIS-User
Andrea and list,

On Fri, Mar 24, 2023 at 5:00 PM Andrea Giudiceandrea via QGIS-User <
qgis-user@lists.osgeo.org> wrote:

> > Thomas Sebastien sebasapp at hotmail.com
> > Fri Mar 24 03:32:25 PDT 2023
>
> > what works best for what I’m trying to achieve is dissolving the
> polygons and placing random points in layer bounds
>
> Hi Sebastien,
> AFAIK, you don't need to dissolve the polygons before using them as
> input of the "Random points in layer bounds" algorithm: such algorithm
> correctly places the total chosen number n of random points even if the
> input N features/polygons are not dissolved.
>
> I believe I was the one who suggested the layer bounds approach.

Thomas Sebastian, you do not need to dissolve the polygons if you are only
interested in placing the random points within the layer bounds as Andrea
says.  If you have a non-rectangular dataset then your layer bounds could
result in points being placed outside the polygons in your dataset; you
should do the dissolve and place the points within the dissolved polygon.
If like me you live in a rectangular / map-sheet-ish world then by all
means work in the layer bounds.


-- 
Chris Hermansen · clhermansen "at" gmail "dot" com

C'est ma façon de parler.
___
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


Re: [Qgis-user] Placing random points

2023-03-24 Thread Andrea Giudiceandrea via QGIS-User

Thomas Sebastien sebasapp at hotmail.com
Fri Mar 24 03:32:25 PDT 2023



what works best for what I’m trying to achieve is dissolving the polygons and 
placing random points in layer bounds


Hi Sebastien,
AFAIK, you don't need to dissolve the polygons before using them as 
input of the "Random points in layer bounds" algorithm: such algorithm 
correctly places the total chosen number n of random points even if the 
input N features/polygons are not dissolved.


Best regards.

Andrea
___
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


Re: [Qgis-user] Placing random points

2023-03-24 Thread Thomas Sebastien via QGIS-User
Hi Árni, Andrea, Nyall and Chris,

Thank you very much for your help. I tried all your suggestions and what works 
best for what I’m trying to achieve is dissolving the polygons and placing 
random points in layer bounds because not only do the points fall inside the 
polygons, as Andrea pointed out, but also it lets me pick a minimum distance 
between the points, which is quite useful for my study.

Again many thanks!

Have a good day,

Sébastien

Le 24 mars 2023 à 09:14, Árni Geirsson via QGIS-User 
 a écrit :


How about generating a large number of points into the N polygons, using the 
tool available, then add an attribute to the points and generate uniform random 
numbers into the attribute and keep only the n points with the lowest random 
numbers?

Árni


On Thu, 23 Mar 2023 at 21:55, Andrea Giudiceandrea via QGIS-User 
mailto:qgis-user@lists.osgeo.org>> wrote:
Hi Sebastien,
in addition to the suggestion given by Nyall Dawson, I would suggest you
using the "Random points in layer bounds" algorithm: you just need to
specify the total number of random points to be generated. The resulting
layer will contain the specified number of points and such points will
fall inside the polygons.

It seems to me that the "Random points in extent" algorithm, suggested
by Chris Hermansen, may not be suitable for your needs: while the
resulting layer will contain the specified number of points, such points
will fall inside the extent of the layer containing the polygons, so it
is not guaranteed that such points will actually fall inside the polygons.

Best regards,

Andrea Giudiceandrea
___
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
___
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
___
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


Re: [Qgis-user] Placing random points

2023-03-24 Thread Árni Geirsson via QGIS-User
How about generating a large number of points into the N polygons, using
the tool available, then add an attribute to the points and generate
uniform random numbers into the attribute and keep only the n points with
the lowest random numbers?

Árni


On Thu, 23 Mar 2023 at 21:55, Andrea Giudiceandrea via QGIS-User <
qgis-user@lists.osgeo.org> wrote:

> Hi Sebastien,
> in addition to the suggestion given by Nyall Dawson, I would suggest you
> using the "Random points in layer bounds" algorithm: you just need to
> specify the total number of random points to be generated. The resulting
> layer will contain the specified number of points and such points will
> fall inside the polygons.
>
> It seems to me that the "Random points in extent" algorithm, suggested
> by Chris Hermansen, may not be suitable for your needs: while the
> resulting layer will contain the specified number of points, such points
> will fall inside the extent of the layer containing the polygons, so it
> is not guaranteed that such points will actually fall inside the polygons.
>
> Best regards,
>
> Andrea Giudiceandrea
> ___
> 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
>
___
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


Re: [Qgis-user] Placing random points

2023-03-23 Thread Andrea Giudiceandrea via QGIS-User

Hi Sebastien,
in addition to the suggestion given by Nyall Dawson, I would suggest you 
using the "Random points in layer bounds" algorithm: you just need to 
specify the total number of random points to be generated. The resulting 
layer will contain the specified number of points and such points will 
fall inside the polygons.


It seems to me that the "Random points in extent" algorithm, suggested 
by Chris Hermansen, may not be suitable for your needs: while the 
resulting layer will contain the specified number of points, such points 
will fall inside the extent of the layer containing the polygons, so it 
is not guaranteed that such points will actually fall inside the polygons.


Best regards,

Andrea Giudiceandrea
___
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


Re: [Qgis-user] Placing random points

2023-03-23 Thread Nyall Dawson via QGIS-User
On Thu, 23 Mar 2023 at 19:20, Thomas Sebastien via QGIS-User
 wrote:
>
> Dear QGIS users,
>
> I’m trying to place a small number of points, n, randomly in a large number 
> of polygons, N. But, the Vector>Research Tools> Random points in polygons 
> tool only lets me place a minimum of 1 random point in each of the N 
> polygons, i.e N points when I only need n. Do you know a way I can go about 
> this?

How about dissolving the polygons into a single feature and then
placing the desired random number of points inside this dissolved
feature?

Nyall

>
> Thanks,
>
> Sebastien
> ___
> 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
___
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


Re: [Qgis-user] Placing random points

2023-03-23 Thread chris hermansen via QGIS-User
Thomas and list,

On Thu, Mar 23, 2023 at 2:19 AM Thomas Sebastien via QGIS-User <
qgis-user@lists.osgeo.org> wrote:

> Dear QGIS users,
>
> I’m trying to place a small number of points, n, randomly in a large
> number of polygons, N. But, the Vector>Research Tools> Random points in
> polygons tool only lets me place a minimum of 1 random point in each of the
> N polygons, i.e N points when I only need n. Do you know a way I can go
> about this?
>

Does

Vector >  Research Tools > Random points in extent

not accomplish what you want?  Using say the bounding box for all the
polygons?
-- 
Chris Hermansen · clhermansen "at" gmail "dot" com

C'est ma façon de parler.
___
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


[Qgis-user] Placing random points

2023-03-23 Thread Thomas Sebastien via QGIS-User
Dear QGIS users,

I’m trying to place a small number of points, n, randomly in a large number of 
polygons, N. But, the Vector>Research Tools> Random points in polygons tool 
only lets me place a minimum of 1 random point in each of the N polygons, i.e N 
points when I only need n. Do you know a way I can go about this?

Thanks,

Sebastien
___
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