[PROJ] cs2cs in a pipe

Roger Oberholtzer roger.oberholtzer at gmail.com
Tue Nov 17 02:05:52 PST 2020


I am doing some programming inTcl (I like it - don't judge:)

I would like to project some lat/long values to Sweref99. Normally I do
this via the C API. But now I want to do so in a Tcl script. I want to
start the program and, for each line I write to it (it's standard input), I
would like to immediately read the results. And just keep doing this. I do
not want to start the program for each set of values as that would take too
long.

I have no trouble getting the cs2cs program to run. But I do not get values
reported. I see when I trace cs2cs when it is running in my script (via
strace that shows all system calls), cs2cs is correctly reading a line of
values to project. However, it never writes anything. It is just in another
read call waiting for the next line.

Should I expect cs2cs to report each projection as each line is read? I
could not think that it buffered them. But maybe the output is buffered via
whatever call cs2cs is doing to list results? If that is the case, is there
some way to tell cs2cs to flush the results after each projection is
complete?

Or is there a better way to do this? I realize that I could make an
interface in C that Tcl could use. I was trying to avoid that if I could
use a program such as cs2cs to accomplish the same thing.

-- 
Roger Oberholtzer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20201117/9e18019b/attachment.html>


More information about the PROJ mailing list