I have a database of many tens of thousands of events that occurred at specific geographic locations within the United States. The data include x,y coordinates for each event, encoded using the NAD83 reference system. I want to write or use an algorithm to reliably get the US zip code associated with each NAD83 x,y coordinate.
I do not yet have zip code definitions using the NAD83 reference system. And I have never done this kind of programming before. But it just seems like it would be intuitively simple to find out whether a given x,y coordinate is located within a geometric shape of a US zip code defined using the same NAD83 reference system.
I am interested in the following:
- Where do I get reliable US Zip Code definitions in the NAD83 reference system format?
- Where can I find example code for an algorithm to find the zip code given an x,y coordinate?
I am interested in any links to instructional articles/tutorials, example code, and NAD83 zip code boundary definition data. I am doing web searches, but I figured that people on this site might be able to give me more of an expert's guide.
If the code you provide is not written in Java, I could take code written in another language and adapt it to Java for my purposes. I do not have database software installed in my computer because I just use csv or text files as inputs into my Java applications. If you have some database that you suggest I use, I would need links to instructions for how to get the data into a format that I can import into a programming language such as Java.
Finally, the street addresses in my dataset do not include zip codes, and the street addresses are written haphazardly, so that it would be very difficult to try to clean the address data up enough to try to get zip codes from the addresses. I can isolate the data to several adjacent cities, in perhaps a couple hundred zip codes, but I think that the NAD83 x,y coordinates are my best shot at deriving the zip code in which each event in my dataset occurred. I want to link my resulting zip code by zip code analyses with other data that I get about each zip code from sources like the US Census, etc.