Opened 9 years ago

Closed 8 years ago

#2721 closed enhancement (fixed)

t.rast.what: allow stdin and add to GRASS 7.0

Reported by: sbl Owned by: grass-dev@…
Priority: normal Milestone: 7.2.0
Component: Default Version: unspecified
Keywords: t.rast.what Cc:
CPU: Unspecified Platform: All


Please find attached a diff which allows t.rast.what to read from stdin. That way it becomes also possible to add a site name to the output, which is pretty useful for later useage of it... The site name is only propagated to the output, when a site name has been provided in the (first line of the) input.

There are probably more elegant solutions for this, so improvements are very welcome. I did not update the manual and the test suite yet, but I will try to do so, if you consider this addition useful too...

For users with "commandlineophobia" it would be probably better to specify coordinates using the file option G_OPT_F_INPUT?

Furthermore, the script works very well in GRASS 7.0 too. Any particular reason for not shipping it with the stable release? t.rast.what is a pretty handy tool!

Attachments (2)

t.rast.what.diff (7.6 KB ) - added by sbl 9 years ago.
Allow t.rast.what to read from stdin
t.rast.what_fileinput.diff (2.7 KB ) - added by sbl 9 years ago.
Add file input option to t.rast.what

Download all attachments as: .zip

Change History (9)

by sbl, 9 years ago

Attachment: t.rast.what.diff added

Allow t.rast.what to read from stdin

comment:1 by huhabla, 9 years ago

I have applied your patch in r65964 with some modifications. Thanks a lot for this improvement. I have introduced the flag "-i" to expect stdin input, otherwise will block if coordinates or point input are not set.

About a backport to 7.0.*, t.rast.what is still alpha or beta state, it should be further improved [*] and more tested before backporting.

[*] Supporting site names from vector files, input files with coordinates, output transformation with lower memory footprint, ...

by sbl, 9 years ago

Attachment: t.rast.what_fileinput.diff added

Add file input option to t.rast.what

comment:2 by sbl, 9 years ago

In order to support "input files with coordinates" I created a new tiny diff. Please review. I can update the manual accordingly, if you like.

Maybe the coordinates option can be removed as the same functionality is available through file/stdin input? Just a proper check of the input coordinates pair(s) is missing...

For site names from vector files I guess r.what should be improved first, don`t you think?

Would you mind if I try to get the script into the new GRASS plugin in QGIS, marking it as experimental? This module is definitely a good candidate for functionality users with limited knowledge of GRASS / TGIS can benefit from very much... And a nice teaser for the power of TGIS...

Last edited 9 years ago by sbl (previous) (diff)

comment:3 by neteler, 9 years ago

Just for the record: there is also a new t.rast.whatcsv. See

comment:4 by neteler, 9 years ago


Ticket retargeted after milestone closed

comment:5 by sbl, 8 years ago


comment:6 by martinl, 8 years ago


comment:7 by martinl, 8 years ago

Resolution: fixed
Status: newclosed

The patch is part of GRASS 7.2, changing the milestone and closing.

Note: See TracTickets for help on using tickets.