Shapefile Viewer: Open a Shapefile Without GIS

All tools
Report

Heading to the field? Install this site from your browser menu and this tool works with no signal. See how

Converter

Nothing is uploaded. The file is converted on your own device, so it works with no signal.

Drop a file here or

Nothing leaves your device.

No file to hand?

Waiting for a file.

Features in this file

NameTypeFolderVerticesLengthArea

A two panel comparison. The left panel lists what the .shp file holds: a shape type written once in the header, a list of coordinate pairs per record with no names or labels, and a bounding box, with a note that you cannot tell what any shape means from this file. The right panel shows the .dbf as a table with columns for name, depth and code and four borehole rows, noting one row per shape in the same order with column names capped at ten characters. A band below warns that the .shp and .dbf are matched by position alone, so sorting one of them in a separate tool silently breaks the link with no warning.
The pairing is by row order and nothing else. There is no key and no checksum, which is why opening a .dbf in a spreadsheet is the fastest way to corrupt a dataset without seeing an error.

How to use this tool

A shapefile is never one file, so zip the set together and drop the zip above. Include the .shp, .shx and .dbf at minimum, and the .prj if you have it. Everything is drawn on the map, and every shape is listed with its attribute row beside it.

The line under the status message names the coordinate system found in the .prj and says whether anything was reprojected. If there is no .prj, it says that too, rather than quietly assuming degrees.

Nothing is uploaded and nothing is installed. That is the point of this page: answering a question about a shapefile normally means opening desktop GIS, and most questions do not deserve that.

What is actually in the four files

The .shp holds geometry and nothing else. A shape type written once in the header, a list of coordinate pairs per record, and a bounding box. There are no names, no labels and no meaning anywhere in it. You cannot tell from the .shp what a single shape represents.

The .dbf holds the answers. It is a dBase III table, one row per shape, and it is where the borehole number, the depth, the surface type or the parcel reference lives. Reading a shapefile without reading the .dbf tells you where things are and nothing about what they are.

The .shx is an index of where each record starts inside the .shp. It can be rebuilt, but most software refuses to open the set without it. The .prj records what the coordinates mean.

The pairing trap

The .shp and the .dbf are matched by position alone. Record three in the geometry file belongs to row three in the table. There is no key, no identifier and no checksum linking them.

That means the association is only as good as the order, and nothing validates it. Open the .dbf on its own in a spreadsheet, sort it by depth to find the deepest hole, save it, and you have silently reassigned every attribute to the wrong shape. The file still opens. Every tool still reads it. Every value is now attached to the wrong place.

This is worth knowing because the .dbf is temptingly easy to open in Excel, and Excel is very good at offering to sort things for you. If you need to edit attributes, do it in something that understands the pairing.

A worked check you can repeat on paper

You can read the record count straight out of the .dbf header without any software beyond a hex viewer, and it is a useful sanity check when a file seems to be missing features.

The header starts with a version byte, then three bytes for the date the file was last updated: year, month and day, with the year counted from 1900. Then, at byte offset 4, sits a 32 bit record count written least significant byte first.

  • Read the four bytes at offsets 4, 5, 6 and 7.
  • The value is the first, plus 256 times the second, plus 65536 times the third, plus 16777216 times the fourth.
  • So bytes reading 0F 00 00 00 mean 15 records. Bytes reading E8 03 00 00 mean 3 plus 256 times 3, which is 1000.

Compare that against the feature count shown above. If the .dbf claims more rows than there are shapes, or fewer, the set is inconsistent and something has been edited out of step. That mismatch is the usual explanation for attributes that appear to belong to the wrong feature.

The other two useful offsets are the header length at byte 8 and the record length at byte 10, both 16 bit and both least significant byte first, which together let you work out where the rows begin and how long each one is.

How this reader was checked

The shapefile reader was written twice, once for the browser and once independently under Node, and the two are compared automatically. On top of that, shapefiles this engine writes are read back by a third party library that shares no code with either.

That cross checking found a real difference worth recording. Shapefile winds the outer ring of a polygon clockwise and its holes counter clockwise, and GeoJSON requires the opposite. Our reader rewinds to the GeoJSON rule and reproduces the original ring vertex for vertex; the third party library hands back raw shapefile order. Ours is the specification compliant one, and there is now a permanent test holding it there.

Mistakes that catch people out

Receiving a lone .shp and assuming it is broken. It is not broken, it is incomplete. Ask for the whole set, and specifically ask for the .prj.

Editing the .dbf in a spreadsheet. Covered above, and it is the fastest way to corrupt a dataset without producing an error.

Assuming the attribute names are the real ones. The .dbf caps column names at ten characters, a limit inherited from 1983. A column reading measured_d was almost certainly something longer before it was exported.

Expecting one shapefile to hold your whole map. One shape type per file. Points, lines and areas are always separate shapefiles.

Trusting coordinates without a .prj. Numbers in the hundreds of thousands are metres on some grid, and which grid is not recoverable from the file. Guessing puts your site in the wrong country.

Related Calculators and Reference

Looking inside a shapefile is usually the step before deciding what to do with it.