[postgis-users] Tiger Geocoder return values

fork forkandwait at gmail.com
Tue Aug 16 10:55:43 PDT 2011


Hi all,

Using the tiger geocoder, I basically want to update a table with addresses to
also include the geocoded points.  While the example in the docs definitely
works, it is a bit convoluted and tricky.  So here is my first question:  Does
anyone have a simpler pattern they follow when updating a table with geocodes
than the multiple CTE's and subselects and aliasing used in the example?

I have also been thinking about a couple of different approaches and wanted to
know if anyone thought they would be useful:

1.  How about a polymorphic version of geocode() that returns a "geocode" type
basically defined as {norm_addy, rating, geomout}?  Then one could have a column
in a table, run an update statement like 

create table mytab (addr text, mygeocode geocode, mypoint geom);
UPDATE mytab set mygeocode=geocode(addr, 1);
UPDATE mytab set mypoint=mygeocode.geomout where mygeocode.rating<10;

I could write such a thing and submit a patch -- it would be a new couple of
functions and a type definition I think.

2.  Alternatively, one might also write a polymorphic version which allows one
to pass through an ID that is given a column in the return table; one could use
this to join directly after creating the geocode table.  

Any thoughts?  Would this be useful?  Any improvements to the above ideas that
might be nice?  I might not be thinking through the problem of returning
multiple rows and types enough....

And Regina -- I will send you my name once I dig up your email.  We have
corresponded before.  I have nothing particularly interesting to hide, I just
hate to see my stupid questions all attached to my real name ;).




More information about the postgis-users mailing list