[postgis-users] Snapped polygon
nicolas.ribot at gmail.com
Tue Jul 20 08:15:40 PDT 2010
> 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_Contains(block, building) => false
> ST_Coveredby(building, block) => false
> ST_Within(building, block) => false
> The following validations are the ones that confuses me.
> ST_Covers(ST_intersection(block, building), building) => true
> ST_Intersection(block, building) = building => true
> ST_isEmpty(ST_Difference(building, block)) => true
> For what I've read, here
> "Geometry A covers Geometry B if no points of B lie in the exterior of
> 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.
For this kind of relationship, st_relate is very powerful: a good
explanation is given here:
along with a concrete example that, if I recall correctly, is pretty
much the same as yours.
More information about the postgis-users