#788 closed defect (invalid)
Topology: ST_NewEdgesSplit don't work with more edges connected
Reported by: | aperi2007 | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.0.0 |
Component: | topology | Version: | master |
Keywords: | Cc: |
Description
Hi, I find a strange bug.
Starting from an empty topology: 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');
This code sql is working:
select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(1 4, 2 5, 3 5, 4 7)'));
select topology.ST_newedgesSplit('schema_topo',1, ST_GeomFromEWKT('SRID=3003;POINT(3 5)'));
but if the edge is connected to another edge. The code don't work.
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, 2 5, 3 5, 4 7)'));
select topology.ST_newedgesSplit('schema_topo',1, ST_GeomFromEWKT('SRID=3003;POINT(3 5)'));
giving this error:
ERROR: SQL/MM Spatial exception - point not on edge
I use the r6670 version of postgis trunk.
Change History (5)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
yes,
another test confirm this:
select topology.ST_newedgesSplit('schema_topo',1, ST_GeomFromEWKT('SRID=3003;POINT(3 5)'));
work only on the first edge added to the topology.
comment:3 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The second parameter you pass to ST_NewEdgesSplit is the edge identifier. By using '1' you're asking it to split edge number 1, which in your case is likely the one NOT containing POINT(3 5). Try using '2', or even better, whatever AddEdge returned
comment:4 by , 14 years ago
Strk,
doesn't ST_NewEdgesSplit always delete the original edge and create 2 new ones. (We would use ST_ModEdgeSplit (for the other behavior).
In which case shouldn't passing edge number 1 in again return a non-existent edge error.
That was my understanding scanning the code you have and also corroborating with the SQL-MM doc I mentioned earlier. Or do we just have a dangling record somewhere.
Can you verify I documented this right?
http://www.postgis.org/documentation/manual-svn/ST_NewEdgesSplit.html
comment:5 by , 14 years ago
@robe: yes, after you "NewEdgesSplit"ed an edge, that edge shouldn't exist anymore. Would be nice to have a regression testcase for this one, considering all cases. And including the rearranging of faces eventually defined by the given edge.
Hi have more information.
If instead of
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, 2 5, 3 5, 4 7)'));
select topology.ST_newedgesSplit('schema_topo',1, ST_GeomFromEWKT('SRID=3003;POINT(3 5)'));
I exchange the order of the first two addEdge
select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(1 4, 2 5, 3 5, 4 7)'));
select topology.AddEdge('schema_topo',ST_GeomFromEWKT('SRID=3003;LINESTRING(1 4, 4 4)'));
select topology.ST_newedgesSplit('schema_topo',1, ST_GeomFromEWKT('SRID=3003;POINT(3 5)'));
The work work !
Perhaps it work only on the first edge of the table ?