I am trying to convert tables in FGDB to CSV formats. I have 40 or more tables though by the way.

This is the code that i used and it seemed to work fine

ogr2ogr -overwrite -progress -f csv "D:\NGII_Emap\-al.csv" "D:\NGII_Emap\input_table.gdb"

however, when I see the results only the first file's name is -al.csv and the other csv files are as same as the FGDB tables.

enter image description here enter image description here

I want all the output names as same as in the FGDB tables

What did I do wrong?

  • What is your aim? Is it to create just one csv file that is named -al.csv and that holds all the data from all tables? Do all your tables have exactly same attribute schema?
    – user30184
    Dec 19, 2017 at 11:16
  • @user30184 I am trying to convert feature table in FGDB to CSVs and also want to keep the FGDB table names same as output csv files. and i'd like to create separate tables like the input. -al means "for all layers" according to ogr2ogr cookbook. for this input, it has same attribute schema. but i want this code to be more universal.
    – Pil Kwon
    Dec 19, 2017 at 11:25
  • 2
    CSV driver is a bit special and it handles directories as data stores which can contain many layers. Try ogr2ogr -overwrite -progress -f csv "D:\NGII_Emap\" "D:\NGII_Emap\input_table.gdb"
    – user30184
    Dec 19, 2017 at 11:31
  • @user30184 oh! although it does create a new folder and save the tables in it. it just works perfect. thanks a lot!
    – Pil Kwon
    Dec 19, 2017 at 11:43

1 Answer 1

ogr2ogr -overwrite -progress -f csv "D:\NGII_Emap\" "D:\NGII_Emap\input_table.gdb"

it does create the NGII_Emap folder. so if you have NGII_Emap folder already, you'd better change the name

  • 2
    It is even documented in gdal.org/drv_csv.html: The driver supports creating new databases (as a directory of .csv files), adding new .csv files to an existing directory or .csv files or appending features to an existing .csv table.
    – user30184
    Dec 19, 2017 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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