问题
I've got a database of addresses provided by users. In some cases, the user only entered a zip code that, for a time, we thought would be adequate for our purposes. Now we know that a zip code doesn't cut it and we need an actual address.
So, we're looking to convert the zip codes to an address that's close enough to that location, and then letting the users know what we did so they can go in and change those addresses if need be.
Does anyone know of anything that can provide the data I'm looking for?
回答1:
I was a developer at SmartyStreets (I have a lot of experience with street addresses).
Unfortunately, ZIP codes cannot be converted into an address.
US addresses are identified (almost uniquely) by an 11-digit number (12 with the check digit) called a Delivery Point Barcode. The ZIP code is typically the first 5 digits of this code. The remaining 6 digits provide even more granularity to pinpoint the address. Note that this does not pinpoint an address geographically, but only logically, according to the USPS' address assignment system. (They assign ZIP codes and addresses based on what makes the most sense for administration and delivery.) Without those other digits, accurate interpolation is highly, highly unlikely.
Trying to resolve an address from a ZIP code is like trying to scale a 100px bitmap into a 100,000px image, depending on the ZIP code.
Technical unfeasibility aside, I would advise against finding an address then asking users to correct it. From a UX and DBA perspective, why not simply ask your users to fill in the correct address? If you try to guess the address instead, users will be confused, and the database admins will probably lose track of which addresses are bogus and which ones were corrected. In other words, your data will lie to you.
You'd probably rather have incomplete data and know it than having incorrect data and not know it.
Even if users don't fill out their address, you can, with some more reasonable certainty, assume a city and state from the ZIP code. SmartyStreets has an API for that. At least in this way you'd have an approximate coordinate and city/state, instead of completely wrong address data. The chances of guessing correctly are tens of thousands to one.
来源:https://stackoverflow.com/questions/22774588/im-trying-to-convert-a-zip-code-to-an-address-that-resides-roughly-at-the-cente