MacHu-GWU / uszipcode-project

USA zipcode programmable database, includes up-to-date census and geometry information.
MIT License
231 stars 49 forks source link

zipcodes that don't return lat and lon data when using search.by_zipcode #12

Closed derekep closed 6 years ago

derekep commented 6 years ago

I went through a debugging process in an attempt to determine where the issue might lie, but was unable to find it myself. We ran several thousand zipcodes through the search.by_zipcode function and a good number of them did not return any latitude and longitude data. (2701 returned the data and 1648 did not) I googled the first few zipcodes for which the data was not returned to ensure they were valid US zip codes and they were. I have provided a csv file with the 1648 zip codes that did not work. If you can determine why some zip codes work with this function while others don't, it would be much appreciated. I've also provided a short python script showing how we are utilizing the package so you can be sure it is not a problem with the code on our end. Also provided is a csv with ALL the zipcodes we have been testing to write into the script. uszipcode issue.zip

Thanks!

-Derek Prestwich (BYU Prism Lab)

derekep commented 6 years ago

Also, I just opened up the database associated with this package and it contains the zipcode (or for sure the first few zip codes) that we are having trouble with.

MacHu-GWU commented 6 years ago

Let's take the first 5 problem zipcode in your file as example:

,zip,lat,lon
0,49560,,
1,48874,,
5,48870,,
26,48552,,
27,48551,,

Conclusion

Just a friendly suggestion, this is not good pattern in Python:

for i in range(len(zipcodes)):
    result = search.by_zipcode(str(zipcodes[i]))

Use this instead:

for z in zipcodes:
    result = search.by_zipcode(z) # you don't have to stringlize it and zfill it, ``uszipcode`` automatically handle it.

Thank you for your bug report.

MacHu-GWU commented 6 years ago

https://github.com/MacHu-GWU/uszipcode-project/issues/13 is fixed in v0.2.2