开发者

Data constraints in US state/county/city/zip database?

开发者 https://www.devze.com 2023-04-07 13:45 出处:网络
I have a database of US zip codes and their corresponding states, cities and counties. It was supplied as a flat file and I\'m trying to normalize the data and figure out exactly which entities depend

I have a database of US zip codes and their corresponding states, cities and counties. It was supplied as a flat file and I'm trying to normalize the data and figure out exactly which entities depend on which others.

One problem I've come across is that some cities seem to exist in more than one county. I was under the impression that in the US, there is a hierarchy of State -> County -> City -> Zi开发者_开发问答p.

However, this data seems to show otherwise for some cities:

Data constraints in US state/county/city/zip database?

Is my data set incorrect or is this actually a feature of US geography?


I am working with this same topic. I have learned that Virgina has cities that are not within a county. The city functions as both a city and county but in not within any county boundary. Also Alaska has no counties. Their equivilant is Boroughs, but the whole state is not divided into boroughs. Any area not within a borough is referred to as the "unorganized borough".


No, there isn't a clean hierarchy like that.

You're also liable to find cities that straddle state borders (cities in two states), and ZIP codes that take in more than one city. Not long ago, there were ZIP codes that straddled state borders, too. (ZIP codes are more about the route followed to deliver mail than about geography.) There might still be some.

As far as I know, no county is split between two states. But if there happened to be one, it wouldn't surprise me.

Depending on your application, you might discover even weirder things. I used to have to deal with addresses in the mountains that were "in" one county geographically, but were "in" a second county for emergency services (fire, police), and "in" yet a third county for non-emergency services (water, sewer, garbage collection). It depended on where the address was in relation to mountain ridges and roads.

0

精彩评论

暂无评论...
验证码 换一张
取 消