[postgis-users] Re: TIGER geocoder question

Stephen Frost sfrost at snowman.net
Thu Jun 28 22:25:58 PDT 2007


* Marvin (delphet at gmail.com) wrote:
> I seem to be able to geocode an address after running your script. A new
> question I have now is the schema of the result returned from "geocode". It
> seems that a geocoded result may come from one of functions in your script (
> e.g., "geocode_address_state" or "geocode_address_zip"). Do results obtained
> from different functions share the same schema (columns)? The reason I'm
> asking is that I want to set up a table to hold the results but don't know
> where to look for the structure of the results.

Well, the TIGER stuff isn't 'my script', but the answer is that it
returns a cursor which should always be in a fixed record type (PG would
actually complain loudly if that turned out to not be the case, which
I've run into a couple of times but think must be my fault somehow...).

The structure of the results comes from the underlying query the cursor
is based off of.  I'd recommend pulling one of the queries out and
replaceing the variables with constants and then running it.

Also, if things work out, some of that may be changing..  In the stuff
that I've done, I've taken advantage of more recent PG releases to do
things like return records and sets of records from pl/pgsql functions.
I also 'cleaned up' things.  A good example is how normalize_address()
interacts with the other pieces- I went ahead and defined a
'normalized_address' type that's returned from normalize_address()
instead of the :-delimited structured that then had to be parsed.  I've
also updated/modified the regexps in some minor ways and added
state/zip-only lookups.

I'm not yet entirely sure if it's better to return a cursor or a set
from the underlying functions.  One big advantage to the cursor is that
there's much less copying of the data around, but it also makes it a bit
more difficult to adjust the results which come back, if that ends up
being necessary for some reason.

Anyhow, I need to break out the stuff that depends on non-tiger data and
write up some additional documentation and whatnot.  Once that's done
I'll post what I've got, and may be able to update what's actually on
the PostGIS site and assume maintainership (we're looking into that atm,
at least).

	Thanks,

		Stephen

> On 6/28/07, Shuo Liu <delphet at gmail.com> wrote:
> >
> >Hi, All,
> >
> >I'm working on a GIS project and trying to use TIGER Geocoder from the
> >refractions website on TIGER data. The two sql files in the Geocoder
> >generated some errors when being loaded, complaining that some tables
> >("gazetteer_places", "tiger_geocode_roads", "place_lookup", "roads_local",
> >and "countysub_lookup") are missing. Some messages from the mailing list 
> >say
> >that gazetteer tables should be loaded from the Census Bureau gazetteer
> >files. But that doesn't help find "tiger_geocode_roads" and "roads_local"
> >which don't exist in the loaded TIGER database. I used ogr2ogr to load the
> >TIGER data (
> >http://docs.codehaus.org/display/GEOSDOC/Loading+TIGER+basedata) and it
> >seems that some fields required by the Geocoder are in "completechain" but
> >not all. Can anybody who have experience share some hint on this problem?
> >Thank you very much.
> >
> >Marvin
> >

> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070629/fc760a16/attachment.pgp>


More information about the postgis-users mailing list