How do I load a .dbf file into QGIS?

The set of files that you have is referred to collectively, as a Shapefile. It is a common spatial data format developed by ESRI that is used for data transfer between many different packages.

This format consists of 3 primary files with the same name, but the following file extensions:

  • .shp
  • .dbf
  • .shx

A file containing Projection information:

  • .prj

Plus a couple of files generated by software that are spatial indexes:

  • .sbn
  • .sbx

Of the first 3 files, the .shp file contains the spatial information, namely, x,y coordinate pairs describing the point, line or polygon features contained in the file.

The .dbf file is a dbase format file, and contains the Attribute information, or the descriptive characteristics of the features. Some examples of this would be: "Name", if the feature is a point representing a city; "Road Name", or "Speed", if the feature is a line representing a street; or "Population" if the feature is a polygon representing a county area*, or country.

The .shx file acts as a linking file between the .shp and .dbf. It matches up the correct row in the .shp file with the correct record in the .dbf file.

Without these first 3 files, you do not have a valid shapefile.

The other files listed are optional, though the .prj is necessary for correct positioning of your data with respect to other spatial data, and for measuring and calculating distance. See Map Projection, for more information.
The .sbx and .sbn are generally created automatically when the shapefile is created. They can, however, be deleted and recreated without invalidating the shapefile as a whole.

Generally, when you use software that is able to read this format, the files listed in the add layers window are the .shp file. The other files are automatically loaded in. If, however, there is a problem with one of the 3 primary files, the .shp file may be loaded in, but an error will appear saying that this is not a valid shapefile, or simply no features will appear.

In the case you have shown, you appear to be missing the critical .shx file. Without this, there is no connection between the spatial features and the attribute data, thus the software is not able to load the shapefile in properly. What you need to do is go back to the source of your data and make sure that you obtain the .shx file as well. Once you do that, you should be able to load the data in with no problems.

This answer may be overkill, but it helps to know what the files included in a shapefile are for. It may help in the future to know what to look for if you encounter a similar problem.


QGIS 1.8 has the ability to open zip files directly. See here for more details

http://underdark.wordpress.com/2012/05/05/loading-zipped-files-directly-into-qgis/

Otherwise, you can always unzip the .zip file and extract all the files in a folder. After that, once you open the .shp file, it would show up correctly.


If the shapefile loads into QGIS you can view the attribute data (the data stored in the *.dbf file) by right-clicking on the layer in the layers panel and going down to 'Open Attribute Table'.

Tags:

Shapefile

Qgis