Hi guys!
I have vector data with a lot of areas inside, and for each of those areas, is
associated a value called "densita" inside the attribute tab. Is there a way
to add a number of random points in each area, number based on the "densita"
parameter?
For example (assuming the formula for the number of points=densita*10)
Area densita
1 2
2 50
For the area number 1, I need 20 random points, for the number 2, 500
points...
Thx for your ideas.
Luca
--
"E' molto più bello sapere qualcosa di tutto, che tutto di una cosa (Blaise
Pascal)."
GENTOO-GIS Development Team
jabber: casagrande@jabber.linux.it
This may not be the cleanest approach to the problem, but the way I would
solve this is the following. First I would saturate the region with random
points, choosing a high enough n in v.random so that all of the areas are
extremely likely to have at least as many random points as is needed. I'd
then overlay the random points on the vector layer using v.select, and
then make an ascii dump of the attribute table of the resulting layer
containing the id number of the area, the id number of the random point,
and the random point's x-y location. After that I'd sort this table on the
area id number, and would write a script that went line-by-line through
the sorted table, counting out exactly the number of random points for
each area and printing just those. Reimporting this filtered table into
GRASS gives you what you want.
-- Allan
On Fri, 17 Mar 2006, Luca Casagrande wrote:
Hi guys!
I have vector data with a lot of areas inside, and for each of those areas, is
associated a value called "densita" inside the attribute tab. Is there a way
to add a number of random points in each area, number based on the "densita"
parameter?
For example (assuming the formula for the number of points=densita*10)
Area densita
1 2
2 50
For the area number 1, I need 20 random points, for the number 2, 500
points...
Thx for your ideas.
Luca
--