Opened 21 months ago

Closed 8 months 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 21 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 21 months ago by martinl

Version: unspecifiedsvn-trunk

comment:2 Changed 21 months ago by martinl

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

comment:3 in reply to:  description Changed 21 months ago by mlennert

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

Changed 21 months ago by martinl

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

comment:4 Changed 20 months ago by martinl

Milestone: 7.4.17.4.2

comment:5 Changed 20 months ago by martinl

In 72596:

v.random restrict join attributes, see #3528

comment:6 Changed 15 months ago by martinl

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:7 Changed 13 months ago by mlennert

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

comment:8 Changed 11 months ago by martinl

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:9 Changed 8 months ago by martinl

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

comment:10 Changed 8 months ago by martinl

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