<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Dear all,A trying to write a trigger that would automatically create lines joining points in the sequence in which i insert them. <BR>
If I insert point AA then BB then CC, i want lines drawn as AA-BB & BB-CC, Using the trigger below lines are drawn ( atleast i can see the gid in table links) without the geometry. May anyone advise me on this.<BR>
Thank you<BR>
CREATE OR REPLACE FUNCTION insert_new_links() RETURNS "trigger"<BR>
 AS 'DECLAREstartpoint geometry;  <BR>
endpoint geometry;<BR>
BEGIN<BR>
startpoint = asEWKT(NEW.the_geom)  WHERE NEW.<FONT face="">gid</FONT> = NEW.gid;<BR>
endpoint = asEWKT(NEW.the_geom) WHERE NEW.<FONT face="">gid</FONT> = NEW.gid+1;<BR>
INSERT INTO links(the_geom)VALUES(MakeLine(startpoint, endpoint ));<BR>
RETURN NEW;<BR>
 END' LANGUAGE plpgsql; <BR>
CREATE OR  TRIGGER <FONT face="">insert_new_links_insert</FONT>    <BR>
BEFORE INSERT ON nodes  <BR>
FOR EACH ROW    <BR>
EXECUTE PROCEDURE insert_new_links();<BR><BR>Broun Uganda<BR><BR><BR><br /><hr />Live Earth is coming.  Learn more about the hottest summer event - only on MSN. <a href='http://liveearth.msn.com?source=msntaglineliveearthwlm' target='_new'>Check it out!</a></body>
</html>