<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
James,<br>
<br>
I suspect this may be caused by a known bug in the Unary union.
This was identified in this thread on the JTS list:<br>
<br>
<a class="moz-txt-link-freetext" href="http://sourceforge.net/mailarchive/forum.php?thread_name=4C0FB4A5.2010304%40refractions.net&forum_name=jts-topo-suite-user">http://sourceforge.net/mailarchive/forum.php?thread_name=4C0FB4A5.2010304%40refractions.net&forum_name=jts-topo-suite-user</a><br>
<br>
I fixed this in JTS, in the soon-to-be-released ver 1.12. Perhaps
this fix hasn't made it's way into GEOS and PostGIS yet.<br>
<br>
The thing to do is to get this fixed in GEOS, rolled into PostGIS,
and then you can retest your union case.<br>
<br>
Martin<br>
<br>
On 1/11/2011 6:23 PM, <a class="moz-txt-link-abbreviated" href="mailto:James.Sewell@lisasoft.com">James.Sewell@lisasoft.com</a> wrote:
<blockquote
cite="mid:CB506E813C77E9498F043F1F951BB2768E3B982643@optimus.ms.a2end.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1847404672;
        mso-list-type:hybrid;
        mso-list-template-ids:-815234036 201916417 201916419 201916421 201916417 201916419 201916421 201916417 201916419 201916421;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Sorry,
I didn’t include the actual error:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">An
example is:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal">NOTICE: TopologyException: found non-noded
intersection between LINESTRING (143.861 -36.881, 143.861
-36.881) and LINESTRING (143.861 -36.881, 143.861 -36.881) at
143.861 -36.881<o:p></o:p></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">This
particular one is a two very small identical lines, this
isn’t always the case but seems to be the majority of the
time.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><span
style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color: rgb(31,
73, 125);">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 12pt;"><span
style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color:
rgb(153, 153, 153);">James Sewell <br>
Developer <br>
LISAsoft <o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div class="MsoNormal"><span style="font-size: 9pt;
font-family:
"Verdana","sans-serif"; color:
rgb(153, 153, 153);">
<hr style="width: 315pt;" align="left" width="420"
size="2"></span></div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><b><span style="font-size: 9pt;
font-family: "Verdana","sans-serif";
color: rgb(153, 153, 153);">Ph: </span></b><span
style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color:
rgb(153, 153, 153);">+61 3 8680 3250 <b>Fax: </b>+61 3
8680 3299 <br>
Level 9, 601 Bourke St, Melbourne Vic 3000<o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div class="MsoNormal"><span style="font-size: 9pt;
font-family:
"Verdana","sans-serif"; color:
rgb(153, 153, 153);">
<hr style="width: 315pt;" align="left" width="420"
size="2"></span></div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color:
rgb(153, 153, 153);"><br>
LISAsoft is part of the A2end Group of Companies<br>
</span><span style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color: rgb(79,
129, 189);"><a moz-do-not-send="true"
href="http://www.ardec.com.au/"><span style="color:
rgb(79, 129, 189); text-decoration: none;">http://www.ardec.com.au</span></a><br>
<a moz-do-not-send="true" href="http://www.lisasoft.com/"><span
style="color: rgb(79, 129, 189); text-decoration:
none;">http://www.lisasoft.com</span></a><br>
<a moz-do-not-send="true"
href="http://www.terrapages.com/"><span style="color:
rgb(79, 129, 189); text-decoration: none;">http://www.terrapages.com</span></a></span><span
style="color: rgb(31, 73, 125);"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<div>
<div style="border-right: medium none; border-width: 1pt
medium medium; border-style: solid none none; border-color:
rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color;
padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt;
font-family:
"Tahoma","sans-serif";"
lang="EN-US">From:</span></b><span style="font-size:
10pt; font-family:
"Tahoma","sans-serif";" lang="EN-US">
<a class="moz-txt-link-abbreviated" href="mailto:James.Sewell@lisasoft.com">James.Sewell@lisasoft.com</a> <br>
<b>Sent:</b> Wednesday, 12 January 2011 12:06 PM<br>
<b>To:</b> '<a class="moz-txt-link-abbreviated" href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>'<br>
<b>Subject:</b> GEOS errors from PostGIS<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am currently creating an OSS Python app
which uses PostGIS (and thus GEOS) to combines multiple layers
and carries through attributes.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am using a method derived from Paul
Ramsey’s <a moz-do-not-send="true"
href="http://s3.opengeo.org/postgis-power.pdf">http://s3.opengeo.org/postgis-power.pdf</a>
document. The steps I am taking are as follows:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent: -18pt;"><!--[if !supportLists]--><span
style="font-family: Symbol;"><span style="">·<span
style="font: 7pt "Times New Roman";">
</span></span></span><!--[endif]-->Take the left and right
layers and split them into smaller segments<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent: -18pt;"><!--[if !supportLists]--><span
style="font-family: Symbol;"><span style="">·<span
style="font: 7pt "Times New Roman";">
</span></span></span><!--[endif]-->Iterate through the
segments doing the following:<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left: 72pt;
text-indent: -18pt;"><!--[if !supportLists]--><span
style="font-family: "Courier New";"><span style="">o<span
style="font: 7pt "Times New Roman";"> </span></span></span><!--[endif]-->Use
the following to dump each side to linework<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left: 72pt;"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;">SELECT
ST_Collect(a.the_geom) AS the_geom <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;"> FROM
(SELECT <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;"> (ST_Dump<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;">
(ST_Exteriorring(<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;">
(ST_Dumprings(<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;">
(ST_Dump(the_geom)).geom)).geom))).geom AS the_geom<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="margin-left: 72pt;
text-indent: -18pt;"><!--[if !supportLists]--><span
style="font-family: "Courier New";"><span style="">o<span
style="font: 7pt "Times New Roman";"> </span></span></span><!--[endif]-->Put
two resulting multi-polygons into a table, make sure they are
valid (and all encapsulated polys are valid), and union to
remove overlap as follows<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;">SELECT
ST_Union(ST_snaptogrid(the_geom,10E-10)) AS the_geom <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;"><o:p> </o:p></p>
<p class="MsoListParagraph" style="margin-left: 72pt;
text-indent: -18pt;"><!--[if !supportLists]--><span
style="font-family: "Courier New";"><span style="">o<span
style="font: 7pt "Times New Roman";"> </span></span></span><!--[endif]-->Build
the polygons back up as follows<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 36pt;"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;">SELECT
a.the_geom AS the_geom, <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;"> ST_pointonsurface(a.the_geom)
AS point, <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;"> 0
AS leftgid, 0 AS rightgid <o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 72pt; text-indent:
36pt;">FROM (SELECT (ST_Dump(ST_polygonize(the_geom))).geom AS
the_geom<o:p></o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;"><o:p> </o:p></p>
<p class="MsoListParagraph" style="margin-left: 72pt;
text-indent: -18pt;"><!--[if !supportLists]--><span
style="font-family: "Courier New";"><span style="">o<span
style="font: 7pt "Times New Roman";"> </span></span></span><!--[endif]-->Then
use an overlay to map the attributes back through from the
left and the right.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The process works, however I am getting
problems with GEOS Non Noded Intersection <span style="color:
rgb(31, 73, 125);">(“GEOS union() threw an error!”) </span>crashes
in some areas. These can often be fixed by rearranging the
data (importing in a different order, snapping to a slightly
different grid etc...). <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When a failure occurs I am given two
linestrings and a point, however these usually bear no
relationship to the lines in either the expected output, the
left or the right side other than being in the same area.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Unfortunately I can’t provide data at the
moment as any attempt to reduce the size of the dataset seems
to remove (or relocate) the problem. I will try and get
permission to release some data from the customer, but this
will take some time.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">One thing to note is that the layers I am
combining contain very complex and very similar linework. It
would not be unexpected to get 10 sets of similar but not
identical linework all running around an area. This is
acceptable for the end product, but I am wondering if it is
upsetting the Union somehow?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If anyone has any ideas they would be most
appreciated.<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left: 108pt;"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left: 72pt;">
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom: 12pt;"><span
style="font-size: 9pt; font-family:
"Verdana","sans-serif";">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 12pt;"><span
style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color: rgb(153,
153, 153);">James Sewell <br>
Developer <br>
LISAsoft <o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div class="MsoNormal"><span style="font-size: 9pt;
font-family:
"Verdana","sans-serif";
color: rgb(153, 153, 153);">
<hr style="width: 315pt;" align="left"
width="420" size="2"></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><b><span style="font-size: 9pt;
font-family: "Verdana","sans-serif";
color: rgb(153, 153, 153);">Ph: </span></b><span
style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color: rgb(153,
153, 153);">+61 3 8680 3250 <b>Fax: </b>+61 3 8680 3299 <br>
Level 9, 601 Bourke St, Melbourne Vic 3000<o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div class="MsoNormal"><span style="font-size: 9pt;
font-family:
"Verdana","sans-serif";
color: rgb(153, 153, 153);">
<hr style="width: 315pt;" align="left"
width="420" size="2"></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color: rgb(153,
153, 153);"><br>
LISAsoft is part of the A2end Group of Companies<br>
</span><span style="font-size: 9pt; font-family:
"Verdana","sans-serif"; color: rgb(79,
129, 189);"><a moz-do-not-send="true"
href="http://www.ardec.com.au/"><span style="color:
rgb(79, 129, 189); text-decoration: none;">http://www.ardec.com.au</span></a><br>
<a moz-do-not-send="true" href="http://www.lisasoft.com/"><span
style="color: rgb(79, 129, 189); text-decoration: none;">http://www.lisasoft.com</span></a><br>
<a moz-do-not-send="true" href="http://www.terrapages.com/"><span
style="color: rgb(79, 129, 189); text-decoration: none;">http://www.terrapages.com</span></a></span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
geos-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<p class="avgcert" color="#000000" align="left">No virus found in
this message.<br>
Checked by AVG - <a moz-do-not-send="true"
href="http://www.avg.com">www.avg.com</a><br>
Version: 10.0.1191 / Virus Database: 1435/3373 - Release Date:
01/11/11</p>
</blockquote>
</body>
</html>