[postgis-users] Problem with Contains/Within using shapes created by GeomUnion
Mike Leahy
mgleahy at alumni.uwaterloo.ca
Fri Mar 17 10:47:58 PST 2006
Hello list,
I'm wondering if I've run into a bug with PostGIS (or maybe the GEOS
module). I've been building a set of management areas that are created
from a series of smaller districts merged together. I would normally
expect the resulting merged polygon to topologically contain all of its
constituent polygons. This has proved to be true in all cases for my
data except one (so far). You can see the results of a test query below
that compares a handful of shapes to their geomunion'd shape. In all
cases except the shape with ID# 725, it looks fine. For some reason, a
geomunion of that shape with the other contiguous shapes will no longer
contain the original shape itself according to the contains() or
within() functions. I've looked at this shape using Qgis and compared
it to the corresponding geomunion shape, and it looks fine as far as I
can tell visually.
I've included a dump of a test table containing the six shapes in this
management area used in the queries shown below. Let me know if there's
anything I can do to work around this problem, or if there's any
additional information I should provide.
Mike
===========================================================
testdb=# select gid, contains(u,the_geom), within(the_geom,u),
isvalid(the_geom) as the_geom_isvalid, isvalid(u) as u_isvalid,
contains(the_geom,the_geom) as the_geom_contains_itself from gutest
cross join (select geomunion(the_geom) as u from gutest) as foo;
gid | contains | within | the_geom_isvalid | u_isvalid |
the_geom_contains_itself
-----+----------+--------+------------------+-----------+--------------------------
508 | t | t | t | t | t
17 | t | t | t | t | t
741 | t | t | t | t | t
195 | t | t | t | t | t
725 | f | f | t | t | t
18 | t | t | t | t | t
(6 rows)
testdb=# select version();
version
----------------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.1.3 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 4.1.0 20060210 (Red Hat 4.1.0-0.24)
(1 row)
testdb=# select postgis_full_version();
postgis_full_version
----------------------------------------------------------------------------------
POSTGIS="1.1.1" GEOS="2.2.1-CAPI-1.0.1" PROJ="Rel. 4.4.9, 29 Oct 2004"
USE_STATS
(1 row)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gutest.sql.zip
Type: application/zip
Size: 21459 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060317/a13cde88/attachment.zip>
More information about the postgis-users
mailing list