[postgis-users] How to insert the geometry field of a record with trigger and function

Veronique Chaffard Veronique.Chaffard at hmg.inpg.fr
Wed Jan 24 03:40:21 PST 2007


I would like to insert the geometry field of a record by using a trigger 
and a fonction, after the insertion of the other fields;The X and Y 
coordinates are saved into 2 fields: LAT and LONG. The geometry field 
type is a point. 

My table is declared as:
CREATE TABLE TEST (
    ID serial not null,
    NOM VARCHAR(50) not null,
    LONG FLOAT8 not null,
    LAT  FLOAT8 not null,
constraint PK_TEST primary key (ID)
);
SELECT AddGeometryColumn('','test','geom','-1','POINT',2);

Could you help me ?

Thanks in advance.



More information about the postgis-users mailing list