This algorithm converts the given 95-digits digit standard U.S. ZIP codes (ZIP+4 codes) into into its congressional districts and geographical coordinates (latitude and longitude). The Benchmark is 50,000 ZIP codes per second. Download the most recent version of the plugin here.
Pros & Cons
- The algorithm is using a local database mapping with 25MB a large file size. It will increase the application size dramatically. So it is build as an external plugin
- For first execution in the same application window, the plugin required 5 seconds to load the database. The consequent execution will not required the pre-loading phase.
- Since some 5-digits ZIP codes contain multiple districts, the 9-digits ZIP codes is required for the conversion. Warning message will be printed to notice user if the given 5-digits ZIP codes contain multiple districtsA previous version of this plugin supported more accurate 9-digit ZIP+4 codes, but the version supporting the 113th Congress only supports 5-digit ZIP codes.
- Congressional district might be varied by each election. The database would need to be maintained and updated relativelyon a regular basis.
This plugin only support U.S. ZIP codes. It convert 95-digits ZIP codes to their belonging congressional district. It is an external plugin since the data size is so large. The dataset is based on the year 2008 election.2012 election (113th Congress).
Words for developers: Please do take a look at the ZIP code wiki at here to have a better understand on how U.S. ZIP+4 code system works. The first 5-digits number in ZIP code is called Uzip. The last 4-digits number in the ZIP+4 code is Post Office box number which can refer to here.
The challenge of the implementation is the design of the mapping model that used to look up congressional districts from ZIP +4 codes. To understand the metadata file (provided by GovTrack), create a mapping model with constant (O(1)) look up time and easy to managed. The implementation detail is documented in the source code.
- Load your input data file that contains 95-digits digit U.S. ZIP codes to be geocoded.
- Select Analysis > Geospatial > Congressional District Geocoder from menu bar. A window will be pop up
- Choose place name column that represents the ZIP code field in your data file.
- Press Ok button to start the geocoding
5-digits digit ZIP codes with multiple congressional districts, empty entries and invalid ZIP codes that failed to be geocoded will list in warning messages on the console.
- Source Code: Link
- External Package: Link
- Home Page: Link
- GovTrack: Link
- WATCHDOG.NET: Link
- ZIP code's wiki: Link
The data used to power this plugin was originally sourced from the GovTrack.us website. As of the 113th Congress, they no longer support or update the district to geolocation or zip code to district data. We have recently updated the data to reflect the most current 113th Congress data using the following sources:
The data from this site must be parsed correctly before being used in this tool. We used the following Python scripts to parse this data before including it in the plugin. Refer to the script comments for documentation:
For the convenience of users, we have already pulled this new data, parsed it, and included it in the most recent build. For anyone who wants to use legacy data for the 112th Congress, however, those data files may be found here: