6

I opened a DBF file in Excel and I'm looking at attribute data from a shapefile export.

How is the row of attribute data in the DBF file connected to it's corresponding locational data in the SHP file?

I don't see anything that looks like a key.

10

As documented in the shapefile specification (p. 25), only record number links the SHP/SHX pair to the DBF :

The record order must be the same as the order of shape features in the main (*.shp) file.

There is a popular myth that the SHX file serves as a lookup to the dBase file, but this is not true. The SHX is only a fixed width complement to the SHP file, allowing direct access by record number into the variable record width SHP file.

Both the SHP and SHX have 100 byte fixed headers, and the DBF has a 32-byte fixed header and one additional 32-byte header per field. Once you know the byte position for the first record, both the SHX and DBF are fixed width, while the SHP is variable width by vertex count (point SHP files are also fixed width, so the illustration below would be for multipoint, polyline, polygon, or multipatch).

shapefile layout

0

Do not open DBF's from .SHP's in Excel, Access, etc for editing or any other purpose. This isn't documented anywhere, but it is not a recommended practice and is known to corrupt .SHP's.

Open them only through the attribute table in ArcMap or ArcCatalog, or QGIS

They two are linked via the Software.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.