[postgis-users] help with the Union of 2 shp

islanis at infomed.sld.cu islanis at infomed.sld.cu
Tue Dec 17 06:57:16 PST 2013


"Rémi Cura" <remi.cura at gmail.com> escribió:

> Juste use one or 2 polygon !
> you can use limits on your first query,
> or add a where condition with gid=XX, I guess you have a gid field (primary
> key).

ok i make this, and i get all suces but i can see what happening  
because i can see the answer in my quantumgis it say "detecting..." in  
the type of the table of my result, in this case in the  
"all_lines_cuadrado_merged" table, whats happening? please and thanks

*drop table if exists cuadrado;
CREATE TABLE cuadrado
AS (select ST_GeomFromText('MULTIPOLYGON(((-77 56,-52 18,-88 -27,-10  
-13,-11 38,-77 56)))',4326)as the_geom );
UPDATE cuadrado SET the_geom=ST_SetSRID(the_geom,4326);
SELECT Populate_Geometry_Columns('public.cuadrado'::regclass);
ALTER TABLE cuadrado ADD column gid serial;
ALTER TABLE cuadrado ADD COLUMN dato character varying;
ALTER TABLE cuadrado ADD PRIMARY KEY (gid);
UPDATE cuadrado SET dato='cuadrado' WHERE gid=1;

drop table if exists cuadrados;
CREATE TABLE cuadrados
AS (select ST_GeomFromText('MULTIPOLYGON(((-49 63,-32 24,-39 -7,-66  
-19,-72 -9,-74 31,-49 63)))',4326)as the_geom );
UPDATE cuadrados SET the_geom=ST_SetSRID(the_geom,4326);
SELECT Populate_Geometry_Columns('public.cuadrados'::regclass);
ALTER TABLE cuadrados ADD column gid serial;
ALTER TABLE cuadrados ADD COLUMN dato character varying;
ALTER TABLE cuadrados ADD PRIMARY KEY (gid);
UPDATE cuadrados SET dato='cuadrados' WHERE gid=1;

DROP TABLE IF EXISTS all_lines_cuadrado_merged;
CREATE TABLE all_lines_cuadrado_merged AS
SELECT ST_LineMerge(ST_ExteriorRing((ST_Dump(z.the_geom)).geom)) AS the_geom
FROM public.cuadrado z;
UPDATE all_lines_cuadrado_merged SET the_geom=ST_SetSRID(the_geom,4326);
SELECT  
Populate_Geometry_Columns('public.all_lines_cuadrado_merged'::regclass);
ALTER TABLE all_lines_cuadrado_merged ADD column gid serial;
ALTER TABLE all_lines_cuadrado_merged ADD COLUMN dato character varying;
ALTER TABLE all_lines_cuadrado_merged ADD PRIMARY KEY (gid);


DROP TABLE IF EXISTS cuadrados_parts;
CREATE TABLE cuadrados_parts AS
SELECT ST_Split(a.the_geom,z.the_geom) AS the_geom
FROM public.cuadrados a, public.all_lines_cuadrado_merged z;
UPDATE cuadrados_parts SET the_geom=ST_SetSRID(the_geom,4326);
SELECT Populate_Geometry_Columns('public.cuadrados_parts'::regclass);
ALTER TABLE cuadrados_parts ADD column gid serial;
ALTER TABLE cuadrados_parts ADD COLUMN dato character varying;
ALTER TABLE cuadrados_parts ADD PRIMARY KEY (gid);

>
> Cheers,
> Rémi-C
>
>
> 2013/12/16 J.Alejandro Martinez Linares <islanis at infomed.sld.cu>
>
>>
>> El 16/12/13 14:38, Rémi Cura escribió:
>>
>> And of course it is *a very bad idea* to try something without knowing if
>> it works on all your data !
>>
>>  You should try the complete solution on a small sample, then optimize
>> your queries, then use it on all your data...
>>
>>  Cheers,
>>
>>  Rémi-C
>>
>> ok ok, but there are 6570 rows of multipolygons, ok what can i do?, at
>> least i need to know if the entire process is working, i mean like a
>> progress bar, is there enything like that??!!! please and thanks
>>
>



----------------------------------------------------------------
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