[postgis-users] Update the geom of a table WHERE "i" is an even number

Daniel Grum daniel.grum at unibw.de
Tue Oct 13 02:17:43 PDT 2009


Hi,

I need a possibilty that a table "wald_by" will be updatet WHERE my 
counter "i" is an even number?!

UPDATE wald_by
SET the_geom = the_geom - 
ST_Intersection(poly.the_geom,ST_Expand(pt.the_geom, 2000))
FROM public.wald_by poly, public.holzfaeller pt, public.runden i
WHERE poly.the_geom && ST_Expand(pt.the_geom, 2000) AND pt.style=2 AND* 
i/5=2*;

i/5=2 ???--> That mean: this UPDATE should be done if i=[10, 20, 30, 
40...] !!!!
And WHERE  "i" is another number nothing should be done-->the_geom=the_geom

the_geom is a forest area where forest will be cut, and after 10 rounds 
the area of the cut down area should be deducted from the original 
forest area-->the forest will be smaller after 10 rounds!
There are two modes of lumberjacks, the one mode(pt.style=1) he cut down 
the wood regenerative and the other one  is clearing the forest 
completely-->the area should be deducted.

"i" will be stored every round in one table: "runden" and every round 
this SQL will be done:
UPDATE runden SET i=i+1;

Are there any ideas?

--daniel



More information about the postgis-users mailing list