Hi Fabio, I had a small test with your data. I split your data to 2 tables: blocks(big polygon) and building(small polygon) table. Please see the attached file for more details.
The environment is: "PostgreSQL 8.3.5 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux)" I have some green comments bellow: Cheers. On Tue, Jul 20, 2010 at 9:59 PM, Fabio Renzo Panettieri < fpanetti...@xoomcode.com> wrote: > Hi. > I'm, having a problem with some geometries. > I have buildings and blocks represented by polygons, and I have to check > if buildings are contained in blocks. > > The problem is that buildings that are snapped to blocks sides, aren't > considered inside the block. > > These are the validations that I've used so far. > > ST_Covers(block, building) => false ST_Covers(geometry geomA, geometry geomB); Returns 1 (TRUE) if no point in Geometry B is outside Geometry A > ST_Contains(block, building) => false > ST_Contains(geometry geomA, geometry geomB); Returns true if and only if no points of B lie in the exterior of A, and at least one point of the interior of B lies in the interior of A. > ST_Coveredby(building, block) => false > ST_CoveredBy(geometry geomA, geometry geomB); Returns 1 (TRUE) if no point in Geometry/Geography A is outside Geometry/Geography B > ST_Within(building, block) => false > ST_Within(geometry A, geometry B); Returns true if the geometry A is completely inside geometry B > > > The following validations are the ones that confuses me. > > ST_Covers(ST_intersection(block, building), building) => true > => false - plz see the explanation in the attached file > ST_Intersection(block, building) = building => true > => true: because "=" operator is a little more naive, it only tests whether the bounding boxes of two geometries are the same > ST_isEmpty(ST_Difference(building, block)) => true > => false - plz see the explanation in the attached file > For what I've read, here > > http://lin-ear-th-inking.blogspot.com/2007/06/subtleties-of-ogc-covers-spatial.html > "Geometry A covers Geometry B if no points of B lie in the exterior of > A" > Covers should return true. > > The environment is: > SELECT version(); => "PostgreSQL 8.4.4 on x86_64-pc-linux-gnu, compiled > by GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2, 64-bit" > > SELECT postgis_version(); => "1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1" > > I've attached two geometries that you can use to check if I'm doing > something wrong. > > Thanks for your time. > -- > Fabio R. Panettieri > Software Architect > http://www.xoomcode.com > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > -- *Liem Nguyen (DBA) AXON ACTIVE VIETNAM* *www.axonactive.vn*** 10th Floor, Hai Au Building, 39B Truong Son, Ward 4, Tan Binh District, Ho Chi Minh City, Vietnam T +84 8 629 738 59, F +84 8 381 134 89, M +84 168 994 8897 *8897 +10° 48' 32.72", +106° 39' 51.58"*
snapped_polygon.sql
Description: Binary data
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users