[gdal-dev] CSV headers with extra comma

Even Rouault even.rouault at spatialys.com
Sat Oct 12 09:20:48 PDT 2019


On samedi 12 octobre 2019 17:49:22 CEST Seth G wrote:
> Hi list,
> 
> I came across a minor issue in MapServer, but it is GDAL related.
> The following command (using a shapefile from MapServer's msautotest) with a
> single field:
> 
> ogr2ogr -f csv my.csv bdry_counpy2.shp -select CTY_NAME
> 
> Produces the following:
> 
> CTY_NAME,
> Lake of the Woods
> 
> Note the extra comma in the field header. If more than one field is selected
> then there is no additional comma.
> 
> Should I log this as an issue on GitHub?

Seth,

This is a intended hack. The OGR CSV reader will not accept CSV files whose 
header line doesn't contain a field separator, hence the write side adds this 
extra column.
That said the historical limitation of the reader not to accept headers with 
one field  should probably be changed. So yes might be worth filing an issue

Even

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


More information about the gdal-dev mailing list