Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to use QGIS to extract lat/lng data from the vertices of polygons. There are about 400 polygons, each with maybe 200 vertices. I am having trouble with step one, getting the data into QGIS.

The polygons are viewable in ArcGIS Explorer using a zip file that contains files with the following extenstions:

.shp, .dbf, .sbn, .sbx, and .prj

I can load the .shp file into QGIS, but without the other files there is nothing to view. How do I load the .dbf, .sbn, .sbx and .prj files into QGIS?

share|improve this question
add comment

4 Answers

up vote 17 down vote accepted

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.

share|improve this answer
    
This post was extremely helpful and very much appreciated. Thanks. I have now loaded the data (thanks to the missing .shx file). –  tbone Jun 25 '12 at 2:36
    
The purpose of the .shx is to locate the Nth feature in the variable record-width .shp; the .dbf has fixed record sizes, and doesn't need any help. –  Vince Apr 1 at 15:49
add comment

QGIS can read a broken shapefile even without the .dbf file. In that case the attribute data gets lost, but not the geometry.

The .shx file however is necessary. It contains the same metadata header as the .shp file, and the index to the individual records of the .shp file.

See also the wikipedia entry on Shapefiles.

share|improve this answer
add comment

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'.

share|improve this answer
    
Thanks for this great tip. –  tbone Jun 25 '12 at 2:37
add comment

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.

share|improve this answer
    
I just upgraded to 1.8, thanks for this. –  tbone Jun 25 '12 at 2:38
    
That's cool, if only ArcGIS could do the same! –  Dan C Jun 25 '12 at 16:28
add comment

Your Answer

 
discard

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.