Schema
Owner
postgres
Descriptions
args: atopology, anode - Returns an ordered set of edges incident to the given node.
Options
Option | Value |
---|---|
Returns |
Set of topology.getfaceedges_returntype |
Language |
|
Parameters |
atopology varchar anode integer |
Definition
CREATE OR REPLACE FUNCTION topology.getnodeedges (
atopology varchar,
anode integer
)
RETURNS SETOF topology.getfaceedges_returntype AS
$span$
DECLARE
curedge int;
nextedge int;
rec RECORD;
retrec topology.GetFaceEdges_ReturnType;
n int;
sql text;
BEGIN
n := 0;
sql :=
'WITH incident_edges AS ( SELECT edge_id, start_node, end_node, ST_RemoveRepeatedPoints(geom) as geom FROM '
|| quote_ident(atopology)
|| '.edge_data WHERE start_node = ' || anode
|| ' or end_node = ' || anode
|| ') SELECT edge_id, ST_Azimuth(ST_StartPoint(geom), ST_PointN(geom, 2)) as az FROM incident_edges WHERE start_node = ' || anode
|| ' UNION ALL SELECT -edge_id, ST_Azimuth(ST_EndPoint(geom), ST_PointN(geom, ST_NumPoints(geom)-1)) FROM incident_edges WHERE end_node = ' || anode
|| ' ORDER BY az';
FOR rec IN EXECUTE sql
LOOP -- incident edges {
n := n + 1;
retrec.sequence := n;
retrec.edge := rec.edge_id;
RETURN NEXT retrec;
END LOOP; -- incident edges }
END
$span$
LANGUAGE 'plpgsql'
STABLE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100 ROWS 1000;
COMMENT ON FUNCTION topology.getnodeedges(atopology varchar, anode integer)
IS 'args: atopology, anode - Returns an ordered set of edges incident to the given node.';
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 07/12/2018 13:23 |