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

Even Rouault even.rouault at mines-paris.org
Wed Aug 31 16:52:21 EDT 2011


Le mercredi 31 août 2011 22:44:55, Elijah Robison a écrit :
> Hi Devs,
> 
> When troubleshooting geodata integrity issues, we sometimes use ogr2ogr
> to push WKT expressions to a .csv file using a script like I show below.
> It uses an ogr sql statement to grab a single feature from a raw
> shapefile data source, then it saves the output to a CSV:
> 
> ogr2ogr -f "CSV" "C:\xData\CountyData\Shps\OriginalParcelCSV"
> "C:\xData\CountyData\Shps\parcel_polygons.shp" -sql "select * from
> parcel_polygons where id= 9080" -lco "GEOMETRY=AS_WKT" -lco
> "LINEFORMAT=CRLF" -lco "SEPARATOR=SEMICOLON"
> 
> As our needs in this situation are very transient, I'm curious if it is
> possible to output the WKT directly to the console?

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.

> 
> Very Best,
> 
> Elijah Robison
> elijah at villagis.com
> _______________________________________________
> 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