wboykinm

Automatic Acreage Updates for LandPlanner

Aug 24th, 2011
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE FUNCTION add_acres() RETURNS trigger AS $add_acres$
  2.    BEGIN
  3.        NEW.acres := st_area(NEW.the_geom::geography)*0.000247105381;
  4.        RETURN NEW;
  5.    END;
  6. $add_acres$ LANGUAGE plpgsql;
  7.  
  8. CREATE TRIGGER add_acres BEFORE INSERT OR UPDATE ON properties
  9.    FOR EACH ROW EXECUTE PROCEDURE add_acres();
  10.  
  11. CREATE FUNCTION add_acres() RETURNS trigger AS $add_acres$
  12.    BEGIN
  13.        NEW.acres := st_area(NEW.the_geom::geography)*0.000247105381;
  14.        RETURN NEW;
  15.    END;
  16. $add_acres$ LANGUAGE plpgsql;
  17.  
  18. CREATE TRIGGER add_acres BEFORE INSERT OR UPDATE ON cells
  19.    FOR EACH ROW EXECUTE PROCEDURE add_acres();
  20.  
  21. CREATE FUNCTION add_acres() RETURNS trigger AS $add_acres$
  22.    BEGIN
  23.        NEW.acres := st_area(NEW.the_geom::geography)*0.000247105381;
  24.        RETURN NEW;
  25.    END;
  26. $add_acres$ LANGUAGE plpgsql;
  27.  
  28. CREATE TRIGGER add_acres BEFORE INSERT OR UPDATE ON paddocks
  29.    FOR EACH ROW EXECUTE PROCEDURE add_acres();
Advertisement
Add Comment
Please, Sign In to add comment