Opened 14 years ago

Closed 14 years ago

#229 closed enhancement (fixed)

v.random: add random sampling from vector points map

Reported by: neteler Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Default Version: svn-trunk
Keywords: vector Cc:
CPU: All Platform: All


In v.random, there is no possibility to do random sampling from a vector points map (as r.random does). I have seen that most vector code is already in


incl DBMS support since r.random also support vector points (but only from *raster* maps). Maybe not a big issue for someone familiar with vector/DBMS...


Change History (2)

comment:1 by neteler, 14 years ago

The idea to use separately v.random and v.what.vect fails as it introduces new data points: -c lidar1map
g.region vect=lidar1map
v.random output=random_samples10 n=3800 --o
v.db.addtable map=random_samples10 columns='cat integer, height double precision'
v.what.vect vector=random_samples10 column=height qvector=lidar1map qcolumn=N3 dmax=100

while it should subset existing data points.

Suggestion: maybe better use v.extract and add a "random=" parameter there which populates internally the "list=" list of categories?


comment:2 by neteler, 14 years ago

Resolution: fixed
Status: newclosed

Maris wrote:

v.extract now supports extraction of N random categories matching vector features. To extract N points, simply provide random=N option. Current implementation has one small(?) problem - it operates on CAT's and not feature ID's and thus will extract ALL features matching randomly selected CAT values.

He implemented it in r33639. Tested and works fine.

Thanks, Maris,


Note: See TracTickets for help on using tickets.