You load a shapefile and your data shows up in the ocean, in the wrong country, or just slightly off the road it should sit on. The data is almost never "broken". It is a coordinate system problem, and the good news is that the distance your data is off by usually tells you which problem it is.
First, the one idea that fixes most cases
Every coordinate is just a pair of numbers. The coordinate reference system (CRS) tells software what those numbers mean: degrees of latitude and longitude, metres in a UTM zone, metres in Web Mercator, and so on.
A shapefile stores that information in its .prj file. If the .prj is missing, or wrong, your GIS has to guess, and a wrong guess moves your data.
Diagnose it by distance
Measure roughly how far your data is from where it should be, then check this table:
| How far off | Most likely cause |
|---|---|
| A few metres to a few hundred metres | Wrong datum (e.g. an old local datum treated as WGS 84) |
| Roughly 500–700 km east or west | Wrong UTM zone |
| About 10,000 km north or south | Wrong hemisphere (UTM north vs south) |
| A different continent, or the Arctic | Latitude and longitude swapped |
| A tiny dot near 0°, 0° in the Atlantic | Missing coordinates, or degrees read as metres |
| Nowhere at all / "zoom to layer" goes somewhere strange | Metres read as degrees |
Latitude and longitude swapped
Delhi is at about 28.6° N, 77.2° E. Swap the two and you get 77.2° N, 28.6° E, which is up near Svalbard in the Arctic. If your points land on the wrong continent, check the axis order first. This happens a lot with CSV files and some APIs that expect lon, lat instead of lat, lon.
Degrees read as metres (or the other way round)
If data in degrees is labelled as a projected CRS, a value like 77.2 is treated as 77.2 metres. Your whole dataset collapses into a tiny cluster near the origin of the projection.
If data in metres is labelled as WGS 84, a value like 712345 is far outside the valid range for degrees, so the layer seems to disappear.
Wrong UTM zone or hemisphere
UTM splits the world into 6°-wide zones. Using the neighbouring zone shifts everything sideways by one zone width, which is several hundred kilometres. Using the southern hemisphere instead of the northern adds a 10,000 km false northing, so data jumps by roughly a quarter of the planet.
Wrong datum
This is the sneaky one. Everything looks almost right, but buildings are a bit off their footprints or roads are offset from the satellite image. Older local datums can differ from WGS 84 by tens to hundreds of metres.
Assign vs reproject: don't mix them up
This is where most fixes go wrong.
-
Assign (define) a CRS when the
.prjis missing or wrong. It changes the label, not the numbers. - Reproject (transform) when the label is already correct and you want the data in a different CRS. It changes the numbers.
If your data is in the wrong place, you almost always need to assign the correct CRS. Reprojecting data that has the wrong label just moves the mistake somewhere else.
In QGIS:
- Assign: Layer Properties → Source → Assigned Coordinate Reference System
- Reproject: right-click the layer → Export → Save Features As → choose a new CRS
With GDAL's ogr2ogr:
# Assign a CRS (fix the label only)
ogr2ogr -a_srs EPSG:32643 fixed.shp input.shp
# Reproject from UTM 43N to WGS 84 (change the coordinates)
ogr2ogr -s_srs EPSG:32643 -t_srs EPSG:4326 output.shp input.shp
Quick checklist
- Is there a
.prjfile next to the.shp? If not, find out the real CRS from whoever made the data. - Look at a few raw coordinate values. Numbers under 180 are probably degrees; six- or seven-digit numbers are probably metres.
- Measure how far off the data is and use the table above.
- Assign the correct CRS, then reproject only if you need a different output CRS.
I wrote a longer version of this, with more examples, on my site: Why your shapefile shows up in the wrong place.
If you just need GeoJSON, I also built a free Shapefile to GeoJSON converter that reads the .prj and reprojects to WGS 84 automatically. It runs in your browser.
What's the strangest place your data has ever ended up? 🌍
Top comments (0)