[Mapbender-users] Create points with a geoserver WFS-T
Daniel Grum
daniel.grum at unibw.de
Mon Nov 30 09:37:34 EST 2009
Daniel Grum schrieb:
> 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 postgis mailing list too, with now answer!
>
> 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
>
> _______________________________________________
> Mapbender_users mailing list
> Mapbender_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>
I have to add that the actuel trigger function is:
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
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),t.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->1!!!';
END LOOP;
FOR current_row IN
SELECT * FROM public.erzmine e
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),e.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->2!!!';
END LOOP;
FOR current_row IN
SELECT * FROM public.wohnhaus wo
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),wo.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->3!!!';
END LOOP;
FOR current_row IN
SELECT * FROM public.steinbruch s
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),s.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->4!!!';
END LOOP;
FOR current_row IN
SELECT * FROM public.kaserne k
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),k.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->5!!!';
END LOOP;
FOR current_row IN
SELECT * FROM public.saegewerk r
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),t.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->6!!!';
END LOOP;
FOR current_row IN
SELECT * FROM public.wasser_by wa
WHERE ST_Intersects(ST_Buffer(NEW.the_geom, 5),wa.the_geom)
LOOP
RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden-->7!!!';
END LOOP;
-- no intersection, new geometry will be inserted
RETURN NEW;
END;
because a mapbender user said this has to be the right way for this
situation!
The numers should show in which the table the problem with digitizing
starts.
--daniel
More information about the Mapbender_users
mailing list