> I've added two options to r.support to let you change the map's
> title and add a line of metadata info to the map's hist/ file
> (viewable with r.info, r.info -h). They will both run
> non-interactively from the command line.
Given that r.support has historically been an interactive module, it
might be better to put this functionality into separate modules (which
was the approach I took with r.region).
It didn't seem like it was worth the overhead for a couple lines of
code. If anything I considered merging r.timestamp into r.support. As
this wasn't a scriptable module the two new options shouldn't change any
historic use of r.support at all, just add something more and help us
on our way to getting rid of some more G_ask() calls. I agree that
r.region is best on its own.
> I am looking for a simple bashism to add to the examples section of
> the help page for feeding an input file one line at a time into the
> (looped) module.
while read line ; do
r.support map="$map" history="$line"
done < "$file"
Yep, thanks. It occured to me this morning that I should use "read", it
works.
While on "read", another question: For a while I've wanted to have a
port of m.proj2 in GRASS 6, but as a script calling cs2cs. Especially
the -i and -o options to convert a list of coordinates from WGS84
lat/lon into the current projection and convert grid coords to WGS84 LL.
It's pretty easy:
IN_PROJ="+proj=longlat +towgs84=0.000,0.000,0.000"
OUT_PROJ="`g.proj -jf`"
cs2cs -f %.8f $IN_PROJ +to $OUT_PROJ < "${TMP}.in" > "${TMP}.out"
Right now I just do this by hand, but it would be great to be able to
reduce the above to "m.proj -i" plus redirection.
What I haven't been able to figure out is how to have a bash script
optionally accept input piped from stdin. My attempts using read have
been unsatisfactory. This should work the same way as both v.in.ascii
and v.out.ascii. Both input= and output= options are optional filenames or
if omitted assumed to be stdin, stdout.
e.g.
G> v.out.ascii $map | tr '|' ' ' | m.proj -o > map_LL.txt
m.proj [-iod] [input=name] [output=name] [inproj=string] [outproj=string]
Flags:
-i Use WGS84 as input and current location as output projection
-o Use current location as input and WGS84 as output projection
-d Output lat/long in decimal degrees
Parameters:
input Input coordinate file
output Output coordinate file
inproj input projection parameters
outproj output projection parameters
The name of such a module is also open for suggestions.
thanks,
Hamish