[postgis-users] postgis topology question

Fred Lehodey lehodey at gmail.com
Wed Jan 27 02:53:32 PST 2010


Hi,
you can do this using triggers.
Try something like that:



------1  Create a function that return a Trigger ::
CREATE OR REPLACE FUNCTION your_trigger() RETURNS TRIGGER as $$
BEGIN
    IF (TG_OP = 'UPDATE') THEN

        UPDATE your_edge_table SET the_geom =
st_makeline(NEW.the_geom,ST_Endpoint(the_geom))
        WHERE ST_DWithin(ST_Startpoint(the_geom),OLD.the_geom,0.0001);

        UPDATE your_edge_table SET the_geom =
st_makeline(ST_Startpoint(the_geom),NEW.the_geom)
        WHERE ST_DWithin(ST_Endpoint(the_geom),OLD.the_geom,0.0001);

            RETURN NEW;
        END IF;
        RETURN NULL;
END;

$$
language "plpgsql" volatile


----------------------------------------------------2  CREATE TRIGGER
CREATE TRIGGER zz_trig_luz
AFTER UPDATE ON your_node_table
    FOR EACH ROW EXECUTE PROCEDURE your_trigger();



Fred...







On Wed, Jan 27, 2010 at 7:07 AM, Absurd <programmerszp at gmail.com> wrote:

>
> Hi. I’m trying to use postgis topology. And I have a question.
> I have 3 nodes N1, N2, N3 and 2 edges E1 (with start_node = N1; end_node =
> N2) and E2 (with start_node = N2; end_node = N3). I want to move node N2.
> Do I have to select all edges, connected to node N2 (E1 and E2) and change
> their geometry too or there is such functionality in postgis topology?
>
> --
> View this message in context:
> http://old.nabble.com/postgis-topology-question-tp27334914p27334914.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100127/db20d12f/attachment.html>


More information about the postgis-users mailing list