[Gfoss] Calcolo coordinate in una tabella Pgsql

aciali alessandro.ciali a gmail.com
Mer 8 Lug 2015 15:23:39 CEST


Ciao,
innanzi tutto un saluti a tutti voi; sto cercando aiuto per una questione
probabilmente banale ma non per me.
Ho creato una tabella in postgresql 8.4 (postgis 1.5), di seguito la query

CREATE TABLE indagini."Sito_Puntuale"
(
 the_geom geometry,
 "OBJECTID" integer,
 pkey_spu serial NOT NULL,
 ubicazione_prov character(3) NOT NULL,
 ubicazione_com character(3) NOT NULL,
 "ID_SPU" character(15),
 indirizzo character varying(255),
 "coord_X" integer,
 "coord_Y" integer,
 mod_identcoord character varying(6),
 desc_modcoord character varying(30),
 quota_sml smallint NOT NULL,
 modo_quota character varying(6),
 data_sito date DEFAULT ('now'::text)::date,
 note_sito character varying(255),
 CONSTRAINT "Sito_Puntuale_pkey" PRIMARY KEY (pkey_spu),
 CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
 CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOINT'::text OR the_geom IS NULL),
 CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 32633)
)

vorrei popolare i campi coord_X e coord_Y in automatico ad ogni inserimento
con le coordinate del punto generato. Pensavo di utilizzare un Trigger con
le funzioni:

round(ST_XMIN(the_geom)) FROM indagini."Sito_Puntuale"

ma non sono riuscito a far funzionare la cosa. Qualche dritta in proposito?
Grazie a chiunque possa aiutarmi.



--
View this message in context: http://gfoss-geographic-free-and-open-source-software-italian-mailing.3056002.n2.nabble.com/Calcolo-coordinate-in-una-tabella-Pgsql-tp7593079.html
Sent from the Gfoss -- Geographic Free and Open Source Software - Italian mailing list mailing list archive at Nabble.com.


Maggiori informazioni sulla lista Gfoss