Feature request: accept osm data from stdin

Would it be possible that Mkgmap supports reading the OSM data from stdin? Splitter is capable of doing so and it would eliminate the need for a temporary file if Mkgmap could do so too. E.g. --input-file="-" or assume stdin if no filename is given?

On Tue, Nov 02, 2010 at 10:22:33AM +0100, Lambertus wrote:
Would it be possible that Mkgmap supports reading the OSM data from stdin? Splitter is capable of doing so and it would eliminate the need for a temporary file if Mkgmap could do so too.
If you are using a unix-like system, --input-file=/dev/stdin or /dev/fd/0 could be a feasible workaround. It generally works for programs that do not attempt to seek (or rewind) the input file. Marko

On 2010-11-02 10:28, Marko Mäkelä wrote:
On Tue, Nov 02, 2010 at 10:22:33AM +0100, Lambertus wrote:
Would it be possible that Mkgmap supports reading the OSM data from stdin? Splitter is capable of doing so and it would eliminate the need for a temporary file if Mkgmap could do so too.
If you are using a unix-like system, --input-file=/dev/stdin or /dev/fd/0 could be a feasible workaround. It generally works for programs that do not attempt to seek (or rewind) the input file.
Yes, I use Linux, so that might work then. Thanks!

Marko Mäkelä <marko.makela@iki.fi> writes:
On Tue, Nov 02, 2010 at 10:22:33AM +0100, Lambertus wrote:
Would it be possible that Mkgmap supports reading the OSM data from stdin? Splitter is capable of doing so and it would eliminate the need for a temporary file if Mkgmap could do so too.
If you are using a unix-like system, --input-file=/dev/stdin or /dev/fd/0 could be a feasible workaround. It generally works for programs that do not attempt to seek (or rewind) the input file.
True, but it would be nice for mkgmap to read from stdin anyway, since the notion of stdin being available as a file is non-portable - I'm pretty sure POSIX does not specify it.

On Tue, Nov 02, 2010 at 08:11:41AM -0400, Greg Troxel wrote:
True, but it would be nice for mkgmap to read from stdin anyway, since the notion of stdin being available as a file is non-portable - I'm pretty sure POSIX does not specify it.
Sure. Patches are of course welcome. I just wanted to provide a pragmatic solution. I seem to remember that on Microsoft operating systems, stdin and stdout are 'text mode' by default and have to be set binary by some special call, so that the CR and LF bytes will be passed through intact. Is this an issue with Java? Can splitter read osm.pbf from the standard input on Microsoft operating systems? For what it is worth, there does not seem to be a /dev/stdin equivalent on Microsoft operating systems. CON, CONIN$ and CONOUT$ are roughly equivalent to /dev/console. Best regards, Marko
participants (3)
-
Greg Troxel
-
Lambertus
-
Marko Mäkelä