[postgis-users] Create constrain between Province and town tables

islanis at infomed.sld.cu islanis at infomed.sld.cu
Fri Feb 15 12:10:11 PST 2013




Hi people, i need  to create an algoritm, to alter a column of the town table,
cause they are in the form shown below, but i need a establish a  
relation constrain
between Province and town tables because they are polygons and all  
towns are in some
province, and in the actual form they are not in a relation, , i want  
to make that using
the content or intersect functions of postgis, but i dont have idea  
how to do that, help
me please, thanks to all


//////this is the province table///////////////

CREATE TABLE "sigfre_cub_Adm_Prov"
(
   gid serial NOT NULL,
   tipoelemen character varying(10),
   municipio character varying(40),
   dempromkw double precision,
   potinsmw double precision,
   radsolprkw double precision,
   nohab double precision,
   noviv double precision,
   temedimaxc double precision,
   temedminc double precision,
   velvieprms numeric,
   humrel double precision,
   nubosidad double precision,
   extenterri double precision,
   precip_med integer,
   denspob numeric,
   the_geom geometry,
   CONSTRAINT "sigfre_cub_Adm_Prov_pkey" PRIMARY KEY (gid),
   CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
   CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
   CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = (-1))
)
WITH (
   OIDS=FALSE
);
ALTER TABLE "sigfre_cub_Adm_Prov" OWNER TO postgres;

///////////this is the town table///////////////////////////////////
CREATE TABLE "sigfre_cub_Adm_munic"
(
   gid serial NOT NULL,
   nombre character varying(30),
   cabeceramu character varying(30),
   provincia character varying(30),
   km2 numeric,
   canthabt character varying(50),
   cant_casas integer,
   cod_munic character varying(9),
   cod_prov character varying(9),
   the_geom geometry,
   CONSTRAINT "sigfre_cub_Adm_munic_pkey" PRIMARY KEY (gid),
   CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
   CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
   CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = (-1))
)
WITH (
   OIDS=FALSE
);
ALTER TABLE "sigfre_cub_Adm_munic" OWNER TO postgres;
/////////////////////////////////////////////////////////////////////////////



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/


More information about the postgis-users mailing list