Opened 10 years ago

Closed 5 years ago

#5283 closed defect (wontfix)

CSV driver should accept files with only one field

Reported by: Kurt Schwehr Owned by: Kurt Schwehr
Priority: normal Milestone: closed_because_of_github_migration
Component: OGR_SF Version: unspecified
Severity: normal Keywords: csv
Cc:

Description (last modified by Kurt Schwehr)

Proposed by Nick Harper at Google:

Propose removing this: source:trunk/gdal/ogr/ogrsf_frmts/csv/ogrcsvdatasource.cpp#L425

    if( CSLCount(papszFields) < 2 )
	    {
	        VSIFCloseL( fp );
	        CSLDestroy( papszFields );
	        return FALSE;
	    }

Or should this become "< 1" or "!CSLCount(papszFields)"?

Example files that are proposed for writing the test case:

csv_one_column.csv

my_geometry
POINT(61.3483229561 22.6660514134)
POINT(0 0)

csv_one_column.vrt:

<OGRVRTDataSource>
  <OGRVRTLayer name="csv_one_column">
    <SrcDataSource relativeToVrt="1">csv_one_column.csv</SrcDataSource>
    <GeometryType>wkbPoint</GeometryType>
    <LayerSRS>WGS84</LayerSRS>
    <GeometryField encoding="PointFromColumns" reportSrcColumn="false"/>
  </OGRVRTLayer>
</OGRVRTDataSource>

Are we missing something? This file+vrt seems valid

Change History (6)

comment:1 by Kurt Schwehr, 10 years ago

Description: modified (diff)
Status: newassigned

comment:2 by Even Rouault, 10 years ago

Adding a comma at the end of the header line workarounds the issue. Not sure why we don't accept one column CSV. Maybe because CSV means "Comma Separated Values" ;-)

comment:3 by Jukka Rahkonen, 9 years ago

Summary: Valid 1 column csv files are being rejectedCSV driver should accept files with only one field

comment:4 by Even Rouault, 9 years ago

Still interested in this ? I can't see any drawback in the proposed change.

comment:5 by Even Rouault, 9 years ago

Milestone: 1.10.2

comment:6 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: assignedclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.