[postgis-users] Tiger Geocoder error when street name contains name of state

Daniel Ball danpelota at gmail.com
Sat Mar 19 19:03:29 PDT 2011


Hi all,

I've been toying with the Tiger Geocoder and have run into a minor
problem. I can successfully geocode most street addresses:

SELECT
    g.rating,
    ST_X(g.geomout) as lon,
    ST_Y(g.geomout) as lat
  FROM GEOCODE('1124 BERKSHIRE AVE, PITTSBURGH, PA 15226') as g;

 rating |        lon        |       lat
--------+-------------------+------------------
      0 | -80.0163301048089 | 40.3898836658447

However, if I try an address with a street name that includes the name
of a state:

SELECT
    g.rating,
    ST_X(g.geomout) as lon,
    ST_Y(g.geomout) as lat
  FROM GEOCODE('2450 N COLORADO ST, PHILADELPHIA, PA, 19132') as g;

ERROR:  query string argument of EXECUTE is null
CONTEXT:  PL/pgSQL function "location_extract" line 54 at EXECUTE statement
PL/pgSQL function "normalize_address" line 142 at assignment
PL/pgSQL function "geocode" line 10 at assignment

Note that misspelling the name of the street fixes the problem:

SELECT
    g.rating,
    ST_X(g.geomout) as lon,
    ST_Y(g.geomout) as lat
  FROM GEOCODE('2450 N COLORADA ST, PHILADELPHIA, PA, 19132') as g;


 rating |        lon        |       lat
--------+-------------------+------------------
     10 | -75.1607586938776 | 39.9908191428571

Haven't quite worked out the details of the address parser, but I'm
assuming it's matching the state name in the street and throwing off
the what it's passing to the geocoder.

Is this a known bug or something I'm doing wrong? Is it possible to
pass individual elements of the address to the coder explicitly (e.g.,
street="2450 N Colorado ST", city="Philadelphia", state="PA",
zip="19132")?

Thanks in advance for your help!

--
Dan



More information about the postgis-users mailing list