[postgis-users] Question on INTERSECTION functionality...

Aaron Racicot aaronr at ecotrust.org
Mon Mar 21 17:24:47 PST 2005


Hi there,

I am trying to write some vector processing routines in PHP using my
Postgres/PostGIS database and I am running into an issue:

 

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.

 

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?

 

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.

 

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.  

 

Has anyone else encountered this type of issue?  Is there a common
solution?

 

Thanks

 

Aaron

 

+----------------------------------------+

| Aaron Racicot  | aaronr at ecotrust.org   |

| GIS Programmer | 503.467.0759          |

+----------------------------------------+

| e c o t r u s t                        |

| Jean Vollum Natural Capital Center     |

| 721 NW Ninth Avenue                    |

| Suite 200                              |

| Portland, OR 97209                     |

| www.ecotrust.org                       |

+----------------------------------------+

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050321/2f847c84/attachment.html>


More information about the postgis-users mailing list