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

Kent Richards info at kentrichards.net
Sat Apr 26 22:48:04 PDT 2014


Thank you all for your replies.  I think this gives me the solution.

Now that I know this is just a naming issue, rather than try to add aliases for common permutations of all state hwy names in various states, I'm going to look into preprocessing to standardize the street address for anything that looks like a "<state_name> nn" street address.

Stephen Frost:

> It sounds like this is a large part of the issue to begin with- if the
> zip code and place aren't known to the geocoder, I'm not really sure how
> you expect it to be able to produce a better answer based on them...
> Unfortunately, the USPS still (afaik) wants to charge for public
> information like zip code data.  I'm not working with the USGS data much
> any more, unfortunately, but you could also make sure that you're using
> the latest data from them (they release once/year, last I checked).
> 
> If you have geolocation information (POINT data) for those addresses
> then you might be able to incorporate it into the geocoder data, but I'm
> guessing you don't or you wouldn't be using the geocoder to begin
> with, and I don't see how just addresses could help with geocoding...

Definitely see where you're coming from... Not knowing how the geocoder works or what was missing, I was hoping for a *closer* result than 350 miles away (based on the zip, the county, or something) by adding relationship data that could be used by the geocoder to create a fall-back. 

Again, thank you for the help.

Kent


On Apr 25, 2014, at 1:33 PM, Paragon Corporation wrote:

> 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
> 
> 
> _______________________________________________
> 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