<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I'm seeing with more clarity now.</span><div style="font-family:arial,sans-serif;font-size:13px">After running</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>SELECT * FROM addr</div><div>WHERE fromhn ~* '[a-zA-Z]'</div><div>AND tohn ~* '[a-zA-Z]'</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">it returns 381,739 results with chars in fromhn and tohn. Your message came in where you stated </div><div style="font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,255);font-family:Arial">'It was caused by a record not being emitted but that gets the function applied.'</span><br></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(0,0,255);font-family:Arial"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px">Being new and still learning the system I'm assuming there is a function that should be omitting any non integer/numerical values from these columns?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 10:07 AM, Barry McCall <span dir="ltr"><<a href="mailto:barry.mccall+postgis@gmail.com" target="_blank">barry.mccall+postgis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Check out this lil guy right here :-)<div><br></div><div><div>SELECT * FROM tiger_data.nc_addr</div><div>WHERE tlid = '72088154'</div></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 10:06 AM, Barry McCall <span dir="ltr"><<a href="mailto:barry.mccall@gmail.com" target="_blank">barry.mccall@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Check out this lil guy :-)<div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 9:57 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">Barry,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">It was caused by a record not being emitted but that gets the
function applied.</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">I put in a patch for this issue for 2.1 and 2.2 branch.
You just have to replace your reverse_geocode function with the one referenced
in this ticket</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"><a href="http://trac.osgeo.org/postgis/ticket/2958" target="_blank">http://trac.osgeo.org/postgis/ticket/2958</a></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">On a slgihtly related note, I noticed this address geocodes to
1,Greenwood for location instead of just Greenwood.</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">That is caused because the tiger_data.nc_cousub table has a
bunch of 1s etc to denote township number I guess. Not sure why they did
that.</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 want to get rid of those numbers, update the name field
in tiger_data.nc_cousub.</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">I forget why I use cousub instead of something
else.</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">Hope that helps,</font></span></div><span>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Regina</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"><a href="http://www.postgis.us" target="_blank">http://www.postgis.us</a></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"><a href="http://postgis.net" target="_blank">http://postgis.net</a></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"></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"></font></span> </div><br>
</span><div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma"><span><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></span><b>Sent:</b> Tuesday, October 07, 2014 8:17 AM<br><b>To:</b> PostGIS
Users Discussion<br><b>Subject:</b> Re: [postgis-users] reverse_geocode()
specific error at specificgeom point<br></font><br></div><div><div>
<div></div>
<div dir="ltr"><span style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">The
change from </span><span style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">
<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-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="FONT-SIZE:small;FONT-FAMILY:arial">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-SIZE:13px;FONT-FAMILY:arial,sans-serif"><span style="FONT-SIZE:small;FONT-FAMILY:arial"><br></span></div>
<div style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">
<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="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><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>
<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>
<div><font face="Arial"><font color="#0000ff"><font size="+0"><span></span></font></font></font> </div>
<div><font color="#0000ff" face="Arial"></font><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>
<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" target="_blank">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></div></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">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>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>