Learn

How Can You Tell Whether Latitude and Longitude Were Reversed?

Diagnose reversed latitude and longitude by combining range checks, expected extents, known control locations, format conventions, and tests that preserve the original data.

Geobble
introductoryexplainerCoordinates & Uncertainty

Provide a diagnostic troubleshooting article for suspected latitude/longitude reversals, separating axis-order mistakes from sign, CRS, unit, and source-data problems.

How Can You Tell Whether Latitude and Longitude Were Reversed?

A latitude-longitude reversal is easiest to detect when one value falls outside the valid latitude range. If a supposed latitude contains 120, it cannot be latitude because geographic latitude must lie between -90 and +90 degrees. In that case, coordinate order is an obvious suspect.

Many reversals are harder because a pair such as 9.7, 4.1 is numerically valid in either order, and both interpretations can even land on plausible-looking geography. When that happens, you need to combine numeric ranges with the expected extent, known locations and the convention of the format or API that produced the data.

The key is to diagnose the convention before swapping anything.

First question: does the numeric range make one order impossible?

For ordinary geographic longitude and latitude:

latitude  -> -90 to +90
longitude -> -180 to +180

Suppose a row contains:

120.5, 14.6

If the first column has been labelled latitude, the label cannot be correct: 120.5 is outside the latitude range. The values are much more plausibly longitude 120.5, latitude 14.6.

Now consider:

9.7, 4.1

Both numbers fall within -90 to +90, so either could be latitude. A range check cannot resolve the order.

This is why automated rules that simply say "swap values when latitude is above 90" detect only a subset of reversals. They can identify impossible latitudes, but they cannot prove that every numerically plausible pair is ordered correctly.

Check the full extent, not just one row

Calculate the minimum and maximum of both coordinate columns. A dataset often contains enough geographic variation for the overall bounding box to expose the intended order even when individual rows are ambiguous.

For example, data expected in Cameroon should occupy a recognisable latitude and longitude range. Swapping the columns might place some individual points on land, but the complete distribution can extend into an implausible region or have an obviously wrong shape.

Compare both candidate interpretations:

Interpretation A: column 1 = latitude, column 2 = longitude
Interpretation B: column 1 = longitude, column 2 = latitude

Then ask which one matches the expected study area.

Do not rely on visual memory alone. A country boundary, authoritative reference layer or known extent is stronger evidence than "the points look about right".

Use known control locations

If several records refer to places whose positions are already known, test them under both interpretations.

A useful control does not need survey precision: if a row names Douala, Nairobi or Paris, the candidate coordinate should at least land in the expected city or region. Several known records spread across the dataset are better than one convenient example.

Why several? Because some coordinate pairs remain plausible after reversal. A value pair containing two small positive numbers can move to another plausible region rather than to an ocean or invalid latitude.

The goal is to show that one interpretation consistently explains the data, not to find one record that happens to look convincing.

Read the format and API convention

The strongest evidence may already be in the source specification.

GeoJSON, for example, requires longitude first and latitude second. If a valid GeoJSON position appears as [12, 4], the first number is longitude and the second is latitude by definition of the format.

Human-facing forms frequently use the opposite order because people commonly say "latitude and longitude". Formal CRS axis definitions can add another layer: EPSG:4326 has latitude-longitude axis order even though many software formats use longitude-latitude.

The canonical guide Latitude vs Longitude: Which Comes First? explains those conventions in detail. For diagnosis, the practical lesson is simple: read the contract of the representation before treating column position as evidence.

Do not confuse an axis-order problem with a CRS problem

A layer in the wrong place does not automatically mean latitude and longitude were swapped.

Similar symptoms can come from:

  • geographic degrees interpreted as projected metres;

  • a projected CRS assigned to data from another CRS;

  • a missing or wrong datum transformation;

  • a lost negative sign;

  • degrees-minutes-seconds text interpreted as decimal degrees;

  • decimal separators parsed incorrectly;

  • corrupt or incomplete source coordinates.

The numeric scale often helps separate these cases. Values such as 500000, 4500000 are not plausible longitude and latitude in degrees at all. Swapping them will not solve the underlying problem.

Likewise, if the point appears in the correct latitude but on the wrong side of the prime meridian, a lost minus sign may be more likely than reversed axes. Why Are Some Coordinates Negative? covers that symptom.

Plot both interpretations without overwriting the source

When the evidence remains ambiguous, create two temporary interpretations.

Keep the original fields untouched and create candidate coordinates such as:

candidate_A = (column_1 as longitude, column_2 as latitude)
candidate_B = (column_2 as longitude, column_1 as latitude)

Plot a representative sample against a known reference layer. Inspect both the overall distribution and individual control locations.

Because this preserves the starting state, it is safer than swapping the source columns immediately. If neither interpretation works, you can continue diagnosing the CRS, signs, units or source format without having to reconstruct what the original data looked like.

A plausible map is not enough evidence

One of the more dangerous reversal cases occurs when both orders produce believable points.

Imagine data concentrated around longitude 5 to 12 degrees east and latitude 3 to 10 degrees north. Swapping the axes still produces values that are globally valid, and many may remain on the African continent. A quick visual inspection at a small scale can therefore fail to reveal the mistake.

Look for stronger evidence:

  • Do named places align with the correct administrative areas?

  • Does the dataset's shape match the expected corridor, coastline or region?

  • Do distances between known locations make sense?

  • Does the source schema explicitly name the fields?

  • Do all records follow the same convention, or only some of them?

The last question matters. Mixed-source spreadsheets can contain one group exported as latitude-longitude and another as longitude-latitude. A blanket swap can fix half the table and break the other half.

A diagnostic table

Observation · What it suggests · What to check next

  • Supposed latitude exceeds ±90° — Current order is impossible for normal latitude/longitude — Test whether the fields are reversed or whether the data is projected

  • Both fields stay within ±90° — Range check cannot resolve order — Compare expected extent and known locations

  • Swapping all rows moves the dataset into the expected region — Reversal is plausible — Verify the source format and several control points

  • Only some rows look reversed — Mixed import or row-level source problem — Trace provenance by row; do not swap the whole table

  • Neither order produces a plausible extent — Problem may not be reversal — Check CRS, units, sign convention and source integrity

  • Coordinates are around hundreds of thousands or millions — Probably not decimal-degree latitude/longitude — Identify the projected or local CRS before changing fields

The last two cases are important. “Points are in the wrong place” does not uniquely diagnose latitude-longitude reversal.

Verify the correction across the dataset

Once one interpretation is supported, do more than confirm that the map now "looks right".

Recalculate the extent. Check several known locations across the study area. Inspect outliers. Confirm that all rows follow the same order. Record the convention in field names or metadata so the ambiguity does not return at the next export.

If the columns were generic x and y, consider renaming validated geographic fields to longitude and latitude, or to similarly explicit names that include units. If the coordinates are actually projected, use easting/northing terminology instead. X and Y vs Latitude and Longitude explains why that distinction matters.

The correct diagnosis is not "the swapped version looks better". It is: the value ranges, format convention, expected extent and known locations all support this axis interpretation.

That evidence is what makes the correction defensible.

References

  1. IETF RFC 7946 - The GeoJSON Format. Defines GeoJSON positions in longitude-latitude order for geographic coordinates.

  2. PROJ FAQ - Why is the axis ordering in PROJ not consistent?. Explains why formal CRS axis order and common GIS/software conventions can differ.

Related content

How Can You Tell Whether Latitude and Longitude Were Reversed? | Geobble