So, I've been working with Geonames data dumps, but I am finding that they are either not complete enough (cities > 1,000 population), or too complete. Here's an example of being too complete:
damaya@deepthought:~/Downloads$ grep Portland allCountries.txt | grep OR | grep PPL 5724937 East Portland East Portland 45.5154 -122.66037 P PPL US OR 051 0 17 20 America/Los_Angeles 2006-01-15 5743422 North Portland North Portland 45.61039 -122.70343 P PPL US OR 051 0 5 13 America/Los_Angeles 2006-01-15 5746545 Portland Portland Gorad Portlend,PDX,Portland,Portland i Oregon,Portlandas,Portlandia,Portlando,Portlant,Portlend,Portlenda,bo te lan,bwrtland awryghwn,port land,portalainda,portalanda,portlant,portlendi,poteullaendeu,potorando,pwrtlnd,pwrtlnd awrgn,Πόρτλαντ,Горад Портленд,Портланд,Портленд,Պորտլենդ,פורטלנד,بورتلاند، أوريغون,پورتلند، اورگن,पोर्टलंड,पोर्टलैंड,போர்ட்லன்ட்,పోర్ట్ లాండ్,ಪೋರ್ಟ್ಲ್ಯಾಂಡ್,พอร์ตแลนด์,პორტლენდი,ფორთლენდი,ポートランド,波特蘭,포틀랜드 45.52345 -122.67621 P PPLA2 US OR 051 583776 12 15 America/Los_Angeles 2011-05-14 5746560 Portland Heights Portland Heights 45.50567 -122.70315 P PPL US OR 051 0 220 226 America/Los_Angeles 2006-01-15 5753495 South Portland (historical) South Portland (historical) 45.48762 -122.6826 P PPLQ US OR 051 0 87 96 America/Los_Angeles 2011-12-11 5760038 West Portland West Portland 45.45484 -122.7326 P PPL US OR 051 0 185 187 America/Los_Angeles 2006-01-15 5760039 West Portland Park West Portland Park 45.44679 -122.72565 P PPL US OR 051 0 197 200 America/Los_Angeles 2006-01-15
Now, I live in Portland and I don't know a single person who considers East Portland a different location than Portland. I need something that covers a town as small as Napakiak, AK, but doesn't break things down to such a level that you end up with all of these Portlands. Is there any way to extract from Geonames just the towns and cities that would be written on a letter delivered via post (i.e., nobody would send a letter to East Portland, OR, but someone would send a letter to Napakiak, AK). The problem here is that Napakiak is a PPL, but so too is East Portland. Does Geonames have any designation saying the place is (I don't know the term here) something you'd find on a delivered letter?
Another example of an issue here is Gaston, OR. Here's what it looks like in allCountries.txt:
7173478 City of Gaston City of Gaston 45.43566 -123.14372 A ADMD US OR 067 637 81 78 America/Los_Angeles 2013-03-08
The thing is, I don't know anyone who refers to it as "City of Gaston," and it's not even a PPL, it's an ADMD. I just want Gaston, OR; Portland, OR; Milwaukie, OR; Lima, MT (pop 221); Napakiak, AK, and so on.
EDIT: I am using data from geonames.org.