[postgis-users] Error on updating geometry column from two columns value

Firman Hadi jalmiburung at gmail.com
Wed Nov 30 23:31:26 PST 2011


Dear all,

I want to create one table with 3 columns (x, y, geom). I want to input 
the x and y using form with PHP.
When I submit the form, it will trigger the new row.

I use this step below but when I insert the data I get the error as in 
attachment.

I hope that anyone can help me to solve the problem.

Thank you in advance.

Kind regards,

Firman Hadi
Center for Remote Sensing - ITB
Indonesia




CREATE TABLE try_geometry (
      koordinat_y integer,
      koordinat_x integer,
      geom geometry PRIMARY KEY
  );
========================

CREATE FUNCTION try_geometry_func () RETURNS trigger AS '
  BEGIN
      NEW.geometri = ST_GeomFromText('POINT(NEW.koordinat_y, 
NEW.koordinat_x)',32748);
      RETURN NEW;
  END;
  ' LANGUAGE plpgsql;

=======================================

CREATE TRIGGER try_geom_trg BEFORE INSERT OR UPDATE
      ON coba FOR EACH ROW
      EXECUTE PROCEDURE try_geometry_func ();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2011-12-01 at 2.25.58 PM.png
Type: image/png
Size: 49024 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111201/4c704ced/attachment.png>


More information about the postgis-users mailing list