Opened 10 years ago

Closed 9 years ago

#2958 closed defect (fixed)

reverse_geocode erroring ERROR: invalid input syntax for type numeric: " "

Reported by: robe Owned by: robe
Priority: low Milestone: PostGIS 2.1.5
Component: tiger geocoder Version: 2.1.x
Keywords: Cc:

Description

This seems to happen with a particular North Carolina area. haven't been able to replicate with other data I have.

http://lists.osgeo.org/pipermail/postgis-users/2014-October/039645.html

SELECT r.addy[1] FROM reverse_geocode(ST_GeomFromText('POINT(-79.1866
35.3309)',4269),true) AS r;

the debug query when you turn on debugging also errors with same notice:

 WITH ref AS (
        SELECT
'0101000020AD10000095D4096822CC53C08A1F63EE5AAA4140'::geometry As ref_geom )
, 
f AS 
( SELECT faces.* FROM faces  CROSS JOIN ref
WHERE faces.statefp = '37' AND faces.countyfp = '105' 
AND ST_Intersects(faces.the_geom, ref_geom)
    ),
e AS 
( SELECT edges.tlid , edges.statefp, edges.the_geom, CASE WHEN edges.tfidr =
f.tfid THEN 'R' WHEN edges.tfidl = f.tfid THEN 'L' ELSE NULL END::varchar As
eside,
                    ST_ClosestPoint(edges.the_geom,ref_geom) As center_pt,
ref_geom
FROM edges INNER JOIN f ON (f.statefp = edges.statefp AND (edges.tfidr =
f.tfid OR edges.tfidl = f.tfid)) 
    CROSS JOIN ref
WHERE edges.statefp = '37' AND edges.countyfp = '105' 
AND ST_DWithin(edges.the_geom, ref.ref_geom, 0.01) AND (edges.mtfcc LIKE
'S%') --only consider streets and roads
  ) ,
ea AS 
(SELECT e.statefp, e.tlid, a.fromhn, a.tohn, e.center_pt, ref_geom, a.zip,
a.side, e.the_geom
FROM e LEFT JOIN addr As a ON (a.statefp = '37'  AND e.tlid = a.tlid and
e.eside = a.side) 
)
SELECT * 
FROM (SELECT DISTINCT ON(tlid,side)  foo.fullname, foo.streetname,
foo.streettypeabbrev, foo.zip,  foo.center_pt,
  side, to_number(fromhn, '999999') As fromhn, to_number(tohn, '999999') As
tohn, ST_GeometryN(ST_Multi(line),1) As line, 
   dist
FROM 
  (SELECT e.tlid, e.the_geom As line, n.fullname, COALESCE(n.prequalabr || '
','')  || n.name 
 AS streetname, n.predirabrv, COALESCE(suftypabrv, pretypabrv) As
streettypeabbrev,
      n.sufdirabrv, e.zip, e.side, e.fromhn, e.tohn , e.center_pt,
 
ST_Distance_Sphere(ST_SetSRID(e.center_pt,4326),ST_SetSRID(ref_geom,4326))
As dist
FROM ea AS e 
LEFT JOIN (SELECT featnames.* FROM featnames 
    WHERE featnames.statefp = '37'   ) AS n ON (n.statefp =  e.statefp AND
n.tlid = e.tlid) 
ORDER BY dist LIMIT 50 ) As foo 
ORDER BY foo.tlid, foo.side,  CASE 0 WHEN 0 THEN 0  WHEN 1 THEN CASE WHEN
foo.fullname ~ '[0-9]+' THEN 0 ELSE 1 END ELSE CASE WHEN foo.fullname > ''
AND NOT (foo.fullname ~ '[0-9]+') THEN 0 ELSE 1 END END ,  foo.fullname ASC
NULLS LAST, dist LIMIT 50) As f ORDER BY f.dist, CASE WHEN fullname > ''
THEN 0 ELSE 1 END

of course only happens if you have North Carolina data loaded.

Change History (9)

comment:1 by robe, 10 years ago

Isolated this particular issue to tlid= 72088154 which has fromhn: ONKNOWN0, tohn: ONKNOWN98

comment:2 by robe, 10 years ago

Resolution: fixed
Status: newclosed

fixed for PostGIS 2.2 trunk at r13039 and PostGIS 2.1 at r13040

comment:3 by robe, 10 years ago

Resolution: fixed
Status: closedreopened

oops forgot to run my regress tests and now emits 0 for highways and such that don't have numbers.

comment:4 by robe, 10 years ago

revised at r13042 and r13041 (fix NULL address regression).

I'll close this ticket out once I've added a regression test for this ticket.

comment:5 by pramsey, 9 years ago

Milestone: PostGIS 2.1.5PostGIS 2.1.6

comment:6 by pramsey, 9 years ago

Milestone: PostGIS 2.1.6PostGIS 2.1.7

comment:7 by robe, 9 years ago

Milestone: PostGIS 2.1.7PostGIS 2.1.8

comment:8 by robe, 9 years ago

Priority: highlow

comment:9 by robe, 9 years ago

Milestone: PostGIS 2.1.8PostGIS 2.1.5
Resolution: fixed
Status: reopenedclosed

just gonna close this since it's fixed in 2.1.5

Note: See TracTickets for help on using tickets.