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

Sebastian Krohn-Grimberghe sebastian.krohn-grimberghe at ipsyscon.de
Thu Oct 15 07:17:49 EDT 2009


Hello,

>       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, 5),t.the_geom)
> AND
>         ST_Intersects(ST_Buffer(NEW.the_geom, 5),e.the_geom) AND
>         ST_Intersects(ST_Buffer(NEW.the_geom, 5),w.the_geom) AND
>         ST_Intersects(ST_Buffer(NEW.the_geom, 5),s.the_geom) AND
>         ST_Intersects(ST_Buffer(NEW.the_geom, 5),k.the_geom) AND
>         ST_Intersects(ST_Buffer(NEW.the_geom, 5),r.the_geom)
> 
>         LOOP
>            -- intersection found
>     RAISE EXCEPTION 'Gebaeude kann hier nicht errichtet werden!!!';
>     END LOOP;
> 
>     -- no intersection, new geometry will be inserted
>       RETURN NEW;

I guess the mistake is in the SELECT statement. First of all you should
replace each “AND by “OR”. Because with “AND” a new geometry is only not
inserted if it intersects a geometry in each table. But I guess you do not
want to insert a new geometry even if it intersects a geometry in only one
table. 
But this should not be the only mistake. So you could check the SELECT
statement on its own. Replace “NEW.the_geom” by a geometry like
“GeomFromText('POINT(1 1)',-1)” WHERE “-1” must be replaced by your EPGS
code and check if the statement returns what you are expecting.
Or you could change the trigger function by making a LOOP for each table,
like:

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!!!';
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!!!';
END LOOP;


more LOOPs 


RETURN NEW;

Best regards,
Sebastian

--
Sebastian Krohn-Grimberghe
Entwicklung

IP SYSCON GmbH

Tiestestraße 16-18
D-30171 Hannover



More information about the Mapbender_users mailing list