Opened 16 years ago

Closed 16 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

Description

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

 raster/r.random/random.c

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...

Markus

Change History (2)

comment:1 by neteler, 16 years ago

The idea to use separately v.random and v.what.vect fails as it introduces new data points:

v.info -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?

Markus

comment:2 by neteler, 16 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,

Markus

Note: See TracTickets for help on using tickets.