<div dir="ltr">Hi,<div><br></div><div style>To complete Hugues' answer, it may be due to the && operator that operates on geometry extents, which are an approximation, if I recall correctly.</div><div style>But when running a true contains test, the answer is correct:</div>
<div style><br></div><div style><div>select st_intersects(ST_MakeEnvelope(-105.17353271032549,39.798766541338225,-105.07765728967452,39.83016145866177,4326), st_setsrid(ST_MakePOint(-105.130637 ,39.830165),4326));</div>
<div><br></div><div> st_intersects </div><div>---------------</div><div style> f</div><div><br></div><div style>The && operator is mainly used to trigger geometric index use.</div><div style>Index over estimate the geometry a bit.</div>
<div style><br></div><div style>Nicolas</div></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 2 February 2013 09:14, Francois Hugues <span dir="ltr"><<a href="mailto:hugues.francois@irstea.fr" target="_blank">hugues.francois@irstea.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Tahoma">Hi,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Tahoma"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Tahoma">I think this is a tolerance issue. If you
try</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Tahoma"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Tahoma">select
st_distance(ST_MakeEnvelope(-105.17353271032549,39.798766541338225,-105.07765728967452,39.83016145866177,4326),
</font></span><span><font color="#0000ff" face="Tahoma">st_setsrid(ST_MakePOint(-105.130637
,39.830165),4326))</font></span></div>
<div><span><font color="#0000ff" face="Tahoma"></font></span> </div>
<div><span><font color="#0000ff" face="Tahoma">The
distance is very short : 3.54133823066149e-06</font></span></div>
<div><span><font color="#0000ff" face="Tahoma"></font></span> </div>
<div><span><font color="#0000ff" face="Tahoma">And i
you add the where clause, it is also true that your lat is not <= to the
given one, so the single line returned with the simple && query is
now excluded.</font></span></div>
<div><span><font color="#0000ff" face="Tahoma"></font></span> </div>
<div><span><font color="#0000ff" face="Tahoma">Hugues.</font></span></div><br>
<div dir="ltr" lang="fr" align="left">
<hr>
<font face="Tahoma"><b>De :</b> <a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>] <b>De la part de</b> Pavel
Shub<br><b>Envoyé :</b> samedi 2 février 2013 07:14<br><b>À :</b>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br><b>Objet :</b> [postgis-users] (no
subject)<br></font><br></div><div><div class="h5">
<div></div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hi all,<br><br></div>Please tell me if I'm doing something incorrectly, but
I seem to be getting wrong results for the following bounding box
query:<br><br>select * from geotest where geom &&
ST_MakeEnvelope(-105.17353271032549,39.798766541338225,-105.07765728967452,39.83016145866177,4326)<br><br></div>Given
table with columns: name (varchar), lat (double), lon (double), geom (geometry).
geom having srid 4326 points<br><br></div>A row with lat = 39.830165, lon =
-105.130637 is returned. I find this very peculiar because the latitude is
greater than the maxiumum latitude in the envelope (39.83016145866177). If I
then add a 'and lat <= 39.83016145866177' clause, the row is no longer
returned.<br></div>I noticed this on postgres 9.1 with postgis 1.5 then when
testing again got the same results on postgres 9.2 and postgis 2.0<br><br></div>
<div>Is this intended and I missed some documentation somewhere, or is this an
issue?<br></div>
<div><br></div>Thank you,<br></div>Pavel Shub</div></div></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br></div>