Opened 14 years ago

Closed 14 years ago

#781 closed defect (fixed)

topology: wrong result when add an edge intersecting a face.

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

Description

I try this code:


DROP SCHEMA IF EXISTS schema_out CASCADE; CREATE SCHEMA schema_out AUTHORIZATION dbtopowrite; -- DROP TABLE IF EXISTS SCHEMA_OUT.TEST; CREATE TABLE SCHEMA_OUT.TEST(ID INTEGER PRIMARY KEY, CODICE TEXT); SELECT topology.DropTopology('schema_topo'); SELECT topology.CreateTopology('schema_topo',3003, 0.00005); SELECT topology.AddTopoGeometryColumn('schema_topo', 'schema_out', 'test', 'topo_line', 'LINE'); -- select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(1 4, 4 4)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(1 4, 4 7)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(4 7, 6 9)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(2 2, 4 4)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(4 4, 5 5, 6 6)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(6 6, 6 9)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(6 9, 10 3)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(10 3, 10 9)')); select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(10 9, 12 1)'));

-- questo nodo dovrebbe essere un errore perche' viene aggiunto sulla intersezione di un edge select topology.AddNode('schema_topo',ST_GeomFromEWKT('SRID=3003;POINT(5 5)')); select topology.AddFace('schema_topo',ST_GeomFromEWKT('SRID=3003;POLYGON((1 4, 6 9, 6 6, 5 5, 4 4, 1 4))')); --

I have a face: I can see the geometry with this sql: select st_astext(topology.st_getfacegeometry('schema_topo',1));

POLYGON((4 4,1 4,4 7,6 9,6 6,5 5,4 4))

But is I add another edge intersecting the face: select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(4 7, 4 4)'));

and after see the geometry of the face: I see again: POLYGON((4 4,1 4,4 7,6 9,6 6,5 5,4 4))

I think this is wrong. It must be generate an exception or (better) split the face in two faces.

Change History (7)

comment:1 by robe, 14 years ago

Component: postgistopology
Owner: changed from pramsey to strk

comment:2 by aperi2007, 14 years ago

like the ticket #780.

The right action could be give an exception.

comment:3 by strk, 14 years ago

Not sure I got it right (it's late here). Are you basically adding an edge that splits a face but goes from a node to another ?

That's a case I haven't indeed considered for AddEdge. The use case that drove AddEdge/AddFace was one by which you wouldn't have registered any face at the time of edge addition.

A balance should be found between validity and speed. Checking everything would have a big impact on performance. This is pretty much like forcing an ST_IsValid check on geometries, only more expensive...

Note that AddEdge never attempts at defining faces. Even adding a closed edge produces no face (altought it theoretically should).

comment:4 by aperi2007, 14 years ago

Not sure I got it right (it's late here). Are you basically adding an edge that splits a face but goes from a node to another ?

peehaps there are some wrong action due to the ticket #780. I must recheck it.

However I understand your use case. Perhaps the correct action is to define all the edge before to start to registering the faces. Adding an edge between some addFace could give some unpredictable results.

comment:5 by strk, 14 years ago

Correct, you shouldn't use AddEdge if faces are defined. Maybe we could have AddEdge check this prerequisite. Should be a quick check.

in reply to:  5 comment:6 by aperi2007, 14 years ago

Replying to strk:

Correct, you shouldn't use AddEdge if faces are defined. Maybe we could have AddEdge check this prerequisite. Should be a quick check.

+1

comment:7 by strk, 14 years ago

Resolution: fixed
Status: newclosed

Check added as of r6670

Note: See TracTickets for help on using tickets.