[postgis-users] Problems intersecting polygon with lines (was: noding problem)

Chris Hermansen chris.hermansen at timberline.ca
Tue Oct 23 15:39:24 PDT 2007


Good people;

In trying to solve my noding problem I have run into a new problem with
intersecting things.

I have a simple example of two polygon tables, "buildings" and
"parcels", wherein I have

   1. four polygons in buildings
   2. one polygon in parcels
   3. two of the buildings polygons lie completely within the parcels
      polygon
   4. one buildings polygon lies partly within the parcels polygon
   5. one buildings polygon lies completely outside the parcels polygon.

These polygons are all nice neat rectangles.

If I execute:

select
buildingid,parcelid,geometryType(st_intersection(buildings.geom,parcels.geom))
from buildings,parcels
where buildings.geom && parcels.geom;

I get pretty much what I expect, namely three polygons:

 buildingid | parcelid | geometrytype
------------+----------+--------------
          1 |      101 | POLYGON
          2 |      101 | POLYGON
          3 |      101 | POLYGON
(3 rows)

In principle, my "real-world" problem is quite similar.  I have:

three proposed block polygons (like buildings)
3378 vegetation polygons (like parcels)
one of the block polygons lies completely within the vegetation polygons
two of the block polygons lie completely outside the vegetation polygons

If I execute:

select geometryType(st_intersection(pblk.geom,pvri.geom))
from pblk,pvri
where pblk.geom && pvri.geom;

I get something quite different than what I expect.  I expect to get
polygons, and sometimes multipolygons - which I assume arise when the
intersection process splits up polygons into several constituent parts.

But I also get a bunch of geometrycollections.  And these
geometrycollections are apparently empty, for example, the first few
lines of output from the above select:

 numgeometries |    geometrytype   
---------------+--------------------
               | POLYGON
               | POLYGON
             0 | GEOMETRYCOLLECTION
             0 | GEOMETRYCOLLECTION
               | POLYGON
             0 | GEOMETRYCOLLECTION

Are these supposed to be there?  What conceivable purpose could they serve?

-- 
Regards,

Chris Hermansen · mailto:clh at timberline.ca
tel:+1.604.714.2878 · fax:+1.604.733.0631
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5

C'est ma façon de parler.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20071023/63d2cecd/attachment.html>


More information about the postgis-users mailing list