<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 2/26/2015 4:08 PM, Joseph Spenner
wrote:<br>
</div>
<blockquote
cite="mid:1485411847.1148068.1424984931438.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:garamond, new york, times, serif;font-size:14px">
<div id="yui_3_16_0_1_1424960459142_165150">Roxanne:</div>
<div id="yui_3_16_0_1_1424960459142_165149" dir="ltr"> I think
you're on to something here. I just did more tests, and found
the following:</div>
<div dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_164977" dir="ltr">This
command fails with the error:</div>
<div id="yui_3_16_0_1_1424960459142_165011" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165019" dir="ltr">select
ST_Asgeojson( geom ) from dynamic.polys where
ST_Intersects(ST_GeomFromGeoJSON('$jsonPoly'), geom)=TRUE and
ST_Area(ST_Intersection(ST_GeomFromGeoJSON('$jsonPoly')::geography,
geom::geography))>500</div>
<div id="yui_3_16_0_1_1424960459142_165062" dir="ltr"><br>
</div>
<div dir="ltr"> == ERROR==<br>
</div>
<div id="yui_3_16_0_1_1424960459142_165429" dir="ltr">DBD::Pg::st
execute failed: ERROR: Error performing intersection:
TopologyException: Input geom 0 is invalid: Self-intersection
at or near point 1543100.5176146738 389360.239110158 at
1543100.5176146738 389360.239110158 at ./foo.pl line 50.<br
style="" class="">
DBD::Pg::st execute failed: ERROR: Error performing
intersection: TopologyException: Input geom 0 is invalid:
Self-intersection at or near point 1543100.5176146738
389360.239110158 at 1543100.5176146738 389360.239110158 at
./foo.pl line 50.<br>
</div>
<div id="yui_3_16_0_1_1424960459142_165401" dir="ltr"> ==
/ERROR==</div>
<div id="yui_3_16_0_1_1424960459142_165605" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165470" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165095" dir="ltr">But this
command succeeds, no error:</div>
<div id="yui_3_16_0_1_1424960459142_165142" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165108" dir="ltr"> select
ST_Asgeojson( geom ) from dynamic.polys where
ST_Intersects(ST_GeomFromGeoJSON('$jsonPoly'), geom)=TRUE</div>
<div id="yui_3_16_0_1_1424960459142_165147" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165148" dir="ltr"><br>
</div>
<div dir="ltr" id="yui_3_16_0_1_1424960459142_164976"><span
id="yui_3_16_0_1_1424960459142_165188">The only thing
different is the extra AND: </span></div>
<div id="yui_3_16_0_1_1424960459142_165254" dir="ltr"><span
style="" class="" id="yui_3_16_0_1_1424960459142_165188">
</span>ST_Area(ST_Intersection(ST_GeomFromGeoJSON('$jsonPoly')::geography,
geom::geography))>500</div>
<div id="yui_3_16_0_1_1424960459142_164975">
<div id="yui_3_16_0_1_1424960459142_165323"> </div>
<div id="yui_3_16_0_1_1424960459142_165258"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165471" dir="ltr">The
reason I did this was to prevent false positives for geoms
which were simply tangent, or "touching".</div>
<div id="yui_3_16_0_1_1424960459142_165540" dir="ltr">For
example, if I searched for MN, and there was poly/county on
the northern IA border, it would be returned.</div>
</div>
</div>
</blockquote>
I haven't played with geography much as a data type, ymmv<br>
<br>
Try casting the St_Intersection back to geometry and do an
ST_IsValidReason (and ST_GeometryType) on
ST_Intersection(ST_GeomFromGeoJSON('$jsonPoly')::geography,
geom::geography)<br>
<br>
or change the order on the cast to (**with correct SRIDs):<br>
ST_Intersection(ST_GeomFromGeoJSON('$jsonPoly'), geom)::geography<br>
<br>
and see what it says. You may be able to test for a non-polygon
(ST_Area of a (multi)linestring or (multi)point makes no sense)
and/or add ST_MakeValid around it. [not saying that is the problem
- it just might be tho]<br>
<br>
<blockquote
cite="mid:1485411847.1148068.1424984931438.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:garamond, new york, times, serif;font-size:14px">
<div id="yui_3_16_0_1_1424960459142_164975">
<div id="yui_3_16_0_1_1424960459142_165638" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165805" dir="ltr">Looks
like I need to find a better way to deal with the geoms that
just touch with a single point or line in common.</div>
</div>
</div>
</blockquote>
<br>
Not necessarily - just a more robust way of testing edge use cases.<br>
<br>
and/or maybe...<br>
is not ST_Touches (for boundary only intersections) <br>
and is { ST_Crosses (some but not all interior points in common) or
ST_Contains(one is wholly contained in the other) }<br>
and then test ST_Area... essentially filtering out the edge cases
before Area is taken.<br>
<br>
and again - the specific fix is dependent upon the specific cause.
<br>
<br>
<blockquote
cite="mid:1485411847.1148068.1424984931438.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:garamond, new york, times, serif;font-size:14px">
<div id="yui_3_16_0_1_1424960459142_164975">
<div id="yui_3_16_0_1_1424960459142_165736" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165810" dir="ltr">Any idea
on a better way to handle this?</div>
<div id="yui_3_16_0_1_1424960459142_165806" dir="ltr"><br>
</div>
<div id="yui_3_16_0_1_1424960459142_165738" dir="ltr">Thanks
for your help! I owe you a beer. :)<br>
</div>
</div>
</div>
</blockquote>
mmm beer<br>
<blockquote
cite="mid:1485411847.1148068.1424984931438.JavaMail.yahoo@mail.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:garamond, new york, times, serif;font-size:14px">
<div id="yui_3_16_0_1_1424960459142_164957"><br>
<div>
<br>
</div>
</div>
<br>
<div id="yui_3_16_0_1_1424960459142_165809" style="font-family:
garamond, new york, times, serif; font-size: 14px;">
<div id="yui_3_16_0_1_1424960459142_165808"
style="font-family: HelveticaNeue, Helvetica Neue,
Helvetica, Arial, Lucida Grande, sans-serif; font-size:
16px;">
<div id="yui_3_16_0_1_1424960459142_165807" dir="ltr">
<hr size="1"> <font face="Arial" size="2"> <b><span
style="font-weight:bold;">From:</span></b> Roxanne
Reid-Bennett <a class="moz-txt-link-rfc2396E" href="mailto:rox@tara-lu.com"><rox@tara-lu.com></a><br>
<b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a> <br>
<b><span style="font-weight: bold;">Sent:</span></b>
Thursday, February 26, 2015 1:16 PM<br>
<b><span style="font-weight: bold;">Subject:</span></b>
Re: [postgis-users] TopologyException: geom is invalid<br>
</font> </div>
<div class="y_msg_container"><br>
<div id="yiv4431106367">
<div>
<div class="yiv4431106367moz-cite-prefix">On 2/26/2015
1:40 PM, Joseph Spenner wrote:<br clear="none">
</div>
<blockquote type="cite">
<div
style="color:#000;background-color:#fff;font-family:garamond,
new york, times, serif;font-size:14px;">
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100383">I
ran the following against all 4 of my GeoJSON
files:</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100261"><br
clear="none">
</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100196">SELECT
ST_IsSimple(ST_GeomFromGeoJSON('@poly'))</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100199">SELECT
ST_IsValid(ST_GeomFromGeoJSON('@poly'))</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100207">SELECT
ST_IsValidDetail(ST_GeomFromGeoJSON('@poly'))</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100215">SELECT
ST_IsValidReason(ST_GeomFromGeoJSON('@poly'))</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100470"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100262">where
@poly contained each one of the following:</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72093"
style="">
<div><br class="yiv4431106367" style=""
clear="none">
</div>
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72042"
style="">
<div><a moz-do-not-send="true" rel="nofollow"
shape="rect" class="yiv4431106367"
id="yiv4431106367yui_3_16_0_1_1424883046678_72073"
style="" target="_blank"
href="http://microflush.org/stuff/json/MN.json">http://microflush.org/stuff/json/MN.json</a></div>
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72075"
style="">
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72099"
style="">
<div><a moz-do-not-send="true" rel="nofollow"
shape="rect" class="yiv4431106367"
id="yiv4431106367yui_3_16_0_1_1424883046678_72112"
style="" target="_blank"
href="http://microflush.org/stuff/json/mnz091.json">http://microflush.org/stuff/json/mnz091.json</a></div>
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72146"
style="">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100536"><br
clear="none">
</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100588"><a
moz-do-not-send="true" rel="nofollow"
shape="rect" class="yiv4431106367"
id="yiv4431106367yui_3_16_0_1_1424883046678_3584"
style="" target="_blank"
href="http://microflush.org/stuff/json/CA.json">http://microflush.org/stuff/json/CA.json</a></div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100531"><a
moz-do-not-send="true" rel="nofollow"
shape="rect" class="yiv4431106367"
id="yiv4431106367yui_3_16_0_1_1424883046678_3337"
style="" target="_blank"
href="http://microflush.org/stuff/json/nwsZone.json">http://microflush.org/stuff/json/nwsZone.json</a></div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100530"><br
clear="none">
</div>
<div class="yiv4431106367"
id="yiv4431106367yui_3_16_0_1_1424960459142_100530"
style=""><br clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100594"
style="">The select returned no error. I
tried to vary the input slightly to make
sure I was using the proper syntax, and was
able to get errors-- such as:</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100772"
style=""><br clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100773"
style="">DBD::Pg::st execute failed: ERROR:
geometry contains non-closed rings<br
class="yiv4431106367" style=""
clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100870"
style=""><br clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100869"
style="">So, it would seem my geoms are ok.</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100823"
style=""><br clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100962"
style="">I've not yet tried the
"ST_MakeValid". But wouldn't the above
indicate they're already valid?</div>
</div>
</div>
</div>
</blockquote>
<br clear="none">
Yes ST_IsValid coming back true means that the
geometry is "valid". (Topology Exceptions are most
often thrown during operations on invalid geometries -
so this test is the first that should be done when one
occurs... in almost all cases)<br clear="none">
<br clear="none">
In my (limited) experience - just because 2 geometries
are valid, doesn't mean that operations on them won't
generate issues. <br clear="none">
<br clear="none">
Is it the cast to Geography, ST_Intersection or the
ST_Area on the ST_Intersection that is throwing the
error?<br clear="none">
My guess is going to be the ST_Area on the results of
the ST_Intersection.<br clear="none">
<br clear="none">
So, is the result of the ST_Intersection of the two
geographies valid?<br clear="none">
<br clear="none">
Have you perhaps looked at all the involved geometries
(since you are down to 4) at the point identified by
the original Topo error in order to understand
exactly what in the makeup of those geometries makes
the error remotely possible within the operation you
are performing on them? <br clear="none">
<br clear="none">
ST_MakeValid and ST_Buffer adjust the geometry in
(frequently insignificant) ways that help operations
avoid Topos. But what adjustment is likely to avoid
the error when using the related valid geometries is
dependent upon the real cause for the error - and that
is specific to the geometries at the point identified
in the error. Whether those manipulations can validly
be applied is dependent upon your business use
tolerance for those adjustments. (buffering a polygon
by 0.00001 will skew calculated area of a polygon but
may not result in false positives for an Intersects).<br
clear="none">
<br clear="none">
Roxanne<br clear="none">
<br clear="none">
<blockquote type="cite">
<div
style="color:#000;background-color:#fff;font-family:garamond,
new york, times, serif;font-size:14px;">
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72075"
style="">
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72146"
style="">
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_101214"
style=""><br clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_101215"
style="">Thanks!</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_101216"
style=""><br class="yiv4431106367" style=""
clear="none">
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100773"
style=""><br class="yiv4431106367" style=""
clear="none">
</div>
</div>
<div class="yiv4431106367" dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424883046678_72146"
style=""><br class="yiv4431106367" style=""
clear="none">
</div>
</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100005"><br
clear="none">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100126">
<br clear="none">
</div>
</div>
<br clear="none">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100129"
style="font-family:garamond, new york, times,
serif;font-size:14px;">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100128"
style="font-family:HelveticaNeue, Helvetica
Neue, Helvetica, Arial, Lucida Grande,
sans-serif;font-size:16px;">
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100127">
<hr
id="yiv4431106367yui_3_16_0_1_1424960459142_101052"
size="1"> <font
id="yiv4431106367yui_3_16_0_1_1424960459142_100130"
face="Arial" size="2"> <b><span
style="font-weight:bold;">From:</span></b>
Joseph Spenner <a moz-do-not-send="true"
rel="nofollow" shape="rect"
class="yiv4431106367moz-txt-link-rfc2396E"
ymailto="mailto:joseph85750@yahoo.com"
target="_blank"
href="mailto:joseph85750@yahoo.com"><joseph85750@yahoo.com></a><br
clear="none">
<b><span style="font-weight:bold;">To:</span></b>
PostGIS Users Discussion <a
moz-do-not-send="true" rel="nofollow"
shape="rect"
class="yiv4431106367moz-txt-link-rfc2396E"
ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank"
href="mailto:postgis-users@lists.osgeo.org"><postgis-users@lists.osgeo.org></a>
<br clear="none">
<b><span style="font-weight:bold;">Sent:</span></b>
Thursday, February 26, 2015 8:05 AM<br
clear="none">
<b
id="yiv4431106367yui_3_16_0_1_1424960459142_100132"><span
id="yiv4431106367yui_3_16_0_1_1424960459142_100131"
style="font-weight:bold;">Subject:</span></b>
Re: [postgis-users] TopologyException:
geom is invalid<br clear="none">
</font> </div>
<div class="yiv4431106367y_msg_container"
id="yiv4431106367yui_3_16_0_1_1424960459142_100143"><br
clear="none">
<div id="yiv4431106367">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100142">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100141"
style="color:#000;background-color:#fff;font-family:garamond,
new york, times,
serif;font-size:14px;">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_30305">Hello,
and thanks for the replies!</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30743">I'll
try those suggestions.</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30742"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30548">Just
curiuos though-- which geometry
seems to be invalid? Is it the
state poly, or the smaller
county/zone poly? If there was an
invalid geometry, wouldn't it always
show up for that state or county?
Here's what I observed for the CA
issue:</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30549"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30550">1)
I had 3 smaller county
poly/geometries in CA. When
performing my query, instead of
returning the 3 polys, I received
the error which I posted in my
original thread. I identified it
was 1 of those 3. I deleted that 1
offending geometry from my table.
After doing so, my query against CA
turned up the remaining 2, with no
errors. So, that leads me to
believe CA is ok. Or is this not a
valid assumption? Perhaps the
location where that offending
intersection would have occurred in
the CA poly has an issue, and it
doesn't get tickled unless the
smaller county zone intersects it?</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30551"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30552">2)
I was able to plot the offending
county described above in the
GeoJSONLint validation page: <a
moz-do-not-send="true"
rel="nofollow" shape="rect"
id="yiv4431106367yui_3_16_0_1_1424960459142_30556"
target="_blank"
href="http://geojsonlint.com/">http://geojsonlint.com/</a></div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30624">
There didn't appear to be any
issues.</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30741"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30732">Thanks!</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30738"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30739">Regards,</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30740">Joseph
Spenner<br clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30604"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30717"><br
clear="none">
</div>
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30603"><br
clear="none">
</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_30552">
</div>
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_30287"><br
clear="none">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_30553">
<br clear="none">
</div>
</div>
<br clear="none">
<div
class="yiv4431106367qtdSeparateBR"><br
clear="none">
<br clear="none">
</div>
<div
class="yiv4431106367yqt4511872611"
id="yiv4431106367yqt77936">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_30746"
style="font-family:garamond, new
york, times,
serif;font-size:14px;">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_30745"
style="font-family:HelveticaNeue,
Helvetica Neue, Helvetica,
Arial, Lucida Grande,
sans-serif;font-size:16px;">
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_30744">
<hr size="1"> <font
id="yiv4431106367yui_3_16_0_1_1424960459142_30747"
face="Arial" size="2"> <b><span
style="font-weight:bold;">From:</span></b> Rémi Cura <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4431106367moz-txt-link-rfc2396E"
ymailto="mailto:remi.cura@gmail.com" target="_blank"
href="mailto:remi.cura@gmail.com"><remi.cura@gmail.com></a><br
clear="none">
<b><span
style="font-weight:bold;">To:</span></b>
PostGIS Users Discussion <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4431106367moz-txt-link-rfc2396E"
ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank"
href="mailto:postgis-users@lists.osgeo.org"><postgis-users@lists.osgeo.org></a>
<br clear="none">
<b><span
style="font-weight:bold;">Cc:</span></b>
Joseph Spenner <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv4431106367moz-txt-link-rfc2396E"
ymailto="mailto:joseph85750@yahoo.com" target="_blank"
href="mailto:joseph85750@yahoo.com"><joseph85750@yahoo.com></a>
<br clear="none">
<b><span
style="font-weight:bold;">Sent:</span></b>
Thursday, February 26, 2015
1:28 AM<br clear="none">
<b><span
style="font-weight:bold;">Subject:</span></b>
Re: [postgis-users]
TopologyException: geom is
invalid<br clear="none">
</font> </div>
<div
class="yiv4431106367y_msg_container"
id="yiv4431106367yui_3_16_0_1_1424960459142_30853"><br clear="none">
<div id="yiv4431106367">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100307">
<div dir="ltr">
<div>
<div>And also
ST_IsSimple (that
precisely check for
self intersection).<br
clear="none">
</div>
Cheers,<br
clear="none">
</div>
Rémi-C<br clear="none">
</div>
<div
class="yiv4431106367gmail_extra"
id="yiv4431106367yui_3_16_0_1_1424960459142_100306"><br clear="none">
<div
class="yiv4431106367gmail_quote"
id="yiv4431106367yui_3_16_0_1_1424960459142_100305">2015-02-26 8:32
GMT+01:00
BladeOfLight16 <span
dir="ltr"><<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
ymailto="mailto:bladeoflight16@gmail.com"
target="_blank"
href="mailto:bladeoflight16@gmail.com">bladeoflight16@gmail.com</a>></span>:<br
clear="none">
<blockquote
class="yiv4431106367gmail_quote"
id="yiv4431106367yui_3_16_0_1_1424960459142_100304" style="margin:0 0 0
.8ex;border-left:1px
#ccc
solid;padding-left:1ex;">
<div
class="yiv4431106367qtdSeparateBR"><br
clear="none">
<br clear="none">
</div>
<div
class="yiv4431106367yqt4173123445"
id="yiv4431106367yqt47029">
<div dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100303">
<div
class="yiv4431106367gmail_extra"
id="yiv4431106367yui_3_16_0_1_1424960459142_100302">
<div
class="yiv4431106367gmail_quote"
id="yiv4431106367yui_3_16_0_1_1424960459142_100301">On Wed, Feb 25, 2015
at 12:14 PM,
Joseph Spenner
<span
dir="ltr"
id="yiv4431106367yui_3_16_0_1_1424960459142_100300"><<a
moz-do-not-send="true" rel="nofollow" shape="rect"
id="yiv4431106367yui_3_16_0_1_1424960459142_100299"
ymailto="mailto:joseph85750@yahoo.com" target="_blank"
href="mailto:joseph85750@yahoo.com">joseph85750@yahoo.com</a>></span>
wrote:<br
clear="none">
<blockquote
class="yiv4431106367gmail_quote"
id="yiv4431106367yui_3_16_0_1_1424960459142_100315" style="margin:0px
0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex;">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100314">
<div
id="yiv4431106367yui_3_16_0_1_1424960459142_100313"
style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:garamond,
new york,
times,
serif;font-size:14px;">DBD::Pg::st
execute
failed:
ERROR: Error
performing
intersection:
TopologyException:
Input geom 1
is invalid:
Self-intersection
at or near
point
-381688.06935935974
-1206669.4272876547
at
-381688.06935935974
-1206669.4272876547
at ./<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
target="_blank"
href="http://test.pl/">test.pl</a> line 151.<br clear="none">
</div>
</div>
</blockquote>
<div><br
clear="none">
</div>
<div>Did you
try ST_IsValid
to verify the
geometry is
valid
according to
the OGC
standard? (See
<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
target="_blank"
href="http://postgis.net/docs/using_postgis_dbmanagement.html#OGC_Validity">http://postgis.net/docs/using_postgis_dbmanagement.html#OGC_Validity</a>.
ST_IsValidDetail
and
ST_IsValidReason
are also
helpful in
this regard.)
What happens
if you run it
through
ST_MakeValid?
Be aware that
ST_MakeValid
can sometimes
result in
GeometryCollections
if the input
shape is
malformed
(usually
"rings"
without enough
points are
that have
different
start and end
points).<br
clear="none">
</div>
</div>
</div>
</div>
</div>
<br clear="none">
_______________________________________________<br clear="none">
postgis-users
mailing list<br
clear="none">
<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
ymailto="mailto:postgis-users@lists.osgeo.org"
target="_blank"
href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br
clear="none">
<a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
target="_blank"
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd93364"><br clear="none">
</div>
</blockquote>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd17184"> </div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd68174"> <br clear="none">
</div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd88026"> </div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd35048"> </div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd94770">
<br clear="none">
<br clear="none">
</div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd35691">
</div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd22823"> </div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd65214"> </div>
</div>
<div
class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd58266"> </div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd29566"> </div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd35233"> </div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd77022"> <br
clear="none">
<br clear="none">
</div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd50507"> </div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd05806"> </div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd86970"> </div>
</div>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd89017"> <br clear="none">
<fieldset
class="yiv4431106367mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
postgis-users mailing list
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv4431106367moz-txt-link-abbreviated" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv4431106367moz-txt-link-freetext" target="_blank" href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></pre>
</div>
</blockquote>
<br clear="none">
<br clear="none">
<pre class="yiv4431106367moz-signature">--
[At other schools] I think the most common fault in general is to teach students how to pass exams instead of teaching them the science.
Donald Knuth</pre>
<div class="yiv4431106367yqt2272743163"
id="yiv4431106367yqtfd29790"> </div>
</div>
</div>
<br>
<div class="yqt2272743163" id="yqtfd27557">_______________________________________________<br
clear="none">
postgis-users mailing list<br clear="none">
<a moz-do-not-send="true" shape="rect"
ymailto="mailto:postgis-users@lists.osgeo.org"
href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br
clear="none">
<a moz-do-not-send="true" shape="rect"
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users"
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></div>
<br>
<br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
[At other schools] I think the most common fault in general is to teach students how to pass exams instead of teaching them the science.
Donald Knuth</pre>
</body>
</html>