[gdal-dev] VSI issue

Ari Jolma ari.jolma at gmail.com
Sat Nov 19 09:12:51 EST 2011


On 11/19/2011 11:40 AM, Ari Jolma wrote:
> On 11/18/2011 09:02 PM, Even Rouault wrote:
>> Le vendredi 18 novembre 2011 15:04:55, Ari Jolma a écrit :
>>> Hi,
>>>
>>> A few days ago on this list I mentioned that the following works 
>>> using a
>>> recent version from trunk (and Perl bindings):
>>>
>>> use Geo::GDAL;
>>> $datasource = Geo::OGR::Open('/home/ajolma/data/parks.shp');
>>> Geo::OGR::Driver('GML')->Copy($datasource, '/dev/stdout');
>>>
>>> I'm testing a simple WFS written in Perl and basically the above is the
>>> contents of the GetFeature subroutine (the datasource name comes of
>>> course from a configuration file). However, using this in a Perl CGI
>>> program leads to "RuntimeError Failed to create GML file 
>>> /dev/stdout." -
>>> it seems like the VSI does not work when the Perl program is run as a
>>> CGI program. I may investigate the issue more but maybe somebody has an
>>> answer right away. - I can forward the output to a file and then send
>>> the file but it would be nice to feed it directly to the client.
>> The most obvious idea I have is that something closes the stdout of 
>> the forked
>> CGI ?
>
> The standard way to send text (HTML, XML, ..) to the client in a Perl 
> CGI process is to print to stdout (exactly the same way as one does in 
> a command line Perl program). Thus it seems that the VSI stdout is 
> somehow not a standard stdout - I'll take a deeper look into what goes 
> on.

I found the problem. It is changeset 23022 (by you, Even :), which 
removes support for "stdout" and adds "/dev/stdout" as an alias to 
"/vsistdout/". Simple, but took me a while to find out especially as the 
log message begins "mentions in the doc".

>
> Another thing is that in mod_perl sending to client is through a 
> handle (use the print method of an object) - it would be nice to be 
> able to give that handle to the GDAL copy method.

mod_perl is probably not a problem. However, Perl supports memory files 
too and it would be interesting to be able to use VSI memory files and 
Perl memory files interchangeably.

Ari

>
> Ari
>
>
>>
>>> Regards,
>>>
>>> Ari
>>>
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



More information about the gdal-dev mailing list