<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>:) thanks Nicolas. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Here is my data . it has two polygons in it.  I want to convert this to one single polygon.. I have many raws like this. this is just an example. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>MULTIPOLYGON(((44.23219 37.044958,44.232267 37.044496,44.232391 37.043847,44.232478 37.043021,44.232565 37.042165,44.232692 37.04128,44.232701 37.040335,44.232281 37.03922,44.231698 37.038566,44.231192 37.03809,44.230647 37.037585,44.229867 37.037107,44.229007 37.036688,44.228148 37.036181,44.227327 37.035762,44.226585 37.035314,44.225252 37.034959,44.224662 37.035073,44.223167 37.035329,44.22234 37.035501,44.221435 37.035613,44.220767 37.035608,44.220257 37.035575,44.219985 37.035308,44.219949 37.034924,44.22023 37.034394,44.220824 37.033896,44.221616 37.033311,44.222367 37.032843,44.223552 37.032172,44.223988 37.031821,44.225014 37.031015,44.225607 37.030635,44.226243 37.029901,44.226839 37.029284,44.227997 37.027349,44.228435 37.02682,44.228793 37.02635,44.228837 37.025848,44.228843 37.025317,44.228808 37.024814,44.228589 37.023248,44.228838 37.021861,44.229077 37.021538,44.229633 37.020921,44.230188 37.020482,44.23082 37.020043,44.23173 37.019429,44.231851 37.019104,44.232053 37.018515,44.231979 37.018072,44.231513 37.017537,44.231085 37.01718,44.230658 37.016704,44.230505 37.01629,44.230509 37.015876,44.230867 37.015436,44.231421 37.015026,44.23221 37.014677,44.232958 37.014445,44.233632 37.013888,44.234427 37.01286,44.234828 37.012124,44.235617 37.011716,44.236522 37.011574,44.237897 37.011494,44.239662 37.011742,44.240329 37.011805,44.241114 37.01178,44.242294 37.01167,44.243317 37.01144,44.244028 37.01109,44.244266 37.010449,44.244509 37.009682,44.244714 37.008827,44.244995 37.008179,44.245766 37.005272,44.246167 37.004448,44.246804 37.003566,44.247163 37.002948,44.24875 37.001304,44.250062 36.999487,44.252713 37.00048,44.253684 37.000577,44.255382 37.000625,44.256983 36.999849,44.259312 36.999315,44.261689 36.999121,44.263969 36.999412,44.26688 36.999412,44.268918 36.999752,44.269597 36.999752,44.271441 36.999946,44.273333 37.000916,44.273867 37.002226,44.274643 37.002954,44.275662 37.003294,44.277215 37.002857,44.278379 37.002663,44.279932 37.003706,44.280514 37.004288,44.281873 37.006035,44.283522 37.006811,44.285997 37.007394,44.288083 37.008801,44.288617 37.010062,44.289199 37.010984,44.290654 37.011809,44.292449 37.013022,44.293759 37.013604,44.294584 37.014744,44.29473 37.015472,44.295409 37.016927,44.296622 37.018286,44.298078 37.018577,44.300261 37.018334,44.30225 37.01751,44.303123 37.016927,44.304627 37.016394,44.306326 37.016976,44.307975 37.017461,44.309528 37.017364,44.31011 37.018868,44.308363 37.020396,44.304725 37.023404,44.302105 37.025636,44.300892 37.026413,44.299873 37.027189,44.299436 37.028062,44.299436 37.02913,44.299776 37.030197,44.300892 37.030731,44.301959 37.030925,44.3039 37.030439,44.304773 37.030925,44.303366 37.032671,44.30094 37.036165,44.301668 37.037766,44.302529 37.041003,44.23219 37.044958)),((44.253299 36.985138,44.253097 36.984954,44.252473 36.984536,44.252044 36.984179,44.251695 36.983763,44.25162 36.983349,44.252098 36.982673,44.252691 36.982322,44.253557 36.982061,44.254041 36.981849,44.253299 36.985138)))<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> postgis-users-bounces@postgis.refractions.net [mailto:postgis-users-bounces@postgis.refractions.net] <b>On Behalf Of </b>Nicolas Ribot<br><b>Sent:</b> 26 Nisan 2012 18:37<br><b>To:</b> PostGIS Users Discussion<br><b>Subject:</b> Re: [postgis-users] [!! SPAM] multipolygon to single polygon<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Sorry, I read too quickly.<o:p></o:p></p></div><div><p class=MsoNormal>I suggested what you tried ;)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>what query are you running and what are your data to obtain multipolygons ?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Nicolas<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On 26 April 2012 17:32, Nicolas Ribot <<a href="mailto:nicolas.ribot@gmail.com" target="_blank">nicolas.ribot@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Hi,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>As Julien suggested, you could st_dump to explode multipolygons into polygons, then union them.<o:p></o:p></p></div><div><p class=MsoNormal>It will produce a single polygon unioning all others:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>with t as (<o:p></o:p></p></div><div><p class=MsoNormal>    select (st_dump(geom)).geom <o:p></o:p></p></div><div><p class=MsoNormal>    from my_table<o:p></o:p></p></div><div><p class=MsoNormal>) select st_union(geom) from t;<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Nicolas<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On 26 April 2012 17:22, Mehmet Erkek <<a href="mailto:merkek@reidin.com" target="_blank">merkek@reidin.com</a>> wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi Juilen, thanks for quick answer. <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I have 1 geometry and 1 row on the table. this geometry is multiploygon which consists of 4 polygons.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I want to convert this mutlipolygon to one single polygon..<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Any idea how I can do this?<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I hope it is clearer now.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thanks.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a> [mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a>] <b>On Behalf Of </b>ju<br><b>Sent:</b> 26 Nisan 2012 18:02<br><b>To:</b> PostGIS Users Discussion<br><b>Subject:</b> Re: [postgis-users] [!! SPAM] multipolygon to single polygon</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>not clear...<br><br>1) if you have 4 polygons in 4 rows table distinct, this is not a multi object issu. for  this case use<br> dissolve to group polygone into only one, this is not a topic of dump.<br><br><br>2) if you have 1 geometry and 1 row on the tablme, so this is a multi object topic<br>you must sperate the differents objet of the collection<br><br>here : <a href="http://www.postgis.org/docs/ST_GeometryN.html" target="_blank">http://www.postgis.org/docs/ST_GeometryN.html</a><o:p></o:p></p><pre>--Extracting all geometries (useful when you want to assign an id)<o:p></o:p></pre><pre>SELECT gid, n, ST_GeometryN(the_geom, n)<o:p></o:p></pre><pre>FROM sometable CROSS JOIN generate_series(1,100) n<o:p></o:p></pre><pre>WHERE n <= ST_NumGeometries(the_geom);<o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><br>best regards, julien<br><br><br><br>Le 26/04/2012 16:27, Mehmet Erkek a écrit : <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I have multipolygons which I would like to convert a single polygon. is there a way to do this? please check the attached image. I tried st_dump and afterwards st_union , but eventually I get a multipolygon again, not polygon. <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><img border=0 width=851 height=341 id="_x0000_i1025" src="cid:image001.png@01CD23DD.A829AAE0"><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='font-size:10.0pt'>Mehmet Erkek</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><a href="http://www.reidin.com/" target="_blank"><span style='font-size:7.0pt;font-family:"Verdana","sans-serif"'>www.REIDIN.com</span></a><span style='font-size:7.0pt;font-family:"Verdana","sans-serif"'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><br>This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. Please Consider the Environment Before Printing This Email <br><br><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>postgis-users mailing list<o:p></o:p></pre><pre><a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><o:p></o:p></pre><pre><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><o:p> </o:p></p><pre>-- <o:p></o:p></pre><pre>Julien-Pierre Guilloux<o:p></o:p></pre><pre>Service scientifique - Géomatique<o:p></o:p></pre><pre>Parc National des Ecrins<o:p></o:p></pre><pre>Domaine de Charance<o:p></o:p></pre><pre>05 000 GAP<o:p></o:p></pre><pre>tél : 04.92.40.20.10<o:p></o:p></pre><pre>fax : 04.92.52.38.34<o:p></o:p></pre><pre><a href="mailto:julien.guilloux@ecrins-parcnational.fr" target="_blank">julien.guilloux@ecrins-parcnational.fr</a><o:p></o:p></pre></div></div></div><div><div><p class=MsoNormal><br>This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. Please Consider the Environment Before Printing This Email <o:p></o:p></p></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div><br/>This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

Please Consider the Environment Before Printing This Email </body></html>