Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is ist possible to import multiple textfiles (csv, tsv etc.) as layers in one step or do i have to do it file by file?

share|improve this question
What software are you using? – KevinMayall Aug 28 '12 at 16:31
do the delimited text files have the same separator, the same structure, etc.? – Giovanni Manghi Aug 28 '12 at 22:01

You can use the tool ogr2ogr and a little one-liner script to import a bunch of csv files together. It will help if you are trying to automate the process or have large number of files.

If you have QGIS installed, you should already have ogr2ogr. (on windows, open the MSYS terminal ). Otherwise grab FWTools for your platform and try the following.

  • Create a plain text file called .vrt file for each of csv files. See for example syntax. This is a one-time thing. If your source files change after that, you don't need to change the vrt files as long as the path and structure remains the same
  • Assuming you have a folder with your vrt files at /data/csv/ Run the following:

    for x in /data/csv/*.vrt; do ogr2ogr -f "ESRI Shapefile" /data/${x%.*}.shp $x;done

You'll get your shapefiles in /data/ folder.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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