[postgis-users] Points and lines

Paragon Corporation lr at pcorp.us
Mon Sep 7 07:23:28 PDT 2009


Tuomas,
 
I think you answered your own question.  You need a trigger on you your
point table that updates your line table.
 
As Mike already mentioned in a separate thread -- check here
You need to make a common trigger procedure in (for example) PL/pgSQL that
does the update on column X (i.e., NEW.X). See:

http://www.postgresql.org/docs/current/interactive/plpgsql-trigger.html 


http://www.postgresql.org/docs/current/interactive/triggers.html 

 
So a insert/update trigger on point that updates the corresponding line
record.  


Alternatively you could just build a view against your point table that
constructs a line as needed and get rid of your line table.  You would use
the ST_MakeLine aggregate function for that.

http://postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html 


Depending on the size of your dataset and number of points in each line,
that could be prohibitively slow.

So for example frequently updated point data -- the trigger may be really
slow during updates
Frequently read data -- the view could be slower -- but you don't pay the
trigger penalty.
 
Leo
 
 

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Tuomas
Ruohonen
Sent: Monday, September 07, 2009 6:00 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Points and lines


Hi,

I have this kind of problem that i have 2 tables, another has point data and
another has line data that comes from points. Everything is okay, i see
lines etc.
Now I need trigger or function or ... cause everytime that new point comes
to table i need to update my lines table also that table shows the latest
point in line also.
I hope that you understand what i mean :)
Tell me different kind of options that I have that I can make this work...
Thanks for everybody !!

-Tuomas


________________________________

Uusi Spaces ja 25 Gt ilmaista SkyDrive tallennustilaa. Lataa Live paketti.
<http://www.download.live.com/>  





More information about the postgis-users mailing list