The Layer Is Empty but the Table Is Full: Broken Geometry With No Warning

2026-11-245 min read
ShapefileGeoJSON

This is a walk through one pain that GIS users describe on forums again and again. There are no names here, only what goes wrong, why it is so hard to notice, and what a recount of the exports the site produces has shown. If your objects are in the attribute table but not on the map, this article is about you.

What hurts

Someone receives a Shapefile set. All five files are there, the dates are fresh, and the layer opens without a single error. The attribute table is full: names, types, addresses. Yet part of the objects is missing from the map. They are not shifted and not hidden under another layer; they are simply not there. The row exists in the table, but it has no shape.

A second person had it even worse. A layer that weighed megabytes the day before "became empty and weighs 1 KB". The table was still in place, and again the program said nothing. No error window, no warning in the log, no signal of any kind. You only find out when someone counts the buildings on the printed sheet and the number does not match the table.

Why it happens

A Shapefile is not one file but a bundle. The shapes live in .shp, their index in .shx, and the attributes in .dbf. The only link between them is the record number. The format allows a record with an empty shape, the "Null Shape" type, which has no points at all. For a program this is a legal record, so it reads it quietly: there is a row in the table and nothing to draw. That is why no warning appears.

Where do empty shapes come from? Most often from a failure on the way: a clip or a reprojection could not handle a shape and returned nothing, and the exporting program wrote the attribute row anyway. A layer that "weighs 1 KB" is the extreme case of the same thing: the .shp kept only its header while the .dbf stayed full.

In GeoJSON the same defect looks like "geometry": null. The file is still valid JSON and every receiver will open it; the object simply will not appear on the map.

What we checked in our own exports

We took two orders of different size, in Shapefile and GeoJSON, and recounted them by hand instead of trusting any program's word. The result:

  • 2,250 shapes against 2,250 records in the .dbf in the first order;
  • 7,869 against 7,869 in the second;
  • empty shapes: 0; records with every attribute empty: 0;
  • geometry: null in GeoJSON: 0;
  • share of broken objects: 0.00 %.

Diagram from the measurement: on the left, what the failure looks like, 12 rows in the table and 7 shapes on the map; on the right, our exports, 2,250 shapes for 2,250 records and 7,869 for 7,869, zero empty, 0.00 % broken; the block is schematic

This is not luck. The site clips data to the order frame, and if a shape turns out empty after the clip, it does not write it at all, together with its attribute row. So the file never keeps a ghost record: it holds either the whole object, shape and attributes, or nothing. If GEOS cannot handle a particular shape even after a repair, that one shape is dropped and the loss is written to the order log as a warning; the layer does not go empty.

How to check your own layer in a minute

Only a recount catches an empty geometry. You cannot see it on the map, and programs stay silent about it. Three checks are enough.

Diagram from the measurement: three checks, .shx records against .dbf rows, Null Shape records, geometry: null in GeoJSON, and their result on our orders

  1. Record count. The size of the .shx file minus its 100-byte header, divided by 8, is the number of shape records. It must match the number of rows in the .dbf. If it does not, the set is out of sync, and many programs will refuse to open the whole layer.
  2. Empty shapes. The GDAL command ogrinfo -dialect sqlite -sql "SELECT COUNT(*) FROM layer WHERE GEOMETRY IS NULL" layer.shp counts records without a shape. The answer must be 0.
  3. GeoJSON. Search the file for "geometry": null with any editor or with grep -c. That must give 0 as well.

If the .shp weighs about a hundred bytes while the .dbf weighs megabytes, the layer is empty, however complete the table looks. Do not try to fix such a file with a "repair geometry" tool in QGIS: there is nothing to repair, because the shapes are simply not there. You need a fresh export.

What we did NOT check

We recounted two orders, not every order the site has produced. We did not have the third-party exports this pain came from; we describe them from people's accounts. If you ever find a record without a shape in one of our files, send us the layer and we will look into it.

Questions people ask

Will QGIS warn me about empty shapes? Not by default. The layer opens and the rows are visible in the table. The Check Validity tool reports invalid shapes, but a Null Shape is not invalid, it is empty, so it often passes without a word.

Is GeoPackage safer? It keeps everything in one file, so the shapes and the table cannot drift apart. A row with a null geometry is still possible, though, and the same IS NULL query finds it.

Make the same map Order a custom map

← All articles