[postgis-users] FW: Points and lines

Tuomas Ruohonen illurt at hotmail.com
Thu Sep 17 01:44:22 PDT 2009


Hi all,

I have tried many different ways and i am not getting success.

Lets think that i am inserting rows to table and in table there is column the_geom, my insert sentence has lon and lat,
so everytime i insert into table this trigger is fired and it is doing points from lon and lat. In trigger i have now statement that FOR EACH STATEMENT execute...
But querys are still too slow (inserting like 200 rows), if i am doing that point upgrading by manually it is very fast. Should be something like the_geom = NEW.the_geom...
What i should do ?

From: illurt at hotmail.com
To: postgis-users at postgis.refractions.net
Subject: RE: [postgis-users] Points and lines
Date: Tue, 8 Sep 2009 13:16:35 +0300








Hi,

Lets think that i am inserting only rows to table, not updating any data.
These NEW and OLD pseudos are still helping me ?

Br.
Tuomas

> Date: Tue, 8 Sep 2009 10:17:58 +0100
> From: mark.cave-ayland at siriusit.co.uk
> To: postgis-users at postgis.refractions.net
> Subject: Re: [postgis-users] Points and lines
> 
> Tuomas Ruohonen wrote:
> 
> > What is wrong in my function, it doesnt stop or should it take so 
> > loooong... ? Minutes... Trying to insert to lines in table
> > 
> > CREATE OR REPLACE FUNCTION make_point() RETURNS TRIGGER AS $start_point$
> >     BEGIN
> >    
> >       UPDATE positionreports SET the_geom = SetSRID(st_makepoint
> >     ("longitude","latitude"), 4326);
> > 
> >         RETURN NULL; -- result is ignored since this is an AFTER trigger
> >     END;
> > $start_point$ LANGUAGE plpgsql;
> > 
> > CREATE TRIGGER start_point
> > AFTER INSERT OR UPDATE ON positionreports
> >     FOR EACH ROW EXECUTE PROCEDURE make_point();
> 
> Look carefully at your stored procedure - you're updating the contents 
> of the entire table every time someone modifies a single row.
> 
> Take a look at the documentation here: 
> http://www.postgresql.org/docs/8.4/interactive/plpgsql-trigger.html. You 
> should be using the NEW and OLD pseudotypes to change to contents of a 
> single row.
> 
> 
> HTH,
> 
> Mark.
> 
> -- 
> Mark Cave-Ayland - Senior Technical Architect
> PostgreSQL - PostGIS
> Sirius Corporation plc - control through freedom
> http://www.siriusit.co.uk
> t: +44 870 608 0063
> 
> Sirius Labs: http://www.siriusit.co.uk/labs
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

Jaa muistosi verkossa haluamiesi henkilöiden kanssa haluamiesi henkilöiden kanssa.
_________________________________________________________________
Windows puhelimella saat enemmän vastinetta rahoillesi.
http://www.windowsmobile.fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090917/8268b403/attachment.html>


More information about the postgis-users mailing list