Hi Fabio,<br><br>I had a small test with your data. I split your data to 2 tables: blocks(big polygon) and building(small polygon) table.<br>Please see the attached file for more details.<br><br>The environment is: <br>"PostgreSQL 8.3.5 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux)"<br>
<br>I have some green comments bellow:<br><br>Cheers.<br><br><div class="gmail_quote">On Tue, Jul 20, 2010 at 9:59 PM, Fabio Renzo Panettieri <span dir="ltr"><<a href="mailto:fpanettieri@xoomcode.com">fpanettieri@xoomcode.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi.<br>
I'm, having a problem with some geometries.<br>
I have buildings and blocks represented by polygons, and I have to check<br>
if buildings are contained in blocks.<br>
<br>
The problem is that buildings that are snapped to blocks sides, aren't<br>
considered inside the block.<br>
<br>
These are the validations that I've used so far.<br>
<br>
ST_Covers(block, building) => false </blockquote><div><font color="#009900"> ST_Covers(geometry geomA, geometry geomB); Returns 1 (TRUE) if no point in Geometry B is outside Geometry A</font><br></div><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
ST_Contains(block, building) => false<br></blockquote><div> <font color="#009900">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.</font><br>
</div><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">ST_Coveredby(building, block) => false<br></blockquote><div> <font color="#009900"> ST_CoveredBy(geometry geomA, geometry geomB); Returns 1 (TRUE) if no point in Geometry/Geography A is outside Geometry/Geography B<br>
</font> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
ST_Within(building, block) => false<br></blockquote><div> <font color="#009900">ST_Within(geometry A, geometry B); Returns true if the geometry A is completely inside geometry B</font> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
<br>
The following validations are the ones that confuses me.<br>
<br>
ST_Covers(ST_intersection(block, building), building) => true<br></blockquote><div> <span style="color: rgb(0, 153, 0);"> => false</span><span style="color: rgb(51, 204, 0);"> - plz see the explanation in the attached file</span><br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
ST_Intersection(block, building) = building => true<br></blockquote><div> <span style="color: rgb(0, 153, 0);">=> true: because "=" operator is a little more naive, it only tests whether the bounding boxes of two geometries are the same</span><br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
ST_isEmpty(ST_Difference(building, block)) => true<br>
<span style="color: rgb(0, 153, 0);">=> false - plz see the explanation in the
attached file</span></blockquote><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
For what I've read, here<br>
<a href="http://lin-ear-th-inking.blogspot.com/2007/06/subtleties-of-ogc-covers-spatial.html" target="_blank">http://lin-ear-th-inking.blogspot.com/2007/06/subtleties-of-ogc-covers-spatial.html</a><br>
"Geometry A covers Geometry B if no points of B lie in the exterior of<br>
A"<br>
Covers should return true.<br>
<br>
The environment is:<br>
SELECT version(); => "PostgreSQL 8.4.4 on x86_64-pc-linux-gnu, compiled<br>
by GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2, 64-bit"<br>
<br>
SELECT postgis_version(); => "1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1"<br>
<br>
I've attached two geometries that you can use to check if I'm doing<br>
something wrong.<br>
<br>
Thanks for your time.<br>
<font color="#888888">--<br>
Fabio R. Panettieri<br>
Software Architect<br>
<a href="http://www.xoomcode.com" target="_blank">http://www.xoomcode.com</a><br>
</font><br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div>
<div style="margin: 0in 0in 0pt;"><b><span style="color: rgb(31, 73, 125); font-size: 8pt;"><font face="Calibri">Liem Nguyen (DBA)<br><br>AXON ACTIVE
VIETNAM</font></span></b></div>
<div style="margin: 0in 0in 0pt;"><b><span style="color: rgb(31, 73, 125); font-size: 8pt;" lang="DE-CH"><a href="http://www.axonactive.vn/" target="_blank"><span lang="EN-US"><font color="#0000ff" face="Calibri">www.axonactive.vn</font></span></a></span></b><b><span style="color: rgb(31, 73, 125); font-size: 8pt;"></span></b></div>
<div style="margin: 0in 0in 0pt;"><span style="color: rgb(31, 73, 125); font-size: 8pt;"><font face="Calibri"> </font></span></div>
<div style="margin: 0in 0in 0pt;"><span style="color: rgb(31, 73, 125); font-size: 8pt;"><font face="Calibri">10th Floor, Hai Au
Building, 39B Truong Son, Ward 4, Tan Binh District, Ho Chi Minh City,
Vietnam</font></span></div>
<div style="margin: 0in 0in 0pt;"><span style="color: rgb(31, 73, 125); font-size: 8pt;"><font face="Calibri">T +84 8 629 738 59, F
+84 8 381 134 89, M +84 168 994 8897</font></span></div>
<div style="margin: 0in 0in 0pt;"><span style="font-size: 8pt;"><font size="1"><u>8897 +10° 48' 32.72", +106° 39'
51.58"</u></font></span></div><pre><br></pre></div><br>