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.

  • 1
    NGA also has a GeoNames database, so you should probably specify that you're using geonames.org data. – Vince Oct 22 '14 at 13:26
  • 1
    Have you considered doing some post-cleanup on the "too complete" dataset? That process can be done in many ways (both spatial and tabular). Both would work best via some scripting like Python. Spatially you could use census data to select the cities that all fall within the same metro area (such as Portland), and find their mean center. This would "cleanup" some of extra cities you are seeing. Tabular you could loop through the names and create a compare conditional statement to find records that are "close" to each other. From there you can decide what stays and what goes. – evv_gis Oct 22 '14 at 13:32
  • 1
    Your question title says 'in the world' but examples are US-based. You also mention 'delivering a letter' which makes me think a Zip database with a city attribute and processing down the dupes, but obviously that wouldn't work for 'the world'. As for GeoNames, there are different codes from PPL such as PPLS - have you looked at those to see if one would get what you're after? By use of ADMD I'm guessing you're aware of them. Prefixes and suffixes like 'City/Town of' or x 'Village' are often dropped in most uses, but they're still part of the name. – Chris W Oct 22 '14 at 20:12
  • 1
    I'm actually using the post code dumps from Geonames for the US. I used the US in my examples, because it's the only part of the world I know well. However, I do know that other areas don't use postal codes (e.g., Ireland), but I want them in the database as well. I am trying to get an understanding of the codes, and how to use them to extract what I want. I think I will go with the suggestion to use the data as a basis, and clean it up. – Franz Kafka Oct 22 '14 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.