Opened 14 years ago

Closed 13 years ago

#972 closed defect (fixed)

ST_AddIsoEdge - give an error if containing_face is zero

Reported by: aperi2007 Owned by: strk
Priority: medium Milestone: PostGIS 2.0.0
Component: topology Version: master
Keywords: Cc:

Description

Hi, following the ticket http://trac.osgeo.org/postgis/ticket/971

if the containing_face of node table is set to zero the ST_AddIsoEdge don't work correctly and report an error.

the example is this:

select topology.DropTopology('topo_test2');
select topology.CreateTopology('topo_test2',3003);

select topology.ST_AddIsoNode('topo_test2',NULL,ST_GeomFromEWKT('SRID=3003;POINT(1 4)'));
select topology.ST_AddIsoNode('topo_test2',NULL,ST_GeomFromEWKT('SRID=3003;POINT(2 2)'));
select topology.ST_AddIsoNode('topo_test2',NULL,ST_GeomFromEWKT('SRID=3003;POINT(6 4)'));
select topology.ST_AddIsoNode('topo_test2',NULL,ST_GeomFromEWKT('SRID=3003;POINT(4 7)'));
select topology.ST_AddIsoNode('topo_test2',NULL,ST_GeomFromEWKT('SRID=3003;POINT(4 4)'));

update topo_test2.node set containing_face = 0;


select topology.ST_AddIsoEdge('topo_test2',
    topology.GetNodeByPoint('topo_test2', ST_GeomFromEWKT('SRID=3003;POINT(1 4)'), 0),
    topology.GetNodeByPoint('topo_test2', ST_GeomFromEWKT('SRID=3003;POINT(2 2)'), 0),
    ST_GeomFromEWKT('SRID=3003;LINESTRING(1 4, 2 2)')
);

the last select report this error:

ERROR: operator does not exist: ! boolean

Change History (3)

comment:1 by aperi2007, 14 years ago

I see the code of ST_AddIsoEdge.

I guess the error is due to the ST_GetFaceGeometry as report in the ticket #973.

The error is in this piece of code:

		FOR rec IN EXECUTE 'SELECT topology.ST_GetFaceGeometry('
			|| quote_literal(atopology) ||
			',' || aface || ') as face'
		LOOP
			face := rec.face;
		END LOOP;

		--
		-- Check acurve to be within face
		--
**HERE** -->	IF ! ST_Within(acurve, face) THEN
	RAISE EXCEPTION
	'SQL/MM Spatial exception - geometry not within face.';
		END IF;


Because the ST_GetFaceGeometry return a record with a NULL geometry when the FACE is the UniverseFace (idface=0) the ST_Within(acurve, face) give an error.

comment:2 by aperi2007, 13 years ago

I commit a patch to resolve this in the ticket #971.

http://trac.osgeo.org/postgis/attachment/ticket/971/patch_topology.zip

comment:3 by strk, 13 years ago

Resolution: fixed
Status: newclosed

This was fixed by r7211

Note: See TracTickets for help on using tickets.