1

When I try to import a csv file into a PostgreSQL table with the Gdal ogr2ogr tool I get the "Unable to open datasource" Failure. So I tried to open it with the tool ogrinfo and I get the same Failure.

I use it in a Ubuntu 10.10, with the package gdal-bin version 1.6.3-4build1.

This is the command:

> ogrinfo test.csv
FAILURE:
Unable to open datasource `test.csv' with the following drivers.
  -> ESRI Shapefile
  ...
  -> CSV
  ...

This is the content of the "test.csv" file:

col1;col2;col3;col4
1;a;row1;11
2;b;row2;22
3;c;row3;33
4;d;row4;44
5;e;row5;55
6;f;row6;66

Any help?

Could it be the version of gdal bin? kind of old OS I know.

  • Is the separator between column 3 and 4 actually a comma instead of a semicolon like the rest, or is that a typo? – Evil Genius Dec 17 '15 at 12:24
  • 1
    It would be a typo sorry. Ok, let me edit the question to simplify the csv test file. I know anyway the failure persists. – Aleix Dec 17 '15 at 12:51
  • Possibly the user has no right to read the CSV? – bennos Dec 17 '15 at 12:55
  • Could it be the version of gdal bin? kind of old OS I know.. – Aleix Dec 17 '15 at 12:59
  • Might be, GDAL 1.6 is 7 years old osgeo.org/node/801. My GDAL 2.1-dev can read your file just fine. – user30184 Dec 17 '15 at 20:36
0

Ok. I think the problem is with the Gdal-Bin version. I tried in the same environment another csv file but with comma separator, not semicolon, and it worked.

Then I tried the "test.csv" with semicolon separator in my home pc, with the version of gdal-bin 1.7.3-6ubuntu3, and it was imported perfectly.

So my conclusion is that the gdal-bin version 1.6.3-4build1 has some problems importing CSV files with semicolon separator.

Thank you all for your comments.

  • Why dont you install the latest gdal version? – Below the Radar Dec 18 '15 at 12:59
  • Yes, I will, but first I will have to update the Server OS, because I am developing a functionality in a Web Server, and before this I have to arrange some other dependencies. Don't worry, thank you, but with this conclusion I take this question as Solved:) – Aleix Dec 18 '15 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.