I know I can convert a Shapefile to GeoJSON as the following:
ogr2ogr -f GeoJSON outputFile.json inputFile.shp
Instead of writing the result of this conversion to the file outputFile.json
, I'd like to print this result directly on stdout
, without having to write a file on the system. Since I'm inside a bash script I know I can find alternative solutions as the following one:
tmpFile=$(mktemp).json
ogr2ogr -f GeoJSON $tmpFile inputFile.shp
cat $tmpFile
However, I'd like to know if ogr2ogr
supports printing to stdout instead of writing on files, just so I can do it in one line of code. I've searched in the man ogr2ogr
page but it doesn't even contain the word stdout
there. Is it possible to print the output of ogr2ogr
directly to stdout?