Swapped Latitude and Longitude Sends Points to the Wrong Side of the World
KML writes every position as longitude first, then latitude: 34.78,32.08 is a point in Tel Aviv. Most people say coordinates the other way round, “latitude, longitude”, because that’s how maps and phones show them. So when somebody types a few points into a KML file by hand, or a script builds one from a spreadsheet with the columns in the wrong order, the numbers go in backwards.
The file is still valid. Every number is in range. It opens without an error. And every point lands somewhere else entirely: 32.08,34.78 read as longitude 32.08, latitude 34.78 is in the sea just off the west coast of Cyprus. Swap the numbers for Zurich and you get a point in the Horn of Africa.
When a Swap Is Certain
Often a swap can’t be proven. Both orders give a real place, just not the right one. But there’s one case where the file itself gives it away: a latitude can never be more than 90 or less than -90. If every point in a placemark has a first value inside ±90 and a second value outside it, the second number can’t be a latitude, so the two were written in the wrong order.
iKML checks exactly that, placemark by placemark, and reports swapped-latlon only when it holds for every point. Here a delivery company’s depot list came from a spreadsheet export:
$ ikml check plots.kml
plots.kml (kml, 588 bytes)
ERROR swapped-latlon
Every placemark in the file (3) has latitude and longitude in the wrong
order: the first value of each point is within ±90 and the second is
outside it. A swapped point lands on the far side of the world.
1 error(s), 0 warning(s), 0 note(s).

Fixing It, on Purpose
ikml clean doesn’t swap anything by default, because moving data across the world on a guess is the one fix you’d never want to happen by accident. Ask for it:
$ ikml clean plots.kml plots-fixed.kml --fix-swapped --report
Cleaned plots.kml (kml) to plots-fixed.kml (kml, 586 bytes).
Changes (3):
swapped-latlon Swapped longitude and latitude back into the right order.
at Placemark 'Depot North' (line 5)
swapped-latlon Swapped longitude and latitude back into the right order.
at Placemark 'Depot South' (line 9)
swapped-latlon Swapped longitude and latitude back into the right order.
at Placemark 'Supply line' (line 13)
Nothing is lost converting kml to kml.
Before: 1 error(s), 0 warning(s). After: 0 error(s), 0 warning(s).
Every swapped point is listed with its placemark and line. The cleaned file checks clean, and the original is untouched.
The Swaps It Can’t See
Wherever the longitude is within ±90, which covers Europe, Africa and most of Asia, a swapped pair is still a valid pair: 2.35,48.86 (Paris) swapped is a point in the Indian Ocean off Somalia, perfectly legal. iKML can’t call that wrong from the numbers alone, so it doesn’t. What helps there is the preview in the inspector: when the points of a file about Paris show up as a dot in the sea, you know.