[postgis-users] Create points with a geoserver WFS-T

Daniel Grum daniel.grum at unibw.de
Mon Nov 30 02:01:21 PST 2009


Hi,

I want to create points(buildings) with a WFS-T in mapbender and before 
this was done there must be the possibility to control if there is 
another point-(building) or linestring-(water) geometry around the 
point...if there is another geometry the WFT-T should stop and write an 
ERROR message: "You are not able to create a point(building) there!"
New points were digitized,with digitize tool in mapbender, but it don't 
control if there is a point/line at this area where the new point will 
be digitized!

Do I have to create a PostGIS SQL script to stop the digitizing of an 
new point?
I found the "mod_digitize_messages.php" whre I can create massages for 
several actions, but I don't know how I can create the "control-action" 
that control if there is a point in a defined area or not?!

Later I want to create a similar trigger function that control if the 
user have enough ressources to build the new building-->so this trigger 
function have to work at first!

I wrote this in the mapbender mailing list too, with now answer yet!

Are there any ideas??

The triggerfuntion I used for this now is:

"CREATE OR REPLACE FUNCTION my_trigger_function() RETURNS trigger AS
 $$
   DECLARE
    -- declare variables
      current_row RECORD;
   BEGIN
    -- get all existing geometries which intersect the new geometry 
NEW.the_geom
    -- around the new geometry is a buffer of 50 meters (or whatever 
your unit is)
      FOR current_row IN
      SELECT *
      FROM public.holzfaeller t, public.erzmine e, public.wohnhaus w, 
public.steinbruch s, public.kaserne k, public.saegerwerk r
      WHERE     ST_Intersects(ST_Buffer(NEW.the_geom, 50),t.the_geom) AND
        ST_Intersects(ST_Buffer(NEW.the_geom, 50),e.the_geom) AND
        ST_Intersects(ST_Buffer(NEW.the_geom, 50),w.the_geom) AND
        ST_Intersects(ST_Buffer(NEW.the_geom, 50),s.the_geom) AND
        ST_Intersects(ST_Buffer(NEW.the_geom, 50),k.the_geom) AND
        ST_Intersects(ST_Buffer(NEW.the_geom, 50),r.the_geom)

        LOOP
           -- intersection found
    RAISE EXCEPTION 'my error message';
    END LOOP;

    -- no intersection, new geometry will be inserted
      RETURN NEW;
   END;
 $$ LANGUAGE 'plpgsql';

And in every table-->holzfaeller, erzmine .... there is a trigger:

"CREATE TRIGGER my_trigger
  BEFORE INSERT OR UPDATE
  ON holzfaeller
  FOR EACH ROW
  EXECUTE PROCEDURE my_trigger_function();"

I get this with the help of an other mapbender user!
But what can be the variable "NEW" in the trigger function -->Where come 
this from, Where was this defined?

Please help me, every idea can bring me to the solution.

--daniel



More information about the postgis-users mailing list