[postgis-devel] [PostGIS] #1955: Exception when 2 edges passed to ST_ModEdgeHeal() that are attached to the same 2 nodes

PostGIS trac at osgeo.org
Fri Aug 17 05:37:25 PDT 2012


#1955: Exception when 2 edges passed to ST_ModEdgeHeal() that are attached to the
same 2 nodes
----------------------+-----------------------------------------------------
 Reporter:  wimned    |       Owner:  strk         
     Type:  defect    |      Status:  new          
 Priority:  medium    |   Milestone:  PostGIS 2.1.0
Component:  topology  |     Version:  trunk        
 Keywords:            |  
----------------------+-----------------------------------------------------
 exception: 'SQL/MM Spatial exception - other edges connected (ie: 3)'
 raised when following code is executed:

 {{{
 CREATE OR REPLACE FUNCTION testerror1()
  returns void as
 $$
     declare geom0 geometry;
     declare geom1 geometry;
     declare node_rec RECORD;
 begin
     raise notice 'version: %', postgis_full_version();

     perform CreateTopology('wimpy', 4326);

     geom0 = ST_GeometryFromText(
         'POLYGON((0 0,0 1,1 1,1 0,0 0))',4326);

     geom1 = ST_GeometryFromText(
         'POLYGON((2 0,1 1,3 1,3 0,2 0))',4326);


     perform topogeo_AddPolygon('wimpy', geom0);
     perform topogeo_AddPolygon('wimpy', geom1);
     for node_rec in select node_id from node
     loop
         perform cleanse_node(node_rec.node_id);
     end loop;
 END
 $$
 LANGUAGE plpgsql;

 CREATE OR REPLACE FUNCTION cleanse_node(passed_node_id integer)
   returns void AS
 $$
   DECLARE edge_rec RECORD;
   DECLARE edge0 integer;
   DECLARE edge1 integer;
   DECLARE count integer;
 BEGIN
     --raise notice 'check node %', passed_node_id;
     edge0 = 0;
     edge1 = 0;
     count = 0;
     for edge_rec in
          ( select t.edge from
             GetNodeEdges('wimpy', passed_node_id) as t(seq,edge))
     loop
         if count = 0
         then
             edge0 = abs(edge_rec.edge);
         end if;
         if count = 1
         then
             edge1 = abs(edge_rec.edge);
         end if;
         count = count + 1;
     end loop;
     if count = 2 and edge0 != edge1
     then
         raise notice 'remove node %', passed_node_id;
         perform ST_ModEdgeHeal('wimpy', edge0, edge1);
     end if;
 END
 $$
 }}}

 The node at (1 1) is chosen, while the one at (0 0) has to be removed.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1955>
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-devel mailing list