list of all US cities and counties

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
I need a list of every city + county in the US for a database at work. I'm having a hell of a time finding such a thing, which is surprising.

This API generates XML with what appears to be most of what I need, but it isn't clear if the output is complete. I don't care to have links to government websites which, unfortunately, seems to be the whole point of the API.

I also found this google API, but its output format is stupid. You can only pick city or county, not both.

Does anyone know of a maintained list or database of US cities and counties?
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
Your first link links to this, which has cities ("populated places") with a county column. From the description I'd expect it to be complete.

http://geonames.usgs.gov/

Thanks. This is definitely a good start. After looking through it, though, I already see a big problem that I'm not sure how to fix yet. The city of Dallas is in several counties, but the file I downloaded only lists Dallas County. I know the city of Dallas is also in Denton, Collin, and Kaufman counties.

I'm probably going to use this list as my base and add as I go, but that's really tedious. I'm shocked there isn't a readily available, reliable source for this information.
 

veri745

Golden Member
Oct 11, 2007
1,163
4
81
Would you want multiple entries for Dallas, one for each county that it's in? That seems like it would be even worse. You'd end up with multiple entries for most major cities that way, which would be super confusing.
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
Would you want multiple entries for Dallas, one for each county that it's in? That seems like it would be even worse. You'd end up with multiple entries for most major cities that way, which would be super confusing.

The way the input is structured is State -> City -> County. The downstream data is queried depending on the selection of the upstream data. If I pick TX, I would expect to see Dallas in the list of cities. If I pick Dallas, I would expect to see Collin, Dallas, Denton, and Kaufman as choices for county. Does that make sense?

The database would look like this:

Code:
STATE   CITY    COUNTY  ...
------- ------- ------- -------
TEXAS   DALLAS  COLLIN
TEXAS   DALLAS  DALLAS
TEXAS   DALLAS  DENTON
TEXAS   DALLAS  KAUFMAN
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
We use the Geonames database at work. It has some peculiarities, and be advised that "populated places" (code PPL) doesn't always mean the same thing as "cities and towns."
 

fuzzybabybunny

Moderator<br>Digital & Video Cameras
Moderator
Jan 2, 2006
10,455
35
91
To add on to this, can anyone recommend a good zip code database?