Opened 11 years ago
Closed 11 years ago
#4824 closed defect (fixed)
Creating another CSV file into directory with invalid CSV file fails
Reported by: | Jukka Rahkonen | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.2 |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | csv |
Cc: |
Description
Ogr2ogr with CSV driver does not create a new file if there is already at least one file with .csv extension in the directory.
Create a CSV file without problem
F:\OSM_data>ogr2ogr -f csv -dialect SQLITE poi.csv finland.osm.pbf -sql "select amenity from points where amenity is not null" -spat 24.821 60.123 25.259 60.317 -debug on layer names ignored in combination with -sql.
Trial to create another CSV file fails
F:\OSM_data>ogr2ogr -f csv -dialect SQLITE poi2.csv finland.osm.pbf -sql "select amenity from points where amenity is not null" -spat 24.821 60.123 25.259 60.31 7-debug on csv driver failed to create poi2.csv
The latter command works after deleting all existing .csv files from the directory
F:\OSM_data>del *.csv F:\OSM_data>ogr2ogr -f csv -dialect SQLITE poi2.csv finland.osm.pbf -sql "select amenity from points where amenity is not null" -spat 24.821 60.123 25.259 60.31 7-debug on layer names ignored in combination with -sql.
Tested on Windows Vista 32-bit with GDAL version r24962, MSVC2010 build.
Change History (3)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Ah ok, I understand the issue better. The CSV driver cannot recognize a CSV file with a single column, but it can generate them. So the first ogr2ogr produces an invalid CSV file, that prevents following CSV files from being created in the same directory.
comment:3 by , 11 years ago
Component: | default → OGR_SF |
---|---|
Keywords: | csv added |
Milestone: | → 1.9.2 |
Resolution: | → fixed |
Status: | new → closed |
Summary: | Creating another CSV file into directory fails → Creating another CSV file into directory with invalid CSV file fails |
trunk r24965 "CSV: allow creating a new .csv file in a directory where there are invalid .csv files; use a trick so that the CSV driver creates valid single column files (#4824)"
branches/1.9 r24966 "CSV: allow creating a new .csv file in a directory where there are invalid .csv files; use a trick so that the CSV driver creates valid single column files (#4824)"
More information: ogrinfo does not recognise the CSV file created with simple "select amenity from..
If I create the first CSV file as "select * from points..." ogrinfo finds it
Now creating the next CSV succeeds.