Opened 6 years ago

Closed 5 years ago

#3528 closed enhancement (fixed)

v.random restrict join attributes

Reported by: martinl Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Vector Version: svn-trunk
Keywords: v.random, restrict, attributes Cc:
CPU: Unspecified Platform: Unspecified

Description

Currently G7:v.random with restrict parameter transfers categories (if layer > 0) but not attributes itself.

#v.random out=test n=5 --o restrict=geology layer=1
$ v.category test opt=print
28/1
450/2
28/3
21/4
28/5

$ v.db.select test
ERROR: Database connection not defined for layer <1>

Categories allows user to join attributes but it's quite tricky. This ticket suggests to join attributes automatically.

$ v.random out=test n=5 --o restrict=geology layer=1
$ v.db.select test
cat|geology_cat|geology_onemap_pro|geology_PERIMETER|geology_GEOL250_|geology_GEOL250_ID|geology_GEO_NAME|geology_SHAPE_area|geology_SHAPE_len
1|5|0|0|6|5|Ybgg|0|0
2|1093|0|0|1094|1093|Kb|0|0
3|1118|0|0|1119|1118|Kp|0|0
4|537|0|0|538|537|Qp|0|0
5|1135|0|0|1136|1135|Km|0|0

Attributes will be transferred similarly to categories only if layer > 0.

Attachments (1)

v-random-restrict-attr.diff (13.2 KB ) - added by martinl 6 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by martinl, 6 years ago

Version: unspecifiedsvn-trunk

comment:2 by martinl, 6 years ago

Patch for testing attached attachment:v-random-restrict-attr.diff

time v.random out=test n=100000 --o  -b restrict=geology
real	0m11.970s

time v.random out=test n=100000 --o  -b restrict=geology layer=1
real	0m23.384s

in reply to:  description comment:3 by mlennert, 6 years ago

Replying to martinl:

Currently G7:v.random with restrict parameter transfers categories (if layer > 0) but not attributes itself.

#v.random out=test n=5 --o restrict=geology layer=1
$ v.category test opt=print
28/1
450/2
28/3
21/4
28/5

$ v.db.select test
ERROR: Database connection not defined for layer <1>

Categories allows user to join attributes but it's quite tricky. This ticket suggests to join attributes automatically.

$ v.random out=test n=5 --o restrict=geology layer=1
$ v.db.select test
cat|geology_cat|geology_onemap_pro|geology_PERIMETER|geology_GEOL250_|geology_GEOL250_ID|geology_GEO_NAME|geology_SHAPE_area|geology_SHAPE_len
1|5|0|0|6|5|Ybgg|0|0
2|1093|0|0|1094|1093|Kb|0|0
3|1118|0|0|1119|1118|Kp|0|0
4|537|0|0|538|537|Qp|0|0
5|1135|0|0|1136|1135|Km|0|0

Attributes will be transferred similarly to categories only if layer > 0.

+1

by martinl, 6 years ago

Attachment: v-random-restrict-attr.diff added

comment:4 by martinl, 6 years ago

Milestone: 7.4.17.4.2

comment:5 by martinl, 6 years ago

In 72596:

v.random restrict join attributes, see #3528

comment:6 by martinl, 6 years ago

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:7 by mlennert, 5 years ago

As the enhancement has been applied to trunk, can this be closed ?

comment:8 by martinl, 5 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:9 by martinl, 5 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

comment:10 by martinl, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.