[Mapbender-users] Create points with a geoserver WFS-T
Daniel Grum
daniel.grum at unibw.de
Tue Dec 1 11:10:50 EST 2009
Daniel Grum schrieb:
> Daniel Grum schrieb:
> 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
> _______________________________________________
> Mapbender_users mailing list
> Mapbender_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>
The trigger works now, why ever he in the time before have not worked?!
The RAISE EXCEPTION columns can not be writen from mapbender, mapbender
allways takes the messages of the mod_digitize_messages.php.
How I can solve an Update of a table with an "AFTER trigger"
Here my idea:
DECLARE
-- declare variables
current_row RECORD;
BEGIN
FOR current_row IN
SELECT * FROM public.rohstoffe_von_spieler1 r
LOOP
UPDATE rohstoffe_von_spieler1 SET bretter = bretter-100;
UPDATE rohstoffe_von_spieler1 SET stein = stein-100;
END LOOP;
END;
And how I can test if there are enough ressources in my ressources
table? here the first way is:
f.e.: FOR current_row IN
SELECT * FROM public.rohstoffe_von_spieler1 roh
WHERE roh.stein<100
LOOP
RAISE EXCEPTION 'Zu wenig Stein vorhanden!';
END LOOP;
or
FOR current_row IN
SELECT * FROM public.rohstoffe_von_spieler1 roh
WHERE roh.bretter<100
LOOP
RAISE EXCEPTION 'Zu wenig Bretter vorhanden!';
END LOOP;
It will be fine if you have any idea?!
--daniel
More information about the Mapbender_users
mailing list