For some cities and for countries distance between cities are wrong. How can I fix them?
For information the script uses the Geonames databases (their most structured databases) and the Orthodromy formula (1) (one of the two existing distance calculation formulas), the second being Haversine formula (2).
(1) Orthodromy: an orthodromic or great-circle route on the Earth's surface is the shortest possible real way between any two points.
(2) The haversine formula: an equation important in navigation, giving great-circle distances between two points on a sphere from their longitudes and latitudes.
For some cities and for some countries the Geonames longitude and latitude fields are not accurate (or are wrong), so the calculated distances can be also wrong.
Why use the Orthodromy instead of the Haversine formula?
After many tests we don't recommend the haversine formula usage for many reasons. Especially, the percentage of valid distances is higher with the formula "orthodromy" than with the formula "haversine". And that is without appeal.
To solve the distance accurate issue you have to update the cities longitude and latitude fields from the Admin panel.
We hope to have a high percentage of valid geographical coordinates from Geonames soon.