Postgis Tiger Geocoder returning null results

676 views Asked by At

I have loaded tiger data into my postgres database.

SELECT count(*) FROM tiger_data.county_all;

count-> 3233

SELECT count(*) FROM tiger_data.state_all;

count-> 56

Extensions are working

SELECT na.address,
       na.streetname,na.streettypeabbrev,
       na.zip
FROM normalize_address('1 Devonshire Place, Boston, MA 02109') AS na;

returns

address | streetname | streettypeabbrev |  zip
---------+------------+------------------+-------
   1 | Devonshire | Pl               | 02109

Search path to the database is also set

ALTER DATABASE geocoder
    SET search_path TO '"$user", public, tiger';

But when I run a query to search something I get null results.

SELECT g.rating,
       ST_AsText(ST_SnapToGrid(g.geomout,0.00001)) As wktlonlat,
       (addy).address As stno, (addy).streetname As street,
       (addy).streettypeabbrev As styp, (addy).location As city, 
       (addy).stateabbrev As st,(addy).zip
FROM geocode('424 3rd St, Davis, CA 95616',1) As g;

returns nothing

I followed this tutorial How to make a PostGIS TIGER Geocoder in Less than 5 Days But I still can't get it to work.

Any help would be highly appreciated.

Thanks.

1

There are 1 answers

0
sushmit sarmah On

Simple mistake. I had not loaded the state data.

Here is a code to generate a script to load California data.

psql -U postgres -c "SELECT Loader_Generate_Script(ARRAY['CA'], 'sh')" -d bulk_geocoder -tA > ca_script_load.sh

Then run the script ca_script_load.sh after making changes to pg details.

bash ca_script_load.sh

This will fetch data for the state of california and then load the databse.

Follow this tutorial. State loading is from point 12

2.8.1. Tiger Geocoder Enabling your PostGIS database: Using Extension