A newsroom's graphics desk uses the Natural Earth populated-places file as its gazetteer, reading the `lat_attr` / `lon_attr` columns into a spreadsheet because that is easier than reading geometry. A correspondent noticed that the dot for Muscat lands in the sea. Before the desk decides whether to switch to the geometry, it wants the size of the problem: how many places disagree, by how much, and whether anything else in the file is untrustworthy.
Audit the file against itself. For every place, measure the great-circle distance between its geometry and the point at (lon_attr, lat_attr). Then report:
places_over_2km — places where the two disagree by more than 2 kmplaces_over_10km — by more than 10 kmworst_offset_km — the largest disagreement, km, one decimalworst_place — the name of that placeduplicate_name_country_pairs — how many (country, name) combinations occur more than onceThe desk's spreadsheet keys places by country and name, so a duplicate pair is a row it cannot tell apart — a different kind of defect from a wrong coordinate, and in the same file.
These are where the teaching is. Read them twice.
Every reference gazetteer carries coordinates as attributes somewhere in its lineage, and auditing the attribute against the geometry is the first check before a newsroom, a logistics firm or a census office adopts it.
Work the problem in whatever tool you like, then enter the answers here.
places_over_2kmplaces_over_10kmworst_offset_kmworst_placeduplicate_name_country_pairs5 scored, 0 informational
Places whose attributes and geometry disagree by more than 2 km
30%Places disagreeing by more than 10 km
20%The largest disagreement
20%Which place it is
10%Country-and-name pairs that are not unique
20%