[postgis-users] Problem with Contains/Within using shapes created by GeomUnion

strk at refractions.net strk at refractions.net
Mon Mar 20 10:32:30 PST 2006


There might be a bug in the computed bounding box of your geometries,
Try to run the within and contains against a dropbbox() version
of the input. If the problem persist, please provide a small
self-contained testacase so we can check against different
versions and architectures.

TIA

--strk;

On Fri, Mar 17, 2006 at 01:47:58PM -0500, Mike Leahy wrote:
> 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)


> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
----------------------------------------------------------------------
State-collected Geographic Data is public property !
Reject the INSPIRE directive.
Sign the petition: http://petition.publicgeodata.org



More information about the postgis-users mailing list