i'm getting xyz data from the grass command prompt using a query like:
echo "select x,y,z from...." | db.select > outfile.xyz
then reading into grass using:
r.in.xyz input=outfile.xyz ....
just wondering if i can do this in one step by piping my select output
directly into r.in.xyz?
(i suppose i could just right a wrapper script to do this if i can't
do it directly)
No, you can't right now. But it is a planned feature. (input="-")
This would have the advantage of bypassing any LFS problems. (?)
The only (minor) problem I see is that data taken from stdin would
obviously have to bypass the G_percent() calls (that's ok) but as a
replacement I'd like to use G_clicker(), and I'm not sure how well the
GUI version will deal with that. (would need some help from a Tcl expert)
> i'm getting xyz data from the grass command prompt using a query like:
> echo "select x,y,z from...." | db.select > outfile.xyz
>
> then reading into grass using:
> r.in.xyz input=outfile.xyz ....
>
> just wondering if i can do this in one step by piping my select output
> directly into r.in.xyz?
>
> (i suppose i could just right a wrapper script to do this if i can't
> do it directly)
No, you can't right now. But it is a planned feature. (input="-")
r.in.xyz may use multiple passes, and thus requires the ability to
rewind the input.
Allowing it to use stdin would be easy enough, but stdin would still
need to refer to a file (a pipe wouldn't work), so there isn't a lot
of point.
On Windows (at least with cmd.exe) piping goes to a temporary file before being fed into the second program (I believe). Since the temp file may not be on the same drive, you can wind up with mystery out-of-memory-errors on large files. I don’t know if Cygwin gets around this or if the new window’s shell will get around this limitation.
Piping binary data is unreliable (at least with Python) on Windows, but that is another story.
> > i'm getting xyz data from the grass command prompt using a query
> > like: echo "select x,y,z from...." | db.select > outfile.xyz
> >
> > then reading into grass using:
> > r.in.xyz input=outfile.xyz ....
> >
> > just wondering if i can do this in one step by piping my select
> > output directly into r.in.xyz?
> >
> > (i suppose i could just right a wrapper script to do this if i
> > can't do it directly)
Hamish:
> No, you can't right now. But it is a planned feature. (input="-")
Glynn:
r.in.xyz may use multiple passes, and thus requires the ability to
rewind the input.
We would have to add a startup check for "percent=100" (single pass
mode) if data was not from a file. This would limit the output raster
map size based on local system RAM, but not the amount of input data.