[gdal-dev] CSV headers with extra comma

Seth G sethg at geographika.co.uk
Sat Oct 12 14:38:54 PDT 2019


Thanks for the clarification Even. 
Issue opened at https://github.com/OSGeo/gdal/issues/1929 so will hopefully appear if someone searches for this again in the future. 

Seth

On Sat, Oct 12, 2019, at 6:20 PM, Even Rouault wrote:
> 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