What is a Shapefile?

Shapefiles are one of the main types of data you work with in a GIS. I have a description of GIS here, and an intro to the other basic data type (rasters) here. Shapefiles are vector data, and vector data comes in three basic forms: polygons, lines, or points. Polygons are shapes that take up space, like county maps, field boundary files, or watershed maps. The most common examples of line data is contour maps for elevation or road maps. Points are exactly what they sound like– data represented as a one-dimensional location. There are vector file formats that will mix all three data types, but a shapefile will only have one. If you have both lines and polygons to record, you’ll need two shapefiles to store that information in.

One reason shapefiles are confusing is that they require 3+ individual files to save and read the data. The .shp files is the main file that stores the location and vertices of every object in the shapefile. The .shx file is called the “index” file which helps locate each object in the shapefile relative to the first object in the .shp file. Attribute data is stored in the .dbf file, which is the last mandatory file in a shapefile. This file is basically a table with all the information associated with each shape, and it populates the attribute table you can open for each shapefile in you GIS.

Shapefiles also commonly have a .prj file associated with them. This defines the projection information. When you build a shapefile in QGIS, the projection information may be stored as a .qpj file. If you don’t have a .prj or a .qpj file, most GIS software lets you define the coordinate system information manually using EPSG codes. I’ll have a future post on projections and the EPSG registry, but that’s for a later day.

When you send a shapefile to someone else, send at least the .shp, .shx, and .dbf files. It doesn’t hurt to send all associated files you have, especially any projection information available. I also like to send a screenshot of the projected data if I can so they know what to expect when they open the file. If you’re opening a shapefile for the first time, it’s nice to also have a satellite image projected at the same time to make sure your shapes line up where you think they should. Happy map-making!

1 thought on “What is a Shapefile?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s