<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6001.18226" name=GENERATOR></HEAD>
<BODY 
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2>Ben,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2>There is a function available in PostGIS 1.4 called 
ST_IsValidReason() which does what you want.  Its in trunk and requires 
GEOS 3.1.0.  Unfortunately this does not exist in PostGIS 1.3 and also 
requires GEOS 3.1 and above.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2>Regin</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=902543202-05052009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Ben 
Madin<BR><B>Sent:</B> Monday, May 04, 2009 10:03 PM<BR><B>To:</B> 
postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] Getting 
a NOTICE into a query output<BR></FONT><BR></DIV>
<DIV></DIV>G'day all,
<DIV><BR></DIV>
<DIV>I have some bad geometries (Self-intersections) that I need to fix:</DIV>
<DIV><BR></DIV>
<DIV>when I run :</DIV>
<DIV><BR></DIV>
<DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">australia=# select gid, 
tailtag, area_name, st_astext(st_centroid(the_geom)) as centroid from 
tailtagarea where st_isValid(the_geom) is false order by 
st_centroid(the_geom);;</FONT></DIV>
<DIV><BR></DIV>
<DIV> to make myself a nice list to work with I get :</DIV>
<DIV><BR></DIV>
<DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 146.646 -41.1121</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 147.787 -42.288</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 115.999 -32.7807</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 136.002 -33.3412</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 151.385 -27.7379</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 142.163 -26.2079</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 151.385 -27.7379</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 142.163 -26.2079</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 115.999 -32.7807</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 130.528 -12.7086</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 115.556 -21.4113</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 113.653 -24.8917</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">NOTICE: 
 Self-intersection at or near point 115.142 -30.6844</FONT></DIV>
<DIV><BR></DIV>
<DIV>
<DIV>then :</DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> gid | tailtag | 
   area_name    |             
    centroid                 
 </FONT></DIV>
<DIV><FONT class=Apple-style-span 
face="'Courier New'">-----+---------+-----------------+-------------------------------------------</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 276 | WCN   
  | Carnarvon       | POINT(114.382000002796 
-24.3219058101861)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 291 | WDN   
  | Dandaragan      | POINT(115.504407697781 
-30.5410130360183)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 380 | WWA   
  | Waroona         | POINT(115.91620760142 
-32.8588263644047)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 343 | WMY   
  | Murray          | POINT(115.966965752586 
-32.6237045619179)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 362 | WRO   
  | Roebourne       | POINT(117.03170469097 
-21.0526004441269)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">  60 | TDG 
    | Darwin And Gulf | POINT(133.897365573887 
-14.2140172548334)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 247 | S71   
  | S71             | POINT(136.913166015303 
-32.9332738397356)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">  70 | QBC 
    | Barcoo          | 
POINT(142.269579925576 -25.1377197205728)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 170 | QQP   
  | Quilpie         | POINT(143.889867295296 
-26.354593975264)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 498 | MLA   
  | Latrobe         | POINT(146.544098538635 
-41.2417387155427)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 510 | MRS   
  | Ross            | POINT(147.556140609695 
-42.1118612308958)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 147 | QMM   
  | Millmerran      | POINT(151.11832129932 
-27.8551116855016)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'"> 169 | QPW   
  | Pittsworth      | POINT(151.538916320118 
-27.7014266930915)</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'Courier New'">(13 
rows)</FONT></DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>It would be excellent if I could get the Notice to display in the query 
results, so I could print it out and work with it to quickly locate the problems 
(in QGIS)</DIV>
<DIV><BR></DIV>
<DIV>... so can I do that? or am I best to just copy and paste the notices</DIV>
<DIV><BR></DIV>
<DIV>Unfortunately as I write this "Safari could not open the page “<A 
href="http://postgis.refractions.net/documentation/">http://postgis.refractions.net/documentation/</A>” 
because the server is not responding."</DIV>
<DIV><BR></DIV>
<DIV>cheers</DIV>
<DIV><BR></DIV>
<DIV>Ben</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV><BR>
<DIV apple-content-edited="true">
<DIV>
<DIV>-- </DIV>
<DIV><BR></DIV>
<DIV>Ben Madin</DIV>
<DIV>REMOTE INFORMATION</DIV>
<DIV><BR></DIV>
<DIV>t : +61 8 9192 5455</DIV>
<DIV>f : +61 8 9192 5535</DIV>
<DIV>m : 0448 887 220</DIV>
<DIV>Broome   WA   6725</DIV>
<DIV><BR></DIV>
<DIV><A 
href="mailto:ben@remoteinformation.com.au">ben@remoteinformation.com.au</A></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>Out here, it 
pays to know...</DIV></DIV><BR></DIV><BR></DIV></BODY></HTML>