Ticket #1955 (closed defect: fixed)
Exception when 2 edges passed to ST_ModEdgeHeal() that are attached to the same 2 nodes
| Reported by: | wimned | Owned by: | strk |
|---|---|---|---|
| Priority: | medium | Milestone: | PostGIS 2.0.2 |
| Component: | topology | Version: | 2.0.x |
| Keywords: | Cc: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

