I've got about 300,000 lat/lng coordinates of events that I'm combining into a large map. The coordinates come from all over the world.
For each point, I want to find the nearest city of at least XYZ residents. I've written a Node script that uses the geoNames database of world cities and does all the calculations.
It all works fine but for the fact that there seems to be a far amount of overlap in some of these cities. For example, cities15000.txt
lists both "North Atlanta" and "Atlanta," and there is both a "Manhattan" and a "New York City."
I was hoping I could limit the search to the highest level in the city hierarchy using geoNames' feature codes, but the documentation is not terribly clear. North Atlanta is "PPL" (populated place), Atlanta is PPLA (seat of a first-order administrative division). I thought I could limit to PPLA, but Baltimore is PPLA2 (seat of a second-order administrative division). There does not appear to be anything near Baltimore (say, "City of Baltimore" or something) that I'm missing.
Where do these codes come from? Is there a way to eliminate subsections of cities? I also don't mind using a different source, though I do find the geoNames data clean and easy to manipulate.