[PROJ] cs2cs in a pipe
Schmitz, Uwe
uwe.schmitz at bezreg-koeln.nrw.de
Tue Nov 17 04:18:40 PST 2020
Roger,
You didn't post sample code, so I only can guess some things.
In addition, you haven't written what you have tried so far,
so maybe the following is not unknown to you.
First, I suppose that you set up a pipe to cs2cs like:
set fid [open "|cs2cs" r+]
Second, to send line by line to the pipe you should do
chan configure $fid –buffering line
Finally, you have to make sure that the output is not buffered.
I assume that cs2cs buffers its output. That seems to be your problem,
I guess. You can verify this by sending say 10000 or more transformation
lines to the pipe. At some point cs2cs may flush its output and you will see
it by reading the pipe.
IMHO, there is no way to prevent cs2cs from buffering.
But... under Linux you can try unbuffer:
https://linux.die.net/man/1/unbuffer
E.g.:
set fid [open "|unbuffer cs2cs" r+]
If you really consider using the bare C-Api, I recommend
using the great Ffidl package:
https://wiki.tcl-lang.org/page/Ffidl
Hope this helps a bit.
--
Uwe Schmitz
More information about the PROJ
mailing list