Opened 16 years ago

Closed 14 years ago

#195 closed enhancement (worksforme)

-g flag in r.proj/v.proj for easily-parsable output for use in scripts

Reported by: epatton Owned by: grass-dev@…
Priority: trivial Milestone: 6.4.0
Component: Raster Version: svn-trunk
Keywords: r.proj, output, print, script Cc:
CPU: All Platform: All

Description

Hi,

Currently r.proj -l spits out a tab-separated list of rasters; I would like to request a -g flag to print out rasters (and vectors with v.proj) one per line so it's easily parsable in one-liner scripts a la:

for MAP in `r.proj -g location=spearfish mapset=PERMANENT` ; do
r.proj $MAP ...etc.

Thanks,

~ Eric.

Change History (4)

comment:1 by neteler, 16 years ago

CPU: x86-64All
Platform: LinuxAll

Sounds reasonable. r.proj (indeed it is r.proj.seg) use G_list_element() which needs an extra parameter for that (hence an update to all modules/libs which use this function (defined in lib/gis/list.c).

Markus

comment:2 by neteler, 14 years ago

Do ticket #845 and changes in 6.5svn (r40559) and trunk in r40560) help?

in reply to:  2 comment:3 by hamish, 14 years ago

Replying to neteler:

Do ticket #845 and changes in 6.5svn (r40559) and trunk in r40560) help?

Yes. Although not exactly in the way Eric envisioned, I think the new -g flag will make it possible to accomplish the same thing in a script.

Eric, any comments before closing this one?

Hamish

comment:4 by epatton, 14 years ago

Resolution: worksforme
Status: newclosed

Originally, I wanted to create a list of rasters from outside the current Location for batch-reprojecting into the current Location. I don't follow how the -g flag will really accomplish this, but then it is Monday morning. Regardless, I think the new functionality of the -g flag will be quite useful in its own right.

As for the initial wish, I guess I could always go to the Location of the rasters that are to be reprojected, create the list with g.mlist > list.txt, then use that as input to a r.proj one-liner script.

Anyway, I'd say its ok to close this one, thanks.

~ Eric.

Note: See TracTickets for help on using tickets.