<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2>I'm guessing your result may be a Geometrycollection which
ESRI shape has no clue what to do with.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2>If I understand you correctly, I think you really should be
using ST_Difference instead of ST_SymDifference.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2>So ST_Difference(polygon2, polygon1) - will give you that
portion of polygon2 which does not intersect with polygon1 which would give you
a polygon with polygon1 removed (a doughnut so to speak).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2>The ST_Symdifference will give you that portion of polygon2
not in polygon1 + polygon1 not in polygon2 = the holed polygon you want + an
empty geometry collection -> a geometry collection if taken
strictly. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2> I'm not sure if PostGIS will throw out the second
part (the empty collection) - and at anyrate is a waste of processing power to
even compute it.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=829444111-12032008><FONT face=Arial
color=#0000ff size=2>Regina</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Ghislain Geniaux<BR><B>Sent:</B> Wednesday, March 12, 2008 6:29
AM<BR><B>To:</B> postgis-users@postgis.refractions.net<BR><B>Subject:</B>
[postgis-users] problem creating and exporting a polygon with holeusing
pgsql2shp<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>Using a postgis table with Two polygons, in which polygon 1 entirely
contained in polygon 2, I've create a new polygon with a hole using
: </FONT></DIV>
<DIV style="MIN-HEIGHT: 16px; MARGIN: 0px; FONT: 13px Verdana"><BR></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>------ </FONT></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>create table matable2 as </FONT></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>select r.gid, area(symdifference(r.the_geom,i.the_geom)) as
area,(symdifference(r.the_geom,i.the_geom)) as the_geom from matable as r,
matable as i where i.gid=2 and r.gid=1; </FONT></DIV>
<DIV style="MIN-HEIGHT: 16px; MARGIN: 0px; FONT: 13px Verdana"><BR></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>ALTER TABLE matable2 ADD PRIMARY KEY (GID); </FONT></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>\q </FONT></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>pgsql2shp -f ext.shp conversion 'select * from
matable2' </FONT></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>----- </FONT></DIV>
<DIV style="MIN-HEIGHT: 16px; MARGIN: 0px; FONT: 13px Verdana"><BR></DIV>
<DIV style="MARGIN: 0px"><FONT style="FONT: 13px Verdana" face=Verdana
size=4>Area is correct, display of the polygon in QGIS is also correct, but the
export by pgsl2shp produce an empty shapefile. </FONT></DIV>
<DIV style="MIN-HEIGHT: 16px; MARGIN: 0px; FONT: 13px Verdana"><BR></DIV>
<DIV style="MARGIN: 0px"><SPAN class=Apple-style-span
style="FONT-SIZE: 13px; FONT-FAMILY: Verdana">How to deal with this
problem?</SPAN></DIV>
<DIV style="MARGIN: 0px"><FONT class=Apple-style-span face=Verdana size=3><SPAN
class=Apple-style-span style="FONT-SIZE: 13px"><BR
class=webkit-block-placeholder></SPAN></FONT></DIV>
<DIV style="MARGIN: 0px">------------------------------------------</DIV>
<DIV><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; -khtml-text-decorations-in-effect: none; -apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN
class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; -khtml-text-decorations-in-effect: none; -apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN
class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; -khtml-text-decorations-in-effect: none; -apple-text-size-adjust: auto; orphans: 2; widows: 2">
<DIV style="MARGIN: 0px">Geniaux Ghislain</DIV>
<DIV style="MARGIN: 0px"><BR></DIV></SPAN></SPAN></SPAN></DIV><BR></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>
<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>