Suppose you have a DBF (.dbf) file containing X and Y values that you want to import and save as a spatial layer.

QGIS doesn’t support direct import of a DBF file as a map layer, however, we can use some command line magic to convert it to a CSV file and then use the Delimited Text plugin to get the job done.

Your DBF file should have an id for each record and fields containing X and Y values. If it has additional fields that should be OK as well.

First convert the DBF to a comma delimited file using ogr2ogr:
ogr2ogr -f CSV my_csv my_data.dbf

If you don’t have ogr2ogr see http://www.gdal.org/index.html.

This will create my_data.csv in the my_csv directory. You are now ready to bring it into QGIS.

Here are the steps to import the CSV:

  1. Start QGIS
  2. If not already enabled, use the plugin manager to enable the Delimited Text plugin
  3. Click on the Delimited Text icon in the Plugin toolbar or choose it from the Plugins menu
  4. Browse to the location of your CSV file
  5. Enter a name for the layer
  6. Under Selected delimiters, check Comma
  7. If your X and Y fields aren’t automatically determined, set them using the drop-down boxes
  8. The sample text should show how the file is being parsed—if it looks right click OK, otherwise adjust the settings
  9. The layer is added to QGIS

Delmited Text plugin ready to import CSV

At this point the layer behaves pretty much like any other QGIS layer. To save it as a shapefile, right click on its name in the legend and choose Save as…