[postgis-users] Adding to geocoder data for better results?

Paragon Corporation lr at pcorp.us
Fri Apr 25 13:33:01 PDT 2014


Kent,

The PostGIS tiger geocoder works on an inheritance structure.  So to make
the below geocode right you can for example create extra side-line tables
that inherit from tiger tables.  To make this geocode right, you need to
tell the geocoder
That California 1 is an alias for State Rte 1 features

Like so:
CREATE TABLE tiger_data.extra_featnames_ca
(
  CONSTRAINT pk_extra_featnames_ca PRIMARY KEY (gid),
  CONSTRAINT chk_statefp CHECK (statefp::text = '06'::text)
)
INHERITS (tiger.featnames);

INSERT INTO tiger_data.extra_featnames_ca(tlid, fullname, name, predirabrv,
pretypabrv, prequalabr, 
       sufdirabrv, suftypabrv, sufqualabr, predir, pretyp, prequal, 
       sufdir, suftyp, sufqual, linearid, mtfcc, paflag, statefp)
       SELECT tlid, 'California 1' As fullname, 'California 1' AS name,
predirabrv, NULL AS pretypabrv, prequalabr, sufdirabrv, suftypabrv,
sufqualabr, predir, pretyp, prequal, 
       sufdir, suftyp, sufqual, linearid, mtfcc, paflag, statefp
       FROM tiger_data.ca_featnames
       WHERE fullname = 'State Rte 1';


SELECT install_missing_indexes();



--- After you do the above -

 select * from geocode('46896 California 1, Big Sur, CA 93920');

Should resolve to:

                     addy                       |
geomout                       | rating
------------------------------------------------+---------------------------
-------------------------+--------
(46896,,"California 1",,,,"Big Sur",CA,93920,t) |
0101000020AD100000E1F6AB307E725EC0E3F0C88B2D214240 |      0


Which 
POINT(-121.788952033934 36.2592024546773)

You could also insert directly into the ca_featnames table but then you'd
loose your customizations if you reloaded tiger.

Hope that helps,
Regina
http://www.postgis.us
http://postgis.net



-----Original Message-----
From: postgis-users-bounces at lists.osgeo.org
[mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Kent Richards
Sent: Friday, April 25, 2014 12:55 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Adding to geocoder data for better results?

Apologies this has been discussed.  I searched the archives, did not find an
answer.

Description of the problem:

PostGIS version =
POSTGIS="2.0.2 r10789" GEOS="3.3.8-CAPI-1.7.8" PROJ="Rel. 4.8.0, 6 March
2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.8.0"
LIBJSON="UNKNOWN" RASTER

When geocoding some addresses (perhaps, unincorporated areas), the returned
results are not even in the ballpark.

Example:

select * from geocode('46896 California 1, Big Sur, CA 93920');
                         addy                          |
geomout                       | rating 
-------------------------------------------------------+--------------------
--------------------------------+--------
 (,,California,Via,,,"Dana Point",CA,92624,t)          |
0101000020AD10000073368950A46A5DC082C23F6CC5BB4040 |     38
 (,,California,Via,,,"Dana Point",CA,92675,t)          |
0101000020AD100000CCE9BF1EA76A5DC05EB5F600C9BB4040 |     39
 (,,California,Via,,,"San Juan Capistrano",CA,92675,t) |
0101000020AD1000006679E728A16A5DC0467CB31001BC4040 |     40

Dana Point, CA is ~350 miles from Big Sur, CA.

The search zip (93920) doesn't appear to be in zip_lookup or zip_lookup_all.

"Big Sur" doesn't appear to be in place.

I have voter registration data that includes full addresses for registered
voters.  Is there a way to add this data to the geocoder tables so that
geocoding returns something in the ballpark for addresses such as this?

Thank you.
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users




More information about the postgis-users mailing list