Opened 16 years ago
Closed 16 years ago
#2538 closed defect (fixed)
Reading CSV files with blank columns using VRT
Reported by: | jduckles | Owned by: | warmerdam |
---|---|---|---|
Priority: | low | Milestone: | 1.6.0 |
Component: | OGR_SF | Version: | unspecified |
Severity: | minor | Keywords: | |
Cc: |
Description
This is minor, but has had me scratching my head for a few minutes on two occasions. If you create a vrt for a .csv file which has trailing empty columns, the VRT driver fails ungracefully. I received data from a client exported from a spreadsheet which had empty columns (the extraneous commas at the end of each line) like:
lat,lon,wypt,, 44.0000,-88.0000,, 42.0000,-87.0000,,
Created a VRT file to use with ogr2ogr
<OGRVRTDataSource> <OGRVRTLayer name="test"> <SrcDataSource>test.csv</SrcDataSource> <GeometryType>wkbPoint</GeometryType> <LayerSRS>WGS84</LayerSRS> <GeometryField encoding="PointFromColumns" x="lon" y="lat"/> </OGRVRTLayer> </OGRVRTDataSource>
Running a:
ogrinfo test.vrt
Gives:
ERROR 4: Update access not supported for VRT datasources. ERROR 1: Unable to identify source X or Y field for PointFromColumns encoding. FAILURE:
Removing the extra commas fixes the problem as a workaround, but it would be nice for OGR to gracefully handle this common situation.
Change History (1)
comment:1 by , 16 years ago
Milestone: | → 1.6.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in trunk in r15197