Closed derekep closed 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.
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,,
by_zipcode()
method only returns standard zipcode, but all of other query method have a zipcode_type=xxx
optional parameters to specify the zipcode type you want to return (set None to return any). This should be considered as a bug, because we should expect by_zipcode()
function returns any type.Conclusion
For most of zipcode, if you can't find lat, lng, but it exists in my database, and Google Map has records, mostly it is a Unique, or PO Box zipcode. I checked another zipcode project https://pypi.org/project/zipcodes/, it is using a subset of uszipcode
database, so that project doesn't have it either. I am going to use Google GeoCoding API to update lat, lng info for most of Unique, and PO Box zipcode later. If you really need it urgently and you only need lat, lng, please take a look at another my project https://github.com/MacHu-GWU/apipool-project, it is a project to use multiple API KEY to make API call, so you can just apply many google API Key, and do the lat, lng query. I personally use this library to get my uszipcode
database up-to-date.
I will issue a new HOT FIX release soon for this bug: by_zipcode
only return standard zipcode.
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.
https://github.com/MacHu-GWU/uszipcode-project/issues/13 is fixed in v0.2.2
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)