[postgis-tickets] [PostGIS] #2007: topogeo_addlinestring: error - geometry intersects edge

PostGIS trac at osgeo.org
Wed Jul 24 03:19:16 PDT 2013


#2007: topogeo_addlinestring: error - geometry  intersects edge
-------------------------------+--------------------------------------------
 Reporter:  amartin            |       Owner:  strk         
     Type:  defect             |      Status:  new          
 Priority:  medium             |   Milestone:  PostGIS 2.0.4
Component:  topology           |     Version:  2.0.x        
 Keywords:  linestring, order  |  
-------------------------------+--------------------------------------------
Changes (by amartin):

 * cc: amartin (added)


Comment:

 Just found another example of the ''topogeo_addlinestring: error -
 geometry intersects edge'' error.

 I this case minimum distance between points is > topology tolerance.

 The offending geometries are (SRID: 25830)

 {{{
 MULTIPOLYGON(((308602.91 4614696.3,308609.22 4614708.19,308619.74
 4614723.97,308630.98 4614746.21,308636.76 4614764.04,308641.05
 4614779.52,308652.12 4614791.86,308670.07 4614797.76,308686.51
 4614795.59,308699.72 4614771.95,308710.27 4614752.2,308602.91 4614696.3)))
 }}}

 and

 {{{
 MULTILINESTRING((308609.32 4614708.34,308609.22 4614708.19,308619.74
 4614723.97,308630.98 4614746.21,308636.76 4614764.04,308641.05
 4614779.52,308652.12 4614791.86,308670.07 4614797.76,308686.51
 4614795.59,308699.72 4614771.95,308710.27 4614752.2),(308710.27
 4614752.2,308609.32 4614708.34))
 }}}

 Test case:
 {{{
 SELECT CreateTopology('test_topo', 25830, 0.01);
 SELECT AddTopoGeometryColumn('test_topo', 'public', 'test_lines', 'geom',
 'LINE'); -- 1
 SELECT AddTopoGeometryColumn('test_topo', 'public', 'test_polygons',
 'geom', 'POLYGON'); -- 2


 SELECT ToTopoGeom (st_geomfromtext('MULTIPOLYGON(((308602.91
 4614696.3,308609.22 4614708.19,308619.74 4614723.97,308630.98
 4614746.21,308636.76 4614764.04,308641.05 4614779.52,308652.12
 4614791.86,308670.07 4614797.76,308686.51 4614795.59,308699.72
 4614771.95,308710.27 4614752.2,308602.91 4614696.3)))', 25830),
 'test_topo', 2, 0.01);
 WITH
   inp as (SELECT st_geomfromtext('MULTILINESTRING((308609.32
 4614708.34,308609.22 4614708.19,308619.74 4614723.97,308630.98
 4614746.21,308636.76 4614764.04,308641.05 4614779.52,308652.12
 4614791.86,308670.07 4614797.76,308686.51 4614795.59,308699.72
 4614771.95,308710.27 4614752.2),(308710.27 4614752.2,308609.32
 4614708.34))', 25830) as g),
   topo as (SELECT ToTopoGeom(g, 'test_topo', 1, 0.01) as t FROM inp)
   SELECT st_astext(t) from topo ;
 }}}

 test fails with error on both postgis 2.0.2 & 2.0.3

 {{{
 ERROR:  Spatial exception - geometry intersects edge 2
 CONTEXT:  PL/pgSQL function topogeo_addlinestring(character
 varying,geometry,double precision) line 124 at assignment
 PL/pgSQL function totopogeom(geometry,character varying,integer,double
 precision) line 100 at FOR over SELECT rows
 }}}

 Topology tolerance = 0.01

 Minimum distance between any two points on both geometries =
 0.180277563327628

 {{{
 with
   inp1 as ( select st_geomfromtext('MULTIPOLYGON(((308602.91
 4614696.3,308609.22 4614708.19,308619.74 4614723.97,308630.98
 4614746.21,308636.76 4614764.04,308641.05 4614779.52,308652.12
 4614791.86,308670.07 4614797.76,308686.51 4614795.59,308699.72
 4614771.95,308710.27 4614752.2,308602.91 4614696.3)))', 25830) as g ),
   inp2 as (select  st_geomfromtext('MULTILINESTRING((308609.32
 4614708.34,308609.22 4614708.19,308619.74 4614723.97,308630.98
 4614746.21,308636.76 4614764.04,308641.05 4614779.52,308652.12
 4614791.86,308670.07 4614797.76,308686.51 4614795.59,308699.72
 4614771.95,308710.27 4614752.2),(308710.27 4614752.2,308609.32
 4614708.34))', 25830) as g),
   inp as (select st_collect(inp1.g, inp2.g) as g from inp1, inp2),
   d as ( select (st_dumppoints(g)).* from inp ),
   dist as (  select st_distance(a.geom,b.geom) as distance from d a, d b
   where b.path[1] > a.path[1] )
   select min(distance) from dist where distance > 0;
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2007#comment:8>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list