--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
|| quote_ident(atopology) || ''.node '' ||
- ''WHERE geom && '' || quote_literal(apoint) || ''::geometry''
- ||'' AND x(geom) = x(''||quote_literal(apoint)||''::geometry)''
- ||'' AND y(geom) = y(''||quote_literal(apoint)||''::geometry)''
+ ''WHERE geom && '' || quote_literal(apoint::text) || ''::geometry''
+ ||'' AND x(geom) = x(''||quote_literal(apoint::text)||''::geometry)''
+ ||'' AND y(geom) = y(''||quote_literal(apoint::text)||''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - coincident node'';
--
FOR rec IN EXECUTE ''SELECT edge_id FROM ''
|| quote_ident(atopology) || ''.edge ''
- || ''WHERE geom && '' || quote_literal(apoint)
- || '' AND intersects(geom, '' || quote_literal(apoint)
+ || ''WHERE geom && '' || quote_literal(apoint::text)
+ || '' AND intersects(geom, '' || quote_literal(apoint::text)
|| '')''
LOOP
RAISE EXCEPTION
IF aface IS NOT NULL THEN
FOR rec IN EXECUTE ''SELECT within(''
- || quote_literal(apoint) || ''::geometry,
+ || quote_literal(apoint::text) || ''::geometry,
topology.ST_GetFaceGeometry(''
|| quote_literal(atopology) || '', '' || aface ||
''))''
IF aface IS NOT NULL THEN
EXECUTE ''INSERT INTO '' || quote_ident(atopology)
|| ''.node(node_id, geom, containing_face)
- VALUES(''||nodeid||'',''||quote_literal(apoint)||
+ VALUES(''||nodeid||'',''||quote_literal(apoint::text)||
'',''||aface||'')'';
ELSE
EXECUTE ''INSERT INTO '' || quote_ident(atopology)
|| ''.node(node_id, geom)
- VALUES(''||nodeid||'',''||quote_literal(apoint)||
+ VALUES(''||nodeid||'',''||quote_literal(apoint::text)||
'')'';
END IF;
--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
|| quote_ident(atopology) || ''.node '' ||
- ''WHERE geom && '' || quote_literal(apoint) || ''::geometry''
- ||'' AND x(geom) = x(''||quote_literal(apoint)||''::geometry)''
- ||'' AND y(geom) = y(''||quote_literal(apoint)||''::geometry)''
+ ''WHERE geom && '' || quote_literal(apoint::text) || ''::geometry''
+ ||'' AND x(geom) = x(''||quote_literal(apoint::text)||''::geometry)''
+ ||'' AND y(geom) = y(''||quote_literal(apoint::text)||''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - coincident node'';
--
FOR rec IN EXECUTE ''SELECT edge_id FROM ''
|| quote_ident(atopology) || ''.edge ''
- || ''WHERE geom && '' || quote_literal(apoint)
- || '' AND intersects(geom, '' || quote_literal(apoint)
+ || ''WHERE geom && '' || quote_literal(apoint::text)
+ || '' AND intersects(geom, '' || quote_literal(apoint::text)
|| '')''
LOOP
RAISE EXCEPTION
-- Update node point
--
EXECUTE ''UPDATE '' || quote_ident(atopology) || ''.node ''
- || '' SET geom = '' || quote_literal(apoint)
+ || '' SET geom = '' || quote_literal(apoint::text)
|| '' WHERE node_id = '' || anode;
RETURN ''Isolated Node '' || anode || '' moved to location ''
-- Check if a coincident node already exists
--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
- || quote_ident(atopology) || ''.node '' ||
- ''WHERE geom && '' || quote_literal(apoint) || ''::geometry''
- ||'' AND x(geom) = x(''||quote_literal(apoint)||''::geometry)''
- ||'' AND y(geom) = y(''||quote_literal(apoint)||''::geometry)''
+ || quote_ident(atopology) || ''.node ''
+ || ''WHERE geom && ''
+ || quote_literal(apoint::text) || ''::geometry''
+ || '' AND x(geom) = x(''
+ || quote_literal(apoint::text) || ''::geometry)''
+ || '' AND y(geom) = y(''
+ || quote_literal(apoint::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - coincident node'';
--
EXECUTE ''INSERT INTO '' || quote_ident(atopology)
|| ''.node(node_id, geom)
- VALUES(''||nodeid||'',''||quote_literal(apoint)||
- '')'';
+ VALUES('' || nodeid || '',''
+ || quote_literal(apoint::text)
+ || '')'';
--
-- Delete the old edge
||'',''||oldedge.next_right_edge
||'',''||oldedge.left_face
||'',''||oldedge.right_face
- ||'',''||quote_literal(edge1)
+ ||'',''||quote_literal(edge1::text)
||'')'';
EXECUTE ''INSERT INTO '' || quote_ident(atopology)
||'',-''||edgeid1
||'',''||oldedge.left_face
||'',''||oldedge.right_face
- ||'',''||quote_literal(edge2)
+ ||'',''||quote_literal(edge2::text)
||'')'';
--
-- Get topology id
SELECT id FROM topology.topology into topoid
WHERE name = atopology;
+ IF topoid IS NULL THEN
+ RAISE EXCEPTION ''No topology % registered'',
+ quote_ident(atopology);
+ END IF;
--
-- Update references in the Relation table.
--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
|| quote_ident(atopology) || ''.node '' ||
- ''WHERE geom && '' || quote_literal(apoint) || ''::geometry''
- ||'' AND x(geom) = x(''||quote_literal(apoint)||''::geometry)''
- ||'' AND y(geom) = y(''||quote_literal(apoint)||''::geometry)''
+ ''WHERE geom && ''
+ || quote_literal(apoint::text) || ''::geometry''
+ ||'' AND x(geom) = x(''
+ || quote_literal(apoint::text) || ''::geometry)''
+ ||'' AND y(geom) = y(''
+ ||quote_literal(apoint::text)||''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - coincident node'';
--
EXECUTE ''INSERT INTO '' || quote_ident(atopology)
|| ''.node(node_id, geom)
- VALUES(''||nodeid||'',''||quote_literal(apoint)||
+ VALUES(''||nodeid||'',''||quote_literal(apoint::text)||
'')'';
--
||'',-''||anedge
||'',''||oldedge.left_face
||'',''||oldedge.right_face
- ||'',''||quote_literal(newedge2)
+ ||'',''||quote_literal(newedge2::text)
||'')'';
--
-- Update the old edge
--
EXECUTE ''UPDATE '' || quote_ident(atopology) || ''.edge_data ''
- || '' SET geom = '' || quote_literal(newedge1)
+ || '' SET geom = '' || quote_literal(newedge1::text)
|| '',''
|| '' next_left_edge = '' || newedgeid
|| '',''
--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
|| quote_ident(atopology) || ''.node ''
- || '' WHERE geom && '' || quote_literal(acurve)
- || '' AND contains('' || quote_literal(acurve)
+ || '' WHERE geom && '' || quote_literal(acurve::text)
+ || '' AND contains('' || quote_literal(acurve::text)
|| '',geom)''
LOOP
RAISE EXCEPTION
--
FOR rec IN EXECUTE ''SELECT * FROM ''
|| quote_ident(atopology) || ''.edge_data
- WHERE geom && '' || quote_literal(acurve) || ''::geometry
- AND intersects(geom, '' || quote_literal(acurve) || ''::geometry)''
+ WHERE geom && '' || quote_literal(acurve::text) || ''::geometry
+ AND intersects(geom, '' || quote_literal(acurve::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - geometry intersects an edge'';
'',''||anothernode||'',''
||(-edgeid)||'',''||edgeid||'',''
||aface||'',''||aface||'',''
- ||quote_literal(acurve)||'')'';
+ ||quote_literal(acurve::text)||'')'';
RETURN edgeid;
--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
|| quote_ident(atopology) || ''.node
- WHERE geom && '' || quote_literal(acurve) || ''::geometry
- AND within(geom, '' || quote_literal(acurve) || ''::geometry)''
+ WHERE geom && '' || quote_literal(acurve::text) || ''::geometry
+ AND within(geom, '' || quote_literal(acurve::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - geometry crosses a node'';
|| quote_ident(atopology) || ''.edge_data ''
|| '' WHERE edge_id != '' || anedge
|| '' AND geom && ''
- || quote_literal(acurve) || ''::geometry ''
+ || quote_literal(acurve::text) || ''::geometry ''
|| '' AND intersects(geom, ''
- || quote_literal(acurve) || ''::geometry)''
+ || quote_literal(acurve::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - geometry intersects an edge'';
-- Update edge geometry
--
EXECUTE ''UPDATE '' || quote_ident(atopology) || ''.edge_data ''
- || '' SET geom = '' || quote_literal(acurve)
+ || '' SET geom = '' || quote_literal(acurve::text)
|| '' WHERE edge_id = '' || anedge;
RETURN ''Edge '' || anedge || '' changed'';
--
FOR rec IN EXECUTE ''SELECT node_id FROM ''
|| quote_ident(atopology) || ''.node
- WHERE geom && '' || quote_literal(acurve) || ''::geometry
- AND within(geom, '' || quote_literal(acurve) || ''::geometry)''
+ WHERE geom && '' || quote_literal(acurve::text) || ''::geometry
+ AND within(geom, '' || quote_literal(acurve::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - geometry crosses a node'';
--
FOR rec IN EXECUTE ''SELECT * FROM ''
|| quote_ident(atopology) || ''.edge_data
- WHERE geom && '' || quote_literal(acurve) || ''::geometry
- AND crosses(geom, '' || quote_literal(acurve) || ''::geometry)''
+ WHERE geom && '' || quote_literal(acurve::text) || ''::geometry
+ AND crosses(geom, '' || quote_literal(acurve::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - geometry crosses an edge'';
FOR rec IN EXECUTE ''SELECT * FROM ''
|| quote_ident(atopology) || ''.edge_data ''
|| '' WHERE ''
- || '' geom && '' || quote_literal(acurve) || ''::geometry ''
+ || '' geom && '' || quote_literal(acurve::text) || ''::geometry ''
|| '' AND ''
|| '' ( (''
|| '' start_node = '' || anode
|| '' start_node = '' || anothernode
|| '' ) )''
|| '' AND ''
- || ''equals(geom,'' || quote_literal(acurve) || ''::geometry)''
+ || ''equals(geom,'' || quote_literal(acurve::text) || ''::geometry)''
LOOP
RAISE EXCEPTION
''SQL/MM Spatial exception - coincident edge'';