Grammars for Shapefiles

Shapefile is a very popular file format for storing geospatial vector data. To be precise, shapefiles consist of three mandatory file formats. One of them is the popular dBASE format which was very common in the MS-DOS times. (You remember? ;-)

There are now three new grammars available:

  • .shp - the main shape files with the vector data
  • .shx - contains an index for the shape file data
  • .dbf - the dBASE file with attributes of the shapes

Although the .shp and .shx formats are structured quite simple, they have an uncommon mixture of little and big endian data, even in the main file header. The rest of the file is stored in little endian byte order.

The side effect of having grammars for shape files is the ability to decode dBASE files, at least on record level.

Here you find free shapefiles of many countries:

If you're interested in more details of the shapefile format, please have a look at the specification.