<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">The change from </span><span class="im" style="font-family:arial,sans-serif;font-size:13px"><div><br><div>to_number(fromhn, '999999') As fromhn, to_number(tohn, '999999') As tohn</div><div> </div><div><font color="#0000ff" face="Arial">to</font></div><div><font color="#0000ff" face="Arial"></font> </div><div><font color="#0000ff" face="Arial">fromhn, tohn</font></div></div><div><font color="#0000ff" face="Arial"><br></font></div></span><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial;font-size:small">does work when I change it in the debug code. When I update the function it spits out the error below:</span><br></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial;font-size:small"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px"><div>ERROR: operator does not exist: character varying - character varying</div><div>LINE 1: ...ate_Point(var_redge.line, var_pt)*(var_redge.tohn - var_redg...</div><div> ^</div><div>HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.</div><div>QUERY: SELECT (var_redge.fromhn + ST_Line_Locate_Point(var_redge.line, var_pt)*(var_redge.tohn - var_redge.fromhn))::numeric(10)</div><div>CONTEXT: PL/pgSQL function reverse_geocode(geometry,boolean) line 157 at assignment</div><div>********** Error **********</div><div><br></div><div>ERROR: operator does not exist: character varying - character varying</div><div>SQL state: 42883</div><div>Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.</div><div>Context: PL/pgSQL function reverse_geocode(geometry,boolean) line 157 at assignment</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 7:24 AM, Paragon Corporation <span dir="ltr"><<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">I was able to replicate the error by loading NC
data.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">The problem is with the NULL address range records (coming
from those unnamed streets) I think. I'll try to have a fix later
today.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">If you take change</font></span></div><span class="">
<div> </div>
<div>to_number(fromhn, '999999') As fromhn, to_number(tohn, '999999') As
tohn</div>
<div> </div>
</span><div><span></span><font color="#0000ff" face="Arial"><span>to</span></font></div>
<div><font color="#0000ff" face="Arial"><span></span></font> </div>
<div><font color="#0000ff" face="Arial"><span>fromhn, tohn</span></font></div>
<div><font color="#0000ff" face="Arial"><span></span></font> </div>
<div><font color="#0000ff" face="Arial"><span>in the
debug query </span></font></div>
<div><font color="#0000ff" face="Arial"><span>you
should see records come back</span></font></div><span class="">
<div><font face="Arial"><font color="#0000ff"><font><span></span></font></font></font> </div>
<div><br></div>
<div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma"><b>From:</b> <a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Barry
McCall<br><b>Sent:</b> Monday, October 06, 2014 6:03 PM<br><b>To:</b>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br><b>Subject:</b> [postgis-users]
reverse_geocode() specific error at specific geom point<br></font><br></div>
<div></div>
</span><div><div class="h5"><div dir="ltr">
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">For some reason when
I reverse_geocode geometry point
0101000020AD10000095D4096822CC53C08A1F63EE5AAA4140</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">it returns
error </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">
<div>ERROR: invalid input syntax for type numeric: " "</div>
<div>********** Error **********</div>
<div><br></div>
<div>ERROR: invalid input syntax for type numeric: " "</div>
<div>SQL state: 22P02</div></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">I performed UPDATE
tiger.geocode_settings SET setting = 'true' WHERE name =
'debug_reverse_geocode'; to try to get a grasp of what was going on; however,
there are so many CTEs in the debug I cant get a grasp of what is really
happening. </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">Does anyone familiar
with this system know why this is throwing this error? It seems to only happen
with lon,lat around -79.1866 35.3309. </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">SELECT r.addy[1]
FROM reverse_geocode(ST_GeomFromText('POINT(-79.1866 35.3309)',4269),true) AS
r<br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><br></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">NOTICE:
Statement 1: </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> WITH ref AS (</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> SELECT
'0101000020AD10000095D4096822CC53C08A1F63EE5AAA4140'::geometry As ref_geom )
, </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>f AS </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>( SELECT faces.* FROM faces CROSS
JOIN ref</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>WHERE faces.statefp = '37' AND
faces.countyfp = '105' </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>AND ST_Intersects(faces.the_geom,
ref_geom)</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> ),</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>e AS </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>( 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,</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">
ST_ClosestPoint(edges.the_geom,ref_geom) As center_pt, ref_geom</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>FROM edges INNER JOIN f ON (f.statefp =
edges.statefp AND (edges.tfidr = f.tfid OR edges.tfidl = f.tfid)) </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> CROSS JOIN ref</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>WHERE edges.statefp = '37' AND
edges.countyfp = '105' </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>AND ST_DWithin(edges.the_geom,
ref.ref_geom, 0.01) AND (edges.mtfcc LIKE 'S%') --only consider streets and
roads</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> )<span style="WHITE-SPACE:pre-wrap"> </span>,</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>ea AS </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>(SELECT e.statefp, e.tlid, a.fromhn,
a.tohn, e.center_pt, ref_geom, a.zip, a.side, e.the_geom</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>FROM e LEFT JOIN addr As a ON (a.statefp =
'37' AND e.tlid = a.tlid and e.eside = a.side) </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>)</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>SELECT * </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>FROM (SELECT DISTINCT ON(tlid,side)
foo.fullname, foo.streetname, foo.streettypeabbrev, foo.zip,
foo.center_pt,</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> side, to_number(fromhn,
'999999') As fromhn, to_number(tohn, '999999') As tohn,
ST_GeometryN(ST_Multi(line),1) As line, </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> dist</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>FROM </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> (SELECT e.tlid, e.the_geom As
line, n.fullname, COALESCE(n.prequalabr || ' ','') || <a href="http://n.name/" target="_blank">n.name</a>
<div style="min-height:16px;DISPLAY:inline-block;WIDTH:16px"></div> AS
streetname, n.predirabrv, COALESCE(suftypabrv, pretypabrv) As
streettypeabbrev,</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> n.sufdirabrv,
e.zip, e.side, e.fromhn, e.tohn , e.center_pt,</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>
ST_Distance_Sphere(ST_SetSRID(e.center_pt,4326),ST_SetSRID(ref_geom,4326))
As dist</div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>FROM ea AS e </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>LEFT JOIN (SELECT featnames.* FROM
featnames </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span> WHERE featnames.statefp
= '37' ) AS n ON (n.statefp = e.statefp AND n.tlid =
e.tlid) </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>ORDER BY dist LIMIT 50 ) As foo </div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="WHITE-SPACE:pre-wrap"></span>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</div></div></div></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>