END LOOP;
IF count < 2 THEN
- RAISE EXCEPTION
- 'SQL/MM Spatial exception - non-existent node';
+ IF count = 1 AND anode = anothernode THEN
+ RAISE EXCEPTION
+ 'Closed edges would not be isolated, try ST_AddEdgeNewFaces';
+ ELSE
+ RAISE EXCEPTION
+ 'SQL/MM Spatial exception - non-existent node';
+ END IF;
END IF;
'SQL/MM Spatial exception - geometry crosses a node';
END LOOP;
- --
- -- o) Check if curve intersects any other edge
- --
- FOR rec IN EXECUTE 'SELECT * FROM '
- || quote_ident(atopology) || '.edge_data
- WHERE geom && ' || quote_literal(acurve::text) || '::geometry
- AND ST_Intersects(geom, ' || quote_literal(acurve::text) || '::geometry)'
- LOOP
- RAISE EXCEPTION
- 'SQL/MM Spatial exception - geometry intersects an edge';
- END LOOP;
+ --
+ -- o) Check if curve intersects any other edge
+ --
+ FOR rec IN EXECUTE 'SELECT * FROM '
+ || quote_ident(atopology) || '.edge_data
+ WHERE ST_Intersects(geom, ' || quote_literal(acurve::text) || '::geometry)'
+ LOOP
+ RAISE EXCEPTION 'SQL/MM Spatial exception - geometry intersects an edge';
+ END LOOP;
--
-- Get new edge id from sequence
SELECT topology.ST_AddIsoEdge('sqlmm_topology',
5, 6, 'LINESTRING(10 10, 20 10)');
+-- Not isolated edge (shares endpoint with self)
+SELECT topology.ST_AddIsoEdge('sqlmm_topology',
+ 3, 3, 'LINESTRING(5 0, 4 -2, 6 -2, 5 0)');
+
-- Edge intersection (geometry intersects an edge)
SELECT topology.ST_AddIsoEdge('sqlmm_topology',
- 1, 2, 'LINESTRING(0 0, 2 20, 10 0)');
+ 3, 6, 'LINESTRING(5 0, 20 10)');
-- TODO: check closed edge (not-isolated I guess...)
-- on different faces (TODO req. nodes contained in face)
N6|0
ERROR: SQL/MM Spatial exception - not isolated node
ERROR: SQL/MM Spatial exception - not isolated node
-ERROR: SQL/MM Spatial exception - not isolated node
+ERROR: Closed edges would not be isolated, try ST_AddEdgeNewFaces
+ERROR: SQL/MM Spatial exception - geometry intersects an edge
Topology 'sqlmm_topology' dropped