Diesen Artikel gibt es noch nicht auf Deutsch — Sie lesen ihn auf Englisch.
Kept Only the .shp and the Layer Will Not Open: A Shapefile Is a Set
This is a walk through one small but frequent pain that GIS specialists keep raising on forums. There are no names here, only what goes wrong, why, and what the site delivers. If you received an archive of shapefiles, tidied it up, and the layer stopped opening, this article is about you.
What hurts
Someone receives an export and decides: "I will use only the data in shp
format and delete the rest." The files with the .shp extension stay in the
folder, and everything else goes to the bin. He opens the layer, and it does
not open at all, or it opens without attributes and without a coordinate
system.
It is a small thing, but it is directly about how any export is packed: the archive must make it obvious that these files belong together and cannot be separated.
Why it happens
A shapefile is not one file but a set of files sharing one name. Each part has its own job:
.shpholds the geometry itself: points, lines, polygons;.shxis the index the program uses to find each shape inside the.shp;.dbfis the attribute table: names, types, addresses;.prjis the coordinate system;.cpgis the text encoding of the.dbf.
Without the .shx, many programs refuse to open the layer at all. Without
the .dbf, every attribute is gone. Without the .prj, the program does not
know where on Earth the coordinates lie, and the layer lands in the wrong
place. Without the .cpg, names in non-Latin scripts turn into garbage. There
is nothing spare to delete from the set: every file is doing a job.

What our archive contains
In the site's shapefile archive every layer has its own folder, and that
folder holds the whole set: .shp, .shx, .dbf, .prj, .cpg, and, when
the layer is styled, a .qml style file as well. The root of the archive has
a README.txt. It lists all layers, every file of each layer's set, and
explains separately what each extension is for.
To be honest about the limit: the README does not currently contain a plain line saying "do not separate these files". It explains what the set contains, but it does not warn in so many words. So here is the rule in writing: move the layer folder as a whole, never single files out of it.
How to skip the set entirely
If the receiver needs one file rather than a folder, take GeoPackage. We exported one frame of 0.49 km² in a city centre into three formats at once and compared what arrived:
- geopackage: ONE file of 1,609,728 bytes with 41 layers inside (addresses, advertising, aeroways, barriers and others);
- tab: a zip of 161 files, 40 layers of four files each (
.tab,.dat,.map,.id) plus a README; - mif: a zip of 77 files, 38 layers of two files each (
.mif,.mid) plus a README.
In a GeoPackage there is nothing to take apart: geometry, attributes and the coordinate system all live inside one database file. You cannot delete the "unneeded" part of it by accident, because there are no separate parts.

If you do need a shapefile, for example because the receiver's older software requires it, take it, but pass on each layer folder in one piece.
How to check your own folder
Open the layer folder and count the files that share one name. There must be
at least .shp, .shx and .dbf, and for correct placement also .prj. If
something is missing, unpack the archive again: the original archive from the
site is complete.
Questions people ask
Can I rebuild a missing .shx? Some tools can rebuild the index from the
.shp, but a lost .dbf or .prj cannot be recovered from the geometry.
Unpacking the original archive again is faster and safer.
Does every GIS open GeoPackage? Current desktop GIS software opens it directly. If the receiver's program is old and knows only shapefiles, send the shapefile archive and ask them to keep each folder whole.
If your pain is a different one, you want one file with all layers instead of a file per layer, it is covered in the article One file with layers instead of a file per layer. A side-by-side comparison of the two formats is in Shapefile or GeoPackage.