-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV driver doesn't honor CSVT sidecar in Dataset.GetFileList(), Driver.CreateCopy(), and other I/O operations #8165
Comments
By reading the documentation of the CSV driver https://gdal.org/drivers/vector/csv.html, by default the .csvt file is not created. A special layer creation option is required.
|
Thanks for your response! We use that when writing datasets, yes, and it works. But in our issue above, we copy dataset, not create from scratch, so expect all sidecars to be copied automatically as it happens, for example, w/ GeoTIFF or ESRI Shapefile. +It doesn't seem to affect opening datasets which already have this sidecar. |
I may be wrong, but doesn't driver.CreateCopy make a copy of the internal presentation of the data that GDAL has after opening the source dataset? So it does not copy files even if the source and target formats are the same, but the data gets rewritten. Have you tried to use the layer creation option as I suggested? Unfortunately I am not a programmer and I can't tell how to test that. Maybe https://gdal.org/api/python/osgeo.ogr.html#osgeo.ogr.DataSource.CopyLayer does something similar:
|
I'm working on having GetFileList() report the .csvt file, but you indeed shouldn't expect CreateCopy() to create a .csvt file, even if the source dataset is a .csv file with a .csvt. Output driver of GDAL know nothing about input drivers, and everything goes through a pivot model that forget about the implementation details. You'd better use plain file copy if you want to do CSV -> CSV without any change. |
CSV: implement GetFileList() and return .csvt if used (fixes #8165)
@rouault big thanks for fixing this! @jratike80 big thanks for your assist as well! |
Expected behavior and actual behavior.
Given:
.csv
index and.csvt
sidecar.testcsvt.csv
andtestcsvt.csvt
from GDAL autotest data: https://github.com/OSGeo/gdal/tree/master/autotest/ogr/data/csvSteps to reproduce the problem.
Reproduction case #1:
Expected output:
['testcsvt.csv', 'testcsvt.csvt']
Actual output:
['testcsvt.csv']
Reproduction case #2:
Expected output:
['testcsvt.csv', 'testcsvt.csvt']
Actual output:
['testcsvt.csv']
Reproduction case #3:
How can we checked that CSVT is really loaded by GDAL?
Operating system
Reproducible w/ any of the following:
GDAL version and provenance
Reproducible w/ any of the following:
master
branchThe text was updated successfully, but these errors were encountered: