[gdal-dev] Re: ogr2ogr - output WKT to console?

Even Rouault even.rouault at mines-paris.org
Wed Aug 31 17:28:03 EDT 2011


Le mercredi 31 août 2011 23:08:36, Hermann Peifer a écrit :
> On 31/08/2011 22:52, Even Rouault wrote:
> > Yes, as a output filename, you can use the special name /vsistdout/ (you
> > need the trailing slash) . You likely need GDAL 1.8 or later for it to
> > work.
> 
> Even,
> 
> Thanks for the hint. Is there a specific reason why the csv driver isn't
> able to use /dev/stdout, similar to the kml driver [1] ?

Because the CSV driver is a bit more complex with its processing of files and 
directories and requires special processing for the /vsistdout/ case in a few 
places to avoid trying random access IO. But it was easy to also support 
/dev/stdout as an alias for /vsistdout/. Added in r23016.

The advantage of /vsistdout/ is that is portable (within the GDAL world) for 
non-Unix OSs.

> 
> Hermann
> 
> [1]
> 
> $ ogr2ogr -f kml /dev/stdout test.shp
> <?xml version="1.0" encoding="utf-8" ?>
> <kml xmlns="http://www.opengis.net/kml/2.2">
> <Document><Folder><name>test</name>
> <Schema name="test" id="test">
>          <SimpleField name="Name" type="string"></SimpleField>
>          <SimpleField name="Description" type="string"></SimpleField>
>          <SimpleField name="Latitude" type="string"></SimpleField>
>          <SimpleField name="Longitude" type="string"></SimpleField>
>          <SimpleField name="Value" type="string"></SimpleField>
> </Schema>
>    <Placemark>
>          <name>First point</name>
>          <ExtendedData><SchemaData schemaUrl="#test">
>                  <SimpleData name="Name">First point</SimpleData>
>                  <SimpleData name="Latitude">50</SimpleData>
>                  <SimpleData name="Longitude">50</SimpleData>
>                  <SimpleData name="Value">1</SimpleData>
>          </SchemaData></ExtendedData>
>        <Point><coordinates>50,50</coordinates></Point>
>    </Placemark>
> (...)


More information about the gdal-dev mailing list