Okay, first crack at http://code.google.com/p/mapnik-utils/source/detail?r=971

Now you can use '-' as the first argument to indicate piped XML input should be 
accepted from stdin, otherwise stdin will not be read from.

Also passing '-' as the second argument triggers writing the image to stdout 
instead of a file to allow unix redirection. I don't use this feature much but 
its been available in some form or another in nik2ing since the beginning as 
the tool was originally modeled after shp2img, which defaults to printing the 
image to stdout.

Now, a command like:

$ nik2img.py mapfile_wgs84.xml image.png 

can now be done alternatively like:

$ cat mapfile_wgs84.xml | nik2img.py - - > image.png

Let me know if that works more like you hope otherwise I can continue to tweak.

Its not released yet, but I bumped the version number so pulling from trunk and 
installing with:

python setup.py install

should do the trick to test.

Cheers,

Dane


On May 24, 2010, at 8:24 PM, Michal Migurski wrote:

> Seconding "-", it's a common way to denote stdin.
> 
> -mike.
> 
> On May 24, 2010, at 1:32 PM, Dane Springmeyer wrote:
> 
>> Frederik,
>> 
>> Thanks very much for the suggestion. It was tricky getting the xml from 
>> stdin approach working originally, so I'd like to revisit it to get it 
>> working better. Your idea of passing '-' sounds good, as I've seen that used 
>> recently in useful command line tool to turn html into pdf [1]
>> 
>> I'll post back when I've made progress.
>> 
>> Dane
>> 
>> [1] http://code.google.com/p/wkhtmltopdf/
>> 
>> On May 24, 2010, at 12:39 PM, Frederik Ramm wrote:
>> 
>>> Dane,
>>> 
>>> Dane Springmeyer wrote:
>>>> Latest nik2img adds geotiff output (georeferenced tiff) to the list of 
>>>> one-liner output formats.
>>> 
>>> While you're at it, I have a little request. nik2img fooled me a number of 
>>> times with this. When I do a normal request:
>>> 
>>> nik2img map.xml parameter parameter parameter...
>>> 
>>> it works fine. Then I put this in a shell wrapper like this:
>>> 
>>> cat list-of-mapfiles | while read mapfile
>>> do
>>> nik2img $mapfile parameter parameter parameter ...
>>> done
>>> 
>>> and suddenly: Nothing but complaints about not being able to parse the map 
>>> file!
>>> 
>>> Turns out that somehow nik2img tries to magically detect if a map file can 
>>> be read from stdin; in the second invocation, it actually inherits the pipe 
>>> on stdin from the shell loop and tries to read its map file from stdin.
>>> 
>>> It would be good if that could be fixed somehow. Maybe by just dropping 
>>> support for reading mapfiles from stdin, or if you want that you should 
>>> explicitly specify "-" on the command line.
>>> 
>>> Bye
>>> Frederik
>>> 
>>> -- 
>>> Frederik Ramm  ##  eMail [email protected]  ##  N49°00'09" E008°23'33"
>>> _______________________________________________
>>> Mapnik-users mailing list
>>> [email protected]
>>> https://lists.berlios.de/mailman/listinfo/mapnik-users
>> 
>> _______________________________________________
>> Mapnik-users mailing list
>> [email protected]
>> https://lists.berlios.de/mailman/listinfo/mapnik-users
>> 
> 
> ----------------------------------------------------------------
> michal migurski- [email protected]
>                 415.558.1610
> 
> 
> 
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to