Opened 6 years ago
Closed 6 years ago
#3689 closed enhancement (fixed)
v.rast.stats: add where option
Reported by: | veroandreo | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.6.0 |
Component: | Vector | Version: | svn-trunk |
Keywords: | v.rast.stats | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Would you agree to add where
option in G7:v.rast.stats? I find it useful in some occasions where user is interested in querying only some features meeting a certain category. I attach the diff
Attachments (2)
Change History (11)
follow-up: 2 comment:1 by , 6 years ago
comment:2 by , 6 years ago
Replying to mmetz:
Replying to veroandreo:
Would you agree to add
where
option in G7:v.rast.stats? I find it useful in some occasions where user is interested in querying only some features meeting a certain category. I attach the diffA
where
option would make sense. You need to add thiswhere
option to the call to G7:v.to.rast in G7:v.rast.stats.
Right! See new patch attached. I tested with:
v.rast.stats map=urbanarea@PERMANENT where="NAME == 'Raleigh'" raster=aspect@PERMANENT column_prefix=aspect method=number
and got expected results and no errors :)
by , 6 years ago
Attachment: | v_rast_stats_add_where.diff added |
---|
new patch adding where option in v.rast.stats
comment:4 by , 6 years ago
Replying to veroandreo:
MarkusM, do you think I can commit it now?
Have you tested your patch also if the new where option is not given? If this succeeds you can commit.
follow-up: 6 comment:5 by , 6 years ago
I tested... it does not work. It keeps extracting only where="NAME == 'Raleigh'" even if I remove the column and do not set any where... I added this:
if where == "" or where == " " or where == "\n": where = None
but it does not work... There seems to be something I need to clean/remove from previous run, but do not know where nor how. Would you help me, please?
comment:6 by , 6 years ago
Replying to veroandreo:
I tested... it does not work. It keeps extracting only where="NAME == 'Raleigh'" even if I remove the column and do not set any where... I added this:
if where == "" or where == " " or where == "\n": where = Nonebut it does not work... There seems to be something I need to clean/remove from previous run, but do not know where nor how. Would you help me, please?
See attached patch.
Test commands for the NC sample dataset:
g.region rast=elev_state_500m g.copy vect=railroads,myrailroads v.rast.stats map=myrailroads raster=elev_state_500m column_prefix=ele method=average -d where="cat = 8802" v.db.select map=myrailroads v.db.update map=myrailroads col=ele_average val=NULL v.rast.stats map=myrailroads raster=elev_state_500m column_prefix=ele method=average -d v.db.select map=myrailroads v.db.update map=myrailroads col=ele_average val=NULL v.rast.stats map=myrailroads raster=elev_state_500m column_prefix=ele method=average v.db.select map=myrailroads v.db.update map=myrailroads col=ele_average val=NULL v.rast.stats map=myrailroads raster=elev_state_500m column_prefix=ele method=average -d where="cat = 8802" v.db.select map=myrailroads
by , 6 years ago
Attachment: | v_rast_stats_add_where_2.diff added |
---|
patch to add where option o v.rast.stats, working with and without where option used
follow-up: 8 comment:7 by , 6 years ago
Thanks so much, MarkusM! Committed in r73666. Milestone was set to 7.8, but is it worth a backport to next 7.6 release?
comment:8 by , 6 years ago
Replying to veroandreo:
Thanks so much, MarkusM! Committed in r73666. Milestone was set to 7.8, but is it worth a backport to next 7.6 release?
I think it's ok if you backport to 7.6
comment:9 by , 6 years ago
Milestone: | 7.8.0 → 7.6.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Milestone changed to 76 and change backported. Closing.
Thanks again, markusM :)
Replying to veroandreo:
A
where
option would make sense. You need to add thiswhere
option to the call to G7:v.to.rast in G7:v.rast.stats.