ArticleslgStudy

science

Shapefile

Shapefile is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Shapefile rather than just read about it. In short: The shapefile format is a geospatial vector data format for geographic information system (GIS) software. It is developed and regulated by Esri as a mostly open specification for data interoperability among Esri and other GIS software products.

Shapefile — main illustration
Shapefile — illustration

Key takeaways

  • Shapefile belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Shapefile to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Shapefile from memory before moving on to harder problems.

Reference excerpt

The shapefile format is a geospatial vector data format for geographic information system (GIS) software. It is developed and regulated by Esri as a mostly open specification for data interoperability among Esri and other GIS software products. The shapefile format can spatially describe vector features: points, lines, and polygons, representing, for example, water wells, rivers, and lakes. Each item usually has attributes that describe it, such as name or temperature.

Overview The shapefile format is a digital vector storage format for storing geographic location and associated attribute information. This format lacks the capacity to store topological information. The shapefile format was introduced with ArcView GIS version 2 in the early 1990s. It is now possible to read and write geographical datasets using the shapefile format with a wide variety of software. The shapefile format stores the geometry as primitive geometric shapes like points, lines, and polygons. These shapes, together with data attributes that are linked to each shape, create the representation of the geographic data. The term "shapefile" is quite common, but the format consists of a collection of files with a common filename prefix, stored in the same directory. The three mandatory files have filename extensions .shp, .shx, and .dbf. The actual shapefile relates specifically to the .shp file, but alone is incomplete for distribution as the other supporting files are required. In line with the ESRI Shapefile Technical Description, legacy GIS software may expect that the filename prefix be limited to eight characters to conform to the DOS 8.3 filename convention, though modern software applications accept files with longer names.

Mandatory files .shp Shape format; the feature geometry itself.Content-type: application/vnd.shp .shx Shape index format; a positional index of the feature geometry to allow seeking forwards and backwards quickly.Content-type: application/vnd.shp.shx .dbf Attribute format; columnar attributes for each shape, in dBase IV format.Content-type: application/vnd.dbf

Other files .prj — projection description, using a well-known text representation of coordinate reference systems {content-type: text/plain OR application/text} .sbn and .sbx — a spatial index of the features {content-type: application/vnd.shp} .fbn and .fbx — a spatial index of the features that are read-only {content-type: application/vnd.shp} .ain and .aih — an attribute index of the active fields in a table {content-type: application/vnd.shp} .ixs — a geocoding index for read-write datasets {content-type: application/vnd.shp} .mxs — a geocoding index for read-write datasets (ODB format) {content-type: application/vnd.shp} .atx — an attribute index for the .dbf file in the form of shapefile.columnname.atx (ArcGIS 8 and later) {content-type: application/vnd.shp } .shp.xml — geospatial metadata in XML format, such as ISO 19115 or other XML schema {content-type: application/fgdc+xml} .cpg — used to specify the code page (only for .dbf) for identifying the character encoding to be used {content-type: text/plain OR application/vnd.shp } .qix — an alternative quadtree spatial index used by MapServer and GDAL/OGR software {content-type: application/vnd.shp} In each of the .shp, .shx, and .dbf files, the shapes in each file correspond to each other in sequence (i.e., the first record in the .shp file corresponds to the first record in the .shx and .dbf files, etc.). The .shp and .shx files have various fields with different endianness, so an implementer of the file formats must be very careful to respect the endianness of each field and treat it properly.

File formats

Shapefile shape format (.shp) The main file (.shp) contains the geometry data. Geometry of a given feature is stored as a set of vector coordinates. The binary file consists of a single fixed-length header followed by one or more variable-length records. Each of the variable-length records includes a record-header component and a record-contents component. A detailed description of the file format is given in the ESRI Shapefile Technical Description. This format should not be confused with the AutoCAD shape font source format, which shares the .shp extension. The 2D axis ordering of coordinate data assumes a Cartesian coordinate system, using the order (X Y) or (Easting Northing). This axis order is consistent for Geographic coordinate systems, where the order is similarly (longitude latitude). Geometries may also support 3- or 4-dimensional Z and M coordinates, for elevation and measure, respectively. A Z-dimension stores the elevation of each coordinate in 3D space, which can be used for analysis or for visualisation of geometries using 3D computer graphics. The user-defined M dimension can be used for one of many functions, such as storing linear referencing measures or relative time of a feature in 4D space. The main file header is fixed at 100 bytes in length and contains 17 fields; nine 4-byte (32-bit signed integer or int32) integer fields followed by eight 8-byte (double) signed floating point fields:

Shapefile headers

Shapefile record headers The file then contains any number of variable-length records. Each record is prefixed with a record header of 8 bytes:

Shapefile records Following the record header is the actual record:

The variable-length record contents depend on the shape type, which must be either the shape type given in the file header or Null. The following are the possible shape types:

Shapefile shape index format (.shx) The index contains positional index of the feature geometry and the same 100-byte header as the .shp file, followed by any number of 8-byte fixed-length records which consist of the following two fields:

Using this index, it is possible to seek backwards in the shapefile by, first, seeking backwards in the shape index (which is possible because it uses fixed-length records), then reading the record offset, and using that offset to seek to the correct position in the .shp file. It is also possible to seek forwards an arbitrary number of records using the same method. It is possible to generate the complete index file given a lone .shp file. However, since a shapefile is supposed to always contain an index, doing so counts as repairing a corrupt file.

Shapefile attribute format (.dbf)

… excerpt ends here. Continue reading the full article.

Illustrations

Shapefile illustration

Worked examples

Example 1 — a first encounter with Shapefile

Start with the simplest possible case. Write down what Shapefile claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Shapefile before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Shapefile ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Shapefile

In research
Shapefile appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Shapefile in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Shapefile is common in secondary-school and first-year university syllabi. It links to neighbouring topics GIS vector file formats, Open formats, so understanding it makes those chapters shorter.
In everyday life
Look for Shapefile outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Shapefile” →

How to study Shapefile in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Shapefile means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Shapefile out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Shapefile in simple terms?

The shapefile format is a geospatial vector data format for geographic information system (GIS) software. It is developed and regulated by Esri as a mostly open specification for data interoperability among Esri and other GIS software products.

Why does Shapefile matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Shapefile?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Shapefile.

Tags

  • GIS vector file formats
  • Open formats

Keep exploring