Ahasanul Hoque

Ahasanul Hoque

Lives in Bangladesh
Ahasanul Hoque

Understand the Shapefile !!!

May 10, 2017, by aHaSaN, category Geospatial & Environmental Job

A shapefile is an Esri vector data storage format for storing the location, shape, and attributes of geographic features. It is stored as a set of related files and contains one feature class. Shapefiles often contain large features with a lot of associated data and historically have been used in GIS desktop applications such as ArcMap. If you have a small amount of data in a shapefile—generally fewer than 1,000 features—you can make it available for others to view through a web browser by adding it as a .zip file containing the .shp, .shx, .dbf, and .prj files to a map you create with the map viewer.

Shapefiles are made up of mandatory and optional files. The mandatory file extensions needed for a shapefile are .shp, .shx and .dbf. The optional files are: .prj, .xml, .sbn and .sbx

If you have several hours to spare, you could go through the  34-page ESRI Shapefile Technical Description document.

Let’s take a closer inspection at what makes up an ArcGIS shapefile.

List of shapefile extensions (Mandatory)
.shp: ESRI file that represents the feature geometry. Each shapefile has it’s own .shp file that can represent points, lines and polygons in a map. Mandatory

.shx: ESRI and AutoCAD shape index position. This type of file is used to search forward and backwards. Mandatory.

.dbf: Standard database file used to store attribute data and object IDs. .dbf can be opened in Microsoft Access or Excel. Mandatory.

Shapefile Extensions (Optional)
.prj: This file type contains the metadata associated with the shapefiles coordinate and projection system. If this file does not exist, the error “unknown coordinate system” will appear. To fix this error, the “define projection” tool generates .prj files. Optional.

.xml: This file type contains the metadata associated with the shapefile. Delete this file, and you essentially delete your metadata. This file type (.xml) can be opened and edited in any text editor. Optional.

.sbn: Spatial index file that optimizes spatial queries. This file type is saved together with a .sbx file. These two files make up a shape index to speed up spatial queries. Optional.

.sbx: Similar to .sbn files, this file type speeds up loading times. It works with .sbn files to optimize spatial queries. We tested .sbn and .sbx extensions and found that there were faster load times when these files existed. It was 6 seconds faster (27.3 sec versus 33.3 sec) comparing with/without .sbn and .sbx files. Optional.

.cpg: These are optional plain text files that describes the encoding applied to create the Shapefile. If your shapefile doesn’t have a cpg file, then it has the system default encoding. Optional.

In Windows Explorer: When moving shapefile files from one folder to another, you should drag and drop all the mandatory and optional files.

In ArcCatalog: When moving shapefiles, it will move all the mandatory and optional files for you.

There are over 150 different GIS file extensions that exist. These file types are exclusively used in GIS. This doesn’t even include AutoCAD and common image formats.

The most common GIS file type are shapefiles. Even the USGS Earth Explorer accepts shapefiles as input to define boundaries.


So, what do you think ?