codefornola / 211-data-wrangling

A project to help cleanup 211 data from multiple sources
0 stars 2 forks source link

Enhance zipcode geocoding #4

Open mrcnc opened 4 years ago

mrcnc commented 4 years ago

Currently the uszipcode library does not return lat/lng coordinates for certain zip codes.

>>> from uszipcode import SearchEngine
>>> search = SearchEngine(simple_zipcode=True)
>>> zipcode = '70728'
>>> search.by_zipcode(int(zipcode))
SimpleZipcode(zipcode='70728', zipcode_type='PO Box', major_city='Duplessis', post_office_city=None, common_city_list=['Duplessis'], county='Ascension Parish', state='LA', lat=None, lng=None, timezone=None, radius_in_miles=None, area_code_list=['225'], population=None, population_density=None, land_area_in_sqmi=None, water_area_in_sqmi=None, housing_units=None, occupied_housing_units=None, median_home_value=None, median_household_income=None, bounds_west=None, bounds_east=None, bounds_north=None, bounds_south=None)

No ❤️ for Duplessis 😞

As a first step, let's enhance the script to ensure all the zip codes in Louisiana have a corresponding lat/lng.

mrcnc commented 4 years ago

It might be a good idea to first determine how many zip codes are actually missing....if it's only a few, maybe we can hardcode them. Otherwise maybe we need to look into using a geocoding service or other method to replace uszipcode

mrcnc commented 4 years ago

Let's use this mapping https://gist.github.com/mrcnc/5f8e36828d10caef6ebf2e6872adeba6