[GRASS5] randomly select polygons?
Hamish
hamish_nospam at yahoo.com
Sat Apr 24 02:12:09 EDT 2004
> I would like to randomly select polygons and I'm not sure how to do
> it. I've thought about converting the polygon map into a rast map,
> then using mapcalc, but since mapcalc works cell by cell, I won't get
> the entire polygon. I'm using GRASS 5.3 since I seem to be having
> build troubles with GRASS 5.7 and I don't know how to add multiple
> attributes to a vector map in 5.3. If I could then, I could perform
> some type of (and I'm dreaming here)"select * into rand.trainploys
> from trainpolys where rand() > 0.5"
>
> I haven't attempted to build 5.7 in some time and can't spend the day
> trying.
Sorry for the "use 5.7" answer, but if you get it to work, try
v.extract:
"Selects vector objects from an existing vector map and creates a new
map containing only the selected objects."
You'd need to label each polygon from 1+ with v.alabel or something and
use a simple random number generator program to pick a number. Then
v.extract.
Do you just need stats on a random polygon or need to make a whole new
map of it?
What's the problem you're having with 5.7? what kind of computer?
If you can build 5.3, then there shouldn't be anything horribly missing
for a 5.7 build.
good luck,
Hamish
More information about the grass-dev
mailing list