[gdal-dev] OGR SQL on CSV file with field name with parentheses?

Even Rouault even.rouault at spatialys.com
Fri Apr 19 01:45:57 PDT 2019


On vendredi 19 avril 2019 14:52:13 CEST John Baumgartner wrote:
> Try surrounding the field name with square brackets:
> 
> ogrinfo -al "Data_directory" -dialect sqlite -sql "SELECT [Vs30(m/s)] as
> Vs30 FROM file1"

Brackets won't work with OGR SQL or SQLite. You must use double quotes

On a Bash shell, if you use double quotes for the SQL statement itself,
you need to escape them

ogrinfo test.csv -sql "select \"VS30(m/s)\" as VS30ms from test"

On Windows cmd.exe, you might also apparently try the above in most cases,
but there are some subtleties and dangers in some cases (not for the
above one), as underlined by
https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
(paragraph "cmd.exe" and following)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list