[geos-devel] [GEOS] #1036: GeomDifference with Overlay turned on goes into infinite look in PostGIS ST_WrapX

GEOS geos-trac at osgeo.org
Thu Jul 30 09:50:19 PDT 2020


#1036: GeomDifference with Overlay turned on goes into infinite look in PostGIS
ST_WrapX
------------------------+--------------------------
 Reporter:  robe        |      Owner:  geos-devel@…
     Type:  defect      |     Status:  new
 Priority:  blocker     |  Milestone:  3.9.0
Component:  Default     |    Version:  master
 Severity:  Unassigned  |   Keywords:
------------------------+--------------------------
 This is related to https://trac.osgeo.org/postgis/ticket/4731.
 Which after much input has been determined to be an issue with the new
 GEOS 3.9 overlay logic.

 The crashing example in PostGIS


 {{{
 SELECT ST_WrapX('LINESTRING(-11.1111111 70,70 -11.1111111)'::geometry,
 20.1,20.1);
 }}}

 Related IRC discussion


 {{{
 15:30:30        Algunenano:     ReginaObe[m]: WrapX uses split by line,
 which uses GEOSUnion
 15:30:39        Algunenano:     Maybe it's that?
 15:30:57        ReginaObe[m]:   ah Algunenano so I guess we got to update
 the docs too to reflect it uses GEOS
 15:31:14        ReginaObe[m]:   who would have thunk it :)
 15:31:37        PaulRamsey[m]:  you have a winner, it crashed for me too
 15:31:42        ReginaObe[m]:   Paul Ramsey: well that's a crasher
 15:33:19        PaulRamsey[m]:  It does eventually call GEOSDifference
 15:33:28        PaulRamsey[m]:  after 25000 frames of recursion?
 15:33:41        PaulRamsey[m]:  I mean, something non-geos broken in
 there?
 15:33:48        PaulRamsey[m]:  weird
 15:36:20        PaulRamsey[m]:  probably in ` split =
 lwgeom_split(geom_in, blade);`
 15:36:34        Algunenano:     It looks like an infinite loop. Has the
 geometry type changed? Maybe line -> multiline?
 15:38:35        Algunenano:     It seems that, for some reason,
 lwgeom_split_wrapx calls lwcollection_wrapx over the result, so it it
 returns a multiline (with a single line) it might be going to infinity and
 beyond
 15:39:34        PaulRamsey[m]:  yeah, not sure why it tries to wrap the
 components of the split...
 15:39:50        PaulRamsey[m]:  but if the components were slightly
 shifted, like enough to hit the blade again
 15:39:57        PaulRamsey[m]:  it would split over and over and over
 15:45:54        ReginaObe[m]:   Hmm ST_Split also doesn't note dependency
 on GEOS
 15:46:09        ReginaObe[m]:   which version of GEOS are required for
 these
 15:46:35        PaulRamsey[m]:  it uses difference, so pretty much all of
 them
 15:47:06        PaulRamsey[m]:  once martin implements a splitter over the
 new overlay all the splitting code can get simpler and more reliable..
 right now it's a hack on difference
 15:49:35        PaulRamsey[m]:  found it, @algunano
 }}}


 {{{
 15:49:35        PaulRamsey[m]:  found it, @algunano

 select st_astext(st_difference('LINESTRING(-11.1111111 70,70
 -11.1111111)'::geometry, 'LINESTRING (20.1 90, 20.1 -90)'::geometry));
                          st_astext
 -----------------------------------------------------------
  LINESTRING(-11.1111111 70,20.1 38.7888889,70 -11.1111111)
 (1 row)
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/geos/ticket/1036>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list