Fixing a Shapefile with a missing .prj — RICE
RICE Learn Tools Premium

Troubleshooting · 6 min read

Fixing a missing .prj

You open a Shapefile and it appears off the coast of West Africa, or as a tiny speck, or nowhere at all. Nine times out of ten the .prj file is missing and your software is guessing. Here is how to find out what it should have said.

What the .prj does

A Shapefile stores bare numbers. The .prj is a small text file that says what those numbers mean — degrees or metres, which datum, which projection. Without it, 604215, 7101833 could be a spot in Limpopo or a point in a completely different country. The geometry is fine; only the label is missing.

The symptoms

  • The layer sits near 0°, 0° in the Gulf of Guinea — sometimes called "Null Island". Usually projected metres being read as degrees, or empty coordinates.
  • The layer is far too big or off the map. Values of hundreds of thousands are being treated as degrees, which only go to 180.
  • The layer is right-shaped but shifted by tens to hundreds of metres. The projection is right but the datum is wrong — for example Cape datum instead of Hartebeesthoek94.
  • The layer is mirrored or rotated. Axis order is swapped, which is common with South African Lo data.

Step 1 — Ask, and look for clues

The fastest fix is an email to whoever sent the file. If that is not possible, look around it: a .xml metadata file with the same name, a PDF report, a readme, or a CAD drawing title block often names the system. Surveyors in South Africa will usually write something like "Lo29, Hartebeesthoek94".

Step 2 — Read the numbers

Open the attribute table or check the layer's extent. The size of the coordinates narrows things down quickly:

What you seeLikely system
X between −180 and 180, Y between −90 and 90Geographic degrees — almost always WGS 84 (EPSG:4326)
X from about 160,000 to 840,000, Y in the millionsUTM. In the southern hemisphere Y counts down from 10,000,000 at the equator, so South African values fall around 6.1 to 7.6 million
Y within about ±100,000, X around 2.4 to 3.9 million, sometimes negativeSouth African Lo system — Y is measured west from a central meridian, X south from the equator
X and Y both in the millions, with X around ±2 to 4 million in AfricaWeb Mercator (EPSG:3857)

For UTM you still need the zone. If you know roughly where the data is, the zone follows from longitude — in South Africa, zone 34S west of 24° E and 35S east of it. For Lo, the central meridian is the odd degree nearest the site: Lo27 for Pretoria and Johannesburg, Lo19 for Cape Town, Lo31 for Durban.

Step 3 — Assign, don't transform

This is the step that goes wrong most often. There are two different operations:

  • Assigning (or "defining") a coordinate system writes the missing label. The numbers stay exactly as they are.
  • Transforming (or "reprojecting") converts the numbers into a different system.

A file with no .prj needs assigning. If you reproject it instead, the software applies a conversion to numbers it has misunderstood, and the data moves somewhere new and equally wrong. Only once the correct label is in place should you reproject to the system you actually want.

Step 4 — Check against something you trust

Overlay the fixed layer on a basemap or a layer you know is right — a road network, cadastral boundaries, aerial imagery. Road centrelines should sit on the roads. An offset of 100 to 300 metres in South Africa usually points to data on the old Cape datum. An offset of exactly one UTM zone, about 600 to 700 km east or west, means the zone is wrong.

Stop it happening again

  • Always zip the .shp, .shx, .dbf, .prj and .cpg together.
  • Put the coordinate system in the file name or a readme — for example erven_Lo27_Hart94.zip.
  • For new work, prefer GeoPackage. It keeps the coordinate system inside the one file.
Try it
Let RICE spot it for you

Drop the zipped Shapefile into Convert or Reproject. RICE flags a missing .prj, reads the coordinate ranges and suggests likely systems, and lets you choose the source before anything is transformed.

Open Reproject
Keep reading What is GeoJSON? A practical guide KML vs Shapefile — which one to send EPSG:4326 vs EPSG:3857 — degrees, metres and the web map

Published by RICE, a LocalID Pty Ltd product. Questions or corrections: info@cartesiasa.com.