--
-- g) Check if curve crosses any node
- -- _within_ used to let endpoints out
--
- FOR rec IN EXECUTE 'SELECT node_id FROM '
- || quote_ident(atopology) || '.node
- WHERE ST_Within(geom, ' || quote_literal(acurve::text) || '::geometry)'
+ FOR rec IN EXECUTE
+ 'SELECT node_id, ST_Relate(geom, '
+ || quote_literal(acurve::text) || '::geometry, 2) as relate FROM '
+ || quote_ident(atopology)
+ || '.node WHERE geom && '
+ || quote_literal(acurve::text)
+ || '::geometry'
LOOP
- RAISE EXCEPTION
- 'SQL/MM Spatial exception - geometry crosses a node';
+ IF ST_RelateMatch(rec.relate, 'T********') THEN
+ RAISE EXCEPTION 'SQL/MM Spatial exception - geometry crosses a node';
+ END IF;
END LOOP;
--
|| ' SET geom = ' || quote_literal(acurve::text)
|| ' WHERE edge_id = ' || anedge;
+ --
+ -- TODO: Check if we need to update linking
+ -- We do if:
+ -- o edge is closed and we changed direction)
+ -- o edge moved to another face
+ --
+
RETURN 'Edge ' || anedge || ' changed';
END
SELECT topology.ST_ChangeEdgeGeom('city_data', 5,
'LINESTRING(41 40, 49 40, 49 34, 57 33)');
--- TODO: test changing closed edge
+-- Change a closed edge
+SELECT topology.ST_ChangeEdgeGeom('city_data', 26,
+ 'LINESTRING(4 31, 7 31, 4 34, 4 31)');
+
-- TODO: test reverse direction of closed edge
SELECT topology.DropTopology('city_data');