CREATE DATABASE project_name;
CREATE USER super_user WITH SUPERUSER PASSWORD 'password';
- Create a new file named .env
- Copy the contents of the .env.example file and paste them into the new .env file
- Replace the placeholder values in the .env file with the actual values for your local environment
- Save the changes made to the .env file, also make sure these environment variables names are not previously used for other purpose and set directly to avoid any possible collision
- You can use one of the two scripts to setup your postgis tiger database in your device, tiger_setup.py and download_script.py
- Install unzip or 7z(unziptool) and wget(wgettool), replace their placeholder path if you are using tiger_setup.py, you dont need them if you are using download_script.py
- Check https://www.census.gov/library/reference/code-lists/ansi.html#state for state list
- The state you added should be present in "abbr - fips.json" file, if not you can add it with its fips code in "abbr - fips.json" file and see if that fips have data in their web server
- Now make sure every path in .env file is correct and installed properly by calling them from your terminal
pip install -r requirements.txt
python3.11 -m venv venv
source venv/bin/activate
Run this script if you dont want to install and add their path to .env file
python download_script.py
Run this script if you already have installed unziptool and wgettool and added their path to .env file and when previous one didnt work for you for some reason
python tiger_setup.py
from geocoder import Database
if __name__ == "__main__":
db = Database()
print(db.get_geocoded_data("60 TEMPLE PL, BOSTON, MA"))
That's it! You should now be able to use TIGER geocoding in Python