<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Courier;
        panose-1:2 7 4 9 2 2 5 2 4 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle17
        {font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hi there,</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to write some vector processing routines in PHP
using my Postgres/PostGIS database and I am running into an issue:</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to recursively sub-select polygons by doing
intersections to generate a new set of polygons with connectivity information
as to which original polygon it came from.  In essence, I am trying to
chop an initial set of arbitrary polygons into small pieces, each defined by
how many other polygons that piece intersected.</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>The problem I am having is that while all of my initial polygons
are MULTIPOLYGON type, the intersection operator returns GEOMETRYCOLLECTION for
some of the intersections.  I read over the simple features spec and it
seems to imply that some intersections will generate shapes that can not be
represented anymore as polygons, but instead polygons and other types like
lines.  Is this true?</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>If it is, I have a problem in that I can not do the
intersection operator on GEOMETRYCOLLECTION and therefore can not continue my
process of breaking down overlapping polygons.  Is there any solution to
this problem?  I was hoping that you could do some type of “cast”
from GEOMETRYCOLLECTION to another type, say MULTIPOLYGON, and get a “best”
approximation by dropping other geometry types out of the collection and just
returning the resulting polygons.</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have dealt with a similar issue in the other direction
with INTERSECTION returning POLYGON when the initial shapes where MULTIPOLYGON,
and I am able to use the MULTI operator to “cast” to a
MULTIPOLYGON.  </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Has anyone else encountered this type of issue?  Is
there a common solution?</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Aaron</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>+----------------------------------------+</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| </span></font><font size=2
 face=Courier><span style='font-size:10.0pt;font-family:Courier'>Aaron Racicot</span></font><font
size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>  |
aaronr@ecotrust.org   |</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| GIS Programmer |
503.467.0759          |</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>+----------------------------------------+</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| e c o t r u s
t                       
|</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| </span></font><font size=2
  face=Courier><span style='font-size:10.0pt;font-family:Courier'>Jean</span></font><font
 size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'> </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>Vollum</span></font><font
 size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'> </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>Natural</span></font><font
 size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'> </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>Capital</span></font><font
 size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'> </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>Center</span></font><font
size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>    
|</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>721 NW
  Ninth Avenue</span></font><font size=2 face=Courier><span style='font-size:
10.0pt;font-family:Courier'>                   
|</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| Suite
200                             
|</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| </span></font><font size=2
  face=Courier><span style='font-size:10.0pt;font-family:Courier'>Portland</span></font><font
 size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>, </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>OR</span></font><font
 size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'> </span></font><font
  size=2 face=Courier><span style='font-size:10.0pt;font-family:Courier'>97209                   
  </span></font><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> |</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>| </span></font><a
href="www.ecotrust.org"><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>www.ecotrust.org</span></font></a><font size=2
face=Courier><span style='font-size:10.0pt;font-family:Courier'>                       |</span></font></p>

<p style='margin:0in;margin-bottom:.0001pt'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>+----------------------------------------+</span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> </span></font></p>

</div>

</body>

</html>