You might also need to add something like:

alter table single_polygon_countries add column id serial;
alter table single_polygon_countries add primary key (id);

This will create a new column in the table with a unique id value for each row, 
and use this as a primary key to the table. 

This will be needed by some applications using the new table (such as QGIS or 
Mapserver), and it is good practice to create a primary key on the table anyway.


Cheers,

  Brent Wood
 

--- On Mon, 2/1/10, Marko Čubranić <[email protected]> wrote:

> From: Marko Čubranić <[email protected]>
> Subject: Re: [postgis-users] brake MPolygon to polygons
> To: "PostGIS Users Discussion" <[email protected]>
> Date: Monday, February 1, 2010, 10:15 PM
> thanks Nicklas, 
> 
> 2010/2/1 Nicklas Avén <[email protected]>
> 
> 
> 
>       
>       
> 
> 
> 
> 
>       
> Hallo
>       
>  
>       
> If I understand you right you have
> multipolygons representing countries that you want splitted
> to single polygons.
>       
>  
>       
> That is no problem but they will not fit
> in the same table since you will get additional rows.
>       
>  
>       
> If you want to make a new table with this
> country polygons as single polygons you can do
>       
>  
>       
> create table single_polygon_countries
> as
>       
> select (ST_Dump(the_geom)).geom as
> the_geom, countryID from original_country_table;
>       
>  
>       
> I put countryID there, just to illustrate
> that you probably want to bring some id or name to the new
> table. That will be repeated for all single polygons from
> original multi polygon
>       
>  
>       
> Hope that helps
>       
> Nicklas
>       
>  
>       
> 
> 
>               
> 
>               2010-02-01 Marko Èubraniæ wrote:
> 
>               
> 
>               Dear colleagues,
> 
>               >
> 
>               >if i have x Mpolygons in table (country) and i want
> to brake each of them in polygons, and put polygons in new
> columns, how should i do that?..
> 
>               >
> 
>               >thank you
> 
>               >
> 
>               >Marko Cubranic
> 
>               >
> 
> 
> 
> _______________________________________________
> 
> postgis-users mailing list
> 
> [email protected]
> 
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 
> 
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> postgis-users mailing list
> [email protected]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to