[gdal-dev] Make stdin in OGR/GDAL tools cross-platform?

Stefan Keller sfkeller at gmail.com
Thu Mar 13 03:34:15 PDT 2014


Hi Even

Oh, sorry for asking something obvious: It works on my Windows with
curl and "/vsistdin/" like e.g.

> curl http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf | ogr2ogr -f SQLite liechtenstein.sqlite /vsistdin/

Actually there a spurious error when trying to do that with ogrinfo:

> curl http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf | ogrinfo -al -so /vsistdin/
...
curl: (23) Failed writing body


--Stefan


2014-03-13 11:10 GMT+01:00 Even Rouault <even.rouault at mines-paris.org>:
> Stefan,
>
> /dev/stdin is indeed Unix specific, but /vsistdin/ is a special filename within
> GDAL virtual file system handling. So I believe /vsistdin/ should also work on
> Windows, but I'm not sure this has been very much tested. Just try !
>
> Even
>
>> In OSM driver [1] there's an example about using stdin in OGR which is
>> Unix based:
>>
>> > Reading .osm.bz2 files and/or online files
>> > .osm.bz2 are not natively recognized, however you can process them (on
>> Unix),
>> > with the following command :
>> >
>> > bzcat my.osm.bz2 | ogr2ogr -f SQLite my.sqlite /vsistdin/
>> >
>> > You can convert a .osm or .pbf file without downloading it :
>> > wget -O - http://www.example.com/some.pbf | ogr2ogr -f SQLite my.sqlite
>> /vsistdin/
>>
>> Is it possible to do that also under Windows? Like this (untested but
>> inspired by [2]!)
>>
>> %wget -O - http://www.example.com/some.pbf | ogr2ogr -f SQLite my.sqlite <1
>> or
>> % type singapore.geojson | ogrinfo -al -so  <1
>>
>> --Stefan
>>
>> [1] http://www.gdal.org/ogr/drv_osm.html
>> [2]
>>
> http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true
>> _______________________________________________
>> 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