<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
This occurs because the geometries are invalid, and the current
intersects algorithm used in JTS/GEOS has kittens when invalid
geometries are used as input. The core dump thing is unfortunate
(and obviously got fixed in later versions).<br>
<br>
You might say "surely this shouldn't cause such a serious error",
and I'd agree. Probably what should happen in the case of invalid
geometries input to predicates is that they return a (possibly
bogus) result. You might then say "but obviously they do intersect,
so why can't the result be correct?", and in this case I'd also
agree. The intersects algorithm could be enhanced to detect
intersection correctly in almost all cases, valid or not. (Some of
the other predicates might not be so tolerant - but still a "best
effort" strategy would be nicer than outright failure).<br>
<br>
But that's all work for the future (and get in touch if you have
funding to offer!)<br>
<br>
For now, all you can do is to check validity before running the
ST_intersects function in some way. The nicest way to do this would
be to create a new function which does the validity check
internally. And that function could also be enhanced to do some
other kinds of intersection checks, to try and detect intersection
for any inputs. For instance, in this case ST_intersects could be
run safely on the geometry boundary linework, and will then report
the correct answer. This could be supplemented with some
point-in-polygon checks to catch the situation of disjoint
boundaries. Alternatively, if invalid polygons are detected the
buffer(0) trick could be used to try and clean them.<br>
<br>
<br>
<div class="moz-cite-prefix">On 9/20/2012 7:37 AM, Adam wrote:<br>
</div>
<blockquote
cite="mid:CALChyfqfh5S00bVRFJiSigkp87jbOiOuzDycAw58yC4eW-zgFw@mail.gmail.com"
type="cite">Running this query against Postgis 1.5 causes a core
dump:
<div>
<div>SELECT ST_intersects(</div>
<div> geomfromtext('POLYGON((31.904296875
67.32421875,14.58984375 67.32421875,12.744140625
65.830078125,33.75 66.09375,31.904296875
67.236328125,31.81640625 67.32421875,31.904296875
67.32421875))', 4326), </div>
<div> geomfromtext('POLYGON((31.904296875
67.32421875,14.58984375 67.32421875,12.744140625
65.830078125,33.75 66.09375,31.904296875
67.236328125,31.81640625 67.32421875,31.904296875
67.32421875))', 4326)</div>
<div>
);</div>
<div><br>
</div>
<div>Running against Postgis 2.0 gives the following error (much
preferred to get an error than a core dump!):</div>
<div>ERROR: GEOSIntersects: TopologyException: side location
conflict at 31.81640625 67.32421875</div>
<div>CONTEXT: SQL function "st_intersects" statement 1</div>
<div><br>
</div>
<div>Both are using geos version: '3.3.5-CAPI-1.7.5'.</div>
<div><br>
</div>
<div>Unfortunately upgrading to Postgis 2 is not an option for
us.</div>
<div>Our platform is Solaris 10 x86 using 64 bit builds.</div>
<div><br>
</div>
<div>From dbx the core file shows:</div>
<div>
<div> [1] 0x1b408d(0x1, 0x1, 0x474e5543432b2b00, 0xbe0170,
0xfffffd7fffdf8880, 0x1b408d), at 0x1b408d</div>
<div> [2] _Unwind_RaiseException_Body(0x0, 0x0, 0x0, 0x0,
0x0, 0x0), at 0xfffffd7ffec416bc</div>
<div> [3] _SUNW_Unwind_RaiseException(0x0, 0x0, 0x0, 0x0,
0x0, 0x0), at 0xfffffd7ffec418a9</div>
<div> [4] __cxa_throw(obj = (nil), tinfo = (nil), dest =
(nil)), line 75 in "eh_throw.cc"</div>
<div> [5]
geos::geomgraph::EdgeEndStar::propagateSideLabels(this =
0xfffffd7ffe6e2a00, geomIndex = 0), line 69 in
"new_allocator.h"</div>
<div> [6]
_ZN4geos9geomgraph11EdgeEndStar16computeLabellingEPSt6vectorIPNS0_13GeometryGraphESaIS4_EE(this
= 0x91bc10, geomGraph = 0xfffffd7fffdf8e18), line 88 in
"EdgeEndStar.cpp"</div>
<div> [7]
geos::operation::relate::RelateComputer::labelNodeEdges(this
= 0xfffffd7fffdf8e30), line 327 in "RelateComputer.cpp"</div>
<div> [8]
geos::operation::relate::RelateComputer::computeIM(this =
0xfffffd7fffdf8e30), line 131 in "RelateComputer.cpp"</div>
<div> [9] geos::operation::relate::RelateOp::relate(a =
(nil), b = (nil)), line 43 in "RelateOp.cpp"</div>
<div> [10] geos::geom::Geometry::intersects(this = 0x91b598,
g = 0x91b638), line 191 in "memory"</div>
<div> [11] GEOSIntersects_r(extHandle = 0x91d100, g1 = (nil),
g2 = (nil)), line 351 in "geos_ts_c.cpp"</div>
<div> [12] GEOSIntersects(g1 = (nil), g2 = (nil)), line 139
in "geos_c.cpp"</div>
<div> [13] intersects(fcinfo = 0xfffffd7fffdf9110), line 2322
in "lwgeom_geos.c"</div>
<div> [14] ExecMakeFunctionResult(fcache =
0xfffffd7fffdf90d0, econtext = 0xbd5740, isNull = 0xbd6c28
"", isDone = (nil)), at 0x5a9d88</div>
<div> [15] ExecEvalAnd(andExpr = (nil), econtext = 0xbd5740,
isNull = 0xbd6c28 "", isDone = (nil)), at 0x5aaf23</div>
<div> [16] ExecProject(projInfo = 0xbd6c40, isDone =
0xfffffd7fffdf95bc), at 0x5ae659</div>
<div> [17] ExecResult(node = 0xbd5630), at 0x5ba7d0</div>
<div> [18] ExecProcNode(node = 0xbd5630), at 0x5a77ec</div>
<div> [19] standard_ExecutorRun(queryDesc = 0xbcd2e8,
direction = ForwardScanDirection, count = 1), at 0x5a550c</div>
<div> [20] fmgr_sql(fcinfo = 0xfffffd7fffdf9880), at 0x5b1529</div>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</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: 2012.0.2221 / Virus Database: 2441/5281 - Release Date:
09/20/12</p>
</blockquote>
<br>
</body>
</html>